Backed out changeset 1ce6d2b0a418 (bug 1411746) for timeouts in test_unresolved_fetch_interception.html on Win7 debug non-e10s, again

MozReview-Commit-ID: 1r7KEhkpHvA
This commit is contained in:
Phil Ringnalda 2017-10-26 20:46:39 -07:00
parent ac48293bbe
commit 7b1f06bcab
4 changed files with 19 additions and 15 deletions

View File

@ -10,7 +10,6 @@
</head>
<body>
<div id="content" style="display: none"></div>
<script src="utils.js"></script>
<script type="text/javascript">
"use strict";
@ -95,12 +94,15 @@ add_task(async function test_bypassServiceWorker() {
const swURL = "fetch.js";
let registration = await navigator.serviceWorker.register(swURL);
// Wait for the service worker to control the document
let waitForControlled = new Promise(resolve => {
navigator.serviceWorker.oncontrollerchange = resolve;
});
let sw =
registration.active || registration.waiting || registration.installing;
await waitForState(sw, 'activated');
sw.postMessage("claim");
await waitForControlled(window);
await waitForControlled;
try {
await testBypassSW();

View File

@ -10,7 +10,6 @@
</head>
<body>
<div id="content" style="display: none"></div>
<script src="utils.js"></script>
<script type="text/javascript">
"use strict";
@ -50,12 +49,16 @@ add_task(async function test_integrity_serviceWorker() {
var filename = make_absolute_url("fetch.js");
var filename2 = make_absolute_url("fake.html");
// The SW will claim us once it activates; this is async, start listening now.
let waitForControlled = new Promise((resolve) => {
navigator.serviceWorker.oncontrollerchange = resolve;
});
let registration = await navigator.serviceWorker.register("fetch.js",
{ scope: "./" });
let worker = registration.installing || registration.active;
await waitForState(worker, 'activated');
worker.postMessage('claim');
await waitForControlled(window);
await waitForControlled;
info("Test for mNavigationInterceptions.")
// The client_win will reload to another URL after opening filename2.

View File

@ -22,7 +22,6 @@
<pre id="test">
</pre>
<script src="utils.js"></script>
<script class="testbody" type="text/javascript">
// (This doesn't really need to be its own task, but it allows the actual test
// case to be self-contained.)
@ -40,13 +39,14 @@ add_task(async function grace_timeout_termination_with_interrupted_intercept() {
["dom.serviceWorkers.idle_timeout", 0],
["dom.serviceWorkers.idle_extended_timeout", 299999]]});
// The SW will claim us once it activates; this is async, start listening now.
let waitForControlled = new Promise((resolve) => {
navigator.serviceWorker.oncontrollerchange = resolve;
});
let registration = await navigator.serviceWorker.register(
"unresolved_fetch_worker.js", { scope: "./"} );
let worker = registration.installing || registration.active;
await waitForState(worker, 'activated');
worker.postMessage('claim');
await waitForControlled(window);
await waitForControlled;
ok(navigator.serviceWorker.controller, "Controlled"); // double check!
// We want to make sure the SW is active and processing the fetch before we

View File

@ -14,7 +14,6 @@ onfetch = function(event) {
event.respondWith((keepPromiseAlive = new Promise(function(res, rej) {})));
}
onmessage = function(event) {
onactivate = function(event) {
event.waitUntil(clients.claim());
self.onmessage = null;
}