Bug 1592699 - Fix test_serviceworker_lifetime.html r=asuth

- Reset idle timeout when dispatching service worker operations even if the
worker is alive.
- Use MessageEvent instead of FetchEvent to avoid creating objects that leak
when the test finishes.

Differential Revision: https://phabricator.services.mozilla.com/D51016

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Perry Jiang 2019-10-30 17:23:53 +00:00
parent 5b7ceaf11d
commit 8ae16063a4
3 changed files with 6 additions and 6 deletions

View File

@ -26,7 +26,6 @@ skip-if = os == "win" # Bug 1373346
[test_try_registering_offline_disabled.html]
skip-if = os == "win" # Bug 1373346
[test_serviceworker_lifetime.html]
fail-if = fission
skip-if = serviceworker_e10s || !e10s || os == "win" || os =="linux" && bits == 64 || os =="mac" # e10s: Bug 1433689, Windows: Bug 1373346, Bug 1578333, Bug 1578374
[test_error_reporting.html]
skip-if = serviceworker_e10s

View File

@ -327,11 +327,11 @@
["dom.serviceWorkers.idle_extended_timeout", 0],
],
steps(context) {
return new Promise(function(res, rej) {
context.iframe.contentWindow.fetch("update");
res(context);
});
},
return new Promise(function(res, rej) {
context.iframe.contentWindow.navigator.serviceWorker.controller.postMessage("ping");
res(context);
});
},
};
// Test that service worker is closed when the extended timeout expired

View File

@ -230,6 +230,7 @@ nsresult ServiceWorkerPrivateImpl::SpawnWorkerIfNeeded() {
MOZ_ASSERT(mOuter->mInfo);
if (mControllerChild) {
mOuter->RenewKeepAliveToken(ServiceWorkerPrivate::WakeUpReason::Unknown);
return NS_OK;
}