Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  test_privateBrowsing.html

  Sprache: HTML
 

 products/Sources/formale Sprachen/C/Firefox/dom/serviceworkers/test/test_privateBrowsing.html


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Test for ServiceWorker - Private Browsing</title>
  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
</head>
<body>

<script type="application/javascript">
const {BrowserTestUtils} = ChromeUtils.importESModule(
  "resource://testing-common/BrowserTestUtils.sys.mjs"
);

var mainWindow;

var contentPage = "http://mochi.test:8888/chrome/dom/workers/test/empty.html";
var workerScope = "http://mochi.test:8888/chrome/dom/serviceworkers/test/";
var workerURL = workerScope + "worker.js";

function testOnWindow(aIsPrivate, aCallback) {
  var win = mainWindow.OpenBrowserWindow({private: aIsPrivate});
  win.addEventListener("load", function() {
    win.addEventListener("DOMContentLoaded", function onInnerLoad() {
      if (win.content.location.href != contentPage) {
        BrowserTestUtils.startLoadingURIString(win.gBrowser, contentPage);
        return;
      }

      win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
      SimpleTest.executeSoon(function() { aCallback(win); });
    }, true);
  }, {capture: true, once: true});
}

function setupWindow() {
  mainWindow = window.browsingContext.topChromeWindow;
  runTest();
}

var wN;
var registration;
var wP;

function testPrivateWindow() {
  testOnWindow(true, function(aWin) {
    wP = aWin;
    ok(!wP.content.eval('"serviceWorker" in navigator'), "ServiceWorkers are not available for private windows");
    runTest();
  });
}

function doTests() {
  testOnWindow(false, function(aWin) {
    wN = aWin;
    ok("serviceWorker" in wN.content.navigator, "ServiceWorkers are available for normal windows");

    wN.content.navigator.serviceWorker.register(workerURL,
                                                { scope: workerScope })
      .then(function(aRegistration) {
        registration = aRegistration;
        ok(registration, "Registering a service worker in a normal window should succeed");

        // Bug 1255621: We should be able to load a controlled document in a private window.
        testPrivateWindow();
      }, function(aError) {
        ok(false, "Error registering worker in normal window: " + aError);
        testPrivateWindow();
      });
  });
}

var steps = [
  setupWindow,
  doTests
];

function cleanup() {
  wN.close();
  wP.close();

  SimpleTest.finish();
}

function runTest() {
  if (!steps.length) {
    registration.unregister().then(cleanup, cleanup);

    return;
  }

  var step = steps.shift();
  step();
}

SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [
  // The anti-tracking test browser_partitionedServiceWorkers.js now covers the
  // matrix of policy decisions around exposure of ServiceWorkers to PBM.  This
  // file is now a legacy crash-test from bug 1255621 that we won't crash if we
  // try and navigate to an origin with a SW registered in non-PBM in PBM where
  // ServiceWorkers are disabled, so we force the SW PBM setting to false.
  //
  // This file can be removed when we remove that pref.
  ["dom.serviceWorkers.privateBrowsing.enabled", false],
  ["dom.serviceWorkers.enabled", true],
  ["dom.serviceWorkers.testing.enabled", true],
  ["browser.startup.page"0],
  ["browser.startup.homepage_override.mstone""ignore"],
]}, runTest);

</script>
</body>
</html>

Messung V0.5 in Prozent
C=93 H=100 G=96

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002