js/src/devtools/rootAnalysis/computeGCFunctions.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* -*- Mode: Javascript; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     3 "use strict";
     5 loadRelativeToScript('utility.js');
     6 loadRelativeToScript('annotations.js');
     7 loadRelativeToScript('loadCallgraph.js');
     9 if (typeof scriptArgs[0] != 'string')
    10     throw "Usage: computeGCFunctions.js <callgraph.txt> <out:gcFunctions.txt> <out:gcFunctions.lst> <out:gcEdges.txt> <out:suppressedFunctions.lst>";
    12 var start = "Time: " + new Date;
    14 var callgraph_filename = scriptArgs[0];
    15 var gcFunctions_filename = scriptArgs[1] || "gcFunctions.txt";
    16 var gcFunctionsList_filename = scriptArgs[2] || "gcFunctions.lst";
    17 var gcEdges_filename = scriptArgs[3] || "gcEdges.txt";
    18 var suppressedFunctionsList_filename = scriptArgs[4] || "suppressedFunctions.lst";
    20 loadCallgraph(callgraph_filename);
    22 printErr("Writing " + gcFunctions_filename);
    23 redirect(gcFunctions_filename);
    24 for (var name in gcFunctions) {
    25     print("");
    26     print("GC Function: " + name + "|" + readableNames[name][0]);
    27     do {
    28         name = gcFunctions[name];
    29         if (name in readableNames)
    30             print("    " + readableNames[name][0]);
    31         else
    32             print("    " + name);
    33     } while (name in gcFunctions);
    34 }
    36 printErr("Writing " + gcFunctionsList_filename);
    37 redirect(gcFunctionsList_filename);
    38 for (var name in gcFunctions) {
    39     for (var readable of readableNames[name])
    40         print(name + "|" + readable);
    41 }
    43 // gcEdges is a list of edges that can GC for more specific reasons than just
    44 // calling a function that is in gcFunctions.txt.
    45 //
    46 // Right now, it is unused. It was meant for ~AutoCompartment when it might
    47 // wrap an exception, but anything held live across ~AC will have to be held
    48 // live across the corresponding constructor (and hence the whole scope of the
    49 // AC), and in that case it'll be held live across whatever could create an
    50 // exception within the AC scope. So ~AC edges are redundant. I will leave the
    51 // stub machinery here for now.
    52 printErr("Writing " + gcEdges_filename);
    53 redirect(gcEdges_filename);
    54 for (var block in gcEdges) {
    55   for (var edge in gcEdges[block]) {
    56       var func = gcEdges[block][edge];
    57     print([ block, edge, func ].join(" || "));
    58   }
    59 }
    61 printErr("Writing " + suppressedFunctionsList_filename);
    62 redirect(suppressedFunctionsList_filename);
    63 for (var name in suppressedFunctions) {
    64     print(name);
    65 }

mercurial