tor-browser

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

browser_devtools_loader.js (2148B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 
      5 declTest("getActor in the regular shared loader", {
      6  loadInDevToolsLoader: false,
      7 
      8  async test(browser) {
      9    let parent = browser.browsingContext.currentWindowGlobal.domProcess;
     10    let parentActor = parent.getActor("TestProcessActor");
     11    ok(parentActor, "JSProcessActorParent should have value.");
     12    is(
     13      Cu.getRealmLocation(Cu.getGlobalForObject(parentActor)),
     14      "shared JSM global",
     15      "The JSActor module in the parent process should be loaded in the shared global"
     16    );
     17 
     18    await SpecialPowers.spawn(browser, [], async function () {
     19      let child = ChromeUtils.domProcessChild;
     20      ok(child, "DOMProcessChild should have value.");
     21      let childActor = child.getActor("TestProcessActor");
     22      ok(childActor, "JSProcessActorChild should have value.");
     23      is(
     24        Cu.getRealmLocation(Cu.getGlobalForObject(childActor)),
     25        "shared JSM global",
     26        "The JSActor module in the child process should be loaded in the shared global"
     27      );
     28    });
     29  },
     30 });
     31 
     32 declTest("getActor in the distinct DevTools loader", {
     33  loadInDevToolsLoader: true,
     34 
     35  async test(browser) {
     36    let parent = browser.browsingContext.currentWindowGlobal.domProcess;
     37    let parentActor = parent.getActor("TestProcessActor");
     38    ok(parentActor, "JSProcessActorParent should have value.");
     39    is(
     40      Cu.getRealmLocation(Cu.getGlobalForObject(parentActor)),
     41      "DevTools global",
     42      "The JSActor module in the parent process should be loaded in the distinct DevTools global"
     43    );
     44 
     45    await SpecialPowers.spawn(browser, [], async function () {
     46      let child = ChromeUtils.domProcessChild;
     47      ok(child, "DOMProcessChild should have value.");
     48      let childActor = child.getActor("TestProcessActor");
     49      ok(childActor, "JSProcessActorChild should have value.");
     50      is(
     51        Cu.getRealmLocation(Cu.getGlobalForObject(childActor)),
     52        "DevTools global",
     53        "The JSActor module in the child process should be loaded in the distinct DevTools global"
     54      );
     55    });
     56  },
     57 });