[JSC] ScriptFetcher should be notified directly from module pipeline
https://bugs.webkit.org/show_bug.cgi?id=178340
Reviewed by Sam Weinig.
Source/JavaScriptCore:
Previously, we use JSStdFunction to let WebCore inform the module pipeline results.
We setup JSStdFunction to the resulted promise of the module pipeline. It is super
ad-hoc since JSStdFunction's lambda need extra-careful to make it non-cyclic-referenced.
JSStdFunction's lambda can capture variables, but they are not able to be marked by GC.
But now, we have ScriptFetcher. It is introduced after we implemented the module pipeline
notification mechanism by using JSStdFunction. But it is appropriate one to receive notification
from the module pipeline by observer style.
This patch removes the above ad-hoc JSStdFunction use. And now ScriptFetcher receives
completion/failure notifications from the module pipeline.
- builtins/ModuleLoaderPrototype.js:
(loadModule):
(loadAndEvaluateModule):
(JSC::loadModule):
- runtime/Completion.h:
- runtime/JSModuleLoader.cpp:
(JSC::jsValueToModuleKey):
(JSC::JSModuleLoader::notifyCompleted):
(JSC::JSModuleLoader::notifyFailed):
- runtime/JSModuleLoader.h:
- runtime/ModuleLoaderPrototype.cpp:
(JSC::moduleLoaderPrototypeNotifyCompleted):
(JSC::moduleLoaderPrototypeNotifyFailed):
(JSC::ScriptFetcher::notifyLoadCompleted):
(JSC::ScriptFetcher::notifyLoadFailed):
Source/WebCore:
No behavior change.
- bindings/js/JSMainThreadExecState.h:
(WebCore::JSMainThreadExecState::loadModule):
- bindings/js/ScriptController.cpp:
(WebCore::ScriptController::loadModuleScriptInWorld):
(WebCore::jsValueToModuleKey): Deleted.
(WebCore::ScriptController::setupModuleScriptHandlers): Deleted.
- bindings/js/ScriptController.h:
- dom/LoadableModuleScript.cpp:
(WebCore::LoadableModuleScript::notifyLoadFailed):
- dom/LoadableModuleScript.h:
LayoutTests:
- http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt:
- http/tests/security/module-no-mime-type-expected.txt:
- js/dom/modules/module-execution-error-should-be-propagated-to-onerror-expected.txt: