Bug 1290116 P6 Add a wpt test case verifying getRegistrations() does not return registrations with a pending uninstall. r=asuth

This commit is contained in:
Ben Kelly 2016-08-18 07:12:09 -07:00
parent d935ad2ac3
commit 588590678e

View File

@ -92,6 +92,38 @@ promise_test(function(t) {
});
}, 'Register then Unregister then getRegistrations');
promise_test(function(t) {
var scope = 'resources/scope/getregistrations/register-unregister-controlled';
var script = 'resources/empty-worker.js';
var registrations;
var frame;
return service_worker_unregister_and_register(t, script, scope)
.then(function(r) {
registration = r;
return wait_for_state(t, registration.installing, 'activated');
})
.then(function() {
return with_iframe(scope);
})
.then(function(f) {
frame = f;
return registration.unregister();
})
.then(function() {
return navigator.serviceWorker.getRegistrations();
})
.then(function(value) {
assert_array_equals(
value,
[],
'getRegistrations should resolve with an empty array.');
assert_equals(registration.installing, null);
assert_equals(registration.waiting, null);
assert_equals(registration.active.state, 'activated');
frame.remove();
});
}, 'Register then Unregister with controlled frame then getRegistrations');
promise_test(function(t) {
var host_info = get_host_info();
// Rewrite the url to point to remote origin.