Ignore:
Timestamp:
Jan 9, 2017, 9:58:19 PM (9 years ago)
Author:
Yusuke Suzuki
Message:

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:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h

    r210522 r210537  
    3333class JSInternalPromise;
    3434class JSModuleNamespaceObject;
     35class SourceCode;
    3536
    3637class JSModuleLoader : public JSNonFinalObject {
     
    6364
    6465    // APIs to control the module loader.
    65     JSValue provide(ExecState*, JSValue key, Status, const String&);
     66    JSValue provide(ExecState*, JSValue key, Status, const SourceCode&);
    6667    JSInternalPromise* loadAndEvaluateModule(ExecState*, JSValue moduleName, JSValue referrer, JSValue initiator);
    6768    JSInternalPromise* loadModule(ExecState*, JSValue moduleName, JSValue referrer, JSValue initiator);
Note: See TracChangeset for help on using the changeset viewer.