Changeset 223237 in webkit
- Timestamp:
- Oct 12, 2017 6:12:48 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 18 added
- 31 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r223227 r223237 1 2017-10-12 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Support integrity="" on module scripts 4 https://bugs.webkit.org/show_bug.cgi?id=177959 5 6 Reviewed by Sam Weinig. 7 8 * http/tests/subresource-integrity/resources/crossorigin-anon-script-module.js: Added. 9 * http/tests/subresource-integrity/resources/crossorigin-creds-script-module.js: Added. 10 * http/tests/subresource-integrity/resources/crossorigin-ineligible-script-module.js: Added. 11 * http/tests/subresource-integrity/resources/matching-digest-module.js: Added. 12 * http/tests/subresource-integrity/resources/non-matching-digest-module.js: Added. 13 * http/tests/subresource-integrity/resources/sri-utilities.js: 14 (add_result_callback): 15 (SRIModuleTest): 16 (SRIModuleTest.prototype.execute): 17 * http/tests/subresource-integrity/sri-module-expected.txt: Added. 18 * http/tests/subresource-integrity/sri-module.html: Added. 19 * js/dom/modules/module-inline-ignore-integrity-expected.txt: Added. 20 * js/dom/modules/module-inline-ignore-integrity.html: Added. 21 * js/dom/modules/module-integrity-non-top-level-expected.txt: Added. 22 * js/dom/modules/module-integrity-non-top-level.html: Added. 23 * js/dom/modules/script-tests/module-integrity-non-top-level-2.js: Added. 24 * js/dom/modules/script-tests/module-integrity-non-top-level.js: Added. 25 1 26 2017-10-11 Per Arne Vollan <pvollan@apple.com> 2 27 -
trunk/LayoutTests/http/tests/subresource-integrity/resources/sri-utilities.js
r216347 r223237 7 7 8 8 add_result_callback(function(res) { 9 if (res.name.startsWith("Script: ") || res.name.startsWith("Style: ") ) {9 if (res.name.startsWith("Script: ") || res.name.startsWith("Style: ") || res.name.startsWith("Module: ")) { 10 10 SRITests.execute(); 11 11 } … … 108 108 this.customCallback(e, container); 109 109 }; 110 111 var SRIModuleURLCounter = 0; 112 var SRIModuleTest = function(pass, name, src, integrityValue, crossoriginValue) { 113 this.pass = pass; 114 this.name = "Module: " + name; 115 this.src = src; 116 this.integrityValue = integrityValue; 117 this.crossoriginValue = crossoriginValue; 118 119 this.test = async_test(this.name); 120 121 this.queue = SRITests; 122 this.queue.push(this); 123 } 124 125 SRIModuleTest.prototype.execute = function() { 126 var test = this.test; 127 var e = document.createElement("script"); 128 e.type = "module"; 129 e.src = this.src + "#" + (SRIModuleURLCounter++); 130 e.setAttribute("integrity", this.integrityValue); 131 if(this.crossoriginValue) { 132 e.setAttribute("crossorigin", this.crossoriginValue); 133 } 134 if(this.pass) { 135 e.addEventListener("load", function() {test.done()}); 136 e.addEventListener("error", function() { 137 test.step(function(){ assert_unreached("Good load fired error handler.") }) 138 }); 139 } else { 140 e.addEventListener("load", function() { 141 test.step(function() { assert_unreached("Bad load succeeded.") }) 142 }); 143 e.addEventListener("error", function() {test.done()}); 144 } 145 document.body.appendChild(e); 146 }; -
trunk/Source/JavaScriptCore/ChangeLog
r223232 r223237 1 2017-10-12 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Support integrity="" on module scripts 4 https://bugs.webkit.org/show_bug.cgi?id=177959 5 6 Reviewed by Sam Weinig. 7 8 This patch adds Subresource Integrity check for module scripts. Currently, 9 only top-level module can be verified with integrity parameter since there 10 is no way to perform integrity check onto the imported modules. 11 12 In JSC side, we add `parameters` to the entry point of the module loader 13 pipeline. This is fetching parameters and used when fetching modules. 14 15 We separately pass this parameters to the pipeline along with the script fetcher. 16 The script fetcher is only one for module graph since this is the initiator of 17 this module graph loading. On the other hand, this parameters is for each 18 module fetching. While setting "integrity" parameters to this script fetcher is 19 sufficient to pass parameters to top-level-module's fetching, it is not enough 20 for the future extension. 21 22 In the future, we will investigate a way to pass parameters to each non-top-level 23 module. At that time, this `parameters` should be per-module. This is because 24 "integrity" value should be different for each module. For example, we will accept 25 some form of syntax to add parameters to `import`. Some proposed syntax is like 26 https://discourse.wicg.io/t/specifying-nonce-or-integrity-when-importing-modules/1861 27 28 import "./xxx.js" integrity "xxxxxxx" 29 30 In this case, this `parameters` will be passed to "./xxx.js" module fetching. This 31 `parameters` should be different from the one of top-level-module's one. That's why 32 we need per-module `parameters` and why this patch adds `parameters` to the module pipeline. 33 34 On the other hand, we also want to keep script fetcher. This `per-module-graph` thing 35 is important to offer module-graph-wide information. For example, import.meta would 36 have `import.meta.scriptElement`, which is the script element fetching the module graph 37 including this. So, we keep the both, script fetcher and parameters. 38 https://github.com/tc39/proposal-import-meta 39 40 This parameters will be finally used by pipeline's fetch hook, and WebCore side 41 can use this parameters to fetch modules. 42 43 We also further clean up the module pipeline by dropping unnecessary features. 44 45 * JavaScriptCore.xcodeproj/project.pbxproj: 46 * Sources.txt: 47 * builtins/ModuleLoaderPrototype.js: 48 (requestFetch): 49 (requestInstantiate): 50 (requestSatisfy): 51 (loadModule): 52 (loadAndEvaluateModule): 53 This loadAndEvaluateModule should be implemented by just calling loadModule and 54 linkAndEvaluateModule. We can drop requestReady and requestLink. 55 56 (requestLink): Deleted. 57 (requestImportModule): Deleted. 58 * jsc.cpp: 59 (GlobalObject::moduleLoaderImportModule): 60 (GlobalObject::moduleLoaderFetch): 61 import and fetch hook takes parameters. Currently, we always pass `undefined` for 62 import hook. When dynamic `import()` is extended to accept additional parameters 63 like integrity, this parameters will be replaced with the actual value. 64 65 (functionLoadModule): 66 (runWithOptions): 67 * runtime/Completion.cpp: 68 (JSC::loadAndEvaluateModule): 69 (JSC::loadModule): 70 (JSC::importModule): 71 * runtime/Completion.h: 72 * runtime/JSGlobalObject.h: 73 * runtime/JSGlobalObjectFunctions.cpp: 74 (JSC::globalFuncImportModule): 75 * runtime/JSModuleLoader.cpp: 76 (JSC::JSModuleLoader::loadAndEvaluateModule): 77 (JSC::JSModuleLoader::loadModule): 78 (JSC::JSModuleLoader::requestImportModule): 79 (JSC::JSModuleLoader::importModule): 80 (JSC::JSModuleLoader::fetch): 81 * runtime/JSModuleLoader.h: 82 * runtime/JSScriptFetchParameters.cpp: Added. 83 (JSC::JSScriptFetchParameters::destroy): 84 * runtime/JSScriptFetchParameters.h: Added. 85 (JSC::JSScriptFetchParameters::createStructure): 86 (JSC::JSScriptFetchParameters::create): 87 (JSC::JSScriptFetchParameters::parameters const): 88 (JSC::JSScriptFetchParameters::JSScriptFetchParameters): 89 Add ScriptFetchParameters' JSCell wrapper, JSScriptFetchParameters. 90 It is used in the module pipeline. 91 92 * runtime/JSType.h: 93 * runtime/ModuleLoaderPrototype.cpp: 94 (JSC::moduleLoaderPrototypeFetch): 95 * runtime/ScriptFetchParameters.h: Added. 96 (JSC::ScriptFetchParameters::~ScriptFetchParameters): 97 Add ScriptFetchParameters. We can define our own custom ScriptFetchParameters 98 by inheriting this class. WebCore creates ModuleFetchParameters by inheriting 99 this. 100 101 * runtime/VM.cpp: 102 (JSC::VM::VM): 103 * runtime/VM.h: 104 1 105 2017-10-11 Yusuke Suzuki <utatane.tea@gmail.com> 2 106 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r223125 r223237 1633 1633 E31618151EC5FE270006A218 /* DOMAttributeGetterSetter.h in Headers */ = {isa = PBXBuildFile; fileRef = E31618121EC5FE080006A218 /* DOMAttributeGetterSetter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1634 1634 E318CBC11B8AEF5100A2929D /* JSModuleNamespaceObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E318CBBF1B8AEF5100A2929D /* JSModuleNamespaceObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1635 E3201C1D1F8E82360076A032 /* JSScriptFetchParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = E38D060B1F8E814100649CF2 /* JSScriptFetchParameters.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1636 E3201C1E1F8E824C0076A032 /* ScriptFetchParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = E38D060C1F8E814100649CF2 /* ScriptFetchParameters.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1635 1637 E322E5A31DA64439006E7709 /* DFGSnippetParams.h in Headers */ = {isa = PBXBuildFile; fileRef = E322E5A11DA64435006E7709 /* DFGSnippetParams.h */; }; 1636 1638 E322E5A71DA644A8006E7709 /* FTLSnippetParams.h in Headers */ = {isa = PBXBuildFile; fileRef = E322E5A51DA644A4006E7709 /* FTLSnippetParams.h */; }; … … 4420 4422 E380A76B1DCD7195000F89E6 /* MacroAssemblerHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerHelpers.h; sourceTree = "<group>"; }; 4421 4423 E380D66B1F19249D00A59095 /* BuiltinNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BuiltinNames.cpp; sourceTree = "<group>"; }; 4424 E38D060B1F8E814100649CF2 /* JSScriptFetchParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScriptFetchParameters.h; sourceTree = "<group>"; }; 4425 E38D060C1F8E814100649CF2 /* ScriptFetchParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptFetchParameters.h; sourceTree = "<group>"; }; 4426 E38D060D1F8E814100649CF2 /* JSScriptFetchParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScriptFetchParameters.cpp; sourceTree = "<group>"; }; 4422 4427 E3963CEC1B73F75000EB4CE5 /* NodesAnalyzeModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodesAnalyzeModule.cpp; sourceTree = "<group>"; }; 4423 4428 E39D9D841D39000600667282 /* InterpreterInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InterpreterInlines.h; sourceTree = "<group>"; }; … … 6480 6485 11C197C2624848EDA84CED7F /* JSScriptFetcher.cpp */, 6481 6486 6BA93C9590484C5BAD9316EA /* JSScriptFetcher.h */, 6487 E38D060D1F8E814100649CF2 /* JSScriptFetchParameters.cpp */, 6488 E38D060B1F8E814100649CF2 /* JSScriptFetchParameters.h */, 6482 6489 0F919D0E157F3327004A4E7D /* JSSegmentedVariableObject.cpp */, 6483 6490 0F919D0F157F3327004A4E7D /* JSSegmentedVariableObject.h */, … … 6650 6657 147341CD1DC02D7900AA29BA /* ScriptExecutable.h */, 6651 6658 8852151A9C3842389B3215B7 /* ScriptFetcher.h */, 6659 E38D060C1F8E814100649CF2 /* ScriptFetchParameters.h */, 6652 6660 A7299DA317D12858005F5FF9 /* SetConstructor.cpp */, 6653 6661 A7299DA417D12858005F5FF9 /* SetConstructor.h */, … … 8733 8741 14874AE615EBDE4A002E3587 /* JSScope.h in Headers */, 8734 8742 9064337DD4B0402BAF34A592 /* JSScriptFetcher.h in Headers */, 8743 E3201C1D1F8E82360076A032 /* JSScriptFetchParameters.h in Headers */, 8735 8744 A7C0C4AC168103020017011D /* JSScriptRefPrivate.h in Headers */, 8736 8745 0F919D11157F332C004A4E7D /* JSSegmentedVariableObject.h in Headers */, … … 8956 8965 147B84630E6DE6B1004775A4 /* PutPropertySlot.h in Headers */, 8957 8966 0FF60AC216740F8300029779 /* ReduceWhitespace.h in Headers */, 8958 7986943B1F8C0ACC009232AE /* StructureCache.h in Headers */,8959 8967 E33637A61B63220200EE0840 /* ReflectObject.h in Headers */, 8960 8968 996B73231BDA08EF00331B84 /* ReflectObject.lut.h in Headers */, … … 9005 9013 147341CE1DC02D7900AA29BA /* ScriptExecutable.h in Headers */, 9006 9014 CEAE7D7B889B477BA93ABA6C /* ScriptFetcher.h in Headers */, 9015 E3201C1E1F8E824C0076A032 /* ScriptFetchParameters.h in Headers */, 9007 9016 A55D93A6185012A800400DED /* ScriptFunctionCall.h in Headers */, 9008 9017 A54CF2FA184EAEDA00237F19 /* ScriptObject.h in Headers */, … … 9056 9065 145722861437E140005FDE26 /* StrongInlines.h in Headers */, 9057 9066 BCDE3AB80E6C82F5001453A7 /* Structure.h in Headers */, 9067 7986943B1F8C0ACC009232AE /* StructureCache.h in Headers */, 9058 9068 7E4EE7090EBB7963005934AA /* StructureChain.h in Headers */, 9059 9069 2AAAA31218BD49D100394CC8 /* StructureIDBlob.h in Headers */, -
trunk/Source/JavaScriptCore/Sources.txt
r223125 r223237 808 808 runtime/JSScope.cpp 809 809 runtime/JSScriptFetcher.cpp 810 runtime/JSScriptFetchParameters.cpp 810 811 runtime/JSSegmentedVariableObject.cpp 811 812 runtime/JSSegmentedVariableObjectSubspace.cpp -
trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js
r223173 r223237 141 141 // Loader. 142 142 143 function requestFetch(key, fetcher)143 function requestFetch(key, parameters, fetcher) 144 144 { 145 145 // https://whatwg.github.io/loader/#request-fetch … … 157 157 // For example, JavaScriptCore shell can provide the hook fetching the resource 158 158 // from the local file system. 159 var fetchPromise = this.fetch(key, fetcher).then((source) => {159 var fetchPromise = this.fetch(key, parameters, fetcher).then((source) => { 160 160 @setStateToMax(entry, @ModuleInstantiate); 161 161 return source; … … 165 165 } 166 166 167 function requestInstantiate(key, fetcher)167 function requestInstantiate(key, parameters, fetcher) 168 168 { 169 169 // https://whatwg.github.io/loader/#request-instantiate … … 175 175 return entry.instantiate; 176 176 177 var instantiatePromise = this.requestFetch(key, fetcher).then((source) => {177 var instantiatePromise = this.requestFetch(key, parameters, fetcher).then((source) => { 178 178 var moduleRecord = this.parseModule(entry.key, source); 179 179 … … 208 208 } 209 209 210 function requestSatisfy(key, fetcher)210 function requestSatisfy(key, parameters, fetcher) 211 211 { 212 212 // https://whatwg.github.io/loader/#satisfy-instance … … 218 218 return entry.satisfy; 219 219 220 var satisfyPromise = this.requestInstantiate(key, fetcher).then((entry) => {220 var satisfyPromise = this.requestInstantiate(key, parameters, fetcher).then((entry) => { 221 221 var depLoads = []; 222 222 for (var i = 0, length = entry.dependencies.length; i < length; ++i) { … … 247 247 } 248 248 249 return this.requestSatisfy(depKey, fetcher).then((entry) => { 249 // Currently, module loader do not pass any information for non-top-level module fetching. 250 return this.requestSatisfy(depKey, @undefined, fetcher).then((entry) => { 250 251 pair.value = entry.module; 251 252 return entry; … … 263 264 entry.satisfy = satisfyPromise; 264 265 return satisfyPromise; 265 }266 267 function requestLink(key, fetcher)268 {269 // https://whatwg.github.io/loader/#request-link270 271 "use strict";272 273 var entry = this.ensureRegistered(key);274 if (entry.state > @ModuleLink) {275 var deferred = @newPromiseCapability(@InternalPromise);276 deferred.@resolve.@call(@undefined, entry);277 return deferred.@promise;278 }279 280 return this.requestSatisfy(key, fetcher).then((entry) => {281 this.link(entry, fetcher);282 return entry;283 });284 }285 286 function requestReady(key, fetcher)287 {288 // https://whatwg.github.io/loader/#request-ready289 290 "use strict";291 292 return this.requestLink(key, fetcher).then((entry) => {293 this.moduleEvaluation(entry.module, fetcher);294 });295 266 } 296 267 … … 364 335 } 365 336 366 function load AndEvaluateModule(moduleName, referrer, fetcher)337 function loadModule(moduleName, parameters, fetcher) 367 338 { 368 339 "use strict"; … … 372 343 // Take the name and resolve it to the unique identifier for the resource location. 373 344 // For example, take the "jquery" and return the URL for the resource. 374 return this.resolve(moduleName, referrer, fetcher).then((key) => { 375 return this.requestReady(key, fetcher); 376 }); 377 } 378 379 function loadModule(moduleName, referrer, fetcher) 380 { 381 "use strict"; 382 383 // Loader.resolve hook point. 384 // resolve: moduleName => Promise(moduleKey) 385 // Take the name and resolve it to the unique identifier for the resource location. 386 // For example, take the "jquery" and return the URL for the resource. 387 return this.resolve(moduleName, referrer, fetcher).then((key) => { 388 return this.requestSatisfy(key, fetcher); 345 return this.resolve(moduleName, @undefined, fetcher).then((key) => { 346 return this.requestSatisfy(key, parameters, fetcher); 389 347 }).then((entry) => { 390 348 return entry.key; … … 404 362 } 405 363 406 function requestImportModule(key, fetcher) 407 { 408 "use strict"; 409 410 return this.requestSatisfy(key, fetcher).then((entry) => { 364 function loadAndEvaluateModule(moduleName, parameters, fetcher) 365 { 366 "use strict"; 367 368 return this.loadModule(moduleName, parameters, fetcher).then((key) => { 369 return this.linkAndEvaluateModule(key, fetcher); 370 }); 371 } 372 373 function requestImportModule(key, parameters, fetcher) 374 { 375 "use strict"; 376 377 return this.requestSatisfy(key, parameters, fetcher).then((entry) => { 411 378 this.linkAndEvaluateModule(entry.key, fetcher); 412 379 return this.getModuleNamespaceObject(entry.module); -
trunk/Source/JavaScriptCore/jsc.cpp
r223173 r223237 1658 1658 } 1659 1659 1660 static JSInternalPromise* moduleLoaderImportModule(JSGlobalObject*, ExecState*, JSModuleLoader*, JSString*, const SourceOrigin&);1660 static JSInternalPromise* moduleLoaderImportModule(JSGlobalObject*, ExecState*, JSModuleLoader*, JSString*, JSValue, const SourceOrigin&); 1661 1661 static JSInternalPromise* moduleLoaderResolve(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue); 1662 static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue );1662 static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue); 1663 1663 static JSObject* moduleLoaderCreateImportMetaProperties(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSModuleRecord*, JSValue); 1664 1664 }; … … 1812 1812 } 1813 1813 1814 JSInternalPromise* GlobalObject::moduleLoaderImportModule(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSString* moduleNameValue, const SourceOrigin& sourceOrigin)1814 JSInternalPromise* GlobalObject::moduleLoaderImportModule(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSString* moduleNameValue, JSValue parameters, const SourceOrigin& sourceOrigin) 1815 1815 { 1816 1816 VM& vm = globalObject->vm(); … … 1836 1836 return rejectPromise(createError(exec, makeString("Could not resolve the referrer name '", String(referrer.impl()), "'."))); 1837 1837 1838 auto result = JSC::importModule(exec, Identifier::fromString(&vm, resolvePath(directoryName.value(), ModuleName(moduleName))), jsUndefined());1838 auto result = JSC::importModule(exec, Identifier::fromString(&vm, resolvePath(directoryName.value(), ModuleName(moduleName))), parameters, jsUndefined()); 1839 1839 scope.releaseAssertNoException(); 1840 1840 return result; … … 1986 1986 } 1987 1987 1988 JSInternalPromise* GlobalObject::moduleLoaderFetch(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue key, JSValue )1988 JSInternalPromise* GlobalObject::moduleLoaderFetch(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue key, JSValue, JSValue) 1989 1989 { 1990 1990 VM& vm = globalObject->vm(); … … 3274 3274 return JSValue::encode(throwException(exec, scope, createError(exec, ASCIILiteral("Could not open file.")))); 3275 3275 3276 JSInternalPromise* promise = loadAndEvaluateModule(exec, fileName );3276 JSInternalPromise* promise = loadAndEvaluateModule(exec, fileName, jsUndefined(), jsUndefined()); 3277 3277 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 3278 3278 … … 3661 3661 3662 3662 if (isModule) { 3663 promise = loadAndEvaluateModule(globalObject->globalExec(), fileName );3663 promise = loadAndEvaluateModule(globalObject->globalExec(), fileName, jsUndefined(), jsUndefined()); 3664 3664 scope.releaseAssertNoException(); 3665 3665 } else { … … 3677 3677 if (isModule) { 3678 3678 if (!promise) 3679 promise = loadAndEvaluateModule(globalObject->globalExec(), makeSource(stringFromUTF(scriptBuffer), SourceOrigin { absolutePath(fileName) }, fileName, TextPosition(), SourceProviderSourceType::Module) );3679 promise = loadAndEvaluateModule(globalObject->globalExec(), makeSource(stringFromUTF(scriptBuffer), SourceOrigin { absolutePath(fileName) }, fileName, TextPosition(), SourceProviderSourceType::Module), jsUndefined()); 3680 3680 scope.clearException(); 3681 3681 -
trunk/Source/JavaScriptCore/runtime/Completion.cpp
r223173 r223237 155 155 } 156 156 157 static JSInternalPromise* loadAndEvaluateModule(const JSLockHolder&, ExecState* exec, JSGlobalObject* globalObject, JSValue moduleName, JSValue referrer, JSValue scriptFetcher) 158 { 159 return globalObject->moduleLoader()->loadAndEvaluateModule(exec, moduleName, referrer, scriptFetcher); 160 } 161 162 static JSInternalPromise* loadAndEvaluateModule(const JSLockHolder& lock, ExecState* exec, JSGlobalObject* globalObject, const Identifier& moduleName, JSValue scriptFetcher) 163 { 164 return loadAndEvaluateModule(lock, exec, globalObject, identifierToJSValue(exec->vm(), moduleName), jsUndefined(), scriptFetcher); 165 } 166 167 JSInternalPromise* loadAndEvaluateModule(ExecState* exec, const String& moduleName, JSValue scriptFetcher) 168 { 169 VM& vm = exec->vm(); 170 JSLockHolder lock(vm); 171 RELEASE_ASSERT(vm.atomicStringTable() == Thread::current().atomicStringTable()); 172 RELEASE_ASSERT(!vm.isCollectorBusyOnCurrentThread()); 173 174 return loadAndEvaluateModule(lock, exec, exec->vmEntryGlobalObject(), Identifier::fromString(exec, moduleName), scriptFetcher); 157 JSInternalPromise* loadAndEvaluateModule(ExecState* exec, const String& moduleName, JSValue parameters, JSValue scriptFetcher) 158 { 159 VM& vm = exec->vm(); 160 JSLockHolder lock(vm); 161 RELEASE_ASSERT(vm.atomicStringTable() == Thread::current().atomicStringTable()); 162 RELEASE_ASSERT(!vm.isCollectorBusyOnCurrentThread()); 163 164 return exec->vmEntryGlobalObject()->moduleLoader()->loadAndEvaluateModule(exec, identifierToJSValue(vm, Identifier::fromString(exec, moduleName)), parameters, scriptFetcher); 175 165 } 176 166 … … 191 181 RETURN_IF_EXCEPTION(scope, rejectPromise(exec, globalObject)); 192 182 193 return loadAndEvaluateModule(lock, exec, globalObject, key, jsUndefined(), scriptFetcher); 194 } 195 196 static JSInternalPromise* loadModule(const JSLockHolder&, ExecState* exec, JSGlobalObject* globalObject, JSValue moduleName, JSValue referrer, JSValue scriptFetcher) 197 { 198 return globalObject->moduleLoader()->loadModule(exec, moduleName, referrer, scriptFetcher); 199 } 200 201 static JSInternalPromise* loadModule(const JSLockHolder& lock, ExecState* exec, JSGlobalObject* globalObject, const Identifier& moduleName, JSValue scriptFetcher) 202 { 203 return loadModule(lock, exec, globalObject, identifierToJSValue(exec->vm(), moduleName), jsUndefined(), scriptFetcher); 204 } 205 206 JSInternalPromise* loadModule(ExecState* exec, const String& moduleName, JSValue scriptFetcher) 207 { 208 VM& vm = exec->vm(); 209 JSLockHolder lock(vm); 210 RELEASE_ASSERT(vm.atomicStringTable() == Thread::current().atomicStringTable()); 211 RELEASE_ASSERT(!vm.isCollectorBusyOnCurrentThread()); 212 213 return loadModule(lock, exec, exec->vmEntryGlobalObject(), Identifier::fromString(exec, moduleName), scriptFetcher); 183 return globalObject->moduleLoader()->loadAndEvaluateModule(exec, key, jsUndefined(), scriptFetcher); 184 } 185 186 JSInternalPromise* loadModule(ExecState* exec, const String& moduleName, JSValue parameters, JSValue scriptFetcher) 187 { 188 VM& vm = exec->vm(); 189 JSLockHolder lock(vm); 190 RELEASE_ASSERT(vm.atomicStringTable() == Thread::current().atomicStringTable()); 191 RELEASE_ASSERT(!vm.isCollectorBusyOnCurrentThread()); 192 193 return exec->vmEntryGlobalObject()->moduleLoader()->loadModule(exec, identifierToJSValue(vm, Identifier::fromString(exec, moduleName)), parameters, scriptFetcher); 214 194 } 215 195 … … 231 211 RETURN_IF_EXCEPTION(scope, rejectPromise(exec, globalObject)); 232 212 233 return loadModule(lock, exec, globalObject, key, jsUndefined(), scriptFetcher);213 return globalObject->moduleLoader()->loadModule(exec, key, jsUndefined(), scriptFetcher); 234 214 } 235 215 … … 245 225 } 246 226 247 JSInternalPromise* importModule(ExecState* exec, const Identifier& moduleKey, JSValue scriptFetcher)248 { 249 VM& vm = exec->vm(); 250 JSLockHolder lock(vm); 251 RELEASE_ASSERT(vm.atomicStringTable() == Thread::current().atomicStringTable()); 252 RELEASE_ASSERT(!vm.isCollectorBusyOnCurrentThread()); 253 254 return exec->vmEntryGlobalObject()->moduleLoader()->requestImportModule(exec, moduleKey, scriptFetcher);227 JSInternalPromise* importModule(ExecState* exec, const Identifier& moduleKey, JSValue parameters, JSValue scriptFetcher) 228 { 229 VM& vm = exec->vm(); 230 JSLockHolder lock(vm); 231 RELEASE_ASSERT(vm.atomicStringTable() == Thread::current().atomicStringTable()); 232 RELEASE_ASSERT(!vm.isCollectorBusyOnCurrentThread()); 233 234 return exec->vmEntryGlobalObject()->moduleLoader()->requestImportModule(exec, moduleKey, parameters, scriptFetcher); 255 235 } 256 236 -
trunk/Source/JavaScriptCore/runtime/Completion.h
r211018 r223237 58 58 59 59 // Load the module source and evaluate it. 60 JS_EXPORT_PRIVATE JSInternalPromise* loadAndEvaluateModule(ExecState*, const String& moduleName, JSValue scriptFetcher = jsUndefined());61 JS_EXPORT_PRIVATE JSInternalPromise* loadAndEvaluateModule(ExecState*, const SourceCode&, JSValue scriptFetcher = jsUndefined());60 JS_EXPORT_PRIVATE JSInternalPromise* loadAndEvaluateModule(ExecState*, const String& moduleName, JSValue parameters, JSValue scriptFetcher); 61 JS_EXPORT_PRIVATE JSInternalPromise* loadAndEvaluateModule(ExecState*, const SourceCode&, JSValue scriptFetcher); 62 62 63 63 // Fetch the module source, and instantiate the module record. 64 JS_EXPORT_PRIVATE JSInternalPromise* loadModule(ExecState*, const String& moduleName, JSValue scriptFetcher = jsUndefined());65 JS_EXPORT_PRIVATE JSInternalPromise* loadModule(ExecState*, const SourceCode&, JSValue scriptFetcher = jsUndefined());64 JS_EXPORT_PRIVATE JSInternalPromise* loadModule(ExecState*, const String& moduleName, JSValue parameters, JSValue scriptFetcher); 65 JS_EXPORT_PRIVATE JSInternalPromise* loadModule(ExecState*, const SourceCode&, JSValue scriptFetcher); 66 66 67 67 // Link and evaluate the already linked module. This function is called in a sync manner. 68 JS_EXPORT_PRIVATE JSValue linkAndEvaluateModule(ExecState*, const Identifier& moduleKey, JSValue scriptFetcher = jsUndefined());68 JS_EXPORT_PRIVATE JSValue linkAndEvaluateModule(ExecState*, const Identifier& moduleKey, JSValue scriptFetcher); 69 69 70 JS_EXPORT_PRIVATE JSInternalPromise* importModule(ExecState*, const Identifier& moduleKey, JSValue scriptFetcher);70 JS_EXPORT_PRIVATE JSInternalPromise* importModule(ExecState*, const Identifier& moduleKey, JSValue parameters, JSValue scriptFetcher); 71 71 72 72 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r223173 r223237 187 187 ShouldInterruptScriptBeforeTimeoutPtr shouldInterruptScriptBeforeTimeout; 188 188 189 typedef JSInternalPromise* (*ModuleLoaderImportModulePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSString*, const SourceOrigin&);189 typedef JSInternalPromise* (*ModuleLoaderImportModulePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSString*, JSValue, const SourceOrigin&); 190 190 ModuleLoaderImportModulePtr moduleLoaderImportModule; 191 191 … … 193 193 ModuleLoaderResolvePtr moduleLoaderResolve; 194 194 195 typedef JSInternalPromise* (*ModuleLoaderFetchPtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue );195 typedef JSInternalPromise* (*ModuleLoaderFetchPtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue); 196 196 ModuleLoaderFetchPtr moduleLoaderFetch; 197 197 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r221849 r223237 798 798 } 799 799 800 auto* internalPromise = globalObject->moduleLoader()->importModule(exec, specifier, sourceOrigin); 800 // We always specify parameters as undefined. Once dynamic import() starts accepting fetching parameters, 801 // we should retrieve this from the arguments. 802 JSValue parameters = jsUndefined(); 803 auto* internalPromise = globalObject->moduleLoader()->importModule(exec, specifier, parameters, sourceOrigin); 801 804 if (Exception* exception = catchScope.exception()) { 802 805 catchScope.clearException(); -
trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp
r223173 r223237 100 100 } 101 101 102 JSInternalPromise* JSModuleLoader::loadAndEvaluateModule(ExecState* exec, JSValue moduleName, JSValue referrer, JSValue scriptFetcher)102 JSInternalPromise* JSModuleLoader::loadAndEvaluateModule(ExecState* exec, JSValue moduleName, JSValue parameters, JSValue scriptFetcher) 103 103 { 104 104 VM& vm = exec->vm(); … … 113 113 MarkedArgumentBuffer arguments; 114 114 arguments.append(moduleName); 115 arguments.append( referrer);115 arguments.append(parameters); 116 116 arguments.append(scriptFetcher); 117 117 … … 120 120 } 121 121 122 JSInternalPromise* JSModuleLoader::loadModule(ExecState* exec, JSValue moduleName, JSValue referrer, JSValue scriptFetcher)122 JSInternalPromise* JSModuleLoader::loadModule(ExecState* exec, JSValue moduleName, JSValue parameters, JSValue scriptFetcher) 123 123 { 124 124 VM& vm = exec->vm(); … … 133 133 MarkedArgumentBuffer arguments; 134 134 arguments.append(moduleName); 135 arguments.append( referrer);135 arguments.append(parameters); 136 136 arguments.append(scriptFetcher); 137 137 … … 159 159 } 160 160 161 JSInternalPromise* JSModuleLoader::requestImportModule(ExecState* exec, const Identifier& moduleKey, JSValue scriptFetcher)161 JSInternalPromise* JSModuleLoader::requestImportModule(ExecState* exec, const Identifier& moduleKey, JSValue parameters, JSValue scriptFetcher) 162 162 { 163 163 VM& vm = exec->vm(); … … 172 172 MarkedArgumentBuffer arguments; 173 173 arguments.append(jsString(exec, moduleKey.impl())); 174 arguments.append(parameters); 174 175 arguments.append(scriptFetcher); 175 176 … … 178 179 } 179 180 180 JSInternalPromise* JSModuleLoader::importModule(ExecState* exec, JSString* moduleName, const SourceOrigin& referrer)181 JSInternalPromise* JSModuleLoader::importModule(ExecState* exec, JSString* moduleName, JSValue parameters, const SourceOrigin& referrer) 181 182 { 182 183 if (Options::dumpModuleLoadingState()) … … 188 189 189 190 if (globalObject->globalObjectMethodTable()->moduleLoaderImportModule) 190 return globalObject->globalObjectMethodTable()->moduleLoaderImportModule(globalObject, exec, this, moduleName, referrer);191 return globalObject->globalObjectMethodTable()->moduleLoaderImportModule(globalObject, exec, this, moduleName, parameters, referrer); 191 192 192 193 auto* deferred = JSInternalPromiseDeferred::create(exec, globalObject); … … 215 216 } 216 217 217 JSInternalPromise* JSModuleLoader::fetch(ExecState* exec, JSValue key, JSValue scriptFetcher)218 JSInternalPromise* JSModuleLoader::fetch(ExecState* exec, JSValue key, JSValue parameters, JSValue scriptFetcher) 218 219 { 219 220 if (Options::dumpModuleLoadingState()) … … 224 225 auto scope = DECLARE_CATCH_SCOPE(vm); 225 226 if (globalObject->globalObjectMethodTable()->moduleLoaderFetch) 226 return globalObject->globalObjectMethodTable()->moduleLoaderFetch(globalObject, exec, this, key, scriptFetcher);227 return globalObject->globalObjectMethodTable()->moduleLoaderFetch(globalObject, exec, this, key, parameters, scriptFetcher); 227 228 JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject); 228 229 String moduleKey = key.toWTFString(exec); -
trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h
r223173 r223237 65 65 // APIs to control the module loader. 66 66 JSValue provideFetch(ExecState*, JSValue key, const SourceCode&); 67 JSInternalPromise* loadAndEvaluateModule(ExecState*, JSValue moduleName, JSValue referrer, JSValue scriptFetcher);68 JSInternalPromise* loadModule(ExecState*, JSValue moduleName, JSValue referrer, JSValue scriptFetcher);67 JSInternalPromise* loadAndEvaluateModule(ExecState*, JSValue moduleName, JSValue parameters, JSValue scriptFetcher); 68 JSInternalPromise* loadModule(ExecState*, JSValue moduleName, JSValue parameters, JSValue scriptFetcher); 69 69 JSValue linkAndEvaluateModule(ExecState*, JSValue moduleKey, JSValue scriptFetcher); 70 JSInternalPromise* requestImportModule(ExecState*, const Identifier&, JSValue scriptFetcher);70 JSInternalPromise* requestImportModule(ExecState*, const Identifier&, JSValue parameters, JSValue scriptFetcher); 71 71 72 72 // Platform dependent hooked APIs. 73 JSInternalPromise* importModule(ExecState*, JSString* moduleName, const SourceOrigin& referrer);73 JSInternalPromise* importModule(ExecState*, JSString* moduleName, JSValue parameters, const SourceOrigin& referrer); 74 74 JSInternalPromise* resolve(ExecState*, JSValue name, JSValue referrer, JSValue scriptFetcher); 75 JSInternalPromise* fetch(ExecState*, JSValue key, JSValue scriptFetcher);75 JSInternalPromise* fetch(ExecState*, JSValue key, JSValue parameters, JSValue scriptFetcher); 76 76 JSObject* createImportMetaProperties(ExecState*, JSValue key, JSModuleRecord*, JSValue scriptFetcher); 77 77 -
trunk/Source/JavaScriptCore/runtime/JSType.h
r221959 r223237 53 53 JSSourceCodeType, 54 54 JSScriptFetcherType, 55 JSScriptFetchParametersType, 55 56 56 57 // The ObjectType value must come before any JSType that is a subclass of JSObject. -
trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp
r223173 r223237 71 71 forceFulfillPromise JSBuiltin DontEnum|Function 2 72 72 fulfillFetch JSBuiltin DontEnum|Function 2 73 requestFetch JSBuiltin DontEnum|Function 2 74 requestInstantiate JSBuiltin DontEnum|Function 2 75 requestSatisfy JSBuiltin DontEnum|Function 2 76 requestLink JSBuiltin DontEnum|Function 2 77 requestReady JSBuiltin DontEnum|Function 2 73 requestFetch JSBuiltin DontEnum|Function 3 74 requestInstantiate JSBuiltin DontEnum|Function 3 75 requestSatisfy JSBuiltin DontEnum|Function 3 78 76 link JSBuiltin DontEnum|Function 2 79 77 moduleDeclarationInstantiation moduleLoaderPrototypeModuleDeclarationInstantiation DontEnum|Function 3 … … 84 82 loadModule JSBuiltin DontEnum|Function 3 85 83 linkAndEvaluateModule JSBuiltin DontEnum|Function 2 86 requestImportModule JSBuiltin DontEnum|Function 284 requestImportModule JSBuiltin DontEnum|Function 3 87 85 getModuleNamespaceObject moduleLoaderPrototypeGetModuleNamespaceObject DontEnum|Function 1 88 86 parseModule moduleLoaderPrototypeParseModule DontEnum|Function 2 89 87 requestedModules moduleLoaderPrototypeRequestedModules DontEnum|Function 1 90 88 resolve moduleLoaderPrototypeResolve DontEnum|Function 2 91 fetch moduleLoaderPrototypeFetch DontEnum|Function 289 fetch moduleLoaderPrototypeFetch DontEnum|Function 3 92 90 @end 93 91 */ … … 196 194 if (!loader) 197 195 return JSValue::encode(jsUndefined()); 198 return JSValue::encode(loader->fetch(exec, exec->argument(0), exec->argument(1) ));196 return JSValue::encode(loader->fetch(exec, exec->argument(0), exec->argument(1), exec->argument(2))); 199 197 } 200 198 -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r223125 r223237 74 74 #include "JSPromiseDeferred.h" 75 75 #include "JSPropertyNameEnumerator.h" 76 #include "JSScriptFetchParameters.h" 76 77 #include "JSScriptFetcher.h" 77 78 #include "JSSet.h" … … 254 255 sourceCodeStructure.set(*this, JSSourceCode::createStructure(*this, 0, jsNull())); 255 256 scriptFetcherStructure.set(*this, JSScriptFetcher::createStructure(*this, 0, jsNull())); 257 scriptFetchParametersStructure.set(*this, JSScriptFetchParameters::createStructure(*this, 0, jsNull())); 256 258 structureChainStructure.set(*this, StructureChain::createStructure(*this, 0, jsNull())); 257 259 sparseArrayValueMapStructure.set(*this, SparseArrayValueMap::createStructure(*this, 0, jsNull())); -
trunk/Source/JavaScriptCore/runtime/VM.h
r223125 r223237 362 362 Strong<Structure> sourceCodeStructure; 363 363 Strong<Structure> scriptFetcherStructure; 364 Strong<Structure> scriptFetchParametersStructure; 364 365 Strong<Structure> structureChainStructure; 365 366 Strong<Structure> sparseArrayValueMapStructure; -
trunk/Source/WebCore/ChangeLog
r223235 r223237 1 2017-10-12 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Support integrity="" on module scripts 4 https://bugs.webkit.org/show_bug.cgi?id=177959 5 6 Reviewed by Sam Weinig. 7 8 This patch extends module hooks to accept fetching parameters. 9 When starting fetching modules, WebCore creates ModuleFetchParameters. 10 And this parameters is propagated to the fetch hook. Then, fetch 11 hook can use this parameters to fetch modules. 12 13 This parameters only contains `integrity` field. This "integrity" is 14 used to perform subresource integrity check in module loader pipeline. 15 And this error is just proparaged as errors in module pipeline, which 16 is the same to the other types of errors in module pipeline. 17 18 Test: http/tests/subresource-integrity/sri-module.html 19 20 * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Added. 21 * ForwardingHeaders/runtime/ScriptFetchParameters.h: Added. 22 * WebCore.xcodeproj/project.pbxproj: 23 * bindings/js/CachedModuleScriptLoader.cpp: 24 (WebCore::CachedModuleScriptLoader::create): 25 (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): 26 Take parameters, which includes "integrity". 27 28 * bindings/js/CachedModuleScriptLoader.h: 29 * bindings/js/JSDOMWindowBase.cpp: 30 (WebCore::JSDOMWindowBase::moduleLoaderFetch): 31 (WebCore::JSDOMWindowBase::moduleLoaderImportModule): 32 import and fetch hooks take parameters. 33 34 * bindings/js/JSDOMWindowBase.h: 35 * bindings/js/JSMainThreadExecState.h: 36 (WebCore::JSMainThreadExecState::loadModule): 37 * bindings/js/ScriptController.cpp: 38 (WebCore::ScriptController::loadModuleScriptInWorld): 39 (WebCore::ScriptController::loadModuleScript): 40 Pass parameters to the entry point of the module pipeline. 41 42 * bindings/js/ScriptController.h: 43 * bindings/js/ScriptModuleLoader.cpp: 44 (WebCore::ScriptModuleLoader::fetch): 45 If parameters are passed, we set them to CachedModuleScriptLoader. 46 47 (WebCore::ScriptModuleLoader::importModule): 48 Pass parameters to the entry point of dynamic import. 49 50 (WebCore::ScriptModuleLoader::notifyFinished): 51 If script loader has parameters, we perform subresource integrity check here. 52 53 * bindings/js/ScriptModuleLoader.h: 54 * dom/LoadableModuleScript.cpp: 55 (WebCore::LoadableModuleScript::create): 56 (WebCore::LoadableModuleScript::LoadableModuleScript): 57 (WebCore::LoadableModuleScript::load): 58 Create ModuleFetchParameters with "integrity" value. 59 60 * dom/LoadableModuleScript.h: 61 * dom/ModuleFetchParameters.h: Copied from Source/WebCore/bindings/js/CachedModuleScriptLoader.h. 62 (WebCore::ModuleFetchParameters::create): 63 (WebCore::ModuleFetchParameters::integrity const): 64 (WebCore::ModuleFetchParameters::ModuleFetchParameters): 65 * dom/ScriptElement.cpp: 66 (WebCore::ScriptElement::requestModuleScript): 67 Pass "integrity" value to the module script. 68 1 69 2017-10-12 Tomas Popela <tpopela@redhat.com> 2 70 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r223206 r223237 6830 6830 E3150EA71DA7219300194012 /* DOMJITHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = E3150EA51DA7218D00194012 /* DOMJITHelpers.h */; }; 6831 6831 E318039D1DC40099009932C2 /* JSDynamicDowncast.h in Headers */ = {isa = PBXBuildFile; fileRef = E3A5872E1DC3F52600F607A6 /* JSDynamicDowncast.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6832 E3201C1A1F8E82130076A032 /* ModuleFetchParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = E38D06091F8E811900649CF2 /* ModuleFetchParameters.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6832 6833 E323CFFA1E5AF6AF00F0B4A0 /* JSDOMConvertPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = E323CFF91E5AF6A500F0B4A0 /* JSDOMConvertPromise.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6833 6834 E3565B7B1DC2D6C900217DBD /* JSEventCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = E34EE49F1DC2D57500EAA9D3 /* JSEventCustom.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 15688 15689 E38838941BAD145F00D62EE3 /* ScriptModuleLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptModuleLoader.cpp; sourceTree = "<group>"; }; 15689 15690 E38838951BAD145F00D62EE3 /* ScriptModuleLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptModuleLoader.h; sourceTree = "<group>"; }; 15691 E38D06091F8E811900649CF2 /* ModuleFetchParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleFetchParameters.h; sourceTree = "<group>"; }; 15690 15692 E3975B761EC9AF3900847717 /* JSDocumentFragmentDOMJIT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDocumentFragmentDOMJIT.cpp; sourceTree = "<group>"; }; 15691 15693 E3975B771EC9AF3900847717 /* JSElementDOMJIT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSElementDOMJIT.cpp; sourceTree = "<group>"; }; … … 26541 26543 CB8CF0151A934B43000D510B /* Microtasks.cpp */, 26542 26544 53B895AD19DC7C37009CAA93 /* Microtasks.h */, 26545 E38D06091F8E811900649CF2 /* ModuleFetchParameters.h */, 26543 26546 85031B2F0A44EFC700F992E0 /* MouseEvent.cpp */, 26544 26547 85031B300A44EFC700F992E0 /* MouseEvent.h */, … … 29527 29530 C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */, 29528 29531 709A01FE1E3D0BDD006B0D4C /* ModuleFetchFailureKind.h in Headers */, 29532 E3201C1A1F8E82130076A032 /* ModuleFetchParameters.h in Headers */, 29529 29533 F55B3DC61251F12D003EF269 /* MonthInputType.h in Headers */, 29530 29534 85031B460A44EFC700F992E0 /* MouseEvent.h in Headers */, -
trunk/Source/WebCore/bindings/js/CachedModuleScriptLoader.cpp
r211280 r223237 32 32 #include "Frame.h" 33 33 #include "JSDOMBinding.h" 34 #include "ModuleFetchParameters.h" 34 35 #include "ResourceLoaderOptions.h" 35 36 #include "ScriptController.h" … … 39 40 namespace WebCore { 40 41 41 Ref<CachedModuleScriptLoader> CachedModuleScriptLoader::create(CachedModuleScriptLoaderClient& client, DeferredPromise& promise, CachedScriptFetcher& scriptFetcher )42 Ref<CachedModuleScriptLoader> CachedModuleScriptLoader::create(CachedModuleScriptLoaderClient& client, DeferredPromise& promise, CachedScriptFetcher& scriptFetcher, RefPtr<ModuleFetchParameters>&& parameters) 42 43 { 43 return adoptRef(*new CachedModuleScriptLoader(client, promise, scriptFetcher ));44 return adoptRef(*new CachedModuleScriptLoader(client, promise, scriptFetcher, WTFMove(parameters))); 44 45 } 45 46 46 CachedModuleScriptLoader::CachedModuleScriptLoader(CachedModuleScriptLoaderClient& client, DeferredPromise& promise, CachedScriptFetcher& scriptFetcher )47 CachedModuleScriptLoader::CachedModuleScriptLoader(CachedModuleScriptLoaderClient& client, DeferredPromise& promise, CachedScriptFetcher& scriptFetcher, RefPtr<ModuleFetchParameters>&& parameters) 47 48 : m_client(&client) 48 49 , m_promise(&promise) 49 50 , m_scriptFetcher(scriptFetcher) 51 , m_parameters(WTFMove(parameters)) 50 52 { 51 53 } -
trunk/Source/WebCore/bindings/js/CachedModuleScriptLoader.h
r210627 r223237 40 40 class Document; 41 41 class JSDOMGlobalObject; 42 class ModuleFetchParameters; 42 43 class URL; 43 44 44 45 class CachedModuleScriptLoader final : public RefCounted<CachedModuleScriptLoader>, private CachedResourceClient { 45 46 public: 46 static Ref<CachedModuleScriptLoader> create(CachedModuleScriptLoaderClient&, DeferredPromise&, CachedScriptFetcher& );47 static Ref<CachedModuleScriptLoader> create(CachedModuleScriptLoaderClient&, DeferredPromise&, CachedScriptFetcher&, RefPtr<ModuleFetchParameters>&&); 47 48 48 49 virtual ~CachedModuleScriptLoader(); … … 52 53 CachedScriptFetcher& scriptFetcher() { return m_scriptFetcher.get(); } 53 54 CachedScript* cachedScript() { return m_cachedScript.get(); } 55 ModuleFetchParameters* parameters() { return m_parameters.get(); } 54 56 55 57 void clearClient() … … 60 62 61 63 private: 62 CachedModuleScriptLoader(CachedModuleScriptLoaderClient&, DeferredPromise&, CachedScriptFetcher& );64 CachedModuleScriptLoader(CachedModuleScriptLoaderClient&, DeferredPromise&, CachedScriptFetcher&, RefPtr<ModuleFetchParameters>&&); 63 65 64 66 void notifyFinished(CachedResource&) final; … … 67 69 RefPtr<DeferredPromise> m_promise; 68 70 Ref<CachedScriptFetcher> m_scriptFetcher; 71 RefPtr<ModuleFetchParameters> m_parameters; 69 72 CachedResourceHandle<CachedScript> m_cachedScript; 70 73 }; -
trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
r223173 r223237 374 374 } 375 375 376 JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderFetch(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSValue moduleKey, JSC::JSValue scriptFetcher)376 JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderFetch(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSValue moduleKey, JSC::JSValue parameters, JSC::JSValue scriptFetcher) 377 377 { 378 378 JSDOMWindowBase* thisObject = JSC::jsCast<JSDOMWindowBase*>(globalObject); 379 379 if (RefPtr<Document> document = thisObject->wrapped().document()) 380 return document->moduleLoader()->fetch(globalObject, exec, moduleLoader, moduleKey, scriptFetcher);380 return document->moduleLoader()->fetch(globalObject, exec, moduleLoader, moduleKey, parameters, scriptFetcher); 381 381 JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::create(exec, globalObject); 382 382 return deferred->reject(exec, jsUndefined()); … … 391 391 } 392 392 393 JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderImportModule(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSString* moduleName, const JSC::SourceOrigin& sourceOrigin)393 JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderImportModule(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSString* moduleName, JSC::JSValue parameters, const JSC::SourceOrigin& sourceOrigin) 394 394 { 395 395 JSDOMWindowBase* thisObject = JSC::jsCast<JSDOMWindowBase*>(globalObject); 396 396 if (RefPtr<Document> document = thisObject->wrapped().document()) 397 return document->moduleLoader()->importModule(globalObject, exec, moduleLoader, moduleName, sourceOrigin);397 return document->moduleLoader()->importModule(globalObject, exec, moduleLoader, moduleName, parameters, sourceOrigin); 398 398 JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::create(exec, globalObject); 399 399 return deferred->reject(exec, jsUndefined()); -
trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h
r218437 r223237 77 77 private: 78 78 static JSC::JSInternalPromise* moduleLoaderResolve(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue, JSC::JSValue); 79 static JSC::JSInternalPromise* moduleLoaderFetch(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue );79 static JSC::JSInternalPromise* moduleLoaderFetch(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue, JSC::JSValue); 80 80 static JSC::JSValue moduleLoaderEvaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue, JSC::JSValue); 81 static JSC::JSInternalPromise* moduleLoaderImportModule(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSString*, const JSC::SourceOrigin&);81 static JSC::JSInternalPromise* moduleLoaderImportModule(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSString*, JSC::JSValue, const JSC::SourceOrigin&); 82 82 static void promiseRejectionTracker(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSPromise*, JSC::JSPromiseRejectionOperation); 83 83 -
trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h
r218794 r223237 91 91 } 92 92 93 static JSC::JSInternalPromise& loadModule(JSC::ExecState& state, const String& moduleName, JSC::JSValue scriptFetcher)93 static JSC::JSInternalPromise& loadModule(JSC::ExecState& state, const String& moduleName, JSC::JSValue parameters, JSC::JSValue scriptFetcher) 94 94 { 95 95 JSMainThreadExecState currentState(&state); 96 return *JSC::loadModule(&state, moduleName, scriptFetcher);96 return *JSC::loadModule(&state, moduleName, parameters, scriptFetcher); 97 97 } 98 98 -
trunk/Source/WebCore/bindings/js/ScriptController.cpp
r223149 r223237 42 42 #include "MainFrame.h" 43 43 #include "ModuleFetchFailureKind.h" 44 #include "ModuleFetchParameters.h" 44 45 #include "NP_jsobject.h" 45 46 #include "Page.h" … … 63 64 #include <runtime/JSModuleRecord.h> 64 65 #include <runtime/JSNativeStdFunction.h> 66 #include <runtime/JSScriptFetchParameters.h> 65 67 #include <runtime/JSScriptFetcher.h> 66 68 #include <wtf/MemoryPressureHandler.h> … … 191 193 } 192 194 193 void ScriptController::loadModuleScriptInWorld(LoadableModuleScript& moduleScript, const String& moduleName, DOMWrapperWorld& world)195 void ScriptController::loadModuleScriptInWorld(LoadableModuleScript& moduleScript, const String& moduleName, Ref<ModuleFetchParameters>&& topLevelFetchParameters, DOMWrapperWorld& world) 194 196 { 195 197 JSLockHolder lock(world.vm()); … … 198 200 auto& state = *proxy.window()->globalExec(); 199 201 200 auto& promise = JSMainThreadExecState::loadModule(state, moduleName, JSC::JSScriptFetch er::create(state.vm(), { &moduleScript }));202 auto& promise = JSMainThreadExecState::loadModule(state, moduleName, JSC::JSScriptFetchParameters::create(state.vm(), WTFMove(topLevelFetchParameters)), JSC::JSScriptFetcher::create(state.vm(), { &moduleScript })); 201 203 setupModuleScriptHandlers(moduleScript, promise, world); 202 204 } 203 205 204 void ScriptController::loadModuleScript(LoadableModuleScript& moduleScript, const String& moduleName )205 { 206 loadModuleScriptInWorld(moduleScript, moduleName, mainThreadNormalWorld());206 void ScriptController::loadModuleScript(LoadableModuleScript& moduleScript, const String& moduleName, Ref<ModuleFetchParameters>&& topLevelFetchParameters) 207 { 208 loadModuleScriptInWorld(moduleScript, moduleName, WTFMove(topLevelFetchParameters), mainThreadNormalWorld()); 207 209 } 208 210 -
trunk/Source/WebCore/bindings/js/ScriptController.h
r218951 r223237 57 57 class HTMLPlugInElement; 58 58 class LoadableModuleScript; 59 class ModuleFetchParameters; 59 60 class ScriptSourceCode; 60 61 class SecurityOrigin; … … 116 117 JSC::JSValue evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld&, ExceptionDetails* = nullptr); 117 118 118 void loadModuleScriptInWorld(LoadableModuleScript&, const String& moduleName, DOMWrapperWorld&);119 void loadModuleScript(LoadableModuleScript&, const String& moduleName );119 void loadModuleScriptInWorld(LoadableModuleScript&, const String& moduleName, Ref<ModuleFetchParameters>&&, DOMWrapperWorld&); 120 void loadModuleScript(LoadableModuleScript&, const String& moduleName, Ref<ModuleFetchParameters>&&); 120 121 void loadModuleScriptInWorld(LoadableModuleScript&, const ScriptSourceCode&, DOMWrapperWorld&); 121 122 void loadModuleScript(LoadableModuleScript&, const ScriptSourceCode&); -
trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp
r212438 r223237 36 36 #include "MIMETypeRegistry.h" 37 37 #include "ModuleFetchFailureKind.h" 38 #include "ModuleFetchParameters.h" 38 39 #include "ScriptController.h" 39 40 #include "ScriptSourceCode.h" 41 #include "SubresourceIntegrity.h" 40 42 #include "WebCoreJSClientData.h" 41 43 #include <runtime/Completion.h> … … 43 45 #include <runtime/JSInternalPromiseDeferred.h> 44 46 #include <runtime/JSModuleRecord.h> 47 #include <runtime/JSScriptFetchParameters.h> 45 48 #include <runtime/JSScriptFetcher.h> 46 49 #include <runtime/JSSourceCode.h> … … 140 143 } 141 144 142 JSC::JSInternalPromise* ScriptModuleLoader::fetch(JSC::JSGlobalObject* jsGlobalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleKeyValue, JSC::JSValue scriptFetcher) 143 { 144 ASSERT(JSC::jsDynamicCast<JSC::JSScriptFetcher*>(exec->vm(), scriptFetcher)); 145 JSC::JSInternalPromise* ScriptModuleLoader::fetch(JSC::JSGlobalObject* jsGlobalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleKeyValue, JSC::JSValue parameters, JSC::JSValue scriptFetcher) 146 { 147 JSC::VM& vm = exec->vm(); 148 ASSERT(JSC::jsDynamicCast<JSC::JSScriptFetcher*>(vm, scriptFetcher)); 145 149 146 150 auto& globalObject = *JSC::jsCast<JSDOMGlobalObject*>(jsGlobalObject); … … 165 169 } 166 170 167 auto loader = CachedModuleScriptLoader::create(*this, deferred.get(), *static_cast<CachedScriptFetcher*>(JSC::jsCast<JSC::JSScriptFetcher*>(scriptFetcher)->fetcher())); 171 RefPtr<ModuleFetchParameters> topLevelFetchParameters; 172 if (auto* scriptFetchParameters = JSC::jsDynamicCast<JSC::JSScriptFetchParameters*>(vm, parameters)) 173 topLevelFetchParameters = static_cast<ModuleFetchParameters*>(&scriptFetchParameters->parameters()); 174 175 auto loader = CachedModuleScriptLoader::create(*this, deferred.get(), *static_cast<CachedScriptFetcher*>(JSC::jsCast<JSC::JSScriptFetcher*>(scriptFetcher)->fetcher()), WTFMove(topLevelFetchParameters)); 168 176 m_loaders.add(loader.copyRef()); 169 177 if (!loader->load(m_document, completedURL)) { … … 213 221 } 214 222 215 JSC::JSInternalPromise* ScriptModuleLoader::importModule(JSC::JSGlobalObject* jsGlobalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSString* moduleName, const JSC::SourceOrigin& sourceOrigin)223 JSC::JSInternalPromise* ScriptModuleLoader::importModule(JSC::JSGlobalObject* jsGlobalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSString* moduleName, JSC::JSValue parameters, const JSC::SourceOrigin& sourceOrigin) 216 224 { 217 225 auto& state = *exec; … … 249 257 return rejectPromise(state, globalObject, TypeError, result.error()); 250 258 251 return JSC::importModule(exec, JSC::Identifier::fromString(&vm, result->string()), JSC::JSScriptFetcher::create(vm, WTFMove(scriptFetcher) ));259 return JSC::importModule(exec, JSC::Identifier::fromString(&vm, result->string()), parameters, JSC::JSScriptFetcher::create(vm, WTFMove(scriptFetcher) )); 252 260 } 253 261 … … 285 293 } 286 294 295 if (auto* parameters = loader.parameters()) { 296 if (!matchIntegrityMetadata(cachedScript, parameters->integrity())) { 297 promise->reject(TypeError, makeString("Cannot load script ", cachedScript.url().stringCenterEllipsizedToLength(), ". Failed integrity metadata check.")); 298 return; 299 } 300 } 301 287 302 m_requestURLToResponseURLMap.add(cachedScript.url(), cachedScript.response().url()); 288 303 promise->resolveWithCallback([&] (JSC::ExecState& state, JSDOMGlobalObject&) { -
trunk/Source/WebCore/bindings/js/ScriptModuleLoader.h
r211280 r223237 57 57 58 58 JSC::JSInternalPromise* resolve(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleName, JSC::JSValue importerModuleKey, JSC::JSValue scriptFetcher); 59 JSC::JSInternalPromise* fetch(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleKey, JSC::JSValue scriptFetcher);59 JSC::JSInternalPromise* fetch(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleKey, JSC::JSValue parameters, JSC::JSValue scriptFetcher); 60 60 JSC::JSValue evaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleKey, JSC::JSValue moduleRecord, JSC::JSValue scriptFetcher); 61 JSC::JSInternalPromise* importModule(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSString*, const JSC::SourceOrigin&);61 JSC::JSInternalPromise* importModule(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSString*, JSC::JSValue parameters, const JSC::SourceOrigin&); 62 62 63 63 private: -
trunk/Source/WebCore/dom/LoadableModuleScript.cpp
r211313 r223237 29 29 #include "Document.h" 30 30 #include "Frame.h" 31 #include "ModuleFetchParameters.h" 31 32 #include "ScriptController.h" 32 33 #include "ScriptElement.h" … … 34 35 namespace WebCore { 35 36 36 Ref<LoadableModuleScript> LoadableModuleScript::create(const String& nonce, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree)37 Ref<LoadableModuleScript> LoadableModuleScript::create(const String& nonce, const String& integrity, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree) 37 38 { 38 return adoptRef(*new LoadableModuleScript(nonce, crossOriginMode, charset, initiatorName, isInUserAgentShadowTree));39 return adoptRef(*new LoadableModuleScript(nonce, integrity, crossOriginMode, charset, initiatorName, isInUserAgentShadowTree)); 39 40 } 40 41 41 LoadableModuleScript::LoadableModuleScript(const String& nonce, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree)42 LoadableModuleScript::LoadableModuleScript(const String& nonce, const String& integrity, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree) 42 43 : LoadableScript(nonce, crossOriginMode, charset, initiatorName, isInUserAgentShadowTree) 44 , m_parameters(ModuleFetchParameters::create(integrity)) 43 45 { 44 46 } … … 92 94 { 93 95 if (auto* frame = document.frame()) 94 frame->script().loadModuleScript(*this, rootURL.string() );96 frame->script().loadModuleScript(*this, rootURL.string(), m_parameters.copyRef()); 95 97 } 96 98 -
trunk/Source/WebCore/dom/LoadableModuleScript.h
r211313 r223237 32 32 33 33 class ScriptSourceCode; 34 class ModuleFetchParameters; 34 35 35 36 class LoadableModuleScript final : public LoadableScript { … … 37 38 virtual ~LoadableModuleScript(); 38 39 39 static Ref<LoadableModuleScript> create(const String& nonce, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree);40 static Ref<LoadableModuleScript> create(const String& nonce, const String& integrity, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree); 40 41 41 42 bool isLoaded() const final; … … 60 61 61 62 private: 62 LoadableModuleScript(const String& nonce, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree);63 LoadableModuleScript(const String& nonce, const String& integrity, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree); 63 64 65 Ref<ModuleFetchParameters> m_parameters; 64 66 RefPtr<UniquedStringImpl> m_moduleKey; 65 67 std::optional<LoadableScript::Error> m_error; -
trunk/Source/WebCore/dom/ModuleFetchParameters.h
r223236 r223237 1 1 /* 2 * Copyright (C) 201 5, 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2017 Yusuke Suzuki <utatane.tea@gmail.com> 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include "CachedResourceClient.h" 29 #include "CachedResourceHandle.h" 30 #include <wtf/Ref.h> 31 #include <wtf/RefCounted.h> 32 #include <wtf/RefPtr.h> 28 #include <runtime/ScriptFetchParameters.h> 33 29 34 30 namespace WebCore { 35 31 36 class CachedModuleScriptLoaderClient; 37 class CachedScript; 38 class CachedScriptFetcher; 39 class DeferredPromise; 40 class Document; 41 class JSDOMGlobalObject; 42 class URL; 43 44 class CachedModuleScriptLoader final : public RefCounted<CachedModuleScriptLoader>, private CachedResourceClient { 32 class ModuleFetchParameters : public JSC::ScriptFetchParameters { 45 33 public: 46 static Ref<CachedModuleScriptLoader> create(CachedModuleScriptLoaderClient&, DeferredPromise&, CachedScriptFetcher&); 47 48 virtual ~CachedModuleScriptLoader(); 49 50 bool load(Document&, const URL& sourceURL); 51 52 CachedScriptFetcher& scriptFetcher() { return m_scriptFetcher.get(); } 53 CachedScript* cachedScript() { return m_cachedScript.get(); } 54 55 void clearClient() 34 static Ref<ModuleFetchParameters> create(const String& integrity) 56 35 { 57 ASSERT(m_client); 58 m_client = nullptr; 36 return adoptRef(*new ModuleFetchParameters(integrity)); 59 37 } 60 38 39 const String& integrity() const { return m_integrity; } 40 61 41 private: 62 CachedModuleScriptLoader(CachedModuleScriptLoaderClient&, DeferredPromise&, CachedScriptFetcher&); 42 ModuleFetchParameters(const String& integrity) 43 : m_integrity(integrity) 44 { 45 } 63 46 64 void notifyFinished(CachedResource&) final; 65 66 CachedModuleScriptLoaderClient* m_client { nullptr }; 67 RefPtr<DeferredPromise> m_promise; 68 Ref<CachedScriptFetcher> m_scriptFetcher; 69 CachedResourceHandle<CachedScript> m_cachedScript; 47 String m_integrity; 70 48 }; 71 49 -
trunk/Source/WebCore/dom/ScriptElement.cpp
r220290 r223237 337 337 338 338 m_isExternalScript = true; 339 auto script = LoadableModuleScript::create(nonce, crossOriginMode, scriptCharset(), m_element.localName(), m_element.isInUserAgentShadowTree()); 339 auto script = LoadableModuleScript::create( 340 nonce, 341 m_element.document().settings().subresourceIntegrityEnabled() ? m_element.attributeWithoutSynchronization(HTMLNames::integrityAttr).string() : emptyString(), 342 crossOriginMode, 343 scriptCharset(), 344 m_element.localName(), 345 m_element.isInUserAgentShadowTree()); 340 346 script->load(m_element.document(), moduleScriptRootURL); 341 347 m_loadableScript = WTFMove(script); … … 343 349 } 344 350 345 auto script = LoadableModuleScript::create(nonce, crossOriginMode, scriptCharset(), m_element.localName(), m_element.isInUserAgentShadowTree());351 auto script = LoadableModuleScript::create(nonce, emptyString(), crossOriginMode, scriptCharset(), m_element.localName(), m_element.isInUserAgentShadowTree()); 346 352 347 353 TextPosition position = m_element.document().isInDocumentWrite() ? TextPosition() : scriptStartPosition;
Note: See TracChangeset
for help on using the changeset viewer.