js/src/jit-test/tests/debug/Source-introductionScript-02.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.

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

mercurial