haikuwebkit/Source/WebCore/dom/ModuleFetchParameters.h

54 lines
2.0 KiB
C
Raw Permalink Normal View History

Support integrity="" on module scripts https://bugs.webkit.org/show_bug.cgi?id=177959 Reviewed by Sam Weinig. Source/JavaScriptCore: This patch adds Subresource Integrity check for module scripts. Currently, only top-level module can be verified with integrity parameter since there is no way to perform integrity check onto the imported modules. In JSC side, we add `parameters` to the entry point of the module loader pipeline. This is fetching parameters and used when fetching modules. We separately pass this parameters to the pipeline along with the script fetcher. The script fetcher is only one for module graph since this is the initiator of this module graph loading. On the other hand, this parameters is for each module fetching. While setting "integrity" parameters to this script fetcher is sufficient to pass parameters to top-level-module's fetching, it is not enough for the future extension. In the future, we will investigate a way to pass parameters to each non-top-level module. At that time, this `parameters` should be per-module. This is because "integrity" value should be different for each module. For example, we will accept some form of syntax to add parameters to `import`. Some proposed syntax is like https://discourse.wicg.io/t/specifying-nonce-or-integrity-when-importing-modules/1861 import "./xxx.js" integrity "xxxxxxx" In this case, this `parameters` will be passed to "./xxx.js" module fetching. This `parameters` should be different from the one of top-level-module's one. That's why we need per-module `parameters` and why this patch adds `parameters` to the module pipeline. On the other hand, we also want to keep script fetcher. This `per-module-graph` thing is important to offer module-graph-wide information. For example, import.meta would have `import.meta.scriptElement`, which is the script element fetching the module graph including this. So, we keep the both, script fetcher and parameters. https://github.com/tc39/proposal-import-meta This parameters will be finally used by pipeline's fetch hook, and WebCore side can use this parameters to fetch modules. We also further clean up the module pipeline by dropping unnecessary features. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/ModuleLoaderPrototype.js: (requestFetch): (requestInstantiate): (requestSatisfy): (loadModule): (loadAndEvaluateModule): This loadAndEvaluateModule should be implemented by just calling loadModule and linkAndEvaluateModule. We can drop requestReady and requestLink. (requestLink): Deleted. (requestImportModule): Deleted. * jsc.cpp: (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderFetch): import and fetch hook takes parameters. Currently, we always pass `undefined` for import hook. When dynamic `import()` is extended to accept additional parameters like integrity, this parameters will be replaced with the actual value. (functionLoadModule): (runWithOptions): * runtime/Completion.cpp: (JSC::loadAndEvaluateModule): (JSC::loadModule): (JSC::importModule): * runtime/Completion.h: * runtime/JSGlobalObject.h: * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncImportModule): * runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::loadAndEvaluateModule): (JSC::JSModuleLoader::loadModule): (JSC::JSModuleLoader::requestImportModule): (JSC::JSModuleLoader::importModule): (JSC::JSModuleLoader::fetch): * runtime/JSModuleLoader.h: * runtime/JSScriptFetchParameters.cpp: Added. (JSC::JSScriptFetchParameters::destroy): * runtime/JSScriptFetchParameters.h: Added. (JSC::JSScriptFetchParameters::createStructure): (JSC::JSScriptFetchParameters::create): (JSC::JSScriptFetchParameters::parameters const): (JSC::JSScriptFetchParameters::JSScriptFetchParameters): Add ScriptFetchParameters' JSCell wrapper, JSScriptFetchParameters. It is used in the module pipeline. * runtime/JSType.h: * runtime/ModuleLoaderPrototype.cpp: (JSC::moduleLoaderPrototypeFetch): * runtime/ScriptFetchParameters.h: Added. (JSC::ScriptFetchParameters::~ScriptFetchParameters): Add ScriptFetchParameters. We can define our own custom ScriptFetchParameters by inheriting this class. WebCore creates ModuleFetchParameters by inheriting this. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WebCore: This patch extends module hooks to accept fetching parameters. When starting fetching modules, WebCore creates ModuleFetchParameters. And this parameters is propagated to the fetch hook. Then, fetch hook can use this parameters to fetch modules. This parameters only contains `integrity` field. This "integrity" is used to perform subresource integrity check in module loader pipeline. And this error is just proparaged as errors in module pipeline, which is the same to the other types of errors in module pipeline. Test: http/tests/subresource-integrity/sri-module.html * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Added. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): Take parameters, which includes "integrity". * bindings/js/CachedModuleScriptLoader.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderFetch): (WebCore::JSDOMWindowBase::moduleLoaderImportModule): import and fetch hooks take parameters. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::loadModule): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::loadModuleScript): Pass parameters to the entry point of the module pipeline. * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::fetch): If parameters are passed, we set them to CachedModuleScriptLoader. (WebCore::ScriptModuleLoader::importModule): Pass parameters to the entry point of dynamic import. (WebCore::ScriptModuleLoader::notifyFinished): If script loader has parameters, we perform subresource integrity check here. * bindings/js/ScriptModuleLoader.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::create): (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Create ModuleFetchParameters with "integrity" value. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: Copied from Source/WebCore/bindings/js/CachedModuleScriptLoader.h. (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::integrity const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): Pass "integrity" value to the module script. LayoutTests: * http/tests/subresource-integrity/resources/crossorigin-anon-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-creds-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-ineligible-script-module.js: Added. * http/tests/subresource-integrity/resources/matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/non-matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/sri-utilities.js: (add_result_callback): (SRIModuleTest): (SRIModuleTest.prototype.execute): * http/tests/subresource-integrity/sri-module-expected.txt: Added. * http/tests/subresource-integrity/sri-module.html: Added. * js/dom/modules/module-inline-ignore-integrity-expected.txt: Added. * js/dom/modules/module-inline-ignore-integrity.html: Added. * js/dom/modules/module-integrity-non-top-level-expected.txt: Added. * js/dom/modules/module-integrity-non-top-level.html: Added. * js/dom/modules/script-tests/module-integrity-non-top-level-2.js: Added. * js/dom/modules/script-tests/module-integrity-non-top-level.js: Added. Canonical link: https://commits.webkit.org/194461@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-12 13:12:48 +00:00
/*
* Copyright (C) 2017 Yusuke Suzuki <utatane.tea@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
Remove WebCore/ForwardingHeaders directory https://bugs.webkit.org/show_bug.cgi?id=182347 Reviewed by Keith Miller. Source/ThirdParty: * gtest/CMakeLists.txt: * gtest/include/gtest/internal/gtest-port.h: Source/WebCore: No new tests. No change in behavior. * CMakeLists.txt: * ForwardingHeaders/bindings/ScriptFunctionCall.h: Removed. * ForwardingHeaders/bindings/ScriptObject.h: Removed. * ForwardingHeaders/bindings/ScriptValue.h: Removed. * ForwardingHeaders/builtins/BuiltinNames.h: Removed. * ForwardingHeaders/builtins/BuiltinUtils.h: Removed. * ForwardingHeaders/builtins/JSCBuiltins.h: Removed. * ForwardingHeaders/bytecode/CodeBlock.h: Removed. * ForwardingHeaders/bytecode/SpeculatedType.h: Removed. * ForwardingHeaders/bytecode/UnlinkedFunctionExecutable.h: Removed. * ForwardingHeaders/debugger/Debugger.h: Removed. * ForwardingHeaders/domjit/DOMJITAbstractHeap.h: Removed. * ForwardingHeaders/domjit/DOMJITEffect.h: Removed. * ForwardingHeaders/domjit/DOMJITGetterSetter.h: Removed. * ForwardingHeaders/domjit/DOMJITHeapRange.h: Removed. * ForwardingHeaders/domjit/DOMJITSignature.h: Removed. * ForwardingHeaders/heap/BlockDirectoryInlines.h: Removed. * ForwardingHeaders/heap/DeleteAllCodeEffort.h: Removed. * ForwardingHeaders/heap/FastMallocAlignedMemoryAllocator.h: Removed. * ForwardingHeaders/heap/GCActivityCallback.h: Removed. * ForwardingHeaders/heap/GCFinalizationCallback.h: Removed. * ForwardingHeaders/heap/HandleTypes.h: Removed. * ForwardingHeaders/heap/Heap.h: Removed. * ForwardingHeaders/heap/HeapInlines.h: Removed. * ForwardingHeaders/heap/HeapObserver.h: Removed. * ForwardingHeaders/heap/IncrementalSweeper.h: Removed. * ForwardingHeaders/heap/LockDuringMarking.h: Removed. * ForwardingHeaders/heap/MachineStackMarker.h: Removed. * ForwardingHeaders/heap/MarkedBlockInlines.h: Removed. * ForwardingHeaders/heap/MarkingConstraint.h: Removed. * ForwardingHeaders/heap/RunningScope.h: Removed. * ForwardingHeaders/heap/SimpleMarkingConstraint.h: Removed. * ForwardingHeaders/heap/SlotVisitor.h: Removed. * ForwardingHeaders/heap/SlotVisitorInlines.h: Removed. * ForwardingHeaders/heap/Strong.h: Removed. * ForwardingHeaders/heap/StrongInlines.h: Removed. * ForwardingHeaders/heap/SubspaceInlines.h: Removed. * ForwardingHeaders/heap/ThreadLocalCache.h: Removed. * ForwardingHeaders/heap/Weak.h: Removed. * ForwardingHeaders/heap/WeakInlines.h: Removed. * ForwardingHeaders/inspector/ConsoleMessage.h: Removed. * ForwardingHeaders/inspector/ContentSearchUtilities.h: Removed. * ForwardingHeaders/inspector/IdentifiersFactory.h: Removed. * ForwardingHeaders/inspector/InjectedScript.h: Removed. * ForwardingHeaders/inspector/InjectedScriptBase.h: Removed. * ForwardingHeaders/inspector/InjectedScriptHost.h: Removed. * ForwardingHeaders/inspector/InjectedScriptManager.h: Removed. * ForwardingHeaders/inspector/InjectedScriptModule.h: Removed. * ForwardingHeaders/inspector/InspectorAgentBase.h: Removed. * ForwardingHeaders/inspector/InspectorAgentRegistry.h: Removed. * ForwardingHeaders/inspector/InspectorBackendDispatcher.h: Removed. * ForwardingHeaders/inspector/InspectorBackendDispatchers.h: Removed. * ForwardingHeaders/inspector/InspectorEnvironment.h: Removed. * ForwardingHeaders/inspector/InspectorFrontendChannel.h: Removed. * ForwardingHeaders/inspector/InspectorFrontendDispatchers.h: Removed. * ForwardingHeaders/inspector/InspectorFrontendRouter.h: Removed. * ForwardingHeaders/inspector/InspectorProtocolObjects.h: Removed. * ForwardingHeaders/inspector/InspectorProtocolTypes.h: Removed. * ForwardingHeaders/inspector/PerGlobalObjectWrapperWorld.h: Removed. * ForwardingHeaders/inspector/ScriptArguments.h: Removed. * ForwardingHeaders/inspector/ScriptBreakpoint.h: Removed. * ForwardingHeaders/inspector/ScriptCallFrame.h: Removed. * ForwardingHeaders/inspector/ScriptCallStack.h: Removed. * ForwardingHeaders/inspector/ScriptCallStackFactory.h: Removed. * ForwardingHeaders/inspector/ScriptDebugListener.h: Removed. * ForwardingHeaders/inspector/ScriptDebugServer.h: Removed. * ForwardingHeaders/inspector/agents/InspectorAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorConsoleAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorDebuggerAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorHeapAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorRuntimeAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorScriptProfilerAgent.h: Removed. * ForwardingHeaders/interpreter/CallFrame.h: Removed. * ForwardingHeaders/interpreter/FrameTracers.h: Removed. * ForwardingHeaders/interpreter/ShadowChicken.h: Removed. * ForwardingHeaders/interpreter/StackVisitor.h: Removed. * ForwardingHeaders/jit/JITCode.h: Removed. * ForwardingHeaders/jit/JITMathICForwards.h: Removed. * ForwardingHeaders/jit/Snippet.h: Removed. * ForwardingHeaders/jit/SnippetParams.h: Removed. * ForwardingHeaders/jit/SpillRegistersMode.h: Removed. * ForwardingHeaders/masm/X86Assembler.h: Removed. * ForwardingHeaders/parser/ParserError.h: Removed. * ForwardingHeaders/parser/SourceCode.h: Removed. * ForwardingHeaders/parser/SourceProvider.h: Removed. * ForwardingHeaders/parser/SourceProviderCache.h: Removed. * ForwardingHeaders/profiler/ProfilerDatabase.h: Removed. * ForwardingHeaders/runtime/ArgList.h: Removed. * ForwardingHeaders/runtime/ArrayBuffer.h: Removed. * ForwardingHeaders/runtime/ArrayBufferView.h: Removed. * ForwardingHeaders/runtime/ArrayPrototype.h: Removed. * ForwardingHeaders/runtime/AuxiliaryBarrierInlines.h: Removed. * ForwardingHeaders/runtime/BooleanObject.h: Removed. * ForwardingHeaders/runtime/CallData.h: Removed. * ForwardingHeaders/runtime/CatchScope.h: Removed. * ForwardingHeaders/runtime/CommonIdentifiers.h: Removed. * ForwardingHeaders/runtime/Completion.h: Removed. * ForwardingHeaders/runtime/ConfigFile.h: Removed. * ForwardingHeaders/runtime/ConsoleClient.h: Removed. * ForwardingHeaders/runtime/ConsoleTypes.h: Removed. * ForwardingHeaders/runtime/ConstructAbility.h: Removed. * ForwardingHeaders/runtime/ConstructData.h: Removed. * ForwardingHeaders/runtime/DataView.h: Removed. * ForwardingHeaders/runtime/DateInstance.h: Removed. * ForwardingHeaders/runtime/Error.h: Removed. * ForwardingHeaders/runtime/ErrorHandlingScope.h: Removed. * ForwardingHeaders/runtime/ErrorInstance.h: Removed. * ForwardingHeaders/runtime/ErrorPrototype.h: Removed. * ForwardingHeaders/runtime/Exception.h: Removed. * ForwardingHeaders/runtime/ExceptionHelpers.h: Removed. * ForwardingHeaders/runtime/Float32Array.h: Removed. * ForwardingHeaders/runtime/Float64Array.h: Removed. * ForwardingHeaders/runtime/FunctionConstructor.h: Removed. * ForwardingHeaders/runtime/FunctionExecutable.h: Removed. * ForwardingHeaders/runtime/FunctionPrototype.h: Removed. * ForwardingHeaders/runtime/HashMapImpl.h: Removed. * ForwardingHeaders/runtime/Identifier.h: Removed. * ForwardingHeaders/runtime/IdentifierInlines.h: Removed. * ForwardingHeaders/runtime/InitializeThreading.h: Removed. * ForwardingHeaders/runtime/Int16Array.h: Removed. * ForwardingHeaders/runtime/Int32Array.h: Removed. * ForwardingHeaders/runtime/Int8Array.h: Removed. * ForwardingHeaders/runtime/InternalFunction.h: Removed. * ForwardingHeaders/runtime/Intrinsic.h: Removed. * ForwardingHeaders/runtime/IterationKind.h: Removed. * ForwardingHeaders/runtime/IteratorOperations.h: Removed. * ForwardingHeaders/runtime/IteratorPrototype.h: Removed. * ForwardingHeaders/runtime/JSAPIValueWrapper.h: Removed. * ForwardingHeaders/runtime/JSArray.h: Removed. * ForwardingHeaders/runtime/JSArrayBuffer.h: Removed. * ForwardingHeaders/runtime/JSArrayBufferView.h: Removed. * ForwardingHeaders/runtime/JSCInlines.h: Removed. * ForwardingHeaders/runtime/JSCJSValue.h: Removed. * ForwardingHeaders/runtime/JSCJSValueInlines.h: Removed. * ForwardingHeaders/runtime/JSCallee.h: Removed. * ForwardingHeaders/runtime/JSCell.h: Removed. * ForwardingHeaders/runtime/JSCellInlines.h: Removed. * ForwardingHeaders/runtime/JSDataView.h: Removed. * ForwardingHeaders/runtime/JSDestructibleObject.h: Removed. * ForwardingHeaders/runtime/JSDestructibleObjectHeapCellType.h: Removed. * ForwardingHeaders/runtime/JSExportMacros.h: Removed. * ForwardingHeaders/runtime/JSFunction.h: Removed. * ForwardingHeaders/runtime/JSGlobalObject.h: Removed. * ForwardingHeaders/runtime/JSGlobalObjectInlines.h: Removed. * ForwardingHeaders/runtime/JSInternalPromise.h: Removed. * ForwardingHeaders/runtime/JSInternalPromiseDeferred.h: Removed. * ForwardingHeaders/runtime/JSLock.h: Removed. * ForwardingHeaders/runtime/JSMap.h: Removed. * ForwardingHeaders/runtime/JSMapIterator.h: Removed. * ForwardingHeaders/runtime/JSModuleLoader.h: Removed. * ForwardingHeaders/runtime/JSModuleRecord.h: Removed. * ForwardingHeaders/runtime/JSNativeStdFunction.h: Removed. * ForwardingHeaders/runtime/JSONObject.h: Removed. * ForwardingHeaders/runtime/JSObject.h: Removed. * ForwardingHeaders/runtime/JSObjectInlines.h: Removed. * ForwardingHeaders/runtime/JSPromise.h: Removed. * ForwardingHeaders/runtime/JSPromiseConstructor.h: Removed. * ForwardingHeaders/runtime/JSPromiseDeferred.h: Removed. * ForwardingHeaders/runtime/JSProxy.h: Removed. * ForwardingHeaders/runtime/JSRunLoopTimer.h: Removed. * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Removed. * ForwardingHeaders/runtime/JSScriptFetcher.h: Removed. * ForwardingHeaders/runtime/JSSegmentedVariableObjectHeapCellType.h: Removed. * ForwardingHeaders/runtime/JSSet.h: Removed. * ForwardingHeaders/runtime/JSSetIterator.h: Removed. * ForwardingHeaders/runtime/JSSourceCode.h: Removed. * ForwardingHeaders/runtime/JSString.h: Removed. * ForwardingHeaders/runtime/JSTypedArrays.h: Removed. * ForwardingHeaders/runtime/JSWithScope.h: Removed. * ForwardingHeaders/runtime/Lookup.h: Removed. * ForwardingHeaders/runtime/MapBase.h: Removed. * ForwardingHeaders/runtime/MapData.h: Removed. * ForwardingHeaders/runtime/MapDataInlines.h: Removed. * ForwardingHeaders/runtime/MatchResult.h: Removed. * ForwardingHeaders/runtime/Microtask.h: Removed. * ForwardingHeaders/runtime/ObjectConstructor.h: Removed. * ForwardingHeaders/runtime/ObjectPrototype.h: Removed. * ForwardingHeaders/runtime/Operations.h: Removed. * ForwardingHeaders/runtime/PrivateName.h: Removed. * ForwardingHeaders/runtime/PromiseDeferredTimer.h: Removed. * ForwardingHeaders/runtime/PropertyNameArray.h: Removed. * ForwardingHeaders/runtime/Protect.h: Removed. * ForwardingHeaders/runtime/RegExp.h: Removed. * ForwardingHeaders/runtime/RegExpObject.h: Removed. * ForwardingHeaders/runtime/RuntimeFlags.h: Removed. * ForwardingHeaders/runtime/SamplingProfiler.h: Removed. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Removed. * ForwardingHeaders/runtime/ScriptFetcher.h: Removed. * ForwardingHeaders/runtime/StringObject.h: Removed. * ForwardingHeaders/runtime/StringPrototype.h: Removed. * ForwardingHeaders/runtime/Structure.h: Removed. * ForwardingHeaders/runtime/StructureChain.h: Removed. * ForwardingHeaders/runtime/StructureInlines.h: Removed. * ForwardingHeaders/runtime/Symbol.h: Removed. * ForwardingHeaders/runtime/SymbolTable.h: Removed. * ForwardingHeaders/runtime/ThrowScope.h: Removed. * ForwardingHeaders/runtime/TypedArrayController.h: Removed. * ForwardingHeaders/runtime/TypedArrayInlines.h: Removed. * ForwardingHeaders/runtime/TypedArrays.h: Removed. * ForwardingHeaders/runtime/Uint16Array.h: Removed. * ForwardingHeaders/runtime/Uint32Array.h: Removed. * ForwardingHeaders/runtime/Uint8Array.h: Removed. * ForwardingHeaders/runtime/Uint8ClampedArray.h: Removed. * ForwardingHeaders/runtime/VM.h: Removed. * ForwardingHeaders/runtime/VMEntryScope.h: Removed. * ForwardingHeaders/runtime/Watchdog.h: Removed. * ForwardingHeaders/runtime/WeakGCMap.h: Removed. * ForwardingHeaders/runtime/WeakGCMapInlines.h: Removed. * ForwardingHeaders/runtime/WriteBarrier.h: Removed. * ForwardingHeaders/wasm/WasmModule.h: Removed. * ForwardingHeaders/wasm/js/JSWebAssemblyModule.h: Removed. * ForwardingHeaders/yarr/RegularExpression.h: Removed. * ForwardingHeaders/yarr/Yarr.h: Removed. * ForwardingHeaders/yarr/YarrInterpreter.h: Removed. * ForwardingHeaders/yarr/YarrJIT.h: Removed. * ForwardingHeaders/yarr/YarrPattern.h: Removed. * Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm: * Modules/encryptedmedia/MediaKeyMessageEvent.h: * Modules/encryptedmedia/MediaKeyMessageEventInit.h: * Modules/encryptedmedia/MediaKeyStatusMap.h: * Modules/encryptedmedia/legacy/LegacyCDM.h: * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: * Modules/fetch/FetchBody.cpp: * Modules/fetch/FetchRequestInit.h: * Modules/fetch/FetchResponse.h: * Modules/indexeddb/IDBCursor.cpp: * Modules/indexeddb/IDBCursor.h: * Modules/indexeddb/IDBCursorWithValue.cpp: * Modules/indexeddb/IDBDatabase.cpp: * Modules/indexeddb/IDBIndex.cpp: * Modules/indexeddb/IDBKey.cpp: * Modules/indexeddb/IDBKeyRange.cpp: * Modules/indexeddb/IDBObjectStore.cpp: * Modules/indexeddb/IDBRequest.cpp: * Modules/indexeddb/IDBRequest.h: * Modules/indexeddb/client/TransactionOperation.cpp: * Modules/indexeddb/server/MemoryObjectStore.cpp: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: * Modules/mediacontrols/MediaControlsHost.cpp: * Modules/mediasource/SourceBuffer.cpp: * Modules/mediastream/RTCDataChannel.cpp: * Modules/plugins/QuickTimePluginReplacement.mm: * Modules/webaudio/AsyncAudioDecoder.cpp: * Modules/webaudio/AudioBuffer.cpp: * Modules/webaudio/AudioBuffer.h: * Modules/webaudio/AudioContext.cpp: * Modules/webaudio/AudioContext.h: * Modules/webaudio/AudioParam.h: * Modules/webaudio/AudioParamTimeline.h: * Modules/webaudio/PeriodicWave.h: * Modules/webaudio/RealtimeAnalyser.cpp: * Modules/webaudio/RealtimeAnalyser.h: * Modules/webaudio/ScriptProcessorNode.cpp: * Modules/webaudio/WaveShaperProcessor.h: * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/PublicKeyCredential.h: * Modules/websockets/WebSocket.cpp: * Modules/websockets/WebSocketChannel.cpp: * Modules/websockets/WorkerThreadableWebSocketChannel.cpp: * Modules/webvr/VREyeParameters.h: * Modules/webvr/VRFrameData.h: * Modules/webvr/VRPose.h: * Modules/webvr/VRStageParameters.h: * PlatformWin.cmake: * bindings/IDLTypes.h: * bindings/js/BufferSource.h: * bindings/js/CachedScriptFetcher.h: * bindings/js/CachedScriptSourceProvider.h: * bindings/js/CallTracerTypes.h: * bindings/js/CommonVM.cpp: * bindings/js/DOMGCOutputConstraint.cpp: * bindings/js/DOMGCOutputConstraint.h: * bindings/js/GCController.cpp: * bindings/js/GCController.h: * bindings/js/IDBBindingUtilities.cpp: * bindings/js/JSCallbackData.cpp: * bindings/js/JSCallbackData.h: * bindings/js/JSCustomElementInterface.cpp: * bindings/js/JSCustomElementInterface.h: * bindings/js/JSCustomEventCustom.cpp: * bindings/js/JSCustomXPathNSResolver.cpp: * bindings/js/JSCustomXPathNSResolver.h: * bindings/js/JSDOMBinding.h: * bindings/js/JSDOMBuiltinConstructorBase.cpp: * bindings/js/JSDOMConstructorBase.cpp: * bindings/js/JSDOMConvertBase.h: * bindings/js/JSDOMConvertBufferSource.h: * bindings/js/JSDOMConvertDate.cpp: * bindings/js/JSDOMConvertInterface.h: * bindings/js/JSDOMConvertJSON.h: * bindings/js/JSDOMConvertNumbers.cpp: * bindings/js/JSDOMConvertNumbers.h: * bindings/js/JSDOMConvertObject.h: * bindings/js/JSDOMConvertRecord.h: * bindings/js/JSDOMConvertSequences.h: * bindings/js/JSDOMConvertStrings.cpp: * bindings/js/JSDOMConvertUnion.h: * bindings/js/JSDOMExceptionHandling.cpp: * bindings/js/JSDOMExceptionHandling.h: * bindings/js/JSDOMGlobalObject.cpp: * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMGlobalObjectTask.cpp: * bindings/js/JSDOMGuardedObject.h: * bindings/js/JSDOMIterator.cpp: * bindings/js/JSDOMIterator.h: * bindings/js/JSDOMMapLike.cpp: * bindings/js/JSDOMMapLike.h: * bindings/js/JSDOMPromise.cpp: * bindings/js/JSDOMPromise.h: * bindings/js/JSDOMPromiseDeferred.cpp: * bindings/js/JSDOMPromiseDeferred.h: * bindings/js/JSDOMWindowBase.cpp: * bindings/js/JSDOMWindowCustom.cpp: * bindings/js/JSDOMWindowProxy.cpp: * bindings/js/JSDOMWindowProxy.h: * bindings/js/JSDOMWrapper.cpp: * bindings/js/JSDOMWrapper.h: * bindings/js/JSDOMWrapperCache.cpp: * bindings/js/JSDOMWrapperCache.h: * bindings/js/JSDynamicDowncast.h: * bindings/js/JSErrorHandler.cpp: * bindings/js/JSEventCustom.cpp: * bindings/js/JSEventListener.cpp: * bindings/js/JSEventListener.h: * bindings/js/JSHTMLElementCustom.cpp: * bindings/js/JSHistoryCustom.cpp: * bindings/js/JSIDBCursorWithValueCustom.cpp: * bindings/js/JSIDBIndexCustom.cpp: * bindings/js/JSImageDataCustom.cpp: * bindings/js/JSLazyEventListener.cpp: * bindings/js/JSLocationCustom.cpp: * bindings/js/JSMainThreadExecState.h: * bindings/js/JSMainThreadExecStateInstrumentation.h: * bindings/js/JSMessageChannelCustom.cpp: * bindings/js/JSMessageEventCustom.cpp: * bindings/js/JSNodeIteratorCustom.cpp: * bindings/js/JSPopStateEventCustom.cpp: * bindings/js/JSReadableStreamPrivateConstructors.cpp: * bindings/js/JSTreeWalkerCustom.cpp: * bindings/js/JSWebGL2RenderingContextCustom.cpp: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/ReadableStreamDefaultController.cpp: * bindings/js/ReadableStreamDefaultController.h: * bindings/js/ScheduledAction.cpp: * bindings/js/ScheduledAction.h: * bindings/js/ScriptCachedFrameData.cpp: * bindings/js/ScriptCachedFrameData.h: * bindings/js/ScriptController.cpp: * bindings/js/ScriptController.h: * bindings/js/ScriptControllerMac.mm: * bindings/js/ScriptModuleLoader.cpp: * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: * bindings/js/ScriptState.cpp: * bindings/js/ScriptWrappable.h: * bindings/js/ScriptWrappableInlines.h: * bindings/js/SerializedScriptValue.cpp: * bindings/js/SerializedScriptValue.h: * bindings/js/StructuredClone.cpp: * bindings/js/WebCoreBuiltinNames.h: * bindings/js/WebCoreJSClientData.cpp: * bindings/js/WebCoreTypedArrayController.cpp: * bindings/js/WebCoreTypedArrayController.h: * bindings/js/WorkerScriptController.cpp: * bindings/js/WorkerScriptController.h: * bridge/NP_jsobject.cpp: * bridge/c/CRuntimeObject.cpp: * bridge/c/c_class.cpp: * bridge/c/c_instance.cpp: * bridge/c/c_runtime.cpp: * bridge/c/c_utility.cpp: * bridge/c/c_utility.h: * bridge/jsc/BridgeJSC.cpp: * bridge/jsc/BridgeJSC.h: * bridge/npruntime.cpp: * bridge/objc/ObjCRuntimeObject.mm: * bridge/objc/WebScriptObject.mm: * bridge/objc/WebScriptObjectPrivate.h: * bridge/objc/objc_instance.mm: * bridge/objc/objc_runtime.h: * bridge/objc/objc_runtime.mm: * bridge/objc/objc_utility.h: * bridge/objc/objc_utility.mm: * bridge/runtime_array.cpp: * bridge/runtime_array.h: * bridge/runtime_method.cpp: * bridge/runtime_method.h: * bridge/runtime_object.cpp: * bridge/runtime_object.h: * bridge/runtime_root.cpp: * bridge/runtime_root.h: * crypto/SubtleCrypto.cpp: * crypto/SubtleCrypto.h: * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp: * crypto/keys/CryptoRsaKeyAlgorithm.h: * crypto/mac/CryptoKeyRSAMac.cpp: * crypto/parameters/CryptoAlgorithmEcdsaParams.h: * crypto/parameters/CryptoAlgorithmHkdfParams.h: * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: * crypto/parameters/CryptoAlgorithmPbkdf2Params.h: * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h: * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: * css/CSSFontFaceSource.h: * css/DOMMatrixReadOnly.cpp: * css/DOMMatrixReadOnly.h: * css/FontFace.cpp: * dom/CustomElementReactionQueue.cpp: * dom/CustomElementRegistry.cpp: * dom/CustomEvent.cpp: * dom/CustomEvent.h: * dom/Document.cpp: * dom/Document.h: * dom/ErrorEvent.cpp: * dom/ErrorEvent.h: * dom/LoadableScript.h: * dom/MessageEvent.cpp: * dom/MessageEvent.h: * dom/ModuleFetchParameters.h: * dom/PopStateEvent.cpp: * dom/PopStateEvent.h: * dom/PromiseRejectionEvent.cpp: * dom/PromiseRejectionEvent.h: * dom/RejectedPromiseTracker.cpp: * dom/RejectedPromiseTracker.h: * dom/ScriptExecutionContext.cpp: * dom/ScriptExecutionContext.h: * dom/TextEncoder.cpp: * dom/TextEncoder.h: * domjit/DOMJITHelpers.h: * domjit/DOMJITIDLTypeFilter.h: * domjit/JSDocumentDOMJIT.cpp: * domjit/JSNodeDOMJIT.cpp: * fileapi/BlobBuilder.cpp: * fileapi/FileReader.cpp: * fileapi/FileReaderLoader.cpp: * fileapi/FileReaderSync.cpp: * html/BaseTextInputType.cpp: * html/EmailInputType.cpp: * html/HTMLAllCollection.cpp: * html/HTMLCanvasElement.cpp: * html/HTMLImageLoader.cpp: * html/HTMLMediaElement.cpp: * html/HTMLPlugInImageElement.cpp: * html/ImageData.cpp: * html/ImageData.h: * html/MediaEncryptedEventInit.h: * html/WebKitMediaKeyError.h: * html/canvas/WebGLAny.h: * html/canvas/WebGLRenderingContext.cpp: * html/canvas/WebGLRenderingContextBase.cpp: * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGPUBuffer.cpp: * html/canvas/WebGPURenderingContext.cpp: * html/canvas/WebGPURenderingContext.h: * html/track/DataCue.cpp: * html/track/DataCue.h: * inspector/CommandLineAPIHost.cpp: * inspector/CommandLineAPIHost.h: * inspector/CommandLineAPIModule.cpp: * inspector/CommandLineAPIModule.h: * inspector/InspectorCanvas.cpp: * inspector/InspectorCanvas.h: * inspector/InspectorClient.cpp: * inspector/InspectorController.cpp: * inspector/InspectorController.h: * inspector/InspectorDatabaseResource.h: * inspector/InspectorFrontendClientLocal.cpp: * inspector/InspectorFrontendHost.cpp: * inspector/InspectorInstrumentation.cpp: * inspector/InspectorInstrumentation.h: * inspector/InspectorOverlay.cpp: * inspector/InspectorOverlay.h: * inspector/InspectorShaderProgram.cpp: * inspector/InspectorShaderProgram.h: * inspector/InspectorStyleSheet.cpp: * inspector/InspectorStyleSheet.h: * inspector/InspectorWebAgentBase.h: * inspector/InstrumentingAgents.h: * inspector/PageScriptDebugServer.cpp: * inspector/PageScriptDebugServer.h: * inspector/TimelineRecordFactory.cpp: * inspector/WebInjectedScriptHost.h: * inspector/WebInjectedScriptManager.h: * inspector/WorkerInspectorController.cpp: * inspector/WorkerInspectorController.h: * inspector/WorkerScriptDebugServer.cpp: * inspector/WorkerScriptDebugServer.h: * inspector/WorkerToPageFrontendChannel.h: * inspector/agents/InspectorApplicationCacheAgent.h: * inspector/agents/InspectorCSSAgent.cpp: * inspector/agents/InspectorCSSAgent.h: * inspector/agents/InspectorCanvasAgent.cpp: * inspector/agents/InspectorCanvasAgent.h: * inspector/agents/InspectorDOMAgent.cpp: * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMStorageAgent.cpp: * inspector/agents/InspectorDOMStorageAgent.h: * inspector/agents/InspectorDatabaseAgent.cpp: * inspector/agents/InspectorDatabaseAgent.h: * inspector/agents/InspectorIndexedDBAgent.cpp: * inspector/agents/InspectorIndexedDBAgent.h: * inspector/agents/InspectorLayerTreeAgent.cpp: * inspector/agents/InspectorLayerTreeAgent.h: * inspector/agents/InspectorMemoryAgent.cpp: * inspector/agents/InspectorMemoryAgent.h: * inspector/agents/InspectorNetworkAgent.cpp: * inspector/agents/InspectorNetworkAgent.h: * inspector/agents/InspectorPageAgent.cpp: * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorTimelineAgent.cpp: * inspector/agents/InspectorTimelineAgent.h: * inspector/agents/InspectorWorkerAgent.h: * inspector/agents/WebConsoleAgent.cpp: * inspector/agents/WebConsoleAgent.h: * inspector/agents/WebDebuggerAgent.h: * inspector/agents/WebHeapAgent.h: * inspector/agents/page/PageDebuggerAgent.cpp: * inspector/agents/page/PageRuntimeAgent.cpp: * inspector/agents/page/PageRuntimeAgent.h: * inspector/agents/worker/ServiceWorkerAgent.h: * inspector/agents/worker/WorkerDebuggerAgent.cpp: * inspector/agents/worker/WorkerRuntimeAgent.cpp: * inspector/agents/worker/WorkerRuntimeAgent.h: * loader/EmptyClients.cpp: * page/CaptionUserPreferences.cpp: * page/Chrome.cpp: * page/ChromeClient.h: * page/Crypto.cpp: * page/DOMWindow.cpp: * page/DOMWindow.h: * page/Frame.cpp: * page/OriginThreadLocalCache.h: * page/PageConsoleClient.cpp: * page/PageConsoleClient.h: * page/PageDebuggable.cpp: * page/PageGroup.cpp: * page/SettingsBase.h: * page/UserContentController.cpp: * page/cocoa/ResourceUsageThreadCocoa.mm: * page/csp/ContentSecurityPolicy.cpp: * page/ios/FrameIOS.mm: * page/linux/ResourceUsageOverlayLinux.cpp: * page/linux/ResourceUsageThreadLinux.cpp: * platform/MediaSample.h: * platform/SerializedPlatformRepresentation.h: * platform/SharedBuffer.h: * platform/audio/mac/CARingBuffer.h: * platform/cocoa/SharedBufferCocoa.mm: * platform/graphics/ImageBuffer.h: * platform/graphics/LegacyCDMSession.h: * platform/graphics/MediaPlayer.h: * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm: * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * platform/graphics/avfoundation/MediaSampleAVFObjC.h: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: * platform/graphics/cairo/ImageBufferCairo.cpp: * platform/graphics/cg/ImageBufferDataCG.cpp: * platform/graphics/cg/ImageBufferDataCG.h: * platform/graphics/cocoa/GPUDeviceMetal.mm: * platform/graphics/filters/FEBlend.cpp: * platform/graphics/filters/FEColorMatrix.cpp: * platform/graphics/filters/FEComponentTransfer.cpp: * platform/graphics/filters/FEComposite.cpp: * platform/graphics/filters/FEConvolveMatrix.cpp: * platform/graphics/filters/FEDisplacementMap.cpp: * platform/graphics/filters/FEDropShadow.cpp: * platform/graphics/filters/FEGaussianBlur.cpp: * platform/graphics/filters/FELighting.h: * platform/graphics/filters/FEMorphology.cpp: * platform/graphics/filters/FETurbulence.cpp: * platform/graphics/filters/FilterEffect.cpp: * platform/graphics/filters/FilterEffect.h: * platform/graphics/gpu/GPUBuffer.h: * platform/graphics/gpu/GPUDevice.h: * platform/graphics/iso/ISOBox.cpp: * platform/graphics/iso/ISOOriginalFormatBox.cpp: * platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp: * platform/graphics/iso/ISOSchemeInformationBox.cpp: * platform/graphics/iso/ISOSchemeTypeBox.cpp: * platform/graphics/iso/ISOTrackEncryptionBox.cpp: * platform/graphics/iso/ISOVTTCue.cpp: * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: * platform/graphics/win/ImageBufferDataDirect2D.cpp: * platform/graphics/win/ImageBufferDataDirect2D.h: * platform/ios/wak/WebCoreThread.mm: * platform/mac/SerializedPlatformRepresentationMac.mm: * platform/mac/StringUtilities.mm: * platform/mock/mediasource/MockBox.cpp: * platform/mock/mediasource/MockSourceBufferPrivate.cpp: * svg/graphics/SVGImage.cpp: * testing/GCObservation.cpp: * testing/GCObservation.h: * testing/Internals.cpp: * testing/Internals.h: * testing/LegacyMockCDM.cpp: * testing/MockCDMFactory.cpp: * testing/js/WebCoreTestSupport.cpp: * workers/Worker.cpp: * workers/Worker.h: * workers/WorkerConsoleClient.cpp: * workers/WorkerConsoleClient.h: * workers/WorkerGlobalScope.cpp: * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: * workers/WorkerInspectorProxy.cpp: * workers/WorkerMessagingProxy.cpp: * workers/WorkerThread.h: * workers/service/ExtendableEvent.cpp: * workers/service/ServiceWorker.cpp: * workers/service/ServiceWorker.h: * workers/service/ServiceWorkerClient.h: * workers/service/context/ServiceWorkerInspectorProxy.cpp: * workers/service/context/ServiceWorkerThread.cpp: * xml/XMLHttpRequest.cpp: Source/WebKit: * Platform/mac/StringUtilities.mm: * Shared/Cocoa/WebKit2InitializeCocoa.mm: * Shared/WebKit2Initialize.cpp: * Shared/linux/WebMemorySamplerLinux.cpp: * Shared/mac/WebMemorySampler.mac.mm: * UIProcess/WebProcessPool.cpp: * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h: * WebProcess/InjectedBundle/API/glib/WebKitConsoleMessagePrivate.h: * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h: * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: * WebProcess/Plugins/PluginProcessConnection.cpp: * WebProcess/Plugins/PluginView.cpp: * WebProcess/WebPage/WebInspector.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/cocoa/WebProcessCocoa.mm: Source/WebKitLegacy/ios: * Misc/WebUIKitSupport.mm: Source/WebKitLegacy/mac: * Carbon/CarbonWindowAdapter.mm: * DOM/WebDOMOperations.mm: * History/WebBackForwardList.mm: * History/WebHistoryItem.mm: * Misc/WebCache.mm: * Misc/WebElementDictionary.mm: * Misc/WebIconDatabase.mm: * Misc/WebStringTruncator.mm: * Plugins/Hosted/NetscapePluginInstanceProxy.mm: * Plugins/Hosted/ProxyInstance.mm: * Plugins/Hosted/ProxyRuntimeObject.mm: * Plugins/Hosted/WebHostedNetscapePluginView.mm: * Plugins/WebBaseNetscapePluginView.mm: * Plugins/WebBasePluginPackage.mm: * Plugins/WebNetscapePluginStream.mm: * Plugins/WebNetscapePluginView.mm: * Plugins/WebPluginController.mm: * WebCoreSupport/WebEditorClient.mm: * WebCoreSupport/WebFrameLoaderClient.mm: * WebCoreSupport/WebInspectorClient.h: * WebCoreSupport/WebInspectorClient.mm: * WebView/WebDataSource.mm: * WebView/WebFrame.mm: * WebView/WebHTMLRepresentation.mm: * WebView/WebHTMLView.mm: * WebView/WebPreferences.mm: * WebView/WebScriptDebugDelegate.mm: * WebView/WebScriptDebugger.h: * WebView/WebTextIterator.mm: * WebView/WebView.mm: * WebView/WebViewData.mm: Source/WebKitLegacy/win: * Plugins/PluginView.cpp: * Plugins/PluginViewWin.cpp: * WebCoreSupport/WebInspectorClient.cpp: * WebCoreSupport/WebInspectorClient.h: * WebFrame.cpp: * WebJavaScriptCollector.cpp: * WebView.cpp: Tools: * WebKitTestRunner/TestController.cpp: Canonical link: https://commits.webkit.org/198358@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228218 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-02-07 05:20:34 +00:00
#include <JavaScriptCore/ScriptFetchParameters.h>
Support integrity="" on module scripts https://bugs.webkit.org/show_bug.cgi?id=177959 Reviewed by Sam Weinig. Source/JavaScriptCore: This patch adds Subresource Integrity check for module scripts. Currently, only top-level module can be verified with integrity parameter since there is no way to perform integrity check onto the imported modules. In JSC side, we add `parameters` to the entry point of the module loader pipeline. This is fetching parameters and used when fetching modules. We separately pass this parameters to the pipeline along with the script fetcher. The script fetcher is only one for module graph since this is the initiator of this module graph loading. On the other hand, this parameters is for each module fetching. While setting "integrity" parameters to this script fetcher is sufficient to pass parameters to top-level-module's fetching, it is not enough for the future extension. In the future, we will investigate a way to pass parameters to each non-top-level module. At that time, this `parameters` should be per-module. This is because "integrity" value should be different for each module. For example, we will accept some form of syntax to add parameters to `import`. Some proposed syntax is like https://discourse.wicg.io/t/specifying-nonce-or-integrity-when-importing-modules/1861 import "./xxx.js" integrity "xxxxxxx" In this case, this `parameters` will be passed to "./xxx.js" module fetching. This `parameters` should be different from the one of top-level-module's one. That's why we need per-module `parameters` and why this patch adds `parameters` to the module pipeline. On the other hand, we also want to keep script fetcher. This `per-module-graph` thing is important to offer module-graph-wide information. For example, import.meta would have `import.meta.scriptElement`, which is the script element fetching the module graph including this. So, we keep the both, script fetcher and parameters. https://github.com/tc39/proposal-import-meta This parameters will be finally used by pipeline's fetch hook, and WebCore side can use this parameters to fetch modules. We also further clean up the module pipeline by dropping unnecessary features. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/ModuleLoaderPrototype.js: (requestFetch): (requestInstantiate): (requestSatisfy): (loadModule): (loadAndEvaluateModule): This loadAndEvaluateModule should be implemented by just calling loadModule and linkAndEvaluateModule. We can drop requestReady and requestLink. (requestLink): Deleted. (requestImportModule): Deleted. * jsc.cpp: (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderFetch): import and fetch hook takes parameters. Currently, we always pass `undefined` for import hook. When dynamic `import()` is extended to accept additional parameters like integrity, this parameters will be replaced with the actual value. (functionLoadModule): (runWithOptions): * runtime/Completion.cpp: (JSC::loadAndEvaluateModule): (JSC::loadModule): (JSC::importModule): * runtime/Completion.h: * runtime/JSGlobalObject.h: * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncImportModule): * runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::loadAndEvaluateModule): (JSC::JSModuleLoader::loadModule): (JSC::JSModuleLoader::requestImportModule): (JSC::JSModuleLoader::importModule): (JSC::JSModuleLoader::fetch): * runtime/JSModuleLoader.h: * runtime/JSScriptFetchParameters.cpp: Added. (JSC::JSScriptFetchParameters::destroy): * runtime/JSScriptFetchParameters.h: Added. (JSC::JSScriptFetchParameters::createStructure): (JSC::JSScriptFetchParameters::create): (JSC::JSScriptFetchParameters::parameters const): (JSC::JSScriptFetchParameters::JSScriptFetchParameters): Add ScriptFetchParameters' JSCell wrapper, JSScriptFetchParameters. It is used in the module pipeline. * runtime/JSType.h: * runtime/ModuleLoaderPrototype.cpp: (JSC::moduleLoaderPrototypeFetch): * runtime/ScriptFetchParameters.h: Added. (JSC::ScriptFetchParameters::~ScriptFetchParameters): Add ScriptFetchParameters. We can define our own custom ScriptFetchParameters by inheriting this class. WebCore creates ModuleFetchParameters by inheriting this. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WebCore: This patch extends module hooks to accept fetching parameters. When starting fetching modules, WebCore creates ModuleFetchParameters. And this parameters is propagated to the fetch hook. Then, fetch hook can use this parameters to fetch modules. This parameters only contains `integrity` field. This "integrity" is used to perform subresource integrity check in module loader pipeline. And this error is just proparaged as errors in module pipeline, which is the same to the other types of errors in module pipeline. Test: http/tests/subresource-integrity/sri-module.html * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Added. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): Take parameters, which includes "integrity". * bindings/js/CachedModuleScriptLoader.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderFetch): (WebCore::JSDOMWindowBase::moduleLoaderImportModule): import and fetch hooks take parameters. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::loadModule): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::loadModuleScript): Pass parameters to the entry point of the module pipeline. * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::fetch): If parameters are passed, we set them to CachedModuleScriptLoader. (WebCore::ScriptModuleLoader::importModule): Pass parameters to the entry point of dynamic import. (WebCore::ScriptModuleLoader::notifyFinished): If script loader has parameters, we perform subresource integrity check here. * bindings/js/ScriptModuleLoader.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::create): (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Create ModuleFetchParameters with "integrity" value. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: Copied from Source/WebCore/bindings/js/CachedModuleScriptLoader.h. (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::integrity const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): Pass "integrity" value to the module script. LayoutTests: * http/tests/subresource-integrity/resources/crossorigin-anon-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-creds-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-ineligible-script-module.js: Added. * http/tests/subresource-integrity/resources/matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/non-matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/sri-utilities.js: (add_result_callback): (SRIModuleTest): (SRIModuleTest.prototype.execute): * http/tests/subresource-integrity/sri-module-expected.txt: Added. * http/tests/subresource-integrity/sri-module.html: Added. * js/dom/modules/module-inline-ignore-integrity-expected.txt: Added. * js/dom/modules/module-inline-ignore-integrity.html: Added. * js/dom/modules/module-integrity-non-top-level-expected.txt: Added. * js/dom/modules/module-integrity-non-top-level.html: Added. * js/dom/modules/script-tests/module-integrity-non-top-level-2.js: Added. * js/dom/modules/script-tests/module-integrity-non-top-level.js: Added. Canonical link: https://commits.webkit.org/194461@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-12 13:12:48 +00:00
namespace WebCore {
class ModuleFetchParameters : public JSC::ScriptFetchParameters {
public:
JS Modules in Workers https://bugs.webkit.org/show_bug.cgi?id=164860 Reviewed by Saam Barati. LayoutTests/imported/w3c: Some of worklet failures in WPT is because, 1. Previously, worklet does not support module. These tests are passing incorrectly when modules are not supported. Now, modules are supported, and some edge features are missing, so start failing 2. WPT is using www1.localhost in some tests (CSP tests), and this is not supported in WebKit's WPT testing. So failing incorrectly. * web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/non-object.tentative.any.worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/microtasks/checkpoint-after-workerglobalscope-onerror-module-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/alpha/base-url-worker-importScripts-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/alpha/base-url-worker.sub-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-1-nothrow-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-1-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-2-import-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-3-dynamic-worker-expected.txt: * web-platform-tests/service-workers/service-worker/import-module-scripts.https-expected.txt: * web-platform-tests/workers/baseurl/alpha/import-in-moduleworker-expected.txt: * web-platform-tests/workers/baseurl/alpha/importScripts-in-worker-expected.txt: * web-platform-tests/workers/baseurl/alpha/xhr-in-moduleworker-expected.txt: * web-platform-tests/workers/baseurl/alpha/xhr-in-worker-expected.txt: * web-platform-tests/workers/constructors/Worker/same-origin-expected.txt: * web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-expected.txt: * web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-module-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-csp-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-failure-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-meta-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-meta.html: * web-platform-tests/workers/modules/dedicated-worker-import-referrer-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import.any-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-options-type-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-parse-error-failure-expected.txt: * web-platform-tests/workers/name-property-expected.txt: * web-platform-tests/worklets/audio-worklet-credentials.https-expected.txt: * web-platform-tests/worklets/audio-worklet-csp.https-expected.txt: * web-platform-tests/worklets/audio-worklet-import.https-expected.txt: * web-platform-tests/worklets/audio-worklet-referrer.https-expected.txt: * web-platform-tests/xhr/open-url-redirected-worker-origin-expected.txt: Source/JavaScriptCore: Add error information to extract this in WebCore's module loader. Currently, we are using Promise pipeline, and this makes it a bit difficult to extract error information. This error information attached in this patch allows us to extract SyntaxError in WebCore, and throwing JS SyntaxError instead of AbortError. We are planning to update our module pipieline not using Promises in the future. The current design derived from the original module loader pipeline where using Promises is critical. But now, that proposal was abandoned, so we can just simplify the module loader. * runtime/AggregateError.cpp: (JSC::AggregateError::AggregateError): * runtime/Error.cpp: (JSC::createError): (JSC::createEvalError): (JSC::createRangeError): (JSC::createReferenceError): (JSC::createSyntaxError): (JSC::createTypeError): (JSC::createURIError): (JSC::createGetterTypeError): (JSC::throwSyntaxError): * runtime/Error.h: * runtime/ErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::ErrorInstance): (JSC::ErrorInstance::create): (JSC::ErrorInstance::sanitizedMessageString): (JSC::ErrorInstance::sanitizedNameString): (JSC::ErrorInstance::sanitizedToString): * runtime/ErrorInstance.h: (JSC::ErrorInstance::create): (JSC::ErrorInstance::errorType const): * runtime/JSGlobalObjectFunctions.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor<errorType>::constructImpl): (JSC::NativeErrorConstructor<errorType>::callImpl): * runtime/NullSetterFunction.cpp: (JSC::NullSetterFunctionInternal::JSC_DEFINE_HOST_FUNCTION): * wasm/js/JSWebAssemblyCompileError.cpp: (JSC::JSWebAssemblyCompileError::JSWebAssemblyCompileError): * wasm/js/JSWebAssemblyLinkError.cpp: (JSC::JSWebAssemblyLinkError::JSWebAssemblyLinkError): * wasm/js/JSWebAssemblyRuntimeError.cpp: (JSC::JSWebAssemblyRuntimeError::JSWebAssemblyRuntimeError): * wasm/js/WebAssemblyCompileErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyLinkErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): Source/WebCore: This patch implements JS modules in Workers and Worklets. We are not supporting modules in ServiceWorkers' initialization yet. But service-worker can import modules via JS `import()`. The worker can be executed as a module if we pass, `type: "module"` to worker options. Worklet is executed as modules by default. 1. In Worker, we first fetch the initial code. And then, analyze the dependencies and load subsequent modules. We iterate run-loop to load all the dependent modules in the module loader. At that time, we annotate run-loop tasks with special taskMode to iterate tasks with this taskMode. This prevents us from discarding different tasks in this run-loop driving phase. (e.g. postMessage can be called from the main thread while loading module graph, in that case, we should not discard this task.) 2. In Worklet, we just request module loading to ScriptModuleLoader, and run it after loading module graph. This is OK since worklet thread is already running. So we can just request modules and worklet thread automatically drives module loading via run-loop. * Headers.cmake: * Modules/webaudio/AudioWorkletGlobalScope.h: (WebCore::AudioWorkletGlobalScope::currentFrame const): Deleted. (WebCore::AudioWorkletGlobalScope::sampleRate const): Deleted. (WebCore::AudioWorkletGlobalScope::currentTime const): Deleted. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): (WebCore::CachedModuleScriptLoader::load): (WebCore::CachedModuleScriptLoader::notifyFinished): * bindings/js/CachedModuleScriptLoader.h: * bindings/js/CachedScriptFetcher.cpp: * bindings/js/JSDOMExceptionHandling.cpp: (WebCore::retrieveErrorMessageWithoutName): (WebCore::createDOMException): * bindings/js/JSDOMExceptionHandling.h: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::scriptModuleLoader): (WebCore::JSDOMGlobalObject::moduleLoaderResolve): (WebCore::JSDOMGlobalObject::moduleLoaderFetch): (WebCore::JSDOMGlobalObject::moduleLoaderEvaluate): (WebCore::JSDOMGlobalObject::moduleLoaderImportModule): (WebCore::JSDOMGlobalObject::moduleLoaderCreateImportMetaProperties): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderResolve): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderFetch): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderEvaluate): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderImportModule): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderCreateImportMetaProperties): Deleted. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkletGlobalScopeBase.cpp: * bindings/js/ModuleScriptLoader.h: Copied from Source/WebCore/dom/ModuleFetchParameters.h. (WebCore::ModuleScriptLoader::clearClient): (WebCore::ModuleScriptLoader::scriptFetcher): (WebCore::ModuleScriptLoader::parameters): (WebCore::ModuleScriptLoader::ModuleScriptLoader): * bindings/js/ModuleScriptLoaderClient.h: Renamed from Source/WebCore/bindings/js/CachedModuleScriptLoaderClient.h. * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::ScriptModuleLoader): (WebCore::resolveModuleSpecifier): (WebCore::ScriptModuleLoader::resolve): (WebCore::ScriptModuleLoader::fetch): (WebCore::ScriptModuleLoader::moduleURL): (WebCore::ScriptModuleLoader::responseURLFromRequestURL): (WebCore::ScriptModuleLoader::evaluate): (WebCore::ScriptModuleLoader::importModule): (WebCore::ScriptModuleLoader::notifyFinished): * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): * bindings/js/WorkerModuleScriptLoader.cpp: Added. (WebCore::WorkerModuleScriptLoader::create): (WebCore::WorkerModuleScriptLoader::WorkerModuleScriptLoader): (WebCore::WorkerModuleScriptLoader::~WorkerModuleScriptLoader): (WebCore::WorkerModuleScriptLoader::load): (WebCore::WorkerModuleScriptLoader::referrerPolicy): (WebCore::WorkerModuleScriptLoader::notifyFinished): (WebCore::WorkerModuleScriptLoader::taskMode): * bindings/js/WorkerModuleScriptLoader.h: Copied from Source/WebCore/dom/ModuleFetchParameters.h. * bindings/js/WorkerScriptFetcher.h: Added. * dom/Document.cpp: * dom/ExceptionCode.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Deleted. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::isTopLevelModule const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoader::create): * loader/ThreadableLoader.h: (WebCore::ThreadableLoader::create): * workers/DedicatedWorkerGlobalScope.h: * workers/Worker.cpp: (WebCore::Worker::Worker): (WebCore::Worker::create): (WebCore::Worker::notifyFinished): * workers/Worker.h: * workers/Worker.idl: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): (WebCore::WorkerGlobalScope::importScripts): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::credentials const): * workers/WorkerGlobalScopeProxy.h: * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerOrWorkletGlobalScope.cpp: (WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope): * workers/WorkerOrWorkletGlobalScope.h: (WebCore::WorkerOrWorkletGlobalScope::moduleLoader): * workers/WorkerOrWorkletScriptController.cpp: (WebCore::jsValueToModuleKey): (WebCore::WorkerOrWorkletScriptController::evaluateModule): (WebCore::WorkerOrWorkletScriptController::loadModuleSynchronously): (WebCore::WorkerOrWorkletScriptController::linkAndEvaluateModule): (WebCore::WorkerOrWorkletScriptController::loadAndEvaluateModule): * workers/WorkerOrWorkletScriptController.h: * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadAsynchronously): (WebCore::WorkerScriptLoader::didReceiveResponse): * workers/WorkerScriptLoader.h: (WebCore::WorkerScriptLoader::responseSource const): (WebCore::WorkerScriptLoader::isRedirected const): * workers/WorkerThread.cpp: (WebCore::WorkerParameters::isolatedCopy const): (WebCore::WorkerThread::evaluateScriptIfNecessary): * workers/WorkerThread.h: * workers/WorkerType.h: * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerGlobalScope.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::fetchScriptWithContext): * workers/service/ServiceWorkerRegistrationOptions.h: * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::ServiceWorkerThread): * workers/service/server/SWServerWorker.h: * worklets/PaintWorkletGlobalScope.h: (WebCore::PaintWorkletGlobalScope::paintDefinitionMap): Deleted. (WebCore::PaintWorkletGlobalScope::paintDefinitionLock): Deleted. (WebCore::PaintWorkletGlobalScope::~PaintWorkletGlobalScope): Deleted. * worklets/WorkletGlobalScope.cpp: (WebCore::WorkletGlobalScope::fetchAndInvokeScript): (WebCore::WorkletGlobalScope::processNextScriptFetchJobIfNeeded): Deleted. (WebCore::WorkletGlobalScope::didReceiveResponse): Deleted. (WebCore::WorkletGlobalScope::notifyFinished): Deleted. (WebCore::WorkletGlobalScope::didCompleteScriptFetchJob): Deleted. * worklets/WorkletGlobalScope.h: LayoutTests: * TestExpectations: * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt: * http/tests/subresource-integrity/sri-module-expected.txt: * webaudio/audioworklet-addModule-failure-expected.txt: * webaudio/worklet-crash-expected.txt: Canonical link: https://commits.webkit.org/234389@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-20 20:28:27 +00:00
static Ref<ModuleFetchParameters> create(const String& integrity, bool isTopLevelModule)
Support integrity="" on module scripts https://bugs.webkit.org/show_bug.cgi?id=177959 Reviewed by Sam Weinig. Source/JavaScriptCore: This patch adds Subresource Integrity check for module scripts. Currently, only top-level module can be verified with integrity parameter since there is no way to perform integrity check onto the imported modules. In JSC side, we add `parameters` to the entry point of the module loader pipeline. This is fetching parameters and used when fetching modules. We separately pass this parameters to the pipeline along with the script fetcher. The script fetcher is only one for module graph since this is the initiator of this module graph loading. On the other hand, this parameters is for each module fetching. While setting "integrity" parameters to this script fetcher is sufficient to pass parameters to top-level-module's fetching, it is not enough for the future extension. In the future, we will investigate a way to pass parameters to each non-top-level module. At that time, this `parameters` should be per-module. This is because "integrity" value should be different for each module. For example, we will accept some form of syntax to add parameters to `import`. Some proposed syntax is like https://discourse.wicg.io/t/specifying-nonce-or-integrity-when-importing-modules/1861 import "./xxx.js" integrity "xxxxxxx" In this case, this `parameters` will be passed to "./xxx.js" module fetching. This `parameters` should be different from the one of top-level-module's one. That's why we need per-module `parameters` and why this patch adds `parameters` to the module pipeline. On the other hand, we also want to keep script fetcher. This `per-module-graph` thing is important to offer module-graph-wide information. For example, import.meta would have `import.meta.scriptElement`, which is the script element fetching the module graph including this. So, we keep the both, script fetcher and parameters. https://github.com/tc39/proposal-import-meta This parameters will be finally used by pipeline's fetch hook, and WebCore side can use this parameters to fetch modules. We also further clean up the module pipeline by dropping unnecessary features. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/ModuleLoaderPrototype.js: (requestFetch): (requestInstantiate): (requestSatisfy): (loadModule): (loadAndEvaluateModule): This loadAndEvaluateModule should be implemented by just calling loadModule and linkAndEvaluateModule. We can drop requestReady and requestLink. (requestLink): Deleted. (requestImportModule): Deleted. * jsc.cpp: (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderFetch): import and fetch hook takes parameters. Currently, we always pass `undefined` for import hook. When dynamic `import()` is extended to accept additional parameters like integrity, this parameters will be replaced with the actual value. (functionLoadModule): (runWithOptions): * runtime/Completion.cpp: (JSC::loadAndEvaluateModule): (JSC::loadModule): (JSC::importModule): * runtime/Completion.h: * runtime/JSGlobalObject.h: * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncImportModule): * runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::loadAndEvaluateModule): (JSC::JSModuleLoader::loadModule): (JSC::JSModuleLoader::requestImportModule): (JSC::JSModuleLoader::importModule): (JSC::JSModuleLoader::fetch): * runtime/JSModuleLoader.h: * runtime/JSScriptFetchParameters.cpp: Added. (JSC::JSScriptFetchParameters::destroy): * runtime/JSScriptFetchParameters.h: Added. (JSC::JSScriptFetchParameters::createStructure): (JSC::JSScriptFetchParameters::create): (JSC::JSScriptFetchParameters::parameters const): (JSC::JSScriptFetchParameters::JSScriptFetchParameters): Add ScriptFetchParameters' JSCell wrapper, JSScriptFetchParameters. It is used in the module pipeline. * runtime/JSType.h: * runtime/ModuleLoaderPrototype.cpp: (JSC::moduleLoaderPrototypeFetch): * runtime/ScriptFetchParameters.h: Added. (JSC::ScriptFetchParameters::~ScriptFetchParameters): Add ScriptFetchParameters. We can define our own custom ScriptFetchParameters by inheriting this class. WebCore creates ModuleFetchParameters by inheriting this. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WebCore: This patch extends module hooks to accept fetching parameters. When starting fetching modules, WebCore creates ModuleFetchParameters. And this parameters is propagated to the fetch hook. Then, fetch hook can use this parameters to fetch modules. This parameters only contains `integrity` field. This "integrity" is used to perform subresource integrity check in module loader pipeline. And this error is just proparaged as errors in module pipeline, which is the same to the other types of errors in module pipeline. Test: http/tests/subresource-integrity/sri-module.html * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Added. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): Take parameters, which includes "integrity". * bindings/js/CachedModuleScriptLoader.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderFetch): (WebCore::JSDOMWindowBase::moduleLoaderImportModule): import and fetch hooks take parameters. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::loadModule): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::loadModuleScript): Pass parameters to the entry point of the module pipeline. * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::fetch): If parameters are passed, we set them to CachedModuleScriptLoader. (WebCore::ScriptModuleLoader::importModule): Pass parameters to the entry point of dynamic import. (WebCore::ScriptModuleLoader::notifyFinished): If script loader has parameters, we perform subresource integrity check here. * bindings/js/ScriptModuleLoader.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::create): (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Create ModuleFetchParameters with "integrity" value. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: Copied from Source/WebCore/bindings/js/CachedModuleScriptLoader.h. (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::integrity const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): Pass "integrity" value to the module script. LayoutTests: * http/tests/subresource-integrity/resources/crossorigin-anon-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-creds-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-ineligible-script-module.js: Added. * http/tests/subresource-integrity/resources/matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/non-matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/sri-utilities.js: (add_result_callback): (SRIModuleTest): (SRIModuleTest.prototype.execute): * http/tests/subresource-integrity/sri-module-expected.txt: Added. * http/tests/subresource-integrity/sri-module.html: Added. * js/dom/modules/module-inline-ignore-integrity-expected.txt: Added. * js/dom/modules/module-inline-ignore-integrity.html: Added. * js/dom/modules/module-integrity-non-top-level-expected.txt: Added. * js/dom/modules/module-integrity-non-top-level.html: Added. * js/dom/modules/script-tests/module-integrity-non-top-level-2.js: Added. * js/dom/modules/script-tests/module-integrity-non-top-level.js: Added. Canonical link: https://commits.webkit.org/194461@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-12 13:12:48 +00:00
{
JS Modules in Workers https://bugs.webkit.org/show_bug.cgi?id=164860 Reviewed by Saam Barati. LayoutTests/imported/w3c: Some of worklet failures in WPT is because, 1. Previously, worklet does not support module. These tests are passing incorrectly when modules are not supported. Now, modules are supported, and some edge features are missing, so start failing 2. WPT is using www1.localhost in some tests (CSP tests), and this is not supported in WebKit's WPT testing. So failing incorrectly. * web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/non-object.tentative.any.worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/microtasks/checkpoint-after-workerglobalscope-onerror-module-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/alpha/base-url-worker-importScripts-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/alpha/base-url-worker.sub-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-1-nothrow-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-1-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-2-import-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-3-dynamic-worker-expected.txt: * web-platform-tests/service-workers/service-worker/import-module-scripts.https-expected.txt: * web-platform-tests/workers/baseurl/alpha/import-in-moduleworker-expected.txt: * web-platform-tests/workers/baseurl/alpha/importScripts-in-worker-expected.txt: * web-platform-tests/workers/baseurl/alpha/xhr-in-moduleworker-expected.txt: * web-platform-tests/workers/baseurl/alpha/xhr-in-worker-expected.txt: * web-platform-tests/workers/constructors/Worker/same-origin-expected.txt: * web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-expected.txt: * web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-module-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-csp-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-failure-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-meta-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-meta.html: * web-platform-tests/workers/modules/dedicated-worker-import-referrer-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import.any-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-options-type-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-parse-error-failure-expected.txt: * web-platform-tests/workers/name-property-expected.txt: * web-platform-tests/worklets/audio-worklet-credentials.https-expected.txt: * web-platform-tests/worklets/audio-worklet-csp.https-expected.txt: * web-platform-tests/worklets/audio-worklet-import.https-expected.txt: * web-platform-tests/worklets/audio-worklet-referrer.https-expected.txt: * web-platform-tests/xhr/open-url-redirected-worker-origin-expected.txt: Source/JavaScriptCore: Add error information to extract this in WebCore's module loader. Currently, we are using Promise pipeline, and this makes it a bit difficult to extract error information. This error information attached in this patch allows us to extract SyntaxError in WebCore, and throwing JS SyntaxError instead of AbortError. We are planning to update our module pipieline not using Promises in the future. The current design derived from the original module loader pipeline where using Promises is critical. But now, that proposal was abandoned, so we can just simplify the module loader. * runtime/AggregateError.cpp: (JSC::AggregateError::AggregateError): * runtime/Error.cpp: (JSC::createError): (JSC::createEvalError): (JSC::createRangeError): (JSC::createReferenceError): (JSC::createSyntaxError): (JSC::createTypeError): (JSC::createURIError): (JSC::createGetterTypeError): (JSC::throwSyntaxError): * runtime/Error.h: * runtime/ErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::ErrorInstance): (JSC::ErrorInstance::create): (JSC::ErrorInstance::sanitizedMessageString): (JSC::ErrorInstance::sanitizedNameString): (JSC::ErrorInstance::sanitizedToString): * runtime/ErrorInstance.h: (JSC::ErrorInstance::create): (JSC::ErrorInstance::errorType const): * runtime/JSGlobalObjectFunctions.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor<errorType>::constructImpl): (JSC::NativeErrorConstructor<errorType>::callImpl): * runtime/NullSetterFunction.cpp: (JSC::NullSetterFunctionInternal::JSC_DEFINE_HOST_FUNCTION): * wasm/js/JSWebAssemblyCompileError.cpp: (JSC::JSWebAssemblyCompileError::JSWebAssemblyCompileError): * wasm/js/JSWebAssemblyLinkError.cpp: (JSC::JSWebAssemblyLinkError::JSWebAssemblyLinkError): * wasm/js/JSWebAssemblyRuntimeError.cpp: (JSC::JSWebAssemblyRuntimeError::JSWebAssemblyRuntimeError): * wasm/js/WebAssemblyCompileErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyLinkErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): Source/WebCore: This patch implements JS modules in Workers and Worklets. We are not supporting modules in ServiceWorkers' initialization yet. But service-worker can import modules via JS `import()`. The worker can be executed as a module if we pass, `type: "module"` to worker options. Worklet is executed as modules by default. 1. In Worker, we first fetch the initial code. And then, analyze the dependencies and load subsequent modules. We iterate run-loop to load all the dependent modules in the module loader. At that time, we annotate run-loop tasks with special taskMode to iterate tasks with this taskMode. This prevents us from discarding different tasks in this run-loop driving phase. (e.g. postMessage can be called from the main thread while loading module graph, in that case, we should not discard this task.) 2. In Worklet, we just request module loading to ScriptModuleLoader, and run it after loading module graph. This is OK since worklet thread is already running. So we can just request modules and worklet thread automatically drives module loading via run-loop. * Headers.cmake: * Modules/webaudio/AudioWorkletGlobalScope.h: (WebCore::AudioWorkletGlobalScope::currentFrame const): Deleted. (WebCore::AudioWorkletGlobalScope::sampleRate const): Deleted. (WebCore::AudioWorkletGlobalScope::currentTime const): Deleted. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): (WebCore::CachedModuleScriptLoader::load): (WebCore::CachedModuleScriptLoader::notifyFinished): * bindings/js/CachedModuleScriptLoader.h: * bindings/js/CachedScriptFetcher.cpp: * bindings/js/JSDOMExceptionHandling.cpp: (WebCore::retrieveErrorMessageWithoutName): (WebCore::createDOMException): * bindings/js/JSDOMExceptionHandling.h: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::scriptModuleLoader): (WebCore::JSDOMGlobalObject::moduleLoaderResolve): (WebCore::JSDOMGlobalObject::moduleLoaderFetch): (WebCore::JSDOMGlobalObject::moduleLoaderEvaluate): (WebCore::JSDOMGlobalObject::moduleLoaderImportModule): (WebCore::JSDOMGlobalObject::moduleLoaderCreateImportMetaProperties): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderResolve): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderFetch): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderEvaluate): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderImportModule): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderCreateImportMetaProperties): Deleted. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkletGlobalScopeBase.cpp: * bindings/js/ModuleScriptLoader.h: Copied from Source/WebCore/dom/ModuleFetchParameters.h. (WebCore::ModuleScriptLoader::clearClient): (WebCore::ModuleScriptLoader::scriptFetcher): (WebCore::ModuleScriptLoader::parameters): (WebCore::ModuleScriptLoader::ModuleScriptLoader): * bindings/js/ModuleScriptLoaderClient.h: Renamed from Source/WebCore/bindings/js/CachedModuleScriptLoaderClient.h. * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::ScriptModuleLoader): (WebCore::resolveModuleSpecifier): (WebCore::ScriptModuleLoader::resolve): (WebCore::ScriptModuleLoader::fetch): (WebCore::ScriptModuleLoader::moduleURL): (WebCore::ScriptModuleLoader::responseURLFromRequestURL): (WebCore::ScriptModuleLoader::evaluate): (WebCore::ScriptModuleLoader::importModule): (WebCore::ScriptModuleLoader::notifyFinished): * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): * bindings/js/WorkerModuleScriptLoader.cpp: Added. (WebCore::WorkerModuleScriptLoader::create): (WebCore::WorkerModuleScriptLoader::WorkerModuleScriptLoader): (WebCore::WorkerModuleScriptLoader::~WorkerModuleScriptLoader): (WebCore::WorkerModuleScriptLoader::load): (WebCore::WorkerModuleScriptLoader::referrerPolicy): (WebCore::WorkerModuleScriptLoader::notifyFinished): (WebCore::WorkerModuleScriptLoader::taskMode): * bindings/js/WorkerModuleScriptLoader.h: Copied from Source/WebCore/dom/ModuleFetchParameters.h. * bindings/js/WorkerScriptFetcher.h: Added. * dom/Document.cpp: * dom/ExceptionCode.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Deleted. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::isTopLevelModule const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoader::create): * loader/ThreadableLoader.h: (WebCore::ThreadableLoader::create): * workers/DedicatedWorkerGlobalScope.h: * workers/Worker.cpp: (WebCore::Worker::Worker): (WebCore::Worker::create): (WebCore::Worker::notifyFinished): * workers/Worker.h: * workers/Worker.idl: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): (WebCore::WorkerGlobalScope::importScripts): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::credentials const): * workers/WorkerGlobalScopeProxy.h: * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerOrWorkletGlobalScope.cpp: (WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope): * workers/WorkerOrWorkletGlobalScope.h: (WebCore::WorkerOrWorkletGlobalScope::moduleLoader): * workers/WorkerOrWorkletScriptController.cpp: (WebCore::jsValueToModuleKey): (WebCore::WorkerOrWorkletScriptController::evaluateModule): (WebCore::WorkerOrWorkletScriptController::loadModuleSynchronously): (WebCore::WorkerOrWorkletScriptController::linkAndEvaluateModule): (WebCore::WorkerOrWorkletScriptController::loadAndEvaluateModule): * workers/WorkerOrWorkletScriptController.h: * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadAsynchronously): (WebCore::WorkerScriptLoader::didReceiveResponse): * workers/WorkerScriptLoader.h: (WebCore::WorkerScriptLoader::responseSource const): (WebCore::WorkerScriptLoader::isRedirected const): * workers/WorkerThread.cpp: (WebCore::WorkerParameters::isolatedCopy const): (WebCore::WorkerThread::evaluateScriptIfNecessary): * workers/WorkerThread.h: * workers/WorkerType.h: * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerGlobalScope.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::fetchScriptWithContext): * workers/service/ServiceWorkerRegistrationOptions.h: * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::ServiceWorkerThread): * workers/service/server/SWServerWorker.h: * worklets/PaintWorkletGlobalScope.h: (WebCore::PaintWorkletGlobalScope::paintDefinitionMap): Deleted. (WebCore::PaintWorkletGlobalScope::paintDefinitionLock): Deleted. (WebCore::PaintWorkletGlobalScope::~PaintWorkletGlobalScope): Deleted. * worklets/WorkletGlobalScope.cpp: (WebCore::WorkletGlobalScope::fetchAndInvokeScript): (WebCore::WorkletGlobalScope::processNextScriptFetchJobIfNeeded): Deleted. (WebCore::WorkletGlobalScope::didReceiveResponse): Deleted. (WebCore::WorkletGlobalScope::notifyFinished): Deleted. (WebCore::WorkletGlobalScope::didCompleteScriptFetchJob): Deleted. * worklets/WorkletGlobalScope.h: LayoutTests: * TestExpectations: * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt: * http/tests/subresource-integrity/sri-module-expected.txt: * webaudio/audioworklet-addModule-failure-expected.txt: * webaudio/worklet-crash-expected.txt: Canonical link: https://commits.webkit.org/234389@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-20 20:28:27 +00:00
return adoptRef(*new ModuleFetchParameters(integrity, isTopLevelModule));
Support integrity="" on module scripts https://bugs.webkit.org/show_bug.cgi?id=177959 Reviewed by Sam Weinig. Source/JavaScriptCore: This patch adds Subresource Integrity check for module scripts. Currently, only top-level module can be verified with integrity parameter since there is no way to perform integrity check onto the imported modules. In JSC side, we add `parameters` to the entry point of the module loader pipeline. This is fetching parameters and used when fetching modules. We separately pass this parameters to the pipeline along with the script fetcher. The script fetcher is only one for module graph since this is the initiator of this module graph loading. On the other hand, this parameters is for each module fetching. While setting "integrity" parameters to this script fetcher is sufficient to pass parameters to top-level-module's fetching, it is not enough for the future extension. In the future, we will investigate a way to pass parameters to each non-top-level module. At that time, this `parameters` should be per-module. This is because "integrity" value should be different for each module. For example, we will accept some form of syntax to add parameters to `import`. Some proposed syntax is like https://discourse.wicg.io/t/specifying-nonce-or-integrity-when-importing-modules/1861 import "./xxx.js" integrity "xxxxxxx" In this case, this `parameters` will be passed to "./xxx.js" module fetching. This `parameters` should be different from the one of top-level-module's one. That's why we need per-module `parameters` and why this patch adds `parameters` to the module pipeline. On the other hand, we also want to keep script fetcher. This `per-module-graph` thing is important to offer module-graph-wide information. For example, import.meta would have `import.meta.scriptElement`, which is the script element fetching the module graph including this. So, we keep the both, script fetcher and parameters. https://github.com/tc39/proposal-import-meta This parameters will be finally used by pipeline's fetch hook, and WebCore side can use this parameters to fetch modules. We also further clean up the module pipeline by dropping unnecessary features. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/ModuleLoaderPrototype.js: (requestFetch): (requestInstantiate): (requestSatisfy): (loadModule): (loadAndEvaluateModule): This loadAndEvaluateModule should be implemented by just calling loadModule and linkAndEvaluateModule. We can drop requestReady and requestLink. (requestLink): Deleted. (requestImportModule): Deleted. * jsc.cpp: (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderFetch): import and fetch hook takes parameters. Currently, we always pass `undefined` for import hook. When dynamic `import()` is extended to accept additional parameters like integrity, this parameters will be replaced with the actual value. (functionLoadModule): (runWithOptions): * runtime/Completion.cpp: (JSC::loadAndEvaluateModule): (JSC::loadModule): (JSC::importModule): * runtime/Completion.h: * runtime/JSGlobalObject.h: * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncImportModule): * runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::loadAndEvaluateModule): (JSC::JSModuleLoader::loadModule): (JSC::JSModuleLoader::requestImportModule): (JSC::JSModuleLoader::importModule): (JSC::JSModuleLoader::fetch): * runtime/JSModuleLoader.h: * runtime/JSScriptFetchParameters.cpp: Added. (JSC::JSScriptFetchParameters::destroy): * runtime/JSScriptFetchParameters.h: Added. (JSC::JSScriptFetchParameters::createStructure): (JSC::JSScriptFetchParameters::create): (JSC::JSScriptFetchParameters::parameters const): (JSC::JSScriptFetchParameters::JSScriptFetchParameters): Add ScriptFetchParameters' JSCell wrapper, JSScriptFetchParameters. It is used in the module pipeline. * runtime/JSType.h: * runtime/ModuleLoaderPrototype.cpp: (JSC::moduleLoaderPrototypeFetch): * runtime/ScriptFetchParameters.h: Added. (JSC::ScriptFetchParameters::~ScriptFetchParameters): Add ScriptFetchParameters. We can define our own custom ScriptFetchParameters by inheriting this class. WebCore creates ModuleFetchParameters by inheriting this. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WebCore: This patch extends module hooks to accept fetching parameters. When starting fetching modules, WebCore creates ModuleFetchParameters. And this parameters is propagated to the fetch hook. Then, fetch hook can use this parameters to fetch modules. This parameters only contains `integrity` field. This "integrity" is used to perform subresource integrity check in module loader pipeline. And this error is just proparaged as errors in module pipeline, which is the same to the other types of errors in module pipeline. Test: http/tests/subresource-integrity/sri-module.html * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Added. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): Take parameters, which includes "integrity". * bindings/js/CachedModuleScriptLoader.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderFetch): (WebCore::JSDOMWindowBase::moduleLoaderImportModule): import and fetch hooks take parameters. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::loadModule): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::loadModuleScript): Pass parameters to the entry point of the module pipeline. * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::fetch): If parameters are passed, we set them to CachedModuleScriptLoader. (WebCore::ScriptModuleLoader::importModule): Pass parameters to the entry point of dynamic import. (WebCore::ScriptModuleLoader::notifyFinished): If script loader has parameters, we perform subresource integrity check here. * bindings/js/ScriptModuleLoader.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::create): (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Create ModuleFetchParameters with "integrity" value. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: Copied from Source/WebCore/bindings/js/CachedModuleScriptLoader.h. (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::integrity const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): Pass "integrity" value to the module script. LayoutTests: * http/tests/subresource-integrity/resources/crossorigin-anon-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-creds-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-ineligible-script-module.js: Added. * http/tests/subresource-integrity/resources/matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/non-matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/sri-utilities.js: (add_result_callback): (SRIModuleTest): (SRIModuleTest.prototype.execute): * http/tests/subresource-integrity/sri-module-expected.txt: Added. * http/tests/subresource-integrity/sri-module.html: Added. * js/dom/modules/module-inline-ignore-integrity-expected.txt: Added. * js/dom/modules/module-inline-ignore-integrity.html: Added. * js/dom/modules/module-integrity-non-top-level-expected.txt: Added. * js/dom/modules/module-integrity-non-top-level.html: Added. * js/dom/modules/script-tests/module-integrity-non-top-level-2.js: Added. * js/dom/modules/script-tests/module-integrity-non-top-level.js: Added. Canonical link: https://commits.webkit.org/194461@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-12 13:12:48 +00:00
}
const String& integrity() const { return m_integrity; }
JS Modules in Workers https://bugs.webkit.org/show_bug.cgi?id=164860 Reviewed by Saam Barati. LayoutTests/imported/w3c: Some of worklet failures in WPT is because, 1. Previously, worklet does not support module. These tests are passing incorrectly when modules are not supported. Now, modules are supported, and some edge features are missing, so start failing 2. WPT is using www1.localhost in some tests (CSP tests), and this is not supported in WebKit's WPT testing. So failing incorrectly. * web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/non-object.tentative.any.worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/microtasks/checkpoint-after-workerglobalscope-onerror-module-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/alpha/base-url-worker-importScripts-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/alpha/base-url-worker.sub-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-1-nothrow-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-1-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-2-import-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-3-dynamic-worker-expected.txt: * web-platform-tests/service-workers/service-worker/import-module-scripts.https-expected.txt: * web-platform-tests/workers/baseurl/alpha/import-in-moduleworker-expected.txt: * web-platform-tests/workers/baseurl/alpha/importScripts-in-worker-expected.txt: * web-platform-tests/workers/baseurl/alpha/xhr-in-moduleworker-expected.txt: * web-platform-tests/workers/baseurl/alpha/xhr-in-worker-expected.txt: * web-platform-tests/workers/constructors/Worker/same-origin-expected.txt: * web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-expected.txt: * web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-module-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-csp-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-failure-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-meta-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-meta.html: * web-platform-tests/workers/modules/dedicated-worker-import-referrer-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import.any-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-options-type-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-parse-error-failure-expected.txt: * web-platform-tests/workers/name-property-expected.txt: * web-platform-tests/worklets/audio-worklet-credentials.https-expected.txt: * web-platform-tests/worklets/audio-worklet-csp.https-expected.txt: * web-platform-tests/worklets/audio-worklet-import.https-expected.txt: * web-platform-tests/worklets/audio-worklet-referrer.https-expected.txt: * web-platform-tests/xhr/open-url-redirected-worker-origin-expected.txt: Source/JavaScriptCore: Add error information to extract this in WebCore's module loader. Currently, we are using Promise pipeline, and this makes it a bit difficult to extract error information. This error information attached in this patch allows us to extract SyntaxError in WebCore, and throwing JS SyntaxError instead of AbortError. We are planning to update our module pipieline not using Promises in the future. The current design derived from the original module loader pipeline where using Promises is critical. But now, that proposal was abandoned, so we can just simplify the module loader. * runtime/AggregateError.cpp: (JSC::AggregateError::AggregateError): * runtime/Error.cpp: (JSC::createError): (JSC::createEvalError): (JSC::createRangeError): (JSC::createReferenceError): (JSC::createSyntaxError): (JSC::createTypeError): (JSC::createURIError): (JSC::createGetterTypeError): (JSC::throwSyntaxError): * runtime/Error.h: * runtime/ErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::ErrorInstance): (JSC::ErrorInstance::create): (JSC::ErrorInstance::sanitizedMessageString): (JSC::ErrorInstance::sanitizedNameString): (JSC::ErrorInstance::sanitizedToString): * runtime/ErrorInstance.h: (JSC::ErrorInstance::create): (JSC::ErrorInstance::errorType const): * runtime/JSGlobalObjectFunctions.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor<errorType>::constructImpl): (JSC::NativeErrorConstructor<errorType>::callImpl): * runtime/NullSetterFunction.cpp: (JSC::NullSetterFunctionInternal::JSC_DEFINE_HOST_FUNCTION): * wasm/js/JSWebAssemblyCompileError.cpp: (JSC::JSWebAssemblyCompileError::JSWebAssemblyCompileError): * wasm/js/JSWebAssemblyLinkError.cpp: (JSC::JSWebAssemblyLinkError::JSWebAssemblyLinkError): * wasm/js/JSWebAssemblyRuntimeError.cpp: (JSC::JSWebAssemblyRuntimeError::JSWebAssemblyRuntimeError): * wasm/js/WebAssemblyCompileErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyLinkErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): Source/WebCore: This patch implements JS modules in Workers and Worklets. We are not supporting modules in ServiceWorkers' initialization yet. But service-worker can import modules via JS `import()`. The worker can be executed as a module if we pass, `type: "module"` to worker options. Worklet is executed as modules by default. 1. In Worker, we first fetch the initial code. And then, analyze the dependencies and load subsequent modules. We iterate run-loop to load all the dependent modules in the module loader. At that time, we annotate run-loop tasks with special taskMode to iterate tasks with this taskMode. This prevents us from discarding different tasks in this run-loop driving phase. (e.g. postMessage can be called from the main thread while loading module graph, in that case, we should not discard this task.) 2. In Worklet, we just request module loading to ScriptModuleLoader, and run it after loading module graph. This is OK since worklet thread is already running. So we can just request modules and worklet thread automatically drives module loading via run-loop. * Headers.cmake: * Modules/webaudio/AudioWorkletGlobalScope.h: (WebCore::AudioWorkletGlobalScope::currentFrame const): Deleted. (WebCore::AudioWorkletGlobalScope::sampleRate const): Deleted. (WebCore::AudioWorkletGlobalScope::currentTime const): Deleted. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): (WebCore::CachedModuleScriptLoader::load): (WebCore::CachedModuleScriptLoader::notifyFinished): * bindings/js/CachedModuleScriptLoader.h: * bindings/js/CachedScriptFetcher.cpp: * bindings/js/JSDOMExceptionHandling.cpp: (WebCore::retrieveErrorMessageWithoutName): (WebCore::createDOMException): * bindings/js/JSDOMExceptionHandling.h: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::scriptModuleLoader): (WebCore::JSDOMGlobalObject::moduleLoaderResolve): (WebCore::JSDOMGlobalObject::moduleLoaderFetch): (WebCore::JSDOMGlobalObject::moduleLoaderEvaluate): (WebCore::JSDOMGlobalObject::moduleLoaderImportModule): (WebCore::JSDOMGlobalObject::moduleLoaderCreateImportMetaProperties): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderResolve): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderFetch): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderEvaluate): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderImportModule): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderCreateImportMetaProperties): Deleted. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkletGlobalScopeBase.cpp: * bindings/js/ModuleScriptLoader.h: Copied from Source/WebCore/dom/ModuleFetchParameters.h. (WebCore::ModuleScriptLoader::clearClient): (WebCore::ModuleScriptLoader::scriptFetcher): (WebCore::ModuleScriptLoader::parameters): (WebCore::ModuleScriptLoader::ModuleScriptLoader): * bindings/js/ModuleScriptLoaderClient.h: Renamed from Source/WebCore/bindings/js/CachedModuleScriptLoaderClient.h. * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::ScriptModuleLoader): (WebCore::resolveModuleSpecifier): (WebCore::ScriptModuleLoader::resolve): (WebCore::ScriptModuleLoader::fetch): (WebCore::ScriptModuleLoader::moduleURL): (WebCore::ScriptModuleLoader::responseURLFromRequestURL): (WebCore::ScriptModuleLoader::evaluate): (WebCore::ScriptModuleLoader::importModule): (WebCore::ScriptModuleLoader::notifyFinished): * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): * bindings/js/WorkerModuleScriptLoader.cpp: Added. (WebCore::WorkerModuleScriptLoader::create): (WebCore::WorkerModuleScriptLoader::WorkerModuleScriptLoader): (WebCore::WorkerModuleScriptLoader::~WorkerModuleScriptLoader): (WebCore::WorkerModuleScriptLoader::load): (WebCore::WorkerModuleScriptLoader::referrerPolicy): (WebCore::WorkerModuleScriptLoader::notifyFinished): (WebCore::WorkerModuleScriptLoader::taskMode): * bindings/js/WorkerModuleScriptLoader.h: Copied from Source/WebCore/dom/ModuleFetchParameters.h. * bindings/js/WorkerScriptFetcher.h: Added. * dom/Document.cpp: * dom/ExceptionCode.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Deleted. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::isTopLevelModule const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoader::create): * loader/ThreadableLoader.h: (WebCore::ThreadableLoader::create): * workers/DedicatedWorkerGlobalScope.h: * workers/Worker.cpp: (WebCore::Worker::Worker): (WebCore::Worker::create): (WebCore::Worker::notifyFinished): * workers/Worker.h: * workers/Worker.idl: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): (WebCore::WorkerGlobalScope::importScripts): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::credentials const): * workers/WorkerGlobalScopeProxy.h: * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerOrWorkletGlobalScope.cpp: (WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope): * workers/WorkerOrWorkletGlobalScope.h: (WebCore::WorkerOrWorkletGlobalScope::moduleLoader): * workers/WorkerOrWorkletScriptController.cpp: (WebCore::jsValueToModuleKey): (WebCore::WorkerOrWorkletScriptController::evaluateModule): (WebCore::WorkerOrWorkletScriptController::loadModuleSynchronously): (WebCore::WorkerOrWorkletScriptController::linkAndEvaluateModule): (WebCore::WorkerOrWorkletScriptController::loadAndEvaluateModule): * workers/WorkerOrWorkletScriptController.h: * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadAsynchronously): (WebCore::WorkerScriptLoader::didReceiveResponse): * workers/WorkerScriptLoader.h: (WebCore::WorkerScriptLoader::responseSource const): (WebCore::WorkerScriptLoader::isRedirected const): * workers/WorkerThread.cpp: (WebCore::WorkerParameters::isolatedCopy const): (WebCore::WorkerThread::evaluateScriptIfNecessary): * workers/WorkerThread.h: * workers/WorkerType.h: * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerGlobalScope.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::fetchScriptWithContext): * workers/service/ServiceWorkerRegistrationOptions.h: * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::ServiceWorkerThread): * workers/service/server/SWServerWorker.h: * worklets/PaintWorkletGlobalScope.h: (WebCore::PaintWorkletGlobalScope::paintDefinitionMap): Deleted. (WebCore::PaintWorkletGlobalScope::paintDefinitionLock): Deleted. (WebCore::PaintWorkletGlobalScope::~PaintWorkletGlobalScope): Deleted. * worklets/WorkletGlobalScope.cpp: (WebCore::WorkletGlobalScope::fetchAndInvokeScript): (WebCore::WorkletGlobalScope::processNextScriptFetchJobIfNeeded): Deleted. (WebCore::WorkletGlobalScope::didReceiveResponse): Deleted. (WebCore::WorkletGlobalScope::notifyFinished): Deleted. (WebCore::WorkletGlobalScope::didCompleteScriptFetchJob): Deleted. * worklets/WorkletGlobalScope.h: LayoutTests: * TestExpectations: * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt: * http/tests/subresource-integrity/sri-module-expected.txt: * webaudio/audioworklet-addModule-failure-expected.txt: * webaudio/worklet-crash-expected.txt: Canonical link: https://commits.webkit.org/234389@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-20 20:28:27 +00:00
bool isTopLevelModule() const { return m_isTopLevelModule; }
Support integrity="" on module scripts https://bugs.webkit.org/show_bug.cgi?id=177959 Reviewed by Sam Weinig. Source/JavaScriptCore: This patch adds Subresource Integrity check for module scripts. Currently, only top-level module can be verified with integrity parameter since there is no way to perform integrity check onto the imported modules. In JSC side, we add `parameters` to the entry point of the module loader pipeline. This is fetching parameters and used when fetching modules. We separately pass this parameters to the pipeline along with the script fetcher. The script fetcher is only one for module graph since this is the initiator of this module graph loading. On the other hand, this parameters is for each module fetching. While setting "integrity" parameters to this script fetcher is sufficient to pass parameters to top-level-module's fetching, it is not enough for the future extension. In the future, we will investigate a way to pass parameters to each non-top-level module. At that time, this `parameters` should be per-module. This is because "integrity" value should be different for each module. For example, we will accept some form of syntax to add parameters to `import`. Some proposed syntax is like https://discourse.wicg.io/t/specifying-nonce-or-integrity-when-importing-modules/1861 import "./xxx.js" integrity "xxxxxxx" In this case, this `parameters` will be passed to "./xxx.js" module fetching. This `parameters` should be different from the one of top-level-module's one. That's why we need per-module `parameters` and why this patch adds `parameters` to the module pipeline. On the other hand, we also want to keep script fetcher. This `per-module-graph` thing is important to offer module-graph-wide information. For example, import.meta would have `import.meta.scriptElement`, which is the script element fetching the module graph including this. So, we keep the both, script fetcher and parameters. https://github.com/tc39/proposal-import-meta This parameters will be finally used by pipeline's fetch hook, and WebCore side can use this parameters to fetch modules. We also further clean up the module pipeline by dropping unnecessary features. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/ModuleLoaderPrototype.js: (requestFetch): (requestInstantiate): (requestSatisfy): (loadModule): (loadAndEvaluateModule): This loadAndEvaluateModule should be implemented by just calling loadModule and linkAndEvaluateModule. We can drop requestReady and requestLink. (requestLink): Deleted. (requestImportModule): Deleted. * jsc.cpp: (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderFetch): import and fetch hook takes parameters. Currently, we always pass `undefined` for import hook. When dynamic `import()` is extended to accept additional parameters like integrity, this parameters will be replaced with the actual value. (functionLoadModule): (runWithOptions): * runtime/Completion.cpp: (JSC::loadAndEvaluateModule): (JSC::loadModule): (JSC::importModule): * runtime/Completion.h: * runtime/JSGlobalObject.h: * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncImportModule): * runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::loadAndEvaluateModule): (JSC::JSModuleLoader::loadModule): (JSC::JSModuleLoader::requestImportModule): (JSC::JSModuleLoader::importModule): (JSC::JSModuleLoader::fetch): * runtime/JSModuleLoader.h: * runtime/JSScriptFetchParameters.cpp: Added. (JSC::JSScriptFetchParameters::destroy): * runtime/JSScriptFetchParameters.h: Added. (JSC::JSScriptFetchParameters::createStructure): (JSC::JSScriptFetchParameters::create): (JSC::JSScriptFetchParameters::parameters const): (JSC::JSScriptFetchParameters::JSScriptFetchParameters): Add ScriptFetchParameters' JSCell wrapper, JSScriptFetchParameters. It is used in the module pipeline. * runtime/JSType.h: * runtime/ModuleLoaderPrototype.cpp: (JSC::moduleLoaderPrototypeFetch): * runtime/ScriptFetchParameters.h: Added. (JSC::ScriptFetchParameters::~ScriptFetchParameters): Add ScriptFetchParameters. We can define our own custom ScriptFetchParameters by inheriting this class. WebCore creates ModuleFetchParameters by inheriting this. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WebCore: This patch extends module hooks to accept fetching parameters. When starting fetching modules, WebCore creates ModuleFetchParameters. And this parameters is propagated to the fetch hook. Then, fetch hook can use this parameters to fetch modules. This parameters only contains `integrity` field. This "integrity" is used to perform subresource integrity check in module loader pipeline. And this error is just proparaged as errors in module pipeline, which is the same to the other types of errors in module pipeline. Test: http/tests/subresource-integrity/sri-module.html * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Added. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): Take parameters, which includes "integrity". * bindings/js/CachedModuleScriptLoader.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderFetch): (WebCore::JSDOMWindowBase::moduleLoaderImportModule): import and fetch hooks take parameters. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::loadModule): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::loadModuleScript): Pass parameters to the entry point of the module pipeline. * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::fetch): If parameters are passed, we set them to CachedModuleScriptLoader. (WebCore::ScriptModuleLoader::importModule): Pass parameters to the entry point of dynamic import. (WebCore::ScriptModuleLoader::notifyFinished): If script loader has parameters, we perform subresource integrity check here. * bindings/js/ScriptModuleLoader.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::create): (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Create ModuleFetchParameters with "integrity" value. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: Copied from Source/WebCore/bindings/js/CachedModuleScriptLoader.h. (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::integrity const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): Pass "integrity" value to the module script. LayoutTests: * http/tests/subresource-integrity/resources/crossorigin-anon-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-creds-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-ineligible-script-module.js: Added. * http/tests/subresource-integrity/resources/matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/non-matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/sri-utilities.js: (add_result_callback): (SRIModuleTest): (SRIModuleTest.prototype.execute): * http/tests/subresource-integrity/sri-module-expected.txt: Added. * http/tests/subresource-integrity/sri-module.html: Added. * js/dom/modules/module-inline-ignore-integrity-expected.txt: Added. * js/dom/modules/module-inline-ignore-integrity.html: Added. * js/dom/modules/module-integrity-non-top-level-expected.txt: Added. * js/dom/modules/module-integrity-non-top-level.html: Added. * js/dom/modules/script-tests/module-integrity-non-top-level-2.js: Added. * js/dom/modules/script-tests/module-integrity-non-top-level.js: Added. Canonical link: https://commits.webkit.org/194461@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-12 13:12:48 +00:00
private:
JS Modules in Workers https://bugs.webkit.org/show_bug.cgi?id=164860 Reviewed by Saam Barati. LayoutTests/imported/w3c: Some of worklet failures in WPT is because, 1. Previously, worklet does not support module. These tests are passing incorrectly when modules are not supported. Now, modules are supported, and some edge features are missing, so start failing 2. WPT is using www1.localhost in some tests (CSP tests), and this is not supported in WebKit's WPT testing. So failing incorrectly. * web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/non-object.tentative.any.worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/microtasks/checkpoint-after-workerglobalscope-onerror-module-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/alpha/base-url-worker-importScripts-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/alpha/base-url-worker.sub-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-1-nothrow-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-1-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-2-import-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-3-dynamic-worker-expected.txt: * web-platform-tests/service-workers/service-worker/import-module-scripts.https-expected.txt: * web-platform-tests/workers/baseurl/alpha/import-in-moduleworker-expected.txt: * web-platform-tests/workers/baseurl/alpha/importScripts-in-worker-expected.txt: * web-platform-tests/workers/baseurl/alpha/xhr-in-moduleworker-expected.txt: * web-platform-tests/workers/baseurl/alpha/xhr-in-worker-expected.txt: * web-platform-tests/workers/constructors/Worker/same-origin-expected.txt: * web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-expected.txt: * web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-module-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-csp-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-failure-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-meta-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-meta.html: * web-platform-tests/workers/modules/dedicated-worker-import-referrer-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import.any-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-options-type-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-parse-error-failure-expected.txt: * web-platform-tests/workers/name-property-expected.txt: * web-platform-tests/worklets/audio-worklet-credentials.https-expected.txt: * web-platform-tests/worklets/audio-worklet-csp.https-expected.txt: * web-platform-tests/worklets/audio-worklet-import.https-expected.txt: * web-platform-tests/worklets/audio-worklet-referrer.https-expected.txt: * web-platform-tests/xhr/open-url-redirected-worker-origin-expected.txt: Source/JavaScriptCore: Add error information to extract this in WebCore's module loader. Currently, we are using Promise pipeline, and this makes it a bit difficult to extract error information. This error information attached in this patch allows us to extract SyntaxError in WebCore, and throwing JS SyntaxError instead of AbortError. We are planning to update our module pipieline not using Promises in the future. The current design derived from the original module loader pipeline where using Promises is critical. But now, that proposal was abandoned, so we can just simplify the module loader. * runtime/AggregateError.cpp: (JSC::AggregateError::AggregateError): * runtime/Error.cpp: (JSC::createError): (JSC::createEvalError): (JSC::createRangeError): (JSC::createReferenceError): (JSC::createSyntaxError): (JSC::createTypeError): (JSC::createURIError): (JSC::createGetterTypeError): (JSC::throwSyntaxError): * runtime/Error.h: * runtime/ErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::ErrorInstance): (JSC::ErrorInstance::create): (JSC::ErrorInstance::sanitizedMessageString): (JSC::ErrorInstance::sanitizedNameString): (JSC::ErrorInstance::sanitizedToString): * runtime/ErrorInstance.h: (JSC::ErrorInstance::create): (JSC::ErrorInstance::errorType const): * runtime/JSGlobalObjectFunctions.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor<errorType>::constructImpl): (JSC::NativeErrorConstructor<errorType>::callImpl): * runtime/NullSetterFunction.cpp: (JSC::NullSetterFunctionInternal::JSC_DEFINE_HOST_FUNCTION): * wasm/js/JSWebAssemblyCompileError.cpp: (JSC::JSWebAssemblyCompileError::JSWebAssemblyCompileError): * wasm/js/JSWebAssemblyLinkError.cpp: (JSC::JSWebAssemblyLinkError::JSWebAssemblyLinkError): * wasm/js/JSWebAssemblyRuntimeError.cpp: (JSC::JSWebAssemblyRuntimeError::JSWebAssemblyRuntimeError): * wasm/js/WebAssemblyCompileErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyLinkErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): Source/WebCore: This patch implements JS modules in Workers and Worklets. We are not supporting modules in ServiceWorkers' initialization yet. But service-worker can import modules via JS `import()`. The worker can be executed as a module if we pass, `type: "module"` to worker options. Worklet is executed as modules by default. 1. In Worker, we first fetch the initial code. And then, analyze the dependencies and load subsequent modules. We iterate run-loop to load all the dependent modules in the module loader. At that time, we annotate run-loop tasks with special taskMode to iterate tasks with this taskMode. This prevents us from discarding different tasks in this run-loop driving phase. (e.g. postMessage can be called from the main thread while loading module graph, in that case, we should not discard this task.) 2. In Worklet, we just request module loading to ScriptModuleLoader, and run it after loading module graph. This is OK since worklet thread is already running. So we can just request modules and worklet thread automatically drives module loading via run-loop. * Headers.cmake: * Modules/webaudio/AudioWorkletGlobalScope.h: (WebCore::AudioWorkletGlobalScope::currentFrame const): Deleted. (WebCore::AudioWorkletGlobalScope::sampleRate const): Deleted. (WebCore::AudioWorkletGlobalScope::currentTime const): Deleted. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): (WebCore::CachedModuleScriptLoader::load): (WebCore::CachedModuleScriptLoader::notifyFinished): * bindings/js/CachedModuleScriptLoader.h: * bindings/js/CachedScriptFetcher.cpp: * bindings/js/JSDOMExceptionHandling.cpp: (WebCore::retrieveErrorMessageWithoutName): (WebCore::createDOMException): * bindings/js/JSDOMExceptionHandling.h: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::scriptModuleLoader): (WebCore::JSDOMGlobalObject::moduleLoaderResolve): (WebCore::JSDOMGlobalObject::moduleLoaderFetch): (WebCore::JSDOMGlobalObject::moduleLoaderEvaluate): (WebCore::JSDOMGlobalObject::moduleLoaderImportModule): (WebCore::JSDOMGlobalObject::moduleLoaderCreateImportMetaProperties): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderResolve): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderFetch): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderEvaluate): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderImportModule): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderCreateImportMetaProperties): Deleted. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkletGlobalScopeBase.cpp: * bindings/js/ModuleScriptLoader.h: Copied from Source/WebCore/dom/ModuleFetchParameters.h. (WebCore::ModuleScriptLoader::clearClient): (WebCore::ModuleScriptLoader::scriptFetcher): (WebCore::ModuleScriptLoader::parameters): (WebCore::ModuleScriptLoader::ModuleScriptLoader): * bindings/js/ModuleScriptLoaderClient.h: Renamed from Source/WebCore/bindings/js/CachedModuleScriptLoaderClient.h. * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::ScriptModuleLoader): (WebCore::resolveModuleSpecifier): (WebCore::ScriptModuleLoader::resolve): (WebCore::ScriptModuleLoader::fetch): (WebCore::ScriptModuleLoader::moduleURL): (WebCore::ScriptModuleLoader::responseURLFromRequestURL): (WebCore::ScriptModuleLoader::evaluate): (WebCore::ScriptModuleLoader::importModule): (WebCore::ScriptModuleLoader::notifyFinished): * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): * bindings/js/WorkerModuleScriptLoader.cpp: Added. (WebCore::WorkerModuleScriptLoader::create): (WebCore::WorkerModuleScriptLoader::WorkerModuleScriptLoader): (WebCore::WorkerModuleScriptLoader::~WorkerModuleScriptLoader): (WebCore::WorkerModuleScriptLoader::load): (WebCore::WorkerModuleScriptLoader::referrerPolicy): (WebCore::WorkerModuleScriptLoader::notifyFinished): (WebCore::WorkerModuleScriptLoader::taskMode): * bindings/js/WorkerModuleScriptLoader.h: Copied from Source/WebCore/dom/ModuleFetchParameters.h. * bindings/js/WorkerScriptFetcher.h: Added. * dom/Document.cpp: * dom/ExceptionCode.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Deleted. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::isTopLevelModule const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoader::create): * loader/ThreadableLoader.h: (WebCore::ThreadableLoader::create): * workers/DedicatedWorkerGlobalScope.h: * workers/Worker.cpp: (WebCore::Worker::Worker): (WebCore::Worker::create): (WebCore::Worker::notifyFinished): * workers/Worker.h: * workers/Worker.idl: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): (WebCore::WorkerGlobalScope::importScripts): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::credentials const): * workers/WorkerGlobalScopeProxy.h: * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerOrWorkletGlobalScope.cpp: (WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope): * workers/WorkerOrWorkletGlobalScope.h: (WebCore::WorkerOrWorkletGlobalScope::moduleLoader): * workers/WorkerOrWorkletScriptController.cpp: (WebCore::jsValueToModuleKey): (WebCore::WorkerOrWorkletScriptController::evaluateModule): (WebCore::WorkerOrWorkletScriptController::loadModuleSynchronously): (WebCore::WorkerOrWorkletScriptController::linkAndEvaluateModule): (WebCore::WorkerOrWorkletScriptController::loadAndEvaluateModule): * workers/WorkerOrWorkletScriptController.h: * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadAsynchronously): (WebCore::WorkerScriptLoader::didReceiveResponse): * workers/WorkerScriptLoader.h: (WebCore::WorkerScriptLoader::responseSource const): (WebCore::WorkerScriptLoader::isRedirected const): * workers/WorkerThread.cpp: (WebCore::WorkerParameters::isolatedCopy const): (WebCore::WorkerThread::evaluateScriptIfNecessary): * workers/WorkerThread.h: * workers/WorkerType.h: * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerGlobalScope.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::fetchScriptWithContext): * workers/service/ServiceWorkerRegistrationOptions.h: * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::ServiceWorkerThread): * workers/service/server/SWServerWorker.h: * worklets/PaintWorkletGlobalScope.h: (WebCore::PaintWorkletGlobalScope::paintDefinitionMap): Deleted. (WebCore::PaintWorkletGlobalScope::paintDefinitionLock): Deleted. (WebCore::PaintWorkletGlobalScope::~PaintWorkletGlobalScope): Deleted. * worklets/WorkletGlobalScope.cpp: (WebCore::WorkletGlobalScope::fetchAndInvokeScript): (WebCore::WorkletGlobalScope::processNextScriptFetchJobIfNeeded): Deleted. (WebCore::WorkletGlobalScope::didReceiveResponse): Deleted. (WebCore::WorkletGlobalScope::notifyFinished): Deleted. (WebCore::WorkletGlobalScope::didCompleteScriptFetchJob): Deleted. * worklets/WorkletGlobalScope.h: LayoutTests: * TestExpectations: * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt: * http/tests/subresource-integrity/sri-module-expected.txt: * webaudio/audioworklet-addModule-failure-expected.txt: * webaudio/worklet-crash-expected.txt: Canonical link: https://commits.webkit.org/234389@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-20 20:28:27 +00:00
ModuleFetchParameters(const String& integrity, bool isTopLevelModule)
Support integrity="" on module scripts https://bugs.webkit.org/show_bug.cgi?id=177959 Reviewed by Sam Weinig. Source/JavaScriptCore: This patch adds Subresource Integrity check for module scripts. Currently, only top-level module can be verified with integrity parameter since there is no way to perform integrity check onto the imported modules. In JSC side, we add `parameters` to the entry point of the module loader pipeline. This is fetching parameters and used when fetching modules. We separately pass this parameters to the pipeline along with the script fetcher. The script fetcher is only one for module graph since this is the initiator of this module graph loading. On the other hand, this parameters is for each module fetching. While setting "integrity" parameters to this script fetcher is sufficient to pass parameters to top-level-module's fetching, it is not enough for the future extension. In the future, we will investigate a way to pass parameters to each non-top-level module. At that time, this `parameters` should be per-module. This is because "integrity" value should be different for each module. For example, we will accept some form of syntax to add parameters to `import`. Some proposed syntax is like https://discourse.wicg.io/t/specifying-nonce-or-integrity-when-importing-modules/1861 import "./xxx.js" integrity "xxxxxxx" In this case, this `parameters` will be passed to "./xxx.js" module fetching. This `parameters` should be different from the one of top-level-module's one. That's why we need per-module `parameters` and why this patch adds `parameters` to the module pipeline. On the other hand, we also want to keep script fetcher. This `per-module-graph` thing is important to offer module-graph-wide information. For example, import.meta would have `import.meta.scriptElement`, which is the script element fetching the module graph including this. So, we keep the both, script fetcher and parameters. https://github.com/tc39/proposal-import-meta This parameters will be finally used by pipeline's fetch hook, and WebCore side can use this parameters to fetch modules. We also further clean up the module pipeline by dropping unnecessary features. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/ModuleLoaderPrototype.js: (requestFetch): (requestInstantiate): (requestSatisfy): (loadModule): (loadAndEvaluateModule): This loadAndEvaluateModule should be implemented by just calling loadModule and linkAndEvaluateModule. We can drop requestReady and requestLink. (requestLink): Deleted. (requestImportModule): Deleted. * jsc.cpp: (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderFetch): import and fetch hook takes parameters. Currently, we always pass `undefined` for import hook. When dynamic `import()` is extended to accept additional parameters like integrity, this parameters will be replaced with the actual value. (functionLoadModule): (runWithOptions): * runtime/Completion.cpp: (JSC::loadAndEvaluateModule): (JSC::loadModule): (JSC::importModule): * runtime/Completion.h: * runtime/JSGlobalObject.h: * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncImportModule): * runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::loadAndEvaluateModule): (JSC::JSModuleLoader::loadModule): (JSC::JSModuleLoader::requestImportModule): (JSC::JSModuleLoader::importModule): (JSC::JSModuleLoader::fetch): * runtime/JSModuleLoader.h: * runtime/JSScriptFetchParameters.cpp: Added. (JSC::JSScriptFetchParameters::destroy): * runtime/JSScriptFetchParameters.h: Added. (JSC::JSScriptFetchParameters::createStructure): (JSC::JSScriptFetchParameters::create): (JSC::JSScriptFetchParameters::parameters const): (JSC::JSScriptFetchParameters::JSScriptFetchParameters): Add ScriptFetchParameters' JSCell wrapper, JSScriptFetchParameters. It is used in the module pipeline. * runtime/JSType.h: * runtime/ModuleLoaderPrototype.cpp: (JSC::moduleLoaderPrototypeFetch): * runtime/ScriptFetchParameters.h: Added. (JSC::ScriptFetchParameters::~ScriptFetchParameters): Add ScriptFetchParameters. We can define our own custom ScriptFetchParameters by inheriting this class. WebCore creates ModuleFetchParameters by inheriting this. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WebCore: This patch extends module hooks to accept fetching parameters. When starting fetching modules, WebCore creates ModuleFetchParameters. And this parameters is propagated to the fetch hook. Then, fetch hook can use this parameters to fetch modules. This parameters only contains `integrity` field. This "integrity" is used to perform subresource integrity check in module loader pipeline. And this error is just proparaged as errors in module pipeline, which is the same to the other types of errors in module pipeline. Test: http/tests/subresource-integrity/sri-module.html * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Added. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): Take parameters, which includes "integrity". * bindings/js/CachedModuleScriptLoader.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderFetch): (WebCore::JSDOMWindowBase::moduleLoaderImportModule): import and fetch hooks take parameters. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::loadModule): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::loadModuleScript): Pass parameters to the entry point of the module pipeline. * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::fetch): If parameters are passed, we set them to CachedModuleScriptLoader. (WebCore::ScriptModuleLoader::importModule): Pass parameters to the entry point of dynamic import. (WebCore::ScriptModuleLoader::notifyFinished): If script loader has parameters, we perform subresource integrity check here. * bindings/js/ScriptModuleLoader.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::create): (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Create ModuleFetchParameters with "integrity" value. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: Copied from Source/WebCore/bindings/js/CachedModuleScriptLoader.h. (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::integrity const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): Pass "integrity" value to the module script. LayoutTests: * http/tests/subresource-integrity/resources/crossorigin-anon-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-creds-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-ineligible-script-module.js: Added. * http/tests/subresource-integrity/resources/matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/non-matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/sri-utilities.js: (add_result_callback): (SRIModuleTest): (SRIModuleTest.prototype.execute): * http/tests/subresource-integrity/sri-module-expected.txt: Added. * http/tests/subresource-integrity/sri-module.html: Added. * js/dom/modules/module-inline-ignore-integrity-expected.txt: Added. * js/dom/modules/module-inline-ignore-integrity.html: Added. * js/dom/modules/module-integrity-non-top-level-expected.txt: Added. * js/dom/modules/module-integrity-non-top-level.html: Added. * js/dom/modules/script-tests/module-integrity-non-top-level-2.js: Added. * js/dom/modules/script-tests/module-integrity-non-top-level.js: Added. Canonical link: https://commits.webkit.org/194461@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-12 13:12:48 +00:00
: m_integrity(integrity)
JS Modules in Workers https://bugs.webkit.org/show_bug.cgi?id=164860 Reviewed by Saam Barati. LayoutTests/imported/w3c: Some of worklet failures in WPT is because, 1. Previously, worklet does not support module. These tests are passing incorrectly when modules are not supported. Now, modules are supported, and some edge features are missing, so start failing 2. WPT is using www1.localhost in some tests (CSP tests), and this is not supported in WebKit's WPT testing. So failing incorrectly. * web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/non-object.tentative.any.worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/microtasks/checkpoint-after-workerglobalscope-onerror-module-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/alpha/base-url-worker-importScripts-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/alpha/base-url-worker.sub-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-1-nothrow-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-1-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-2-import-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-3-dynamic-worker-expected.txt: * web-platform-tests/service-workers/service-worker/import-module-scripts.https-expected.txt: * web-platform-tests/workers/baseurl/alpha/import-in-moduleworker-expected.txt: * web-platform-tests/workers/baseurl/alpha/importScripts-in-worker-expected.txt: * web-platform-tests/workers/baseurl/alpha/xhr-in-moduleworker-expected.txt: * web-platform-tests/workers/baseurl/alpha/xhr-in-worker-expected.txt: * web-platform-tests/workers/constructors/Worker/same-origin-expected.txt: * web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-expected.txt: * web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-module-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-csp-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-failure-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-meta-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-meta.html: * web-platform-tests/workers/modules/dedicated-worker-import-referrer-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import.any-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-options-type-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-parse-error-failure-expected.txt: * web-platform-tests/workers/name-property-expected.txt: * web-platform-tests/worklets/audio-worklet-credentials.https-expected.txt: * web-platform-tests/worklets/audio-worklet-csp.https-expected.txt: * web-platform-tests/worklets/audio-worklet-import.https-expected.txt: * web-platform-tests/worklets/audio-worklet-referrer.https-expected.txt: * web-platform-tests/xhr/open-url-redirected-worker-origin-expected.txt: Source/JavaScriptCore: Add error information to extract this in WebCore's module loader. Currently, we are using Promise pipeline, and this makes it a bit difficult to extract error information. This error information attached in this patch allows us to extract SyntaxError in WebCore, and throwing JS SyntaxError instead of AbortError. We are planning to update our module pipieline not using Promises in the future. The current design derived from the original module loader pipeline where using Promises is critical. But now, that proposal was abandoned, so we can just simplify the module loader. * runtime/AggregateError.cpp: (JSC::AggregateError::AggregateError): * runtime/Error.cpp: (JSC::createError): (JSC::createEvalError): (JSC::createRangeError): (JSC::createReferenceError): (JSC::createSyntaxError): (JSC::createTypeError): (JSC::createURIError): (JSC::createGetterTypeError): (JSC::throwSyntaxError): * runtime/Error.h: * runtime/ErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::ErrorInstance): (JSC::ErrorInstance::create): (JSC::ErrorInstance::sanitizedMessageString): (JSC::ErrorInstance::sanitizedNameString): (JSC::ErrorInstance::sanitizedToString): * runtime/ErrorInstance.h: (JSC::ErrorInstance::create): (JSC::ErrorInstance::errorType const): * runtime/JSGlobalObjectFunctions.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor<errorType>::constructImpl): (JSC::NativeErrorConstructor<errorType>::callImpl): * runtime/NullSetterFunction.cpp: (JSC::NullSetterFunctionInternal::JSC_DEFINE_HOST_FUNCTION): * wasm/js/JSWebAssemblyCompileError.cpp: (JSC::JSWebAssemblyCompileError::JSWebAssemblyCompileError): * wasm/js/JSWebAssemblyLinkError.cpp: (JSC::JSWebAssemblyLinkError::JSWebAssemblyLinkError): * wasm/js/JSWebAssemblyRuntimeError.cpp: (JSC::JSWebAssemblyRuntimeError::JSWebAssemblyRuntimeError): * wasm/js/WebAssemblyCompileErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyLinkErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): Source/WebCore: This patch implements JS modules in Workers and Worklets. We are not supporting modules in ServiceWorkers' initialization yet. But service-worker can import modules via JS `import()`. The worker can be executed as a module if we pass, `type: "module"` to worker options. Worklet is executed as modules by default. 1. In Worker, we first fetch the initial code. And then, analyze the dependencies and load subsequent modules. We iterate run-loop to load all the dependent modules in the module loader. At that time, we annotate run-loop tasks with special taskMode to iterate tasks with this taskMode. This prevents us from discarding different tasks in this run-loop driving phase. (e.g. postMessage can be called from the main thread while loading module graph, in that case, we should not discard this task.) 2. In Worklet, we just request module loading to ScriptModuleLoader, and run it after loading module graph. This is OK since worklet thread is already running. So we can just request modules and worklet thread automatically drives module loading via run-loop. * Headers.cmake: * Modules/webaudio/AudioWorkletGlobalScope.h: (WebCore::AudioWorkletGlobalScope::currentFrame const): Deleted. (WebCore::AudioWorkletGlobalScope::sampleRate const): Deleted. (WebCore::AudioWorkletGlobalScope::currentTime const): Deleted. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): (WebCore::CachedModuleScriptLoader::load): (WebCore::CachedModuleScriptLoader::notifyFinished): * bindings/js/CachedModuleScriptLoader.h: * bindings/js/CachedScriptFetcher.cpp: * bindings/js/JSDOMExceptionHandling.cpp: (WebCore::retrieveErrorMessageWithoutName): (WebCore::createDOMException): * bindings/js/JSDOMExceptionHandling.h: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::scriptModuleLoader): (WebCore::JSDOMGlobalObject::moduleLoaderResolve): (WebCore::JSDOMGlobalObject::moduleLoaderFetch): (WebCore::JSDOMGlobalObject::moduleLoaderEvaluate): (WebCore::JSDOMGlobalObject::moduleLoaderImportModule): (WebCore::JSDOMGlobalObject::moduleLoaderCreateImportMetaProperties): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderResolve): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderFetch): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderEvaluate): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderImportModule): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderCreateImportMetaProperties): Deleted. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkletGlobalScopeBase.cpp: * bindings/js/ModuleScriptLoader.h: Copied from Source/WebCore/dom/ModuleFetchParameters.h. (WebCore::ModuleScriptLoader::clearClient): (WebCore::ModuleScriptLoader::scriptFetcher): (WebCore::ModuleScriptLoader::parameters): (WebCore::ModuleScriptLoader::ModuleScriptLoader): * bindings/js/ModuleScriptLoaderClient.h: Renamed from Source/WebCore/bindings/js/CachedModuleScriptLoaderClient.h. * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::ScriptModuleLoader): (WebCore::resolveModuleSpecifier): (WebCore::ScriptModuleLoader::resolve): (WebCore::ScriptModuleLoader::fetch): (WebCore::ScriptModuleLoader::moduleURL): (WebCore::ScriptModuleLoader::responseURLFromRequestURL): (WebCore::ScriptModuleLoader::evaluate): (WebCore::ScriptModuleLoader::importModule): (WebCore::ScriptModuleLoader::notifyFinished): * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): * bindings/js/WorkerModuleScriptLoader.cpp: Added. (WebCore::WorkerModuleScriptLoader::create): (WebCore::WorkerModuleScriptLoader::WorkerModuleScriptLoader): (WebCore::WorkerModuleScriptLoader::~WorkerModuleScriptLoader): (WebCore::WorkerModuleScriptLoader::load): (WebCore::WorkerModuleScriptLoader::referrerPolicy): (WebCore::WorkerModuleScriptLoader::notifyFinished): (WebCore::WorkerModuleScriptLoader::taskMode): * bindings/js/WorkerModuleScriptLoader.h: Copied from Source/WebCore/dom/ModuleFetchParameters.h. * bindings/js/WorkerScriptFetcher.h: Added. * dom/Document.cpp: * dom/ExceptionCode.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Deleted. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::isTopLevelModule const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoader::create): * loader/ThreadableLoader.h: (WebCore::ThreadableLoader::create): * workers/DedicatedWorkerGlobalScope.h: * workers/Worker.cpp: (WebCore::Worker::Worker): (WebCore::Worker::create): (WebCore::Worker::notifyFinished): * workers/Worker.h: * workers/Worker.idl: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): (WebCore::WorkerGlobalScope::importScripts): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::credentials const): * workers/WorkerGlobalScopeProxy.h: * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerOrWorkletGlobalScope.cpp: (WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope): * workers/WorkerOrWorkletGlobalScope.h: (WebCore::WorkerOrWorkletGlobalScope::moduleLoader): * workers/WorkerOrWorkletScriptController.cpp: (WebCore::jsValueToModuleKey): (WebCore::WorkerOrWorkletScriptController::evaluateModule): (WebCore::WorkerOrWorkletScriptController::loadModuleSynchronously): (WebCore::WorkerOrWorkletScriptController::linkAndEvaluateModule): (WebCore::WorkerOrWorkletScriptController::loadAndEvaluateModule): * workers/WorkerOrWorkletScriptController.h: * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadAsynchronously): (WebCore::WorkerScriptLoader::didReceiveResponse): * workers/WorkerScriptLoader.h: (WebCore::WorkerScriptLoader::responseSource const): (WebCore::WorkerScriptLoader::isRedirected const): * workers/WorkerThread.cpp: (WebCore::WorkerParameters::isolatedCopy const): (WebCore::WorkerThread::evaluateScriptIfNecessary): * workers/WorkerThread.h: * workers/WorkerType.h: * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerGlobalScope.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::fetchScriptWithContext): * workers/service/ServiceWorkerRegistrationOptions.h: * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::ServiceWorkerThread): * workers/service/server/SWServerWorker.h: * worklets/PaintWorkletGlobalScope.h: (WebCore::PaintWorkletGlobalScope::paintDefinitionMap): Deleted. (WebCore::PaintWorkletGlobalScope::paintDefinitionLock): Deleted. (WebCore::PaintWorkletGlobalScope::~PaintWorkletGlobalScope): Deleted. * worklets/WorkletGlobalScope.cpp: (WebCore::WorkletGlobalScope::fetchAndInvokeScript): (WebCore::WorkletGlobalScope::processNextScriptFetchJobIfNeeded): Deleted. (WebCore::WorkletGlobalScope::didReceiveResponse): Deleted. (WebCore::WorkletGlobalScope::notifyFinished): Deleted. (WebCore::WorkletGlobalScope::didCompleteScriptFetchJob): Deleted. * worklets/WorkletGlobalScope.h: LayoutTests: * TestExpectations: * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt: * http/tests/subresource-integrity/sri-module-expected.txt: * webaudio/audioworklet-addModule-failure-expected.txt: * webaudio/worklet-crash-expected.txt: Canonical link: https://commits.webkit.org/234389@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-20 20:28:27 +00:00
, m_isTopLevelModule(isTopLevelModule)
Support integrity="" on module scripts https://bugs.webkit.org/show_bug.cgi?id=177959 Reviewed by Sam Weinig. Source/JavaScriptCore: This patch adds Subresource Integrity check for module scripts. Currently, only top-level module can be verified with integrity parameter since there is no way to perform integrity check onto the imported modules. In JSC side, we add `parameters` to the entry point of the module loader pipeline. This is fetching parameters and used when fetching modules. We separately pass this parameters to the pipeline along with the script fetcher. The script fetcher is only one for module graph since this is the initiator of this module graph loading. On the other hand, this parameters is for each module fetching. While setting "integrity" parameters to this script fetcher is sufficient to pass parameters to top-level-module's fetching, it is not enough for the future extension. In the future, we will investigate a way to pass parameters to each non-top-level module. At that time, this `parameters` should be per-module. This is because "integrity" value should be different for each module. For example, we will accept some form of syntax to add parameters to `import`. Some proposed syntax is like https://discourse.wicg.io/t/specifying-nonce-or-integrity-when-importing-modules/1861 import "./xxx.js" integrity "xxxxxxx" In this case, this `parameters` will be passed to "./xxx.js" module fetching. This `parameters` should be different from the one of top-level-module's one. That's why we need per-module `parameters` and why this patch adds `parameters` to the module pipeline. On the other hand, we also want to keep script fetcher. This `per-module-graph` thing is important to offer module-graph-wide information. For example, import.meta would have `import.meta.scriptElement`, which is the script element fetching the module graph including this. So, we keep the both, script fetcher and parameters. https://github.com/tc39/proposal-import-meta This parameters will be finally used by pipeline's fetch hook, and WebCore side can use this parameters to fetch modules. We also further clean up the module pipeline by dropping unnecessary features. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/ModuleLoaderPrototype.js: (requestFetch): (requestInstantiate): (requestSatisfy): (loadModule): (loadAndEvaluateModule): This loadAndEvaluateModule should be implemented by just calling loadModule and linkAndEvaluateModule. We can drop requestReady and requestLink. (requestLink): Deleted. (requestImportModule): Deleted. * jsc.cpp: (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderFetch): import and fetch hook takes parameters. Currently, we always pass `undefined` for import hook. When dynamic `import()` is extended to accept additional parameters like integrity, this parameters will be replaced with the actual value. (functionLoadModule): (runWithOptions): * runtime/Completion.cpp: (JSC::loadAndEvaluateModule): (JSC::loadModule): (JSC::importModule): * runtime/Completion.h: * runtime/JSGlobalObject.h: * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncImportModule): * runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::loadAndEvaluateModule): (JSC::JSModuleLoader::loadModule): (JSC::JSModuleLoader::requestImportModule): (JSC::JSModuleLoader::importModule): (JSC::JSModuleLoader::fetch): * runtime/JSModuleLoader.h: * runtime/JSScriptFetchParameters.cpp: Added. (JSC::JSScriptFetchParameters::destroy): * runtime/JSScriptFetchParameters.h: Added. (JSC::JSScriptFetchParameters::createStructure): (JSC::JSScriptFetchParameters::create): (JSC::JSScriptFetchParameters::parameters const): (JSC::JSScriptFetchParameters::JSScriptFetchParameters): Add ScriptFetchParameters' JSCell wrapper, JSScriptFetchParameters. It is used in the module pipeline. * runtime/JSType.h: * runtime/ModuleLoaderPrototype.cpp: (JSC::moduleLoaderPrototypeFetch): * runtime/ScriptFetchParameters.h: Added. (JSC::ScriptFetchParameters::~ScriptFetchParameters): Add ScriptFetchParameters. We can define our own custom ScriptFetchParameters by inheriting this class. WebCore creates ModuleFetchParameters by inheriting this. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WebCore: This patch extends module hooks to accept fetching parameters. When starting fetching modules, WebCore creates ModuleFetchParameters. And this parameters is propagated to the fetch hook. Then, fetch hook can use this parameters to fetch modules. This parameters only contains `integrity` field. This "integrity" is used to perform subresource integrity check in module loader pipeline. And this error is just proparaged as errors in module pipeline, which is the same to the other types of errors in module pipeline. Test: http/tests/subresource-integrity/sri-module.html * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Added. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): Take parameters, which includes "integrity". * bindings/js/CachedModuleScriptLoader.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderFetch): (WebCore::JSDOMWindowBase::moduleLoaderImportModule): import and fetch hooks take parameters. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::loadModule): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::loadModuleScript): Pass parameters to the entry point of the module pipeline. * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::fetch): If parameters are passed, we set them to CachedModuleScriptLoader. (WebCore::ScriptModuleLoader::importModule): Pass parameters to the entry point of dynamic import. (WebCore::ScriptModuleLoader::notifyFinished): If script loader has parameters, we perform subresource integrity check here. * bindings/js/ScriptModuleLoader.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::create): (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Create ModuleFetchParameters with "integrity" value. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: Copied from Source/WebCore/bindings/js/CachedModuleScriptLoader.h. (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::integrity const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): Pass "integrity" value to the module script. LayoutTests: * http/tests/subresource-integrity/resources/crossorigin-anon-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-creds-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-ineligible-script-module.js: Added. * http/tests/subresource-integrity/resources/matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/non-matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/sri-utilities.js: (add_result_callback): (SRIModuleTest): (SRIModuleTest.prototype.execute): * http/tests/subresource-integrity/sri-module-expected.txt: Added. * http/tests/subresource-integrity/sri-module.html: Added. * js/dom/modules/module-inline-ignore-integrity-expected.txt: Added. * js/dom/modules/module-inline-ignore-integrity.html: Added. * js/dom/modules/module-integrity-non-top-level-expected.txt: Added. * js/dom/modules/module-integrity-non-top-level.html: Added. * js/dom/modules/script-tests/module-integrity-non-top-level-2.js: Added. * js/dom/modules/script-tests/module-integrity-non-top-level.js: Added. Canonical link: https://commits.webkit.org/194461@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-12 13:12:48 +00:00
{
}
String m_integrity;
JS Modules in Workers https://bugs.webkit.org/show_bug.cgi?id=164860 Reviewed by Saam Barati. LayoutTests/imported/w3c: Some of worklet failures in WPT is because, 1. Previously, worklet does not support module. These tests are passing incorrectly when modules are not supported. Now, modules are supported, and some edge features are missing, so start failing 2. WPT is using www1.localhost in some tests (CSP tests), and this is not supported in WebKit's WPT testing. So failing incorrectly. * web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/non-object.tentative.any.worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/microtasks/checkpoint-after-workerglobalscope-onerror-module-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/alpha/base-url-worker-importScripts-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/alpha/base-url-worker.sub-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-1-nothrow-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-1-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-2-import-worker-expected.txt: * web-platform-tests/html/semantics/scripting-1/the-script-element/module/evaluation-order-3-dynamic-worker-expected.txt: * web-platform-tests/service-workers/service-worker/import-module-scripts.https-expected.txt: * web-platform-tests/workers/baseurl/alpha/import-in-moduleworker-expected.txt: * web-platform-tests/workers/baseurl/alpha/importScripts-in-worker-expected.txt: * web-platform-tests/workers/baseurl/alpha/xhr-in-moduleworker-expected.txt: * web-platform-tests/workers/baseurl/alpha/xhr-in-worker-expected.txt: * web-platform-tests/workers/constructors/Worker/same-origin-expected.txt: * web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-expected.txt: * web-platform-tests/workers/interfaces/WorkerGlobalScope/location/redirect-module-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-csp-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-failure-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-meta-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import-meta.html: * web-platform-tests/workers/modules/dedicated-worker-import-referrer-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-import.any-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-options-type-expected.txt: * web-platform-tests/workers/modules/dedicated-worker-parse-error-failure-expected.txt: * web-platform-tests/workers/name-property-expected.txt: * web-platform-tests/worklets/audio-worklet-credentials.https-expected.txt: * web-platform-tests/worklets/audio-worklet-csp.https-expected.txt: * web-platform-tests/worklets/audio-worklet-import.https-expected.txt: * web-platform-tests/worklets/audio-worklet-referrer.https-expected.txt: * web-platform-tests/xhr/open-url-redirected-worker-origin-expected.txt: Source/JavaScriptCore: Add error information to extract this in WebCore's module loader. Currently, we are using Promise pipeline, and this makes it a bit difficult to extract error information. This error information attached in this patch allows us to extract SyntaxError in WebCore, and throwing JS SyntaxError instead of AbortError. We are planning to update our module pipieline not using Promises in the future. The current design derived from the original module loader pipeline where using Promises is critical. But now, that proposal was abandoned, so we can just simplify the module loader. * runtime/AggregateError.cpp: (JSC::AggregateError::AggregateError): * runtime/Error.cpp: (JSC::createError): (JSC::createEvalError): (JSC::createRangeError): (JSC::createReferenceError): (JSC::createSyntaxError): (JSC::createTypeError): (JSC::createURIError): (JSC::createGetterTypeError): (JSC::throwSyntaxError): * runtime/Error.h: * runtime/ErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::ErrorInstance): (JSC::ErrorInstance::create): (JSC::ErrorInstance::sanitizedMessageString): (JSC::ErrorInstance::sanitizedNameString): (JSC::ErrorInstance::sanitizedToString): * runtime/ErrorInstance.h: (JSC::ErrorInstance::create): (JSC::ErrorInstance::errorType const): * runtime/JSGlobalObjectFunctions.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor<errorType>::constructImpl): (JSC::NativeErrorConstructor<errorType>::callImpl): * runtime/NullSetterFunction.cpp: (JSC::NullSetterFunctionInternal::JSC_DEFINE_HOST_FUNCTION): * wasm/js/JSWebAssemblyCompileError.cpp: (JSC::JSWebAssemblyCompileError::JSWebAssemblyCompileError): * wasm/js/JSWebAssemblyLinkError.cpp: (JSC::JSWebAssemblyLinkError::JSWebAssemblyLinkError): * wasm/js/JSWebAssemblyRuntimeError.cpp: (JSC::JSWebAssemblyRuntimeError::JSWebAssemblyRuntimeError): * wasm/js/WebAssemblyCompileErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyLinkErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): Source/WebCore: This patch implements JS modules in Workers and Worklets. We are not supporting modules in ServiceWorkers' initialization yet. But service-worker can import modules via JS `import()`. The worker can be executed as a module if we pass, `type: "module"` to worker options. Worklet is executed as modules by default. 1. In Worker, we first fetch the initial code. And then, analyze the dependencies and load subsequent modules. We iterate run-loop to load all the dependent modules in the module loader. At that time, we annotate run-loop tasks with special taskMode to iterate tasks with this taskMode. This prevents us from discarding different tasks in this run-loop driving phase. (e.g. postMessage can be called from the main thread while loading module graph, in that case, we should not discard this task.) 2. In Worklet, we just request module loading to ScriptModuleLoader, and run it after loading module graph. This is OK since worklet thread is already running. So we can just request modules and worklet thread automatically drives module loading via run-loop. * Headers.cmake: * Modules/webaudio/AudioWorkletGlobalScope.h: (WebCore::AudioWorkletGlobalScope::currentFrame const): Deleted. (WebCore::AudioWorkletGlobalScope::sampleRate const): Deleted. (WebCore::AudioWorkletGlobalScope::currentTime const): Deleted. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): (WebCore::CachedModuleScriptLoader::load): (WebCore::CachedModuleScriptLoader::notifyFinished): * bindings/js/CachedModuleScriptLoader.h: * bindings/js/CachedScriptFetcher.cpp: * bindings/js/JSDOMExceptionHandling.cpp: (WebCore::retrieveErrorMessageWithoutName): (WebCore::createDOMException): * bindings/js/JSDOMExceptionHandling.h: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::scriptModuleLoader): (WebCore::JSDOMGlobalObject::moduleLoaderResolve): (WebCore::JSDOMGlobalObject::moduleLoaderFetch): (WebCore::JSDOMGlobalObject::moduleLoaderEvaluate): (WebCore::JSDOMGlobalObject::moduleLoaderImportModule): (WebCore::JSDOMGlobalObject::moduleLoaderCreateImportMetaProperties): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderResolve): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderFetch): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderEvaluate): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderImportModule): Deleted. (WebCore::JSDOMWindowBase::moduleLoaderCreateImportMetaProperties): Deleted. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkletGlobalScopeBase.cpp: * bindings/js/ModuleScriptLoader.h: Copied from Source/WebCore/dom/ModuleFetchParameters.h. (WebCore::ModuleScriptLoader::clearClient): (WebCore::ModuleScriptLoader::scriptFetcher): (WebCore::ModuleScriptLoader::parameters): (WebCore::ModuleScriptLoader::ModuleScriptLoader): * bindings/js/ModuleScriptLoaderClient.h: Renamed from Source/WebCore/bindings/js/CachedModuleScriptLoaderClient.h. * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::ScriptModuleLoader): (WebCore::resolveModuleSpecifier): (WebCore::ScriptModuleLoader::resolve): (WebCore::ScriptModuleLoader::fetch): (WebCore::ScriptModuleLoader::moduleURL): (WebCore::ScriptModuleLoader::responseURLFromRequestURL): (WebCore::ScriptModuleLoader::evaluate): (WebCore::ScriptModuleLoader::importModule): (WebCore::ScriptModuleLoader::notifyFinished): * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): * bindings/js/WorkerModuleScriptLoader.cpp: Added. (WebCore::WorkerModuleScriptLoader::create): (WebCore::WorkerModuleScriptLoader::WorkerModuleScriptLoader): (WebCore::WorkerModuleScriptLoader::~WorkerModuleScriptLoader): (WebCore::WorkerModuleScriptLoader::load): (WebCore::WorkerModuleScriptLoader::referrerPolicy): (WebCore::WorkerModuleScriptLoader::notifyFinished): (WebCore::WorkerModuleScriptLoader::taskMode): * bindings/js/WorkerModuleScriptLoader.h: Copied from Source/WebCore/dom/ModuleFetchParameters.h. * bindings/js/WorkerScriptFetcher.h: Added. * dom/Document.cpp: * dom/ExceptionCode.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Deleted. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::isTopLevelModule const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoader::create): * loader/ThreadableLoader.h: (WebCore::ThreadableLoader::create): * workers/DedicatedWorkerGlobalScope.h: * workers/Worker.cpp: (WebCore::Worker::Worker): (WebCore::Worker::create): (WebCore::Worker::notifyFinished): * workers/Worker.h: * workers/Worker.idl: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): (WebCore::WorkerGlobalScope::importScripts): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::credentials const): * workers/WorkerGlobalScopeProxy.h: * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerOrWorkletGlobalScope.cpp: (WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope): * workers/WorkerOrWorkletGlobalScope.h: (WebCore::WorkerOrWorkletGlobalScope::moduleLoader): * workers/WorkerOrWorkletScriptController.cpp: (WebCore::jsValueToModuleKey): (WebCore::WorkerOrWorkletScriptController::evaluateModule): (WebCore::WorkerOrWorkletScriptController::loadModuleSynchronously): (WebCore::WorkerOrWorkletScriptController::linkAndEvaluateModule): (WebCore::WorkerOrWorkletScriptController::loadAndEvaluateModule): * workers/WorkerOrWorkletScriptController.h: * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadAsynchronously): (WebCore::WorkerScriptLoader::didReceiveResponse): * workers/WorkerScriptLoader.h: (WebCore::WorkerScriptLoader::responseSource const): (WebCore::WorkerScriptLoader::isRedirected const): * workers/WorkerThread.cpp: (WebCore::WorkerParameters::isolatedCopy const): (WebCore::WorkerThread::evaluateScriptIfNecessary): * workers/WorkerThread.h: * workers/WorkerType.h: * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerGlobalScope.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::fetchScriptWithContext): * workers/service/ServiceWorkerRegistrationOptions.h: * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::ServiceWorkerThread): * workers/service/server/SWServerWorker.h: * worklets/PaintWorkletGlobalScope.h: (WebCore::PaintWorkletGlobalScope::paintDefinitionMap): Deleted. (WebCore::PaintWorkletGlobalScope::paintDefinitionLock): Deleted. (WebCore::PaintWorkletGlobalScope::~PaintWorkletGlobalScope): Deleted. * worklets/WorkletGlobalScope.cpp: (WebCore::WorkletGlobalScope::fetchAndInvokeScript): (WebCore::WorkletGlobalScope::processNextScriptFetchJobIfNeeded): Deleted. (WebCore::WorkletGlobalScope::didReceiveResponse): Deleted. (WebCore::WorkletGlobalScope::notifyFinished): Deleted. (WebCore::WorkletGlobalScope::didCompleteScriptFetchJob): Deleted. * worklets/WorkletGlobalScope.h: LayoutTests: * TestExpectations: * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt: * http/tests/subresource-integrity/sri-module-expected.txt: * webaudio/audioworklet-addModule-failure-expected.txt: * webaudio/worklet-crash-expected.txt: Canonical link: https://commits.webkit.org/234389@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-20 20:28:27 +00:00
bool m_isTopLevelModule;
Support integrity="" on module scripts https://bugs.webkit.org/show_bug.cgi?id=177959 Reviewed by Sam Weinig. Source/JavaScriptCore: This patch adds Subresource Integrity check for module scripts. Currently, only top-level module can be verified with integrity parameter since there is no way to perform integrity check onto the imported modules. In JSC side, we add `parameters` to the entry point of the module loader pipeline. This is fetching parameters and used when fetching modules. We separately pass this parameters to the pipeline along with the script fetcher. The script fetcher is only one for module graph since this is the initiator of this module graph loading. On the other hand, this parameters is for each module fetching. While setting "integrity" parameters to this script fetcher is sufficient to pass parameters to top-level-module's fetching, it is not enough for the future extension. In the future, we will investigate a way to pass parameters to each non-top-level module. At that time, this `parameters` should be per-module. This is because "integrity" value should be different for each module. For example, we will accept some form of syntax to add parameters to `import`. Some proposed syntax is like https://discourse.wicg.io/t/specifying-nonce-or-integrity-when-importing-modules/1861 import "./xxx.js" integrity "xxxxxxx" In this case, this `parameters` will be passed to "./xxx.js" module fetching. This `parameters` should be different from the one of top-level-module's one. That's why we need per-module `parameters` and why this patch adds `parameters` to the module pipeline. On the other hand, we also want to keep script fetcher. This `per-module-graph` thing is important to offer module-graph-wide information. For example, import.meta would have `import.meta.scriptElement`, which is the script element fetching the module graph including this. So, we keep the both, script fetcher and parameters. https://github.com/tc39/proposal-import-meta This parameters will be finally used by pipeline's fetch hook, and WebCore side can use this parameters to fetch modules. We also further clean up the module pipeline by dropping unnecessary features. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/ModuleLoaderPrototype.js: (requestFetch): (requestInstantiate): (requestSatisfy): (loadModule): (loadAndEvaluateModule): This loadAndEvaluateModule should be implemented by just calling loadModule and linkAndEvaluateModule. We can drop requestReady and requestLink. (requestLink): Deleted. (requestImportModule): Deleted. * jsc.cpp: (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderFetch): import and fetch hook takes parameters. Currently, we always pass `undefined` for import hook. When dynamic `import()` is extended to accept additional parameters like integrity, this parameters will be replaced with the actual value. (functionLoadModule): (runWithOptions): * runtime/Completion.cpp: (JSC::loadAndEvaluateModule): (JSC::loadModule): (JSC::importModule): * runtime/Completion.h: * runtime/JSGlobalObject.h: * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncImportModule): * runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::loadAndEvaluateModule): (JSC::JSModuleLoader::loadModule): (JSC::JSModuleLoader::requestImportModule): (JSC::JSModuleLoader::importModule): (JSC::JSModuleLoader::fetch): * runtime/JSModuleLoader.h: * runtime/JSScriptFetchParameters.cpp: Added. (JSC::JSScriptFetchParameters::destroy): * runtime/JSScriptFetchParameters.h: Added. (JSC::JSScriptFetchParameters::createStructure): (JSC::JSScriptFetchParameters::create): (JSC::JSScriptFetchParameters::parameters const): (JSC::JSScriptFetchParameters::JSScriptFetchParameters): Add ScriptFetchParameters' JSCell wrapper, JSScriptFetchParameters. It is used in the module pipeline. * runtime/JSType.h: * runtime/ModuleLoaderPrototype.cpp: (JSC::moduleLoaderPrototypeFetch): * runtime/ScriptFetchParameters.h: Added. (JSC::ScriptFetchParameters::~ScriptFetchParameters): Add ScriptFetchParameters. We can define our own custom ScriptFetchParameters by inheriting this class. WebCore creates ModuleFetchParameters by inheriting this. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WebCore: This patch extends module hooks to accept fetching parameters. When starting fetching modules, WebCore creates ModuleFetchParameters. And this parameters is propagated to the fetch hook. Then, fetch hook can use this parameters to fetch modules. This parameters only contains `integrity` field. This "integrity" is used to perform subresource integrity check in module loader pipeline. And this error is just proparaged as errors in module pipeline, which is the same to the other types of errors in module pipeline. Test: http/tests/subresource-integrity/sri-module.html * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Added. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): Take parameters, which includes "integrity". * bindings/js/CachedModuleScriptLoader.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderFetch): (WebCore::JSDOMWindowBase::moduleLoaderImportModule): import and fetch hooks take parameters. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::loadModule): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::loadModuleScript): Pass parameters to the entry point of the module pipeline. * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::fetch): If parameters are passed, we set them to CachedModuleScriptLoader. (WebCore::ScriptModuleLoader::importModule): Pass parameters to the entry point of dynamic import. (WebCore::ScriptModuleLoader::notifyFinished): If script loader has parameters, we perform subresource integrity check here. * bindings/js/ScriptModuleLoader.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::create): (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Create ModuleFetchParameters with "integrity" value. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: Copied from Source/WebCore/bindings/js/CachedModuleScriptLoader.h. (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::integrity const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): Pass "integrity" value to the module script. LayoutTests: * http/tests/subresource-integrity/resources/crossorigin-anon-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-creds-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-ineligible-script-module.js: Added. * http/tests/subresource-integrity/resources/matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/non-matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/sri-utilities.js: (add_result_callback): (SRIModuleTest): (SRIModuleTest.prototype.execute): * http/tests/subresource-integrity/sri-module-expected.txt: Added. * http/tests/subresource-integrity/sri-module.html: Added. * js/dom/modules/module-inline-ignore-integrity-expected.txt: Added. * js/dom/modules/module-inline-ignore-integrity.html: Added. * js/dom/modules/module-integrity-non-top-level-expected.txt: Added. * js/dom/modules/module-integrity-non-top-level.html: Added. * js/dom/modules/script-tests/module-integrity-non-top-level-2.js: Added. * js/dom/modules/script-tests/module-integrity-non-top-level.js: Added. Canonical link: https://commits.webkit.org/194461@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-12 13:12:48 +00:00
};
} // namespace WebCore