Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/tests/browser/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  browser_bug1563629.js   Sprache: JAVA

 
"use strict";

const DIRPATH = getRootDirectory(gTestPath).replace(
  "chrome://mochitests/content/",
  ""
);
const PATH = DIRPATH + "file_postMessage_parent.html";

const URL1 = `https://example.com/${PATH}`;
const URL2 = `https://example.org/${PATH}`;

function listenForCrash(win) {
  function listener() {
    ok(false"a crash occurred");
  }

  win.addEventListener("oop-browser-crashed", listener);
  registerCleanupFunction(() => {
    win.removeEventListener("oop-browser-crashed", listener);
  });
}

add_task(async function () {
  let win = await BrowserTestUtils.openNewBrowserWindow({
    fission: true,
    privatetrue,
    remote: true,
  });

  listenForCrash(win);

  try {
    let tab = win.gBrowser.selectedTab;
    let browser = tab.linkedBrowser;

    BrowserTestUtils.startLoadingURIString(browser, URL1);
    await BrowserTestUtils.browserLoaded(browser, false, URL1);

    async function loadURL(url) {
      let iframe = content.document.createElement("iframe");
      content.document.body.appendChild(iframe);

      iframe.contentWindow.location = url;
      await new Promise(resolve =>
        iframe.addEventListener("load", resolve, { once: true })
      );

      return iframe.browsingContext;
    }

    function length() {
      return content.length;
    }

    let outer = await SpecialPowers.spawn(browser, [URL2], loadURL);
    let inner = await SpecialPowers.spawn(outer, [URL2], loadURL);

    is(await SpecialPowers.spawn(outer, [], length), 1, "have 1 inner frame");
    is(await SpecialPowers.spawn(browser, [], length), 1, "have 1 outer frame");

    // Send a message from the outer iframe to the inner one.
    //
    // This would've previously crashed the content process that URL2 is running
    // in.
    await SpecialPowers.spawn(outer, [], () => {
      content.frames[0].postMessage("foo""*");
    });

    // Now send a message from the inner frame to the outer one.
    await SpecialPowers.spawn(inner, [], () => {
      content.parent.postMessage("bar""*");
    });

    // Assert we've made it this far.
    ok(true"didn't crash");
  } finally {
    await BrowserTestUtils.closeWindow(win);
  }
});

Messung V0.5
C=89 H=100 G=94

¤ Dauer der Verarbeitung: 0.21 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.