Skip to content

Commit

Permalink
Bug 1357290 - move test_update_missing_imported_script.html to WPT r=…
Browse files Browse the repository at this point in the history
…edenchuang

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

--HG--
extra : moz-landing-system : lando
  • Loading branch information
perryjiang committed Oct 25, 2018
1 parent 1b83282 commit 96d721e
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 146 deletions.
23 changes: 0 additions & 23 deletions dom/serviceworkers/test/bug1290951_worker_imported.sjs

This file was deleted.

33 changes: 0 additions & 33 deletions dom/serviceworkers/test/bug1290951_worker_main.sjs

This file was deleted.

3 changes: 0 additions & 3 deletions dom/serviceworkers/test/mochitest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ support-files =
service_worker.js
service_worker_client.html
utils.js
bug1290951_worker_main.sjs
bug1290951_worker_imported.sjs
sw_storage_not_allow.js
update_worker.sjs
self_update_worker.sjs
Expand Down Expand Up @@ -308,7 +306,6 @@ tags = openwindow
[test_third_party_iframes.html]
[test_unregister.html]
[test_unresolved_fetch_interception.html]
[test_update_missing_imported_script.html]
skip-if = verify
[test_workerUnregister.html]
[test_workerUpdate.html]
Expand Down
87 changes: 0 additions & 87 deletions dom/serviceworkers/test/test_update_missing_imported_script.html

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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!')
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 96d721e

Please sign in to comment.