tor-browser

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

get-intrinsic.js (659B)


      1 var intrinsic_names = [
      2    "IsConstructor",    // Implementation in C++
      3    "ArrayMap",         // Implementation in JS
      4    "globalMapIterationResultPair",  // Self-hosting variable
      5 ];
      6 
      7 for (var name of intrinsic_names) {
      8    // GetIntrinsic in same global should have consistent values
      9    assertEq(getSelfHostedValue(name), getSelfHostedValue(name));
     10 
     11    // Different globals shouldn't reuse intrinsics.
     12    for (var newCompartment of [true, false]) {
     13        let g = newGlobal({newCompartment});
     14        let a = evaluate(`getSelfHostedValue("${name}")`, { global: g })
     15        let b = getSelfHostedValue(name);
     16        assertEq(a === b, false);
     17    }
     18 }