Update web-platform-tests to revision b622fea47d516f82e303c1954d0aee2652466c80

This commit is contained in:
WPT Sync Bot 2018-10-26 21:55:57 -04:00
parent cb915d669a
commit c6927c2425
54 changed files with 651 additions and 533 deletions

View file

@ -0,0 +1,9 @@
def main(request, response):
key = request.GET['key']
already_requested = request.server.stash.take(key)
if already_requested is None:
request.server.stash.put(key, True)
return [('Content-Type', 'application/javascript')], '// initial script'
response.status = (404, 'Not found: should not have been able to import this script twice!')

View file

@ -0,0 +1,13 @@
def main(request, response):
key = request.GET['key']
already_requested = request.server.stash.take(key)
header = [('Content-Type', 'application/javascript')]
initial_script = 'importScripts("./update-missing-import-scripts-imported-worker.py?key={0}")'.format(key)
updated_script = '// removed importScripts()'
if already_requested is None:
request.server.stash.put(key, True)
return header, initial_script
return header, updated_script

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<title>Service Worker: update with missing importScripts</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<script src="/common/utils.js"></script>
<body>
<script>
/**
* Test ServiceWorkerRegistration.update() when importScripts in a service worker
* script is no longer available (but was initially).
*/
let registration = null;
promise_test(async (test) => {
const script = `resources/update-missing-import-scripts-main-worker.py?key=${token()}`;
const scope = 'resources/update-missing-import-scripts';
registration = await service_worker_unregister_and_register(test, script, scope);
add_completion_callback(() => { registration.unregister(); });
await wait_for_state(test, registration.installing, 'activated');
}, 'Initialize global state');
promise_test(test => {
return new Promise(resolve => {
registration.addEventListener('updatefound', resolve);
registration.update();
});
}, 'Update service worker with new script that\'s missing importScripts()');
</script>
</body>