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 // Calls to 'eval', etc. by JS primitives get attributed to the point of
2 // the primitive's call.
4 var g = newGlobal();
5 var dbg = new Debugger;
6 var gDO = dbg.addDebuggee(g);
7 var log = '';
9 function outerHandler(frame) {
10 log += 'o';
11 var outerScript = frame.script;
13 dbg.onDebuggerStatement = function (frame) {
14 log += 'i';
15 var source = frame.script.source;
16 var introScript = source.introductionScript;
17 assertEq(introScript, outerScript);
18 assertEq(introScript.getOffsetLine(source.introductionOffset), 1234);
19 };
20 };
22 log = '';
23 dbg.onDebuggerStatement = outerHandler;
24 g.evaluate('debugger; ["debugger;"].map(eval)', { lineNumber: 1234 });
25 assertEq(log, 'oi');
27 log = '';
28 dbg.onDebuggerStatement = outerHandler;
29 g.evaluate('debugger; "debugger;".replace(/.*/, eval);',
30 { lineNumber: 1234 });
31 assertEq(log, 'oi');
34 // If the call takes place in another global, however, we don't record the
35 // introduction script.
36 log = '';
37 dbg.onDebuggerStatement = function (frame) {
38 log += 'd';
39 assertEq(frame.script.source.introductionScript, undefined);
40 assertEq(frame.script.source.introductionOffset, undefined);
41 };
42 ["debugger;"].map(g.eval);
43 "debugger;".replace(/.*/, g.eval);
44 assertEq(log, 'dd');