Bug 1189644 - Follow up to fix test. a=bustage

CLOSED TREE
This commit is contained in:
Nikhil Marathe 2015-08-24 13:54:25 -07:00
parent dddfd9b6c7
commit 2cbad0cc3d

View File

@ -58,7 +58,7 @@
});
}
function activateError() {
function activateErrorShouldSucceed() {
// Silence worker errors so they don't cause the test to fail.
window.onerror = function() { }
return navigator.serviceWorker.register("activate_event_error_worker.js", { scope: "./activate_error" })
@ -69,7 +69,7 @@
ok(swr.active, "transition to active successfully");
is(swr.active.state, "activating", "should be activating");
swr.active.onstatechange = function(e) {
is(e.target.state, "redundant", "Activation of worker with error in activate event handler should fail.");
is(e.target.state, "activated", "Activation of worker with error in activate event handler should still succeed.");
resolve(swr);
}
}
@ -80,8 +80,10 @@
}
function unregister() {
return navigator.serviceWorker.getRegistration("./install_event").then(function(reg) {
return reg.unregister();
return Promise.all(["./install_event", "./activate_error"].map(function(scope) {
return navigator.serviceWorker.getRegistration(scope);
})).then(function(regs) {
return Promise.all(regs.map(function(reg) { return reg.unregister(); }));
});
}
@ -90,7 +92,7 @@
.then(simpleRegister)
.then(nextRegister)
.then(installError)
.then(activateError)
.then(activateErrorShouldSucceed)
.then(unregister)
.then(function() {
SimpleTest.finish();