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