Implement InlineClassicScript
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Jan 2017 09:01:40 +0000 (09:01 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Jan 2017 09:01:40 +0000 (09:01 +0000)
commit842ba9b0b9efc764ec6dae285c16e9db56ed035a
tree39a1316b7ccec3cbc66cd05f792ec0fcfd771d53
parenta472979ec450d559240f2ddbb946f50ab74f6c96
Implement InlineClassicScript
https://bugs.webkit.org/show_bug.cgi?id=166925

Reviewed by Ryosuke Niwa.

Source/JavaScriptCore:

Add ScriptFetcher field for SourceOrigin.

* runtime/SourceOrigin.h:
(JSC::SourceOrigin::SourceOrigin):
(JSC::SourceOrigin::fetcher):

Source/WebCore:

As of r210585, ScriptFetcher functionality is decoupled from ScriptElement.
This patch is a further cleanup. We introduce InlineClassicScript, which is
similar to LoadableClassicScript / LoadableModuleScript. And we move ScriptFetcher
functionality from LoadableScript to CachedScriptFetcher, which is the base
class of InlineClassicScript and LoadableScript.

And we start setting this CachedScriptFetcher to the member of JSC::SourceOrigin.
This allows us to examine the ScriptFetcher from the SourceOrigin.
When dynamic-import operator is called, we need to get the ScriptFetcher from the
caller script SourceOrigin since the subsequent module loading needs to know the
metadata about fetching and ScriptFetcher delivers it.

No behavior change.

* CMakeLists.txt:
* bindings/js/CachedModuleScript.cpp:
(WebCore::CachedModuleScript::load):
* bindings/js/CachedModuleScript.h:
* bindings/js/CachedModuleScriptLoader.cpp:
(WebCore::CachedModuleScriptLoader::create):
(WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader):
(WebCore::CachedModuleScriptLoader::load):
* bindings/js/CachedModuleScriptLoader.h:
* bindings/js/CachedScriptFetcher.cpp: Copied from Source/WebCore/dom/LoadableScript.cpp.
(WebCore::CachedScriptFetcher::requestScriptWithCache):
* bindings/js/CachedScriptFetcher.h: Copied from Source/JavaScriptCore/runtime/SourceOrigin.h.
(WebCore::CachedScriptFetcher::CachedScriptFetcher):
* bindings/js/CachedScriptSourceProvider.h:
(WebCore::CachedScriptSourceProvider::create):
(WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
(WebCore::makeSource): Deleted.
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::loadModuleScriptInWorld):
(WebCore::ScriptController::loadModuleScript):
* bindings/js/ScriptController.h:
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::fetch):
(WebCore::ScriptModuleLoader::notifyFinished):
* bindings/js/ScriptSourceCode.h:
(WebCore::ScriptSourceCode::ScriptSourceCode):
(WebCore::ScriptSourceCode::m_url):
* dom/InlineClassicScript.cpp: Added.
(WebCore::InlineClassicScript::create):
* dom/InlineClassicScript.h: Added.
* dom/LoadableClassicScript.cpp:
(WebCore::LoadableClassicScript::execute):
* dom/LoadableScript.cpp:
(WebCore::LoadableScript::requestScriptWithCache): Deleted.
* dom/LoadableScript.h:
(WebCore::LoadableScript::LoadableScript):
(): Deleted.
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::prepareScript):
(WebCore::ScriptElement::requestModuleScript):
(WebCore::ScriptElement::executePendingScript):
* html/parser/HTMLScriptRunner.cpp:
(WebCore::HTMLScriptRunner::runScript):
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::endElementNs):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/SourceOrigin.h
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/CachedModuleScript.cpp
Source/WebCore/bindings/js/CachedModuleScript.h
Source/WebCore/bindings/js/CachedModuleScriptLoader.cpp
Source/WebCore/bindings/js/CachedModuleScriptLoader.h
Source/WebCore/bindings/js/CachedScriptFetcher.cpp [new file with mode: 0644]
Source/WebCore/bindings/js/CachedScriptFetcher.h [new file with mode: 0644]
Source/WebCore/bindings/js/CachedScriptSourceProvider.h
Source/WebCore/bindings/js/ScriptController.cpp
Source/WebCore/bindings/js/ScriptController.h
Source/WebCore/bindings/js/ScriptModuleLoader.cpp
Source/WebCore/bindings/js/ScriptSourceCode.h
Source/WebCore/dom/InlineClassicScript.cpp [new file with mode: 0644]
Source/WebCore/dom/InlineClassicScript.h [new file with mode: 0644]
Source/WebCore/dom/LoadableClassicScript.cpp
Source/WebCore/dom/LoadableScript.cpp
Source/WebCore/dom/LoadableScript.h
Source/WebCore/dom/ScriptElement.cpp
Source/WebCore/html/parser/HTMLScriptRunner.cpp
Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp