tor-browser

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

browser_bug1709346.js (1682B)


      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 add_task(async function remove_subframe_in_cross_site_frame() {
      6  await BrowserTestUtils.withNewTab(
      7    "http://mochi.test:8888/browser/dom/tests/browser/file_empty_cross_site_frame.html",
      8    async browser => {
      9      await TestUtils.waitForCondition(
     10        () => !XULBrowserWindow.isBusy,
     11        "browser is not busy after the tab finishes loading"
     12      );
     13 
     14      // Spawn into the cross-site subframe, and begin loading a slow network
     15      // connection. We'll cancel the load before this navigation completes.
     16      await SpecialPowers.spawn(
     17        browser.browsingContext.children[0],
     18        [],
     19        async () => {
     20          let frame = content.document.createElement("iframe");
     21          frame.src = "load_forever.sjs";
     22          content.document.body.appendChild(frame);
     23 
     24          frame.addEventListener("load", function () {
     25            ok(false, "load should not finish before the frame is removed");
     26          });
     27        }
     28      );
     29 
     30      is(
     31        XULBrowserWindow.isBusy,
     32        true,
     33        "browser should be busy after the load starts"
     34      );
     35 
     36      // Remove the outer iframe, ending the load within this frame's subframe
     37      // early.
     38      await SpecialPowers.spawn(browser, [], async () => {
     39        content.document.querySelector("iframe").remove();
     40      });
     41 
     42      await TestUtils.waitForCondition(
     43        () => !XULBrowserWindow.isBusy,
     44        "Browser should no longer be busy after the frame is removed"
     45      );
     46    }
     47  );
     48 });