Changeset 210537 in webkit
- Timestamp:
- Jan 9, 2017 9:58:19 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r210536 r210537 1 2017-01-09 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Implement JSSourceCode to propagate SourceCode in module pipeline 4 https://bugs.webkit.org/show_bug.cgi?id=166861 5 6 Reviewed by Saam Barati. 7 8 * http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt: 9 1 10 2017-01-09 Chris Dumez <cdumez@apple.com> 2 11 -
trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt
r208788 r210537 1 CONSOLE MESSAGE: line 1 : EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".1 CONSOLE MESSAGE: line 16: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 2 2 3 CONSOLE MESSAGE: line 1 : EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".3 CONSOLE MESSAGE: line 17: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 4 4 5 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".5 CONSOLE MESSAGE: line 34: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 6 6 7 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".7 CONSOLE MESSAGE: line 35: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 8 8 9 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".9 CONSOLE MESSAGE: line 36: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 10 10 11 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".11 CONSOLE MESSAGE: line 37: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 12 12 13 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".13 CONSOLE MESSAGE: line 38: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 14 14 15 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".15 CONSOLE MESSAGE: line 39: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 16 16 17 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".17 CONSOLE MESSAGE: line 40: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 18 18 19 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".19 CONSOLE MESSAGE: line 41: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 20 20 21 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".21 CONSOLE MESSAGE: line 42: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 22 22 23 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".23 CONSOLE MESSAGE: line 43: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 24 24 25 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".25 CONSOLE MESSAGE: line 44: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 26 26 27 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".27 CONSOLE MESSAGE: line 45: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 28 28 29 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".29 CONSOLE MESSAGE: line 46: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 30 30 31 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".31 CONSOLE MESSAGE: line 47: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 32 32 33 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".33 CONSOLE MESSAGE: line 48: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 34 34 35 CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".35 CONSOLE MESSAGE: line 49: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'". 36 36 37 37 -
trunk/Source/JavaScriptCore/CMakeLists.txt
r210521 r210537 789 789 runtime/JSSet.cpp 790 790 runtime/JSSetIterator.cpp 791 runtime/JSSourceCode.cpp 791 792 runtime/JSString.cpp 792 793 runtime/JSStringIterator.cpp -
trunk/Source/JavaScriptCore/ChangeLog
r210535 r210537 1 2017-01-09 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Implement JSSourceCode to propagate SourceCode in module pipeline 4 https://bugs.webkit.org/show_bug.cgi?id=166861 5 6 Reviewed by Saam Barati. 7 8 Instead of propagating source code string, we propagate JSSourceCode 9 cell in the module pipeline. This allows us to attach a metadata 10 to the propagated source code string. In particular, it propagates 11 SourceOrigin through the module pipeline. 12 13 * CMakeLists.txt: 14 * JavaScriptCore.xcodeproj/project.pbxproj: 15 * builtins/ModuleLoaderPrototype.js: 16 (fulfillFetch): 17 (requestFetch): 18 * jsc.cpp: 19 (GlobalObject::moduleLoaderFetch): 20 * llint/LLIntData.cpp: 21 (JSC::LLInt::Data::performAssertions): 22 * llint/LowLevelInterpreter.asm: 23 * runtime/Completion.cpp: 24 (JSC::loadAndEvaluateModule): 25 (JSC::loadModule): 26 * runtime/JSModuleLoader.cpp: 27 (JSC::JSModuleLoader::provide): 28 * runtime/JSModuleLoader.h: 29 * runtime/JSSourceCode.cpp: Added. 30 (JSC::JSSourceCode::destroy): 31 * runtime/JSSourceCode.h: Added. 32 (JSC::JSSourceCode::createStructure): 33 (JSC::JSSourceCode::create): 34 (JSC::JSSourceCode::sourceCode): 35 (JSC::JSSourceCode::JSSourceCode): 36 * runtime/JSType.h: 37 * runtime/ModuleLoaderPrototype.cpp: 38 (JSC::moduleLoaderPrototypeParseModule): 39 * runtime/VM.cpp: 40 (JSC::VM::VM): 41 * runtime/VM.h: 42 1 43 2017-01-09 Yusuke Suzuki <utatane.tea@gmail.com> 2 44 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r210521 r210537 2373 2373 FEF040511AAE662D00BD28B0 /* CompareAndSwapTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEF040501AAE662D00BD28B0 /* CompareAndSwapTest.cpp */; }; 2374 2374 FEFD6FC61D5E7992008F2F0B /* JSStringInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FEFD6FC51D5E7970008F2F0B /* JSStringInlines.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2375 FA3AB211C8494524AB390267 /* JSSourceCode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F73926918DC64330AFCDF0D7 /* JSSourceCode.cpp */; }; 2376 BDFCB2BBE90F41349E1B0BED /* JSSourceCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3032175DF1AD47D8998B34E1 /* JSSourceCode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2375 2377 /* End PBXBuildFile section */ 2376 2378 … … 4901 4903 FEF040521AAEC4ED00BD28B0 /* CompareAndSwapTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CompareAndSwapTest.h; path = API/tests/CompareAndSwapTest.h; sourceTree = "<group>"; }; 4902 4904 FEFD6FC51D5E7970008F2F0B /* JSStringInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringInlines.h; sourceTree = "<group>"; }; 4905 F73926918DC64330AFCDF0D7 /* JSSourceCode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSSourceCode.cpp; path = JSSourceCode.cpp; sourceTree = "<group>"; }; 4906 3032175DF1AD47D8998B34E1 /* JSSourceCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSSourceCode.h; path = JSSourceCode.h; sourceTree = "<group>"; }; 4903 4907 /* End PBXFileReference section */ 4904 4908 … … 6741 6745 C2B6D75218A33793004A9301 /* WriteBarrierInlines.h */, 6742 6746 425BA1337E4344E1B269A671 /* SourceOrigin.h */, 6747 F73926918DC64330AFCDF0D7 /* JSSourceCode.cpp */, 6748 3032175DF1AD47D8998B34E1 /* JSSourceCode.h */, 6743 6749 ); 6744 6750 path = runtime; … … 9115 9121 86704B4312DB8A8100A9FE7B /* YarrSyntaxChecker.h in Headers */, 9116 9122 2D342F36F7244096804ADB24 /* SourceOrigin.h in Headers */, 9123 BDFCB2BBE90F41349E1B0BED /* JSSourceCode.h in Headers */, 9117 9124 ); 9118 9125 runOnlyForDeploymentPostprocessing = 0; … … 10503 10510 86704B8912DBA33700A9FE7B /* YarrPattern.cpp in Sources */, 10504 10511 86704B4212DB8A8100A9FE7B /* YarrSyntaxChecker.cpp in Sources */, 10512 FA3AB211C8494524AB390267 /* JSSourceCode.cpp in Sources */, 10505 10513 ); 10506 10514 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js
r210522 r210537 128 128 } 129 129 130 function fulfillFetch(entry, payload)130 function fulfillFetch(entry, source) 131 131 { 132 132 // https://whatwg.github.io/loader/#fulfill-fetch … … 136 136 if (!entry.fetch) 137 137 entry.fetch = @newPromiseCapability(@InternalPromise).@promise; 138 this.forceFulfillPromise(entry.fetch, payload);138 this.forceFulfillPromise(entry.fetch, source); 139 139 @setStateToMax(entry, @ModuleInstantiate); 140 140 } … … 221 221 // For example, JavaScriptCore shell can provide the hook fetching the resource 222 222 // from the local file system. 223 var fetchPromise = this.fetch(key, initiator).then(( payload) => {223 var fetchPromise = this.fetch(key, initiator).then((source) => { 224 224 @setStateToMax(entry, @ModuleInstantiate); 225 return payload;225 return source; 226 226 }); 227 227 entry.fetch = fetchPromise; -
trunk/Source/JavaScriptCore/jsc.cpp
r210522 r210537 54 54 #include "JSONObject.h" 55 55 #include "JSProxy.h" 56 #include "JSSourceCode.h" 56 57 #include "JSString.h" 57 58 #include "JSTypedArrays.h" … … 1577 1578 return deferred->reject(exec, createError(exec, makeString("Could not open file '", moduleKey, "'."))); 1578 1579 1579 return deferred->resolve(exec, jsString(exec, stringFromUTF(utf8)));1580 return deferred->resolve(exec, JSSourceCode::create(exec->vm(), makeSource(stringFromUTF(utf8), SourceOrigin { moduleKey }))); 1580 1581 } 1581 1582 -
trunk/Source/JavaScriptCore/llint/LLIntData.cpp
r210232 r210537 157 157 STATIC_ASSERT(StringType == 6); 158 158 STATIC_ASSERT(SymbolType == 7); 159 STATIC_ASSERT(ObjectType == 2 1);160 STATIC_ASSERT(FinalObjectType == 2 2);161 STATIC_ASSERT(JSFunctionType == 2 4);162 STATIC_ASSERT(ArrayType == 3 2);163 STATIC_ASSERT(DerivedArrayType == 3 3);164 STATIC_ASSERT(ProxyObjectType == 5 1);165 STATIC_ASSERT(Int8ArrayType == 3 4);166 STATIC_ASSERT(Int16ArrayType == 3 5);167 STATIC_ASSERT(Int32ArrayType == 3 6);168 STATIC_ASSERT(Uint8ArrayType == 3 7);169 STATIC_ASSERT(Uint8ClampedArrayType == 3 8);170 STATIC_ASSERT(Uint16ArrayType == 39);171 STATIC_ASSERT(Uint32ArrayType == 4 0);172 STATIC_ASSERT(Float32ArrayType == 4 1);173 STATIC_ASSERT(Float64ArrayType == 4 2);159 STATIC_ASSERT(ObjectType == 22); 160 STATIC_ASSERT(FinalObjectType == 23); 161 STATIC_ASSERT(JSFunctionType == 25); 162 STATIC_ASSERT(ArrayType == 33); 163 STATIC_ASSERT(DerivedArrayType == 34); 164 STATIC_ASSERT(ProxyObjectType == 52); 165 STATIC_ASSERT(Int8ArrayType == 35); 166 STATIC_ASSERT(Int16ArrayType == 36); 167 STATIC_ASSERT(Int32ArrayType == 37); 168 STATIC_ASSERT(Uint8ArrayType == 38); 169 STATIC_ASSERT(Uint8ClampedArrayType == 39); 170 STATIC_ASSERT(Uint16ArrayType == 40); 171 STATIC_ASSERT(Uint32ArrayType == 41); 172 STATIC_ASSERT(Float32ArrayType == 42); 173 STATIC_ASSERT(Float64ArrayType == 43); 174 174 STATIC_ASSERT(MasqueradesAsUndefined == 1); 175 175 STATIC_ASSERT(ImplementsDefaultHasInstance == 2); -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r210232 r210537 346 346 const StringType = 6 347 347 const SymbolType = 7 348 const ObjectType = 2 1349 const FinalObjectType = 2 2350 const JSFunctionType = 2 4351 const ArrayType = 3 2352 const DerivedArrayType = 3 3353 const ProxyObjectType = 5 1348 const ObjectType = 22 349 const FinalObjectType = 23 350 const JSFunctionType = 25 351 const ArrayType = 33 352 const DerivedArrayType = 34 353 const ProxyObjectType = 52 354 354 355 355 # The typed array types need to be numbered in a particular order because of the manually written 356 356 # switch statement in get_by_val and put_by_val. 357 const Int8ArrayType = 3 4358 const Int16ArrayType = 3 5359 const Int32ArrayType = 3 6360 const Uint8ArrayType = 3 7361 const Uint8ClampedArrayType = 3 8362 const Uint16ArrayType = 39363 const Uint32ArrayType = 4 0364 const Float32ArrayType = 4 1365 const Float64ArrayType = 4 2357 const Int8ArrayType = 35 358 const Int16ArrayType = 36 359 const Int32ArrayType = 37 360 const Uint8ArrayType = 38 361 const Uint8ClampedArrayType = 39 362 const Uint16ArrayType = 40 363 const Uint32ArrayType = 41 364 const Float32ArrayType = 42 365 const Float64ArrayType = 43 366 366 367 367 const FirstArrayType = Int8ArrayType -
trunk/Source/JavaScriptCore/runtime/Completion.cpp
r208074 r210537 194 194 195 195 // Insert the given source code to the ModuleLoader registry as the fetched registry entry. 196 globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source .view().toString());196 globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source); 197 197 RETURN_IF_EXCEPTION(scope, rejectPromise(exec, globalObject)); 198 198 … … 233 233 // Insert the given source code to the ModuleLoader registry as the fetched registry entry. 234 234 // FIXME: Introduce JSSourceCode object to wrap around this source. 235 globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source .view().toString());235 globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source); 236 236 RETURN_IF_EXCEPTION(scope, rejectPromise(exec, globalObject)); 237 237 -
trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp
r210522 r210537 39 39 #include "JSModuleEnvironment.h" 40 40 #include "JSModuleRecord.h" 41 #include "JSSourceCode.h" 41 42 #include "ModuleAnalyzer.h" 42 43 #include "ModuleLoaderPrototype.h" … … 76 77 } 77 78 78 JSValue JSModuleLoader::provide(ExecState* exec, JSValue key, Status status, const String& source) 79 { 79 JSValue JSModuleLoader::provide(ExecState* exec, JSValue key, Status status, const SourceCode& sourceCode) 80 { 81 VM& vm = exec->vm(); 80 82 JSObject* function = jsCast<JSObject*>(get(exec, exec->propertyNames().builtinNames().providePublicName())); 81 83 CallData callData; … … 83 85 ASSERT(callType != CallType::None); 84 86 87 SourceCode source { sourceCode }; 85 88 MarkedArgumentBuffer arguments; 86 89 arguments.append(key); 87 90 arguments.append(jsNumber(status)); 88 arguments.append( jsString(exec, source));91 arguments.append(JSSourceCode::create(vm, WTFMove(source))); 89 92 90 93 return call(exec, function, callType, callData, this, arguments); -
trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h
r210522 r210537 33 33 class JSInternalPromise; 34 34 class JSModuleNamespaceObject; 35 class SourceCode; 35 36 36 37 class JSModuleLoader : public JSNonFinalObject { … … 63 64 64 65 // APIs to control the module loader. 65 JSValue provide(ExecState*, JSValue key, Status, const S tring&);66 JSValue provide(ExecState*, JSValue key, Status, const SourceCode&); 66 67 JSInternalPromise* loadAndEvaluateModule(ExecState*, JSValue moduleName, JSValue referrer, JSValue initiator); 67 68 JSInternalPromise* loadModule(ExecState*, JSValue moduleName, JSValue referrer, JSValue initiator); -
trunk/Source/JavaScriptCore/runtime/JSType.h
r210229 r210537 51 51 52 52 JSFixedArrayType, 53 JSSourceCodeType, 53 54 54 55 // The ObjectType value must come before any JSType that is a subclass of JSObject. -
trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp
r210522 r210537 40 40 #include "JSModuleNamespaceObject.h" 41 41 #include "JSModuleRecord.h" 42 #include "JSSourceCode.h" 42 43 #include "ModuleAnalyzer.h" 43 44 #include "Nodes.h" … … 113 114 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 114 115 115 String source = exec->argument(1).toWTFString(exec);116 RETURN_IF_EXCEPTION(scope, encodedJSValue());117 118 SourceCode sourceCode = makeSource(source, SourceOrigin { moduleKey.impl() }, moduleKey.impl(), TextPosition(), SourceProviderSourceType::Module);116 auto* jsSourceCode = jsDynamicCast<JSSourceCode*>(exec->argument(1)); 117 if (!jsSourceCode) 118 return throwVMTypeError(exec, scope); 119 SourceCode sourceCode = jsSourceCode->sourceCode(); 119 120 120 121 CodeProfiling profile(sourceCode); -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r210139 r210537 72 72 #include "JSPromiseDeferred.h" 73 73 #include "JSPropertyNameEnumerator.h" 74 #include "JSSourceCode.h" 74 75 #include "JSTemplateRegistryKey.h" 75 76 #include "JSWebAssembly.h" … … 239 240 symbolTableStructure.set(*this, SymbolTable::createStructure(*this, 0, jsNull())); 240 241 fixedArrayStructure.set(*this, JSFixedArray::createStructure(*this, 0, jsNull())); 242 sourceCodeStructure.set(*this, JSSourceCode::createStructure(*this, 0, jsNull())); 241 243 structureChainStructure.set(*this, StructureChain::createStructure(*this, 0, jsNull())); 242 244 sparseArrayValueMapStructure.set(*this, SparseArrayValueMap::createStructure(*this, 0, jsNull())); -
trunk/Source/JavaScriptCore/runtime/VM.h
r210201 r210537 327 327 Strong<Structure> symbolTableStructure; 328 328 Strong<Structure> fixedArrayStructure; 329 Strong<Structure> sourceCodeStructure; 329 330 Strong<Structure> structureChainStructure; 330 331 Strong<Structure> sparseArrayValueMapStructure; -
trunk/Source/WebCore/ChangeLog
r210536 r210537 1 2017-01-09 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Implement JSSourceCode to propagate SourceCode in module pipeline 4 https://bugs.webkit.org/show_bug.cgi?id=166861 5 6 Reviewed by Saam Barati. 7 8 Now SourceOrigin is correctly propagated through the module pipeline. 9 So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html 10 is updated. 11 12 * ForwardingHeaders/runtime/JSSourceCode.h: Added. 13 * bindings/js/JSDOMPromise.h: 14 (WebCore::DeferredPromise::resolveWithCallback): 15 * bindings/js/ScriptModuleLoader.cpp: 16 (WebCore::ScriptModuleLoader::notifyFinished): 17 1 18 2017-01-09 Chris Dumez <cdumez@apple.com> 2 19 -
trunk/Source/WebCore/bindings/js/JSDOMPromise.h
r209897 r210537 95 95 void reject(const JSC::PrivateName&); 96 96 97 template<typename Callback, typename Value> 98 void resolveWithCallback(Callback callback, Value value) 99 { 100 if (isSuspended()) 101 return; 102 ASSERT(m_deferred); 103 ASSERT(m_globalObject); 104 JSC::ExecState* exec = m_globalObject->globalExec(); 105 JSC::JSLockHolder locker(exec); 106 resolve(*exec, callback(*exec, *m_globalObject.get(), std::forward<Value>(value))); 107 } 108 97 109 JSC::JSValue promise() const; 98 110 -
trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp
r210319 r210537 41 41 #include <runtime/JSInternalPromiseDeferred.h> 42 42 #include <runtime/JSModuleRecord.h> 43 #include <runtime/JSSourceCode.h> 43 44 #include <runtime/JSString.h> 44 45 #include <runtime/Symbol.h> … … 246 247 247 248 m_requestURLToResponseURLMap.add(cachedScript.url(), cachedScript.response().url()); 248 // FIXME: Let's wrap around ScriptSourceCode to propagate it directly through the module pipeline. 249 promise->resolve<IDLDOMString>(ScriptSourceCode(&cachedScript, JSC::SourceProviderSourceType::Module).source().toString()); 250 } 251 252 } 249 ScriptSourceCode scriptSourceCode(&cachedScript, JSC::SourceProviderSourceType::Module); 250 promise->resolveWithCallback([] (JSC::ExecState& state, JSDOMGlobalObject&, JSC::SourceCode sourceCode) { 251 return JSC::JSSourceCode::create(state.vm(), WTFMove(sourceCode)); 252 }, scriptSourceCode.jsSourceCode()); 253 } 254 255 }
Note: See TracChangeset
for help on using the changeset viewer.