tor-browser

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

browser_bug1899180.js (1493B)


      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 /*
      6 * This test opens a private browsing window, then opens a content page in it
      7 * that loads an svg image that contains an image to an external protocol.
      8 * This tests that we don't hit an assert in this situation.
      9 */
     10 
     11 add_task(async function test() {
     12  function httpURL(filename) {
     13    let chromeURL = getRootDirectory(gTestPath) + filename;
     14    return chromeURL.replace(
     15      "chrome://mochitests/content/",
     16      "http://mochi.test:8888/"
     17    );
     18  }
     19 
     20  let win = await BrowserTestUtils.openNewBrowserWindow({ private: true });
     21 
     22  let tab = (win.gBrowser.selectedTab = BrowserTestUtils.addTab(
     23    win.gBrowser,
     24    "about:blank"
     25  ));
     26 
     27  await BrowserTestUtils.browserLoaded(tab.linkedBrowser, {
     28    wantLoad: "about:blank",
     29  });
     30 
     31  const pageUrl = httpURL("helper1899180.html");
     32 
     33  BrowserTestUtils.startLoadingURIString(tab.linkedBrowser, pageUrl);
     34 
     35  await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
     36 
     37  await new Promise(resolve => {
     38    waitForFocus(resolve, win);
     39  });
     40 
     41  // do a couple rafs here to ensure its loaded and displayed
     42  await new Promise(r => requestAnimationFrame(r));
     43  await new Promise(r => requestAnimationFrame(r));
     44 
     45  await BrowserTestUtils.closeWindow(win);
     46 
     47  win = null;
     48  tab = null;
     49 
     50  ok(true, "we got here and didn't crash/assert");
     51 });