Changeset 268700 in webkit
- Timestamp:
- Oct 19, 2020, 4:50:58 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 38 edited
-
ChangeLog (modified) (1 diff)
-
Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp (modified) (4 diffs)
-
Modules/cache/DOMCache.cpp (modified) (1 diff)
-
Modules/fetch/FetchResponse.cpp (modified) (1 diff)
-
Modules/indexeddb/server/IDBSerializationContext.cpp (modified) (1 diff)
-
Modules/indexeddb/server/IDBSerializationContext.h (modified) (1 diff)
-
Modules/indexeddb/server/MemoryObjectStore.cpp (modified) (2 diffs)
-
Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (modified) (1 diff)
-
Modules/indexeddb/server/UniqueIDBDatabase.cpp (modified) (1 diff)
-
Modules/paymentrequest/PaymentRequest.cpp (modified) (5 diffs)
-
Modules/webxr/WebXRSystem.cpp (modified) (1 diff)
-
bindings/js/JSCustomElementInterface.cpp (modified) (1 diff)
-
bindings/js/JSDOMGlobalObject.cpp (modified) (1 diff)
-
bindings/js/ScriptState.cpp (modified) (3 diffs)
-
bindings/js/ScriptState.h (modified) (2 diffs)
-
bindings/js/WorkerScriptController.cpp (modified) (1 diff)
-
bindings/js/WorkerScriptController.h (modified) (1 diff)
-
dom/ScriptExecutionContext.cpp (modified) (2 diffs)
-
dom/ScriptExecutionContext.h (modified) (1 diff)
-
fileapi/Blob.cpp (modified) (1 diff)
-
html/parser/HTMLDocumentParser.cpp (modified) (1 diff)
-
inspector/InspectorFrontendHost.cpp (modified) (2 diffs)
-
inspector/InspectorInstrumentation.cpp (modified) (1 diff)
-
inspector/agents/InspectorAnimationAgent.cpp (modified) (1 diff)
-
inspector/agents/InspectorCanvasAgent.cpp (modified) (1 diff)
-
inspector/agents/InspectorDOMAgent.cpp (modified) (3 diffs)
-
inspector/agents/InspectorDOMDebuggerAgent.cpp (modified) (2 diffs)
-
inspector/agents/InspectorIndexedDBAgent.cpp (modified) (3 diffs)
-
inspector/agents/WebDebuggerAgent.cpp (modified) (2 diffs)
-
inspector/agents/page/PageDebuggerAgent.cpp (modified) (1 diff)
-
inspector/agents/worker/WorkerAuditAgent.cpp (modified) (1 diff)
-
inspector/agents/worker/WorkerDebuggerAgent.cpp (modified) (1 diff)
-
inspector/agents/worker/WorkerRuntimeAgent.cpp (modified) (1 diff)
-
testing/WebXRTest.cpp (modified) (1 diff)
-
testing/js/WebCoreTestSupport.cpp (modified) (1 diff)
-
workers/WorkerOrWorkletScriptController.h (modified) (1 diff)
-
worklets/WorkletScriptController.cpp (modified) (1 diff)
-
worklets/WorkletScriptController.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r268697 r268700 1 2020-10-19 Chris Dumez <cdumez@apple.com> 2 3 Replace execStateFrom*() functions with globalObject() overloads 4 https://bugs.webkit.org/show_bug.cgi?id=217912 5 6 Reviewed by Darin Adler. 7 8 Introduce globalObject() overloads to replace existing execStateFrom*() functions. 9 This is a first step to promote code sharing. Ideally, code would not have to 10 differentiate workers from worklets as much as possible. 11 12 No new tests, no Web-facing behavior change. 13 14 * bindings/js/JSDOMGlobalObject.cpp: 15 (WebCore::JSDOMGlobalObject::scriptExecutionContext const): 16 * bindings/js/ScriptState.cpp: 17 (WebCore::execStateFromWorkerOrWorkletGlobalScope): 18 * bindings/js/ScriptState.h: 19 * bindings/js/WorkerScriptController.cpp: 20 (WebCore::WorkerScriptController::globalScopeWrapper): 21 * bindings/js/WorkerScriptController.h: 22 * dom/ScriptExecutionContext.cpp: 23 (WebCore::ScriptExecutionContext::vm): 24 (WebCore::ScriptExecutionContext::execState): 25 * inspector/agents/worker/WorkerAuditAgent.cpp: 26 (WebCore::WorkerAuditAgent::injectedScriptForEval): 27 * inspector/agents/worker/WorkerDebuggerAgent.cpp: 28 (WebCore::WorkerDebuggerAgent::injectedScriptForEval): 29 * inspector/agents/worker/WorkerRuntimeAgent.cpp: 30 (WebCore::WorkerRuntimeAgent::injectedScriptForEval): 31 * workers/WorkerOrWorkletScriptController.h: 32 * worklets/WorkletScriptController.cpp: 33 (WebCore::WorkletScriptController::globalScopeWrapper): 34 * worklets/WorkletScriptController.h: 35 1 36 2020-10-19 Timothy Horton <timothy_horton@apple.com> 2 37 -
trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp
r262620 r268700 68 68 69 69 auto throwScope = DECLARE_THROW_SCOPE(context.vm()); 70 auto applePayRequest = convertDictionary<ApplePayRequest>(*context. execState(), data);70 auto applePayRequest = convertDictionary<ApplePayRequest>(*context.globalObject(), data); 71 71 if (throwScope.exception()) 72 72 return Exception { ExistingExceptionError }; … … 306 306 continue; 307 307 308 auto& lexicalGlobalObject = *document(). execState();308 auto& lexicalGlobalObject = *document().globalObject(); 309 309 auto scope = DECLARE_THROW_SCOPE(lexicalGlobalObject.vm()); 310 310 JSC::JSValue data; … … 404 404 auto& context = *scriptExecutionContext(); 405 405 auto throwScope = DECLARE_THROW_SCOPE(context.vm()); 406 auto applePayErrors = convert<IDLSequence<IDLInterface<ApplePayError>>>(*context. execState(), paymentMethodErrors);406 auto applePayErrors = convert<IDLSequence<IDLInterface<ApplePayError>>>(*context.globalObject(), paymentMethodErrors); 407 407 if (throwScope.exception()) 408 408 return Exception { ExistingExceptionError }; … … 443 443 444 444 String errorMessage; 445 auto merchantSession = PaymentMerchantSession::fromJS(*document(). execState(), asObject(merchantSessionValue), errorMessage);445 auto merchantSession = PaymentMerchantSession::fromJS(*document().globalObject(), asObject(merchantSessionValue), errorMessage); 446 446 if (!merchantSession) 447 447 return Exception { TypeError, WTFMove(errorMessage) }; -
trunk/Source/WebCore/Modules/cache/DOMCache.cpp
r263883 r268700 367 367 // FIXME: for efficiency, we should load blobs directly instead of going through the readableStream path. 368 368 if (response->isBlobBody()) { 369 auto streamOrException = response->readableStream(*scriptExecutionContext()-> execState());369 auto streamOrException = response->readableStream(*scriptExecutionContext()->globalObject()); 370 370 if (UNLIKELY(streamOrException.hasException())) { 371 371 promise.reject(streamOrException.releaseException()); -
trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp
r266087 r268700 179 179 // If loading, let's create a stream so that data is teed on both clones. 180 180 if (isLoading() && !m_readableStreamSource) { 181 auto voidOrException = createReadableStream(*context. execState());181 auto voidOrException = createReadableStream(*context.globalObject()); 182 182 if (UNLIKELY(voidOrException.hasException())) 183 183 return voidOrException.releaseException(); -
trunk/Source/WebCore/Modules/indexeddb/server/IDBSerializationContext.cpp
r264486 r268700 92 92 } 93 93 94 JSC::JSGlobalObject& IDBSerializationContext:: execState()94 JSC::JSGlobalObject& IDBSerializationContext::globalObject() 95 95 { 96 96 initializeVM(); -
trunk/Source/WebCore/Modules/indexeddb/server/IDBSerializationContext.h
r264486 r268700 49 49 50 50 JSC::VM& vm(); 51 JSC::JSGlobalObject& execState();51 JSC::JSGlobalObject& globalObject(); 52 52 53 53 private: -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp
r261572 r268700 253 253 IDBError MemoryObjectStore::addRecord(MemoryBackingStoreTransaction& transaction, const IDBKeyData& keyData, const IDBValue& value) 254 254 { 255 auto indexKeys = generateIndexKeyMapForValue(m_serializationContext-> execState(), m_info, keyData, value);255 auto indexKeys = generateIndexKeyMapForValue(m_serializationContext->globalObject(), m_info, keyData, value); 256 256 return addRecord(transaction, keyData, indexKeys, value); 257 257 } … … 343 343 344 344 for (const auto& iterator : *m_keyValueStore) { 345 auto jsValue = deserializeIDBValueToJSValue(m_serializationContext-> execState(), iterator.value);345 auto jsValue = deserializeIDBValueToJSValue(m_serializationContext->globalObject(), iterator.value); 346 346 if (jsValue.isUndefinedOrNull()) 347 347 return IDBError { }; 348 348 349 349 IndexKey indexKey; 350 generateIndexKeyForValue(m_serializationContext-> execState(), index.info(), jsValue, indexKey, m_info.keyPath(), iterator.key);350 generateIndexKeyForValue(m_serializationContext->globalObject(), index.info(), jsValue, indexKey, m_info.keyPath(), iterator.key); 351 351 352 352 if (indexKey.isNull()) -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
r267857 r268700 2087 2087 JSLockHolder locker(m_serializationContext->vm()); 2088 2088 2089 auto jsValue = deserializeIDBValueToJSValue(m_serializationContext-> execState(), value);2089 auto jsValue = deserializeIDBValueToJSValue(m_serializationContext->globalObject(), value); 2090 2090 if (jsValue.isUndefinedOrNull()) 2091 2091 return IDBError { }; 2092 2092 2093 2093 IndexKey indexKey; 2094 generateIndexKeyForValue(m_serializationContext-> execState(), info, jsValue, indexKey, objectStoreInfo.keyPath(), key);2094 generateIndexKeyForValue(m_serializationContext->globalObject(), info, jsValue, indexKey, objectStoreInfo.keyPath(), key); 2095 2095 2096 2096 if (indexKey.isNull()) -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
r263041 r268700 759 759 760 760 // Generate index keys up front for more accurate quota check. 761 auto indexKeys = generateIndexKeyMapForValue(m_backingStore->serializationContext(). execState(), *objectStoreInfo, usedKey, value);761 auto indexKeys = generateIndexKeyMapForValue(m_backingStore->serializationContext().globalObject(), *objectStoreInfo, usedKey, value); 762 762 763 763 if (overwriteMode == IndexedDB::ObjectStoreOverwriteMode::NoOverwrite) { -
trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp
r260707 r268700 309 309 { 310 310 auto scope = DECLARE_THROW_SCOPE(context.vm()); 311 JSC::JSValue data = JSONParse(context. execState(), string);311 JSC::JSValue data = JSONParse(context.globalObject(), string); 312 312 if (scope.exception()) 313 313 return Exception { ExistingExceptionError }; … … 338 338 String serializedData; 339 339 if (paymentMethod.data) { 340 auto scope = DECLARE_THROW_SCOPE(document. execState()->vm());341 serializedData = JSONStringify(document. execState(), paymentMethod.data.get(), 0);340 auto scope = DECLARE_THROW_SCOPE(document.globalObject()->vm()); 341 serializedData = JSONStringify(document.globalObject(), paymentMethod.data.get(), 0); 342 342 if (scope.exception()) 343 343 return Exception { ExistingExceptionError }; … … 358 358 return totalResult.releaseException(); 359 359 360 auto detailsResult = checkAndCanonicalizeDetails(*document. execState(), details, options.requestShipping, ShouldValidatePaymentMethodIdentifier::No);360 auto detailsResult = checkAndCanonicalizeDetails(*document.globalObject(), details, options.requestShipping, ShouldValidatePaymentMethodIdentifier::No); 361 361 if (detailsResult.hasException()) 362 362 return detailsResult.releaseException(); … … 648 648 auto& context = *m_detailsPromise->scriptExecutionContext(); 649 649 auto throwScope = DECLARE_THROW_SCOPE(context.vm()); 650 auto detailsUpdate = convertDictionary<PaymentDetailsUpdate>(*context. execState(), m_detailsPromise->result());650 auto detailsUpdate = convertDictionary<PaymentDetailsUpdate>(*context.globalObject(), m_detailsPromise->result()); 651 651 if (throwScope.exception()) { 652 652 abortWithException(Exception { ExistingExceptionError }); … … 660 660 } 661 661 662 auto detailsResult = checkAndCanonicalizeDetails(*context. execState(), detailsUpdate, m_options.requestShipping, ShouldValidatePaymentMethodIdentifier::Yes);662 auto detailsResult = checkAndCanonicalizeDetails(*context.globalObject(), detailsUpdate, m_options.requestShipping, ShouldValidatePaymentMethodIdentifier::Yes); 663 663 if (detailsResult.hasException()) { 664 664 abortWithException(detailsResult.releaseException()); -
trunk/Source/WebCore/Modules/webxr/WebXRSystem.cpp
r268255 r268700 389 389 return; 390 390 391 auto* globalObject = protectedDocument-> execState();391 auto* globalObject = protectedDocument->globalObject(); 392 392 if (!globalObject) 393 393 return; -
trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp
r266269 r268700 100 100 101 101 ASSERT(&document == scriptExecutionContext()); 102 auto& lexicalGlobalObject = *document. execState();102 auto& lexicalGlobalObject = *document.globalObject(); 103 103 auto element = constructCustomElementSynchronously(document, vm, lexicalGlobalObject, m_constructor.get(), localName); 104 104 EXCEPTION_ASSERT(!!scope.exception() == !element); -
trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
r268161 r268700 225 225 if (inherits<JSWorkerGlobalScopeBase>(vm())) 226 226 return jsCast<const JSWorkerGlobalScopeBase*>(this)->scriptExecutionContext(); 227 #if ENABLE(CSS_PAINTING_API)228 227 if (inherits<JSWorkletGlobalScopeBase>(vm())) 229 228 return jsCast<const JSWorkletGlobalScopeBase*>(this)->scriptExecutionContext(); 230 #endif231 229 #if ENABLE(INDEXED_DATABASE) 232 230 if (inherits<JSIDBSerializationGlobalObject>(vm())) -
trunk/Source/WebCore/bindings/js/ScriptState.cpp
r251425 r268700 40 40 #include "Page.h" 41 41 #include "ScriptController.h" 42 #include "Worker GlobalScope.h"42 #include "WorkerOrWorkletGlobalScope.h" 43 43 #include "WorkerScriptController.h" 44 44 #include "WorkletGlobalScope.h" … … 82 82 } 83 83 84 JSC::JSGlobalObject* execStateFromNode(DOMWrapperWorld& world, Node* node)84 JSC::JSGlobalObject* globalObject(DOMWrapperWorld& world, Node* node) 85 85 { 86 86 if (!node) … … 94 94 } 95 95 96 JSC::JSGlobalObject* execStateFromPage(DOMWrapperWorld& world, Page* page)96 JSC::JSGlobalObject* globalObject(DOMWrapperWorld& world, Page* page) 97 97 { 98 98 return page ? page->mainFrame().script().globalObject(world) : nullptr; 99 99 } 100 100 101 JSC::JSGlobalObject* execStateFromWorkerGlobalScope(WorkerGlobalScope& workerGlobalScope)101 JSC::JSGlobalObject* globalObject(WorkerOrWorkletGlobalScope& workerOrWorkletGlobalScope) 102 102 { 103 return workerGlobalScope.script()->workerGlobalScopeWrapper(); 103 if (auto* scriptController = workerOrWorkletGlobalScope.script()) 104 return scriptController->globalScopeWrapper(); 105 return nullptr; 104 106 } 105 107 106 #if ENABLE(CSS_PAINTING_API)107 JSC::JSGlobalObject* execStateFromWorkletGlobalScope(WorkletGlobalScope& workletGlobalScope)108 {109 if (!workletGlobalScope.script())110 return nullptr;111 return workletGlobalScope.script()->workletGlobalScopeWrapper();112 108 } 113 #endif114 115 } -
trunk/Source/WebCore/bindings/js/ScriptState.h
r251436 r268700 45 45 class Page; 46 46 class ScriptExecutionContext; 47 class WorkerGlobalScope; 48 #if ENABLE(CSS_PAINTING_API) 49 class WorkletGlobalScope; 50 #endif 47 class WorkerOrWorkletGlobalScope; 51 48 52 49 DOMWindow* domWindowFromExecState(JSC::JSGlobalObject*); … … 56 53 JSC::JSGlobalObject* mainWorldExecState(Frame*); 57 54 58 JSC::JSGlobalObject* execStateFromNode(DOMWrapperWorld&, Node*); 59 WEBCORE_EXPORT JSC::JSGlobalObject* execStateFromPage(DOMWrapperWorld&, Page*); 60 JSC::JSGlobalObject* execStateFromWorkerGlobalScope(WorkerGlobalScope&); 61 #if ENABLE(CSS_PAINTING_API) 62 JSC::JSGlobalObject* execStateFromWorkletGlobalScope(WorkletGlobalScope&); 63 #endif 55 JSC::JSGlobalObject* globalObject(DOMWrapperWorld&, Node*); 56 WEBCORE_EXPORT JSC::JSGlobalObject* globalObject(DOMWrapperWorld&, Page*); 57 JSC::JSGlobalObject* globalObject(WorkerOrWorkletGlobalScope&); 64 58 65 59 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp
r264617 r268700 280 280 } 281 281 282 JSC::JSGlobalObject* WorkerScriptController::globalScopeWrapper() 283 { 284 return workerGlobalScopeWrapper(); 285 } 286 282 287 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/WorkerScriptController.h
r267859 r268700 58 58 } 59 59 60 JSC::JSGlobalObject* globalScopeWrapper() final; 61 60 62 void evaluate(const ScriptSourceCode&, String* returnedExceptionMessage = nullptr); 61 63 void evaluate(const ScriptSourceCode&, NakedPtr<JSC::Exception>& returnedException, String* returnedExceptionMessage = nullptr); -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r268271 r268700 484 484 if (is<WorkerGlobalScope>(*this)) 485 485 return downcast<WorkerGlobalScope>(*this).script()->vm(); 486 #if ENABLE(CSS_PAINTING_API)487 486 if (is<WorkletGlobalScope>(*this)) 488 487 return downcast<WorkletGlobalScope>(*this).script()->vm(); 489 #endif490 488 491 489 RELEASE_ASSERT_NOT_REACHED(); … … 525 523 } 526 524 527 JSC::JSGlobalObject* ScriptExecutionContext::execState() 528 { 529 if (is<Document>(*this)) { 530 Document& document = downcast<Document>(*this); 531 auto* frame = document.frame(); 532 return frame ? frame->script().globalObject(mainThreadNormalWorld()) : nullptr; 533 } 534 535 if (is<WorkerGlobalScope>(*this)) 536 return execStateFromWorkerGlobalScope(downcast<WorkerGlobalScope>(*this)); 537 #if ENABLE(CSS_PAINTING_API) 538 if (is<WorkletGlobalScope>(*this)) 539 return execStateFromWorkletGlobalScope(downcast<WorkletGlobalScope>(*this)); 540 #endif 525 JSC::JSGlobalObject* ScriptExecutionContext::globalObject() 526 { 527 if (is<Document>(*this)) 528 return WebCore::globalObject(mainThreadNormalWorld(), downcast<Document>(*this).page()); 529 530 if (is<WorkerOrWorkletGlobalScope>(*this)) 531 return WebCore::globalObject(downcast<WorkerOrWorkletGlobalScope>(*this)); 541 532 542 533 ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/dom/ScriptExecutionContext.h
r268271 r268700 243 243 } 244 244 245 WEBCORE_EXPORT JSC::JSGlobalObject* execState();245 WEBCORE_EXPORT JSC::JSGlobalObject* globalObject(); 246 246 247 247 WEBCORE_EXPORT String domainForCachePartition() const; -
trunk/Source/WebCore/fileapi/Blob.cpp
r268228 r268700 278 278 }; 279 279 280 return ReadableStream::create(*scriptExecutionContext. execState(), adoptRef(*new BlobStreamSource(scriptExecutionContext, *this)));280 return ReadableStream::create(*scriptExecutionContext.globalObject(), adoptRef(*new BlobStreamSource(scriptExecutionContext, *this))); 281 281 } 282 282 -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp
r262683 r268700 229 229 document()->eventLoop().performMicrotaskCheckpoint(); 230 230 231 CustomElementReactionStack reactionStack(document()-> execState());231 CustomElementReactionStack reactionStack(document()->globalObject()); 232 232 auto& elementInterface = constructionData->elementInterface.get(); 233 233 auto newElement = elementInterface.constructElementWithFallback(*document(), constructionData->name); -
trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp
r268473 r268700 157 157 void InspectorFrontendHost::addSelfToGlobalObjectInWorld(DOMWrapperWorld& world) 158 158 { 159 auto& lexicalGlobalObject = * execStateFromPage(world, m_frontendPage);159 auto& lexicalGlobalObject = *globalObject(world, m_frontendPage); 160 160 auto& vm = lexicalGlobalObject.vm(); 161 161 JSC::JSLockHolder lock(vm); … … 501 501 ASSERT(m_frontendPage); 502 502 503 auto& lexicalGlobalObject = * execStateFromPage(debuggerWorld(), m_frontendPage);503 auto& lexicalGlobalObject = *globalObject(debuggerWorld(), m_frontendPage); 504 504 auto& vm = lexicalGlobalObject.vm(); 505 505 auto value = lexicalGlobalObject.get(&lexicalGlobalObject, JSC::Identifier::fromString(vm, "InspectorFrontendAPI")); -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r266669 r268700 322 322 { 323 323 if (auto* webDebuggerAgent = instrumentingAgents.enabledWebDebuggerAgent()) 324 webDebuggerAgent->didScheduleAsyncCall(context. execState(), InspectorDebuggerAgent::AsyncCallType::DOMTimer, timerId, singleShot);324 webDebuggerAgent->didScheduleAsyncCall(context.globalObject(), InspectorDebuggerAgent::AsyncCallType::DOMTimer, timerId, singleShot); 325 325 326 326 if (auto* timelineAgent = instrumentingAgents.trackingTimelineAgent()) -
trunk/Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp
r267464 r268700 314 314 return makeUnexpected(errorString); 315 315 316 auto* state = animation->scriptExecutionContext()-> execState();316 auto* state = animation->scriptExecutionContext()->globalObject(); 317 317 auto injectedScript = m_injectedScriptManager.injectedScriptFor(state); 318 318 ASSERT(!injectedScript.hasNoValue()); -
trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp
r266902 r268700 249 249 return makeUnexpected(errorString); 250 250 251 auto* state = inspectorCanvas->scriptExecutionContext()-> execState();251 auto* state = inspectorCanvas->scriptExecutionContext()->globalObject(); 252 252 auto injectedScript = m_injectedScriptManager.injectedScriptFor(state); 253 253 ASSERT(!injectedScript.hasNoValue()); -
trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
r268635 r268700 1848 1848 1849 1849 JSC::JSObject* handlerObject = nullptr; 1850 JSC::JSGlobalObject* exec= nullptr;1850 JSC::JSGlobalObject* globalObject = nullptr; 1851 1851 1852 1852 JSC::JSLockHolder lock(scriptListener.isolatedWorld().vm()); … … 1854 1854 if (document) { 1855 1855 handlerObject = scriptListener.ensureJSFunction(*document); 1856 exec = execStateFromNode(scriptListener.isolatedWorld(), document);1856 globalObject = WebCore::globalObject(scriptListener.isolatedWorld(), document); 1857 1857 } 1858 1858 1859 if (handlerObject && exec) {1860 JSC::VM& vm = exec->vm();1859 if (handlerObject && globalObject) { 1860 JSC::VM& vm = globalObject->vm(); 1861 1861 JSC::JSFunction* handlerFunction = JSC::jsDynamicCast<JSC::JSFunction*>(vm, handlerObject); 1862 1862 … … 1865 1865 1866 1866 // If the handler is not actually a function, see if it implements the EventListener interface and use that. 1867 auto handleEventValue = handlerObject->get( exec, JSC::Identifier::fromString(vm, "handleEvent"));1867 auto handleEventValue = handlerObject->get(globalObject, JSC::Identifier::fromString(vm, "handleEvent")); 1868 1868 1869 1869 if (UNLIKELY(scope.exception())) -
trunk/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp
r266885 r268700 221 221 void InspectorDOMDebuggerAgent::willHandleEvent(Event& event, const RegisteredEventListener& registeredEventListener) 222 222 { 223 auto state = event.target()->scriptExecutionContext()-> execState();223 auto state = event.target()->scriptExecutionContext()->globalObject(); 224 224 auto injectedScript = m_injectedScriptManager.injectedScriptFor(state); 225 225 if (injectedScript.hasNoValue()) … … 262 262 void InspectorDOMDebuggerAgent::didHandleEvent(Event& event, const RegisteredEventListener& registeredEventListener) 263 263 { 264 auto state = event.target()->scriptExecutionContext()-> execState();264 auto state = event.target()->scriptExecutionContext()->globalObject(); 265 265 auto injectedScript = m_injectedScriptManager.injectedScriptFor(state); 266 266 if (injectedScript.hasNoValue()) -
trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp
r266885 r268700 389 389 } 390 390 391 auto* lexicalGlobalObject = context. execState();391 auto* lexicalGlobalObject = context.globalObject(); 392 392 393 393 auto key = m_injectedScript.wrapObject(toJS(*lexicalGlobalObject, *lexicalGlobalObject, cursor->key()), String(), true); … … 463 463 TransactionActivator activator(idbTransaction.get()); 464 464 RefPtr<IDBRequest> idbRequest; 465 auto* exec = context() ? context()-> execState() : nullptr;465 auto* exec = context() ? context()->globalObject() : nullptr; 466 466 if (!m_indexName.isEmpty()) { 467 467 auto idbIndex = indexForObjectStore(idbObjectStore.get(), m_indexName); … … 706 706 TransactionActivator activator(idbTransaction.get()); 707 707 RefPtr<IDBRequest> idbRequest; 708 if (auto* exec = context() ? context()-> execState() : nullptr) {708 if (auto* exec = context() ? context()->globalObject() : nullptr) { 709 709 auto result = idbObjectStore->clear(*exec); 710 710 ASSERT(!result.hasException()); -
trunk/Source/WebCore/inspector/agents/WebDebuggerAgent.cpp
r266885 r268700 80 80 return; 81 81 82 JSC::JSGlobalObject* scriptState = target.scriptExecutionContext()->execState();83 if (! scriptState)82 auto* globalObject = target.scriptExecutionContext()->globalObject(); 83 if (!globalObject) 84 84 return; 85 85 … … 87 87 m_registeredEventListeners.set(registeredListener.get(), identifier); 88 88 89 didScheduleAsyncCall( scriptState, InspectorDebuggerAgent::AsyncCallType::EventListener, identifier, registeredListener->isOnce());89 didScheduleAsyncCall(globalObject, InspectorDebuggerAgent::AsyncCallType::EventListener, identifier, registeredListener->isOnce()); 90 90 } 91 91 -
trunk/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp
r266885 r268700 172 172 return; 173 173 174 JSC::JSGlobalObject* scriptState = document.execState();175 if (! scriptState)174 auto* globalObject = document.globalObject(); 175 if (!globalObject) 176 176 return; 177 177 178 didScheduleAsyncCall( scriptState, InspectorDebuggerAgent::AsyncCallType::RequestAnimationFrame, callbackId, true);178 didScheduleAsyncCall(globalObject, InspectorDebuggerAgent::AsyncCallType::RequestAnimationFrame, callbackId, true); 179 179 } 180 180 -
trunk/Source/WebCore/inspector/agents/worker/WorkerAuditAgent.cpp
r266885 r268700 56 56 } 57 57 58 JSC::JSGlobalObject* scriptState = execStateFromWorkerGlobalScope(m_workerGlobalScope); 59 return injectedScriptManager().injectedScriptFor(scriptState); 58 return injectedScriptManager().injectedScriptFor(globalObject(m_workerGlobalScope)); 60 59 } 61 60 -
trunk/Source/WebCore/inspector/agents/worker/WorkerDebuggerAgent.cpp
r266885 r268700 61 61 } 62 62 63 JSC::JSGlobalObject* scriptState = execStateFromWorkerGlobalScope(m_workerGlobalScope); 64 return injectedScriptManager().injectedScriptFor(scriptState); 63 return injectedScriptManager().injectedScriptFor(globalObject(m_workerGlobalScope)); 65 64 } 66 65 -
trunk/Source/WebCore/inspector/agents/worker/WorkerRuntimeAgent.cpp
r266885 r268700 59 59 } 60 60 61 JSC::JSGlobalObject* scriptState = execStateFromWorkerGlobalScope(m_workerGlobalScope); 62 return injectedScriptManager().injectedScriptFor(scriptState); 61 return injectedScriptManager().injectedScriptFor(globalObject(m_workerGlobalScope)); 63 62 } 64 63 -
trunk/Source/WebCore/testing/WebXRTest.cpp
r262291 r268700 57 57 Vector<XRReferenceSpaceType> features; 58 58 if (init.supportedFeatures) { 59 if (auto* globalObject = context. execState()) {59 if (auto* globalObject = context.globalObject()) { 60 60 for (auto& feature : init.supportedFeatures.value()) { 61 61 if (auto referenceSpaceType = parseEnumeration<XRReferenceSpaceType>(*globalObject, feature)) -
trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp
r268316 r268700 223 223 return; 224 224 225 auto& state = *globalScope.execState();226 auto& vm = state.vm();225 auto& globalObject = *globalScope.globalObject(); 226 auto& vm = globalObject.vm(); 227 227 JSLockHolder locker(vm); 228 228 auto* contextWrapper = script->workerGlobalScopeWrapper(); 229 contextWrapper->putDirect(vm, Identifier::fromString(vm, Internals::internalsId), toJS(& state, contextWrapper, ServiceWorkerInternals::create(identifier)));229 contextWrapper->putDirect(vm, Identifier::fromString(vm, Internals::internalsId), toJS(&globalObject, contextWrapper, ServiceWorkerInternals::create(identifier))); 230 230 }); 231 231 #else -
trunk/Source/WebCore/workers/WorkerOrWorkletScriptController.h
r267859 r268700 41 41 42 42 virtual bool isTerminatingExecution() const = 0; 43 44 virtual JSC::JSGlobalObject* globalScopeWrapper() = 0; 43 45 }; 44 46 -
trunk/Source/WebCore/worklets/WorkletScriptController.cpp
r267859 r268700 268 268 } 269 269 270 JSC::JSGlobalObject* WorkletScriptController::globalScopeWrapper() 271 { 272 return workletGlobalScopeWrapper(); 273 } 274 270 275 } // namespace WebCore -
trunk/Source/WebCore/worklets/WorkletScriptController.h
r267859 r268700 60 60 } 61 61 62 JSC::JSGlobalObject* globalScopeWrapper() final; 63 62 64 void forbidExecution(); 63 65 bool isExecutionForbidden() const;
Note:
See TracChangeset
for help on using the changeset viewer.