-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No dynamic import in service worker (#27699)
Part of whatwg/html#6395 and w3c/ServiceWorker#1356
- Loading branch information
1 parent
33f2e3f
commit a02460e
Showing
11 changed files
with
151 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
service-workers/service-worker/import-module-scripts.https.html
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
service-workers/service-worker/no-dynamic-import-in-module.any.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// META: global=serviceworker-module | ||
|
||
// This is imported to ensure import('./basic-module-2.js') fails even if | ||
// it has been previously statically imported. | ||
import './basic-module-2.js'; | ||
|
||
import './resources/no-dynamic-import.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// META: global=serviceworker | ||
|
||
importScripts('resources/no-dynamic-import.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 'hello again!'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 'hello!'; |
18 changes: 18 additions & 0 deletions
18
service-workers/service-worker/resources/no-dynamic-import.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** @type {[name: string, url: string][]} */ | ||
const importUrlTests = [ | ||
["Module URL", "./basic-module.js"], | ||
// In no-dynamic-import-in-module.any.js, this module is also statically imported | ||
["Another module URL", "./basic-module-2.js"], | ||
[ | ||
"Module data: URL", | ||
"data:text/javascript;charset=utf-8," + | ||
encodeURIComponent(`export default 'hello!';`), | ||
], | ||
]; | ||
|
||
for (const [name, url] of importUrlTests) { | ||
promise_test( | ||
(t) => promise_rejects_js(t, TypeError, import(url), "Import must reject"), | ||
name | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters