tor-browser

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

test_bug1617527.js (771B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 function run_test() {
      6  let sb1 = new Cu.Sandbox("https://example.org");
      7  let throwingFunc = Cu.evalInSandbox("new Function('throw new Error')", sb1);
      8  // NOTE: Different origin from the other sandbox.
      9  let sb2 = new Cu.Sandbox("https://example.com");
     10  Cu.exportFunction(function() {
     11    // Call a different-compartment throwing function.
     12    throwingFunc();
     13  }, sb2, { defineAs: "func" });
     14  let threw = Cu.evalInSandbox("var threw; try { func(); threw = false; } catch (e) { threw = true } threw",
     15                                sb2);
     16  Assert.ok(threw);
     17 }