[ES6] Implement ES6 Module loader hook stubs in WebCore
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 27 Sep 2015 22:24:18 +0000 (22:24 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 27 Sep 2015 22:24:18 +0000 (22:24 +0000)
commitafe5dc34ada92051d65935420f26a0e22c773c75
tree93103589a0af751044933dcd2c5734a30c86959c
parent1ea0b56bf64aea41a68ba591856a7428f97237a3
[ES6] Implement ES6 Module loader hook stubs in WebCore
https://bugs.webkit.org/show_bug.cgi?id=149574

Reviewed by Ryosuke Niwa.

In this patch, we implement the loader hooks in the WebCore side.
Since the fetcher and actual evaluation code are separated from
this patch, they become empty.

Here, WebCore implements 3 loader hooks.

1. resolve hook

    Takes the module name and resolve it to the unique module key.
    In WebCore, we use URL as a module key.
    And for the inlined module tag (e.g. <script type="module">import ...</script>),
    we use the ES6 symbol as a module key.
    In WebCore, we take the module name like "./hello.js" and resolve it by using
    the URL of the importer module.
    This functionality is implemented in this patch.

2. fetch hook

    Fetches the resource specified by the module key. In WebCore, the module key is
    URL. We use CachedResource loading system to load the resource of the modules.
    The actual code of the fetch hook will be implemented in the subsequent patch.

3. evaluate hook

    This is additional hook to instrument the module's execution for the inspector.
    The actual code of the evaluate hook will be implemented in the subsequent patch.

In addition to that, we added required JSC forward headers for the module loader
implementation.

* CMakeLists.txt:
* ForwardingHeaders/runtime/JSInternalPromise.h: Added.
* ForwardingHeaders/runtime/JSInternalPromiseDeferred.h: Added.
* ForwardingHeaders/runtime/JSModuleRecord.h: Added.
* ForwardingHeaders/runtime/Symbol.h: Added.
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::moduleLoaderResolve):
(WebCore::JSDOMWindowBase::moduleLoaderFetch):
(WebCore::JSDOMWindowBase::moduleLoaderEvaluate):
* bindings/js/JSDOMWindowBase.h:
* bindings/js/JSModuleLoader.cpp: Added.
(WebCore::JSModuleLoader::JSModuleLoader):
(WebCore::JSModuleLoader::resolve):
(WebCore::JSModuleLoader::fetch):
(WebCore::JSModuleLoader::evaluate):
* bindings/js/JSModuleLoader.h: Added.
(WebCore::JSModuleLoader::document):
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::~Document):
* dom/Document.h:
(WebCore::Document::moduleLoader):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190272 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/ForwardingHeaders/runtime/JSInternalPromise.h [new file with mode: 0644]
Source/WebCore/ForwardingHeaders/runtime/JSInternalPromiseDeferred.h [new file with mode: 0644]
Source/WebCore/ForwardingHeaders/runtime/JSModuleRecord.h [new file with mode: 0644]
Source/WebCore/ForwardingHeaders/runtime/Symbol.h [new file with mode: 0644]
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSDOMWindowBase.cpp
Source/WebCore/bindings/js/JSDOMWindowBase.h
Source/WebCore/bindings/js/JSModuleLoader.cpp [new file with mode: 0644]
Source/WebCore/bindings/js/JSModuleLoader.h [new file with mode: 0644]
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h