Changeset 274404 in webkit
- Timestamp:
- Mar 14, 2021 2:19:25 PM (16 months ago)
- Location:
- trunk
- Files:
-
- 3 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/dynamic-import-is-prohibited.https-expected.txt (added)
-
LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/dynamic-import-is-prohibited.https.html (added)
-
LayoutTests/http/wpt/webaudio/the-audio-api/the-audioworklet-interface/processors/dynamic-import-is-prohibited.js (added)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-module-scripts.https-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/bindings/js/ScriptModuleLoader.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r274396 r274404 1 2021-03-14 Yusuke Suzuki <ysuzuki@apple.com> 2 3 Prevent dynamic import in service worker 4 https://bugs.webkit.org/show_bug.cgi?id=222308 5 6 Reviewed by Youenn Fablet. 7 8 Covering worklet case. 9 10 * http/wpt/webaudio/the-audio-api/the-audioworklet-interface/dynamic-import-is-prohibited.https-expected.txt: Added. 11 * http/wpt/webaudio/the-audio-api/the-audioworklet-interface/dynamic-import-is-prohibited.https.html: Added. 12 * http/wpt/webaudio/the-audio-api/the-audioworklet-interface/processors/dynamic-import-is-prohibited.js: Added. 13 (DynamicImportIsProhibitedProcessor.prototype.process): 14 (DynamicImportIsProhibitedProcessor): 15 1 16 2021-03-13 Wenson Hsieh <wenson_hsieh@apple.com> 2 17 -
trunk/LayoutTests/imported/w3c/ChangeLog
r274393 r274404 1 2021-03-14 Yusuke Suzuki <ysuzuki@apple.com> 2 3 Prevent dynamic import in service worker 4 https://bugs.webkit.org/show_bug.cgi?id=222308 5 6 Reviewed by Youenn Fablet. 7 8 Covering service-worker case. 9 10 * web-platform-tests/service-workers/service-worker/import-module-scripts.https-expected.txt: 11 1 12 2021-03-13 Commit Queue <commit-queue@webkit.org> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-module-scripts.https-expected.txt
r273224 r274404 2 2 PASS Static import. 3 3 PASS Nested static import. 4 PASS Static import and then dynamic import. 5 PASS Dynamic import. 6 PASS Nested dynamic import. 7 PASS Dynamic import and then static import. 8 PASS eval(import()). 4 FAIL Static import and then dynamic import. assert_array_equals: value is "Failed to do dynamic import: TypeError: Dynamic-import is not available in Worklets or ServiceWorkers", expected array 5 FAIL Dynamic import. assert_array_equals: value is "Failed to do dynamic import: TypeError: Dynamic-import is not available in Worklets or ServiceWorkers", expected array 6 FAIL Nested dynamic import. assert_array_equals: value is "Failed to do dynamic import: TypeError: Dynamic-import is not available in Worklets or ServiceWorkers", expected array 7 FAIL Dynamic import and then static import. assert_array_equals: value is "Failed to do dynamic import: TypeError: Dynamic-import is not available in Worklets or ServiceWorkers", expected array 8 FAIL eval(import()). assert_array_equals: value is "Failed to do dynamic import: TypeError: Dynamic-import is not available in Worklets or ServiceWorkers", expected array 9 9 -
trunk/Source/WebCore/ChangeLog
r274403 r274404 1 2021-03-14 Yusuke Suzuki <ysuzuki@apple.com> 2 3 Prevent dynamic import in service worker 4 https://bugs.webkit.org/show_bug.cgi?id=222308 5 6 Reviewed by Youenn Fablet. 7 8 dynamic-import should be always rejected if script is executed in Worklets or ServiceWorkers. 9 This is recently changed in the spec https://github.com/whatwg/html/pull/6395. 10 11 * bindings/js/ScriptModuleLoader.cpp: 12 (WebCore::isWorkletOrServiceWorker): 13 (WebCore::ScriptModuleLoader::importModule): 14 1 15 2021-03-14 Rob Buis <rbuis@igalia.com> 2 16 -
trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp
r273299 r274404 46 46 #include "WorkerScriptFetcher.h" 47 47 #include "WorkerScriptLoader.h" 48 #include "WorkletGlobalScope.h" 48 49 #include <JavaScriptCore/Completion.h> 49 50 #include <JavaScriptCore/JSInternalPromise.h> … … 54 55 #include <JavaScriptCore/JSString.h> 55 56 #include <JavaScriptCore/Symbol.h> 57 58 #if ENABLE(SERVICE_WORKER) 59 #include "ServiceWorkerGlobalScope.h" 60 #endif 56 61 57 62 namespace WebCore { … … 259 264 } 260 265 266 static bool isWorkletOrServiceWorker(ScriptExecutionContext& context) 267 { 268 if (is<WorkletGlobalScope>(context)) 269 return true; 270 #if ENABLE(SERVICE_WORKER) 271 if (is<ServiceWorkerGlobalScope>(context)) 272 return true; 273 #endif 274 return false; 275 } 276 261 277 JSC::JSInternalPromise* ScriptModuleLoader::importModule(JSC::JSGlobalObject* jsGlobalObject, JSC::JSModuleLoader*, JSC::JSString* moduleName, JSC::JSValue parameters, const JSC::SourceOrigin& sourceOrigin) 262 278 { 263 279 JSC::VM& vm = jsGlobalObject->vm(); 264 280 auto& globalObject = *JSC::jsCast<JSDOMGlobalObject*>(jsGlobalObject); 281 282 // https://html.spec.whatwg.org/multipage/webappapis.html#hostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability) 283 // If settings object's global object implements WorkletGlobalScope or ServiceWorkerGlobalScope, then: 284 if (isWorkletOrServiceWorker(m_context)) 285 return rejectPromise(globalObject, TypeError, "Dynamic-import is not available in Worklets or ServiceWorkers"_s); 265 286 266 287 // If SourceOrigin and/or CachedScriptFetcher is null, we import the module with the default fetcher.
Note: See TracChangeset
for help on using the changeset viewer.