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

Quelle  test_bug1121701.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/docshell/test/mochitest/test_bug1121701.html


<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1121701
-->

<head>
  <meta charset="utf-8">
  <title>Test for Bug 1121701</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <script type="application/javascript">

  /** Test for Bug 1121701 */
  SimpleTest.waitForExplicitFinish();

  var testUrl1 = "file_bug1121701_1.html";
  var testUrl2 = "file_bug1121701_2.html";

  var page1LoadCount = 0;
  let page1Done = {};
  page1Done.promise = new Promise(resolve => {
    page1Done.resolve = resolve;
  });
  let page2Done = {};
  page2Done.promise = new Promise(resolve => {
    page2Done.resolve = resolve;
  });

  addLoadEvent(async function() {

    // Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
    // Acquire storage access permission here so that the BroadcastChannel used to
    // communicate with the opened windows works in xorigin tests. Otherwise,
    // the iframe containing this page is isolated from first-party storage access,
    // which isolates BroadcastChannel communication.
    if (isXOrigin) {
      await SpecialPowers.pushPrefEnv({
        set: [["privacy.partition.always_partition_third_party_non_cookie_storage", false]],
      });
      SpecialPowers.wrap(document).notifyUserGestureActivation();
      await SpecialPowers.addPermission("storageAccessAPI", true, window.location.href);
      await SpecialPowers.wrap(document).requestStorageAccess();
    }

    var bc = new BroadcastChannel("file_bug1121701_1");
    var bc2 = new BroadcastChannel("file_bug1121701_2");

    async function scheduleFinish() {
      await Promise.all([page1Done.promise, page2Done.promise]);
      bc2.close();
      bc.close();
      SimpleTest.finish();
    }

    bc.onmessage = (msgEvent) => {
      var msg = msgEvent.data;
      var command = msg.command;
      if (command == "child1PageShow") {
        ++page1LoadCount;
        var persisted = msg.persisted;
        var pageHideAsserts = msg.pageHideAsserts;
        if (pageHideAsserts) {
          ok(pageHideAsserts.persisted, "onpagehide: test page 1 should get persisted");
          is(pageHideAsserts.innerHTML, "modified",  "onpagehide: innerHTML text is 'modified'");
        }
        if (page1LoadCount == 1) {
          SimpleTest.executeSoon(function() {
            is(persisted, false, "Initial page load shouldn't be persisted.");
            bc.postMessage({command"setInnerHTML", testUrl2});
          });
        } else if (page1LoadCount == 2) {
          is(persisted, true, "Page load from bfcache should be persisted.");
          is(msg.innerHTML, "modified""innerHTML text is 'modified'");
          bc.postMessage({command"close"});
        }
      } else if (command == "closed") {
        page1Done.resolve();
      }
    }
    bc2.onmessage = (msgEvent) => {
      var msg = msgEvent.data;
      var command = msg.command;
      if (command == "child2PageShow") {
        bc2.postMessage({command"setInnerHTML", location: location.href});
      } else if (command == "onmessage") {
        page2Done.resolve();
      }
    }

    scheduleFinish();
    // If Fission is disabled, the pref is no-op.
    SpecialPowers.pushPrefEnv({set: [["fission.bfcacheInParent", true]]}, () => {
      window.open(testUrl1, """noopener");
    });
  });

  </script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1121701">Mozilla Bug 1121701</a>
<p id="display"></p>
<div id="content" style="display: none">

</div>
<pre id="test">
</pre>
</body>
</html>

Messung V0.5
C=94 H=99 G=96

¤ Dauer der Verarbeitung: 0.0 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.