tor-browser

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

browser_with_frames.js (1179B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 add_task(async function test_broadcasting_with_frames() {
      7  info("Navigate the initial tab to the test URL");
      8  const tab = gBrowser.selectedTab;
      9  await loadURL(tab.linkedBrowser, createTestMarkupWithFrames());
     10 
     11  const contexts =
     12    tab.linkedBrowser.browsingContext.getAllBrowsingContextsInSubtree();
     13  is(contexts.length, 4, "Test tab has 3 children contexts (4 in total)");
     14 
     15  const rootMessageHandler = createRootMessageHandler(
     16    "session-id-broadcasting_with_frames"
     17  );
     18  const broadcastValue = await sendTestBroadcastCommand(
     19    "commandwindowglobalonly",
     20    "testBroadcast",
     21    {},
     22    contextDescriptorAll,
     23    rootMessageHandler
     24  );
     25 
     26  ok(
     27    Array.isArray(broadcastValue),
     28    "The broadcast returned an array of values"
     29  );
     30  is(broadcastValue.length, 4, "The broadcast returned 4 values as expected");
     31 
     32  for (const context of contexts) {
     33    ok(
     34      broadcastValue.includes("broadcast-" + context.id),
     35      "The broadcast contains the value for browsing context " + context.id
     36    );
     37  }
     38 
     39  rootMessageHandler.destroy();
     40 });