Implement JSSourceCode to propagate SourceCode in module pipeline
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jan 2017 02:26:47 +0000 (02:26 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jan 2017 02:26:47 +0000 (02:26 +0000)
commit5149a5ab4281ab9c0a4acd69e0ab6387adb76d00
treec6cbbcbc0b80f345a1c7f968a144823aad5e13ad
parent40170ff23dd5c948b260070a37ded89b1f6eb4fe
Implement JSSourceCode to propagate SourceCode in module pipeline
https://bugs.webkit.org/show_bug.cgi?id=166861

Reviewed by Saam Barati.

Source/JavaScriptCore:

Instead of propagating source code string, we propagate JSSourceCode
cell in the module pipeline. This allows us to attach a metadata
to the propagated source code string. In particular, it propagates
SourceOrigin through the module pipeline.

And it also fixes JSC shell to use Module source type for module source code.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* builtins/ModuleLoaderPrototype.js:
(fulfillFetch):
(requestFetch):
* jsc.cpp:
(GlobalObject::moduleLoaderFetch):
(runWithScripts):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
* runtime/Completion.cpp:
(JSC::loadAndEvaluateModule):
(JSC::loadModule):
* runtime/JSModuleLoader.cpp:
(JSC::JSModuleLoader::provide):
* runtime/JSModuleLoader.h:
* runtime/JSSourceCode.cpp: Added.
(JSC::JSSourceCode::destroy):
* runtime/JSSourceCode.h: Added.
(JSC::JSSourceCode::createStructure):
(JSC::JSSourceCode::create):
(JSC::JSSourceCode::sourceCode):
(JSC::JSSourceCode::JSSourceCode):
* runtime/JSType.h:
* runtime/ModuleLoaderPrototype.cpp:
(JSC::moduleLoaderPrototypeParseModule):
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:

Source/WebCore:

Now SourceOrigin is correctly propagated through the module pipeline.
So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html
is updated.

* ForwardingHeaders/runtime/JSSourceCode.h: Added.
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredPromise::resolveWithCallback):
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::notifyFinished):

LayoutTests:

* http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210573 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/llint/LLIntData.cpp
Source/JavaScriptCore/llint/LowLevelInterpreter.asm
Source/JavaScriptCore/runtime/Completion.cpp
Source/JavaScriptCore/runtime/JSModuleLoader.cpp
Source/JavaScriptCore/runtime/JSModuleLoader.h
Source/JavaScriptCore/runtime/JSSourceCode.cpp [new file with mode: 0644]
Source/JavaScriptCore/runtime/JSSourceCode.h [new file with mode: 0644]
Source/JavaScriptCore/runtime/JSType.h
Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp
Source/JavaScriptCore/runtime/VM.cpp
Source/JavaScriptCore/runtime/VM.h
Source/WebCore/ChangeLog
Source/WebCore/ForwardingHeaders/runtime/JSSourceCode.h [new file with mode: 0644]
Source/WebCore/bindings/js/JSDOMPromise.h
Source/WebCore/bindings/js/ScriptModuleLoader.cpp