Bug 1456466 P3 Fix tests to expect ServiceWorkerRegistration.update() to resolve with a registration. r=baku

This commit is contained in:
Ben Kelly 2018-04-26 13:52:30 -07:00
Родитель 9368ba6249
Коммит 45a9b54c7a
3 изменённых файлов: 34 добавлений и 1 удалений

Просмотреть файл

@ -3,7 +3,7 @@
// test actual update scenarios with a SJS test.
onmessage = function(e) {
self.registration.update().then(function(v) {
return v === undefined ? 'FINISH' : 'FAIL';
return v instanceof ServiceWorkerRegistration ? 'FINISH' : 'FAIL';
}).catch(function(e) {
return 'FAIL';
}).then(function(result) {

Просмотреть файл

@ -364378,6 +364378,12 @@
{}
]
],
"service-workers/service-worker/update-result.https.html": [
[
"/service-workers/service-worker/update-result.https.html",
{}
]
],
"service-workers/service-worker/update.https.html": [
[
"/service-workers/service-worker/update.https.html",
@ -599399,6 +599405,10 @@
"aac5705d6844e4a33200418504adb57053a45be2",
"testharness"
],
"service-workers/service-worker/update-result.https.html": [
"06741e887be9746d7354394f74c054dd920d1b60",
"testharness"
],
"service-workers/service-worker/update.https.html": [
"d55da98b05b5885084474ebdbabdf6c0998f8bca",
"testharness"

Просмотреть файл

@ -0,0 +1,23 @@
<!DOCTYPE html>
<title>Service Worker: update() should resolve a ServiceWorkerRegistration</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<body>
<script>
promise_test(async function(t) {
const script = './resources/empty.js';
const scope = './resources/empty.html?update-result';
let reg = await navigator.serviceWorker.register(script, { scope });
t.add_cleanup(async _ => await reg.unregister());
await wait_for_state(t, reg.installing, 'activated');
let result = await reg.update();
assert_true(result instanceof ServiceWorkerRegistration,
'update() should resolve a ServiceWorkerRegistration');
}, 'ServiceWorkerRegistration.update() should resolve a registration object');
</script>
</body>