tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Frame-asyncPromise-02.js (535B)


      1 // Test the promise property on normal function frames.
      2 
      3 load(libdir + 'asserts.js');
      4 
      5 var g = newGlobal({ newCompartment: true });
      6 var dbg = Debugger(g);
      7 g.eval(`
      8 function f() {
      9  debugger;
     10 }
     11 `);
     12 
     13 let frame;
     14 const promises = [];
     15 dbg.onDebuggerStatement = function(f) {
     16  frame = f;
     17  promises.push(frame.asyncPromise);
     18 };
     19 
     20 const resultPromise = g.f();
     21 
     22 // Frame has terminated, so accessing the property throws.
     23 assertThrowsInstanceOf(() => frame.asyncPromise, Error);
     24 
     25 assertEq(promises.length, 1);
     26 assertEq(promises[0], undefined);