Implement JSSourceCode to propagate SourceCode in module pipeline
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Jan 2017 05:58:19 +0000 (05:58 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Jan 2017 05:58:19 +0000 (05:58 +0000)
commit4cb1f8d61aaf0e45050a4c65659e15a74dfb6c71
treeea0ff466d745c2bded507f51115b996528dd9542
parentaaae97190f8ed76d9237c725b62ca855ed485325
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.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* builtins/ModuleLoaderPrototype.js:
(fulfillFetch):
(requestFetch):
* jsc.cpp:
(GlobalObject::moduleLoaderFetch):
* 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@210537 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