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.
1 // Test extracting frame.arguments element getters and calling them in
2 // various awkward ways.
4 load(libdir + "asserts.js");
6 var g = newGlobal();
7 var dbg = Debugger(g);
8 var hits = 0;
9 var fframe, farguments, fgetter;
10 dbg.onDebuggerStatement = function (frame) {
11 if (hits === 0) {
12 fframe = frame;
13 farguments = frame.arguments;
14 fgetter = Object.getOwnPropertyDescriptor(farguments, "0").get;
15 assertEq(fgetter instanceof Function, true);
17 // Calling the getter without an appropriate this-object
18 // fails, but shouldn't assert or crash.
19 assertThrowsInstanceOf(function () { fgetter.call(Math); }, TypeError);
20 } else {
21 // Since fframe is still on the stack, fgetter can be applied to it.
22 assertEq(fframe.live, true);
23 assertEq(fgetter.call(farguments), 100);
25 // Since h was called without arguments, there is no argument 0.
26 assertEq(fgetter.call(frame.arguments), undefined);
27 }
28 hits++;
29 };
31 g.eval("function h() { debugger; }");
32 g.eval("function f(x) { debugger; h(); }");
33 g.f(100);
34 assertEq(hits, 2);
36 // Now that fframe is no longer live, trying to get its arguments should throw.
37 assertEq(fframe.live, false);
38 assertThrowsInstanceOf(function () { fgetter.call(farguments); }, Error);