tor-browser

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

browser_getActor.js (1247B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 
      5 declTest("getActor on both sides", {
      6  async test(browser) {
      7    let parent = browser.browsingContext.currentWindowGlobal;
      8    ok(parent, "WindowGlobalParent should have value.");
      9    let actorParent = parent.getActor("TestWindow");
     10    is(actorParent.show(), "TestWindowParent", "actor show should have vaule.");
     11    is(actorParent.manager, parent, "manager should match WindowGlobalParent.");
     12 
     13    ok(
     14      actorParent.sawActorCreated,
     15      "Checking that we can observe parent creation"
     16    );
     17 
     18    await SpecialPowers.spawn(browser, [], async function () {
     19      let child = content.windowGlobalChild;
     20      ok(child, "WindowGlobalChild should have value.");
     21      is(
     22        child.isInProcess,
     23        false,
     24        "Actor should be loaded in the content process."
     25      );
     26      let actorChild = child.getActor("TestWindow");
     27      is(actorChild.show(), "TestWindowChild", "actor show should have vaule.");
     28      is(actorChild.manager, child, "manager should match WindowGlobalChild.");
     29 
     30      ok(
     31        actorChild.sawActorCreated,
     32        "Checking that we can observe child creation"
     33      );
     34    });
     35  },
     36 });