js/src/jit-test/tests/debug/Frame-implementation-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.

     1 // Test that Ion frames are invalidated by turning on Debugger. Invalidation
     2 // is unobservable, but we know that Ion scripts cannot handle Debugger
     3 // handlers, so we test for the handlers being called.
     5 load(libdir + "jitopts.js");
     7 if (!jitTogglesMatch(Opts_Ion2NoParallelCompilation))
     8   quit();
    10 withJitOptions(Opts_Ion2NoParallelCompilation, function () {
    11   var g = newGlobal();
    12   var dbg = new Debugger;
    13   var onPopExecuted = false;
    14   var breakpointHit = false;
    16   g.toggle = function toggle(d) {
    17     if (d) {
    18       dbg.addDebuggee(g);
    20       var frame1 = dbg.getNewestFrame();
    21       assertEq(frame1.implementation, "ion");
    22       frame1.onPop = function () {
    23         onPopExecuted = true;
    24       };
    26       var frame2 = frame1.older;
    27       assertEq(frame2.implementation, "ion");
    28       // Offset of |print(42 + 42)|
    29       var offset = frame2.script.getLineOffsets(3)[0];
    30       frame2.script.setBreakpoint(offset, { hit: function (fr) {
    31         assertEq(fr.implementation != "ion", true);
    32         breakpointHit = true;
    33       }});
    34     }
    35   };
    37   g.eval("" + function f(d) {
    38     g(d);
    39     print(42 + 42);
    40   });
    41   g.eval("" + function g(d) { toggle(d); });
    43   g.eval("(" + function test() {
    44     for (var i = 0; i < 5; i++)
    45       f(false);
    46     f(true);
    47   } + ")();");
    49   assertEq(onPopExecuted, true);
    50   assertEq(breakpointHit, true);
    51 });

mercurial