tor-browser

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

bug1449153.js (637B)


      1 // Test performing GetModuleNamespace on an errored module.
      2 
      3 class MyError {}
      4 
      5 async function assertThrowsMyError(f)
      6 {
      7    let caught = false;
      8    try {
      9        await f();
     10    } catch (e) {
     11        caught = true;
     12        assertEq(e.constructor, MyError);
     13    }
     14    assertEq(caught, true);
     15 }
     16 
     17 registerModule("a", parseModule(`
     18    throw new MyError();
     19 `));
     20 
     21 let c = registerModule("c", parseModule(`
     22    import "a";
     23 `));
     24 moduleLink(c);
     25 assertThrowsMyError(() => moduleEvaluate(c));
     26 
     27 let b = registerModule('b', parseModule(`
     28    import * as ns0 from 'a'
     29 `));
     30 moduleLink(b);
     31 assertThrowsMyError(() => moduleEvaluate(b));
     32 
     33 drainJobQueue();