Title: [210923] trunk/Source
Revision
210923
Author
[email protected]
Date
2017-01-19 07:56:13 -0800 (Thu, 19 Jan 2017)

Log Message

ScriptExecutionContext::topOrigin() should return a reference.
<https://webkit.org/b/167190>

Reviewed by Sam Weinig.

Source/WebCore:

There is always a topOrigin() SecurityOrigin, so make it return a reference
and remove some unnecessary null-checks exposed by this change.

* Modules/applepay/ApplePaySession.cpp:
(WebCore::canCallApplePaySessionAPIs):
* Modules/encryptedmedia/CDM.cpp:
(WebCore::CDM::getSupportedConfiguration):
(WebCore::CDM::getConsentStatus):
* Modules/indexeddb/IDBFactory.cpp:
(WebCore::IDBFactory::openInternal):
(WebCore::IDBFactory::deleteDatabase):
* Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
(WebCore::MediaDevicesEnumerationRequest::topLevelDocumentOrigin):
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::topLevelDocumentOrigin):
(WebCore::canCallGetUserMedia):
* dom/Document.h:
* dom/ScriptExecutionContext.h:
* html/DOMURL.cpp:
(WebCore::DOMURL::revokeObjectURL):
* inspector/InspectorIndexedDBAgent.cpp:
(WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::cachedResource):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::selectCache):
(WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
(WebCore::ApplicationCacheGroup::update):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::setDomainForCachePartition):
* page/SecurityOrigin.h:
(WebCore::SecurityOrigin::canAccessDatabase):
(WebCore::SecurityOrigin::canAccessSessionStorage):
(WebCore::SecurityOrigin::canAccessPluginStorage):
(WebCore::SecurityOrigin::canAccessApplicationCache):
* storage/StorageNamespaceProvider.cpp:
(WebCore::StorageNamespaceProvider::localStorageArea):
* testing/Internals.cpp:
(WebCore::Internals::isLoadingFromMemoryCache):
* workers/DedicatedWorkerGlobalScope.cpp:
(WebCore::DedicatedWorkerGlobalScope::create):
(WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
* workers/DedicatedWorkerGlobalScope.h:
* workers/DedicatedWorkerThread.cpp:
(WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
(WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
* workers/DedicatedWorkerThread.h:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
* workers/WorkerGlobalScope.h:
* workers/WorkerThread.cpp:
(WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
(WebCore::WorkerThread::WorkerThread):
* workers/WorkerThread.h:

Source/WebKit/mac:

* Misc/WebCache.mm:
(+[WebCache addImageToCache:forURL:forFrame:]):
(+[WebCache removeImageFromCacheForURL:forFrame:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (210922 => 210923)


--- trunk/Source/WebCore/ChangeLog	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/ChangeLog	2017-01-19 15:56:13 UTC (rev 210923)
@@ -1,3 +1,67 @@
+2017-01-19  Andreas Kling  <[email protected]>
+
+        ScriptExecutionContext::topOrigin() should return a reference.
+        <https://webkit.org/b/167190>
+
+        Reviewed by Sam Weinig.
+
+        There is always a topOrigin() SecurityOrigin, so make it return a reference
+        and remove some unnecessary null-checks exposed by this change.
+
+        * Modules/applepay/ApplePaySession.cpp:
+        (WebCore::canCallApplePaySessionAPIs):
+        * Modules/encryptedmedia/CDM.cpp:
+        (WebCore::CDM::getSupportedConfiguration):
+        (WebCore::CDM::getConsentStatus):
+        * Modules/indexeddb/IDBFactory.cpp:
+        (WebCore::IDBFactory::openInternal):
+        (WebCore::IDBFactory::deleteDatabase):
+        * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
+        (WebCore::MediaDevicesEnumerationRequest::topLevelDocumentOrigin):
+        * Modules/mediastream/UserMediaRequest.cpp:
+        (WebCore::UserMediaRequest::topLevelDocumentOrigin):
+        (WebCore::canCallGetUserMedia):
+        * dom/Document.h:
+        * dom/ScriptExecutionContext.h:
+        * html/DOMURL.cpp:
+        (WebCore::DOMURL::revokeObjectURL):
+        * inspector/InspectorIndexedDBAgent.cpp:
+        (WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::cachedResource):
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::selectCache):
+        (WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
+        (WebCore::ApplicationCacheGroup::update):
+        * loader/archive/cf/LegacyWebArchive.cpp:
+        (WebCore::LegacyWebArchive::create):
+        * loader/cache/CachedResourceRequest.cpp:
+        (WebCore::CachedResourceRequest::setDomainForCachePartition):
+        * page/SecurityOrigin.h:
+        (WebCore::SecurityOrigin::canAccessDatabase):
+        (WebCore::SecurityOrigin::canAccessSessionStorage):
+        (WebCore::SecurityOrigin::canAccessPluginStorage):
+        (WebCore::SecurityOrigin::canAccessApplicationCache):
+        * storage/StorageNamespaceProvider.cpp:
+        (WebCore::StorageNamespaceProvider::localStorageArea):
+        * testing/Internals.cpp:
+        (WebCore::Internals::isLoadingFromMemoryCache):
+        * workers/DedicatedWorkerGlobalScope.cpp:
+        (WebCore::DedicatedWorkerGlobalScope::create):
+        (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
+        * workers/DedicatedWorkerGlobalScope.h:
+        * workers/DedicatedWorkerThread.cpp:
+        (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
+        (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
+        * workers/DedicatedWorkerThread.h:
+        * workers/WorkerGlobalScope.cpp:
+        (WebCore::WorkerGlobalScope::WorkerGlobalScope):
+        * workers/WorkerGlobalScope.h:
+        * workers/WorkerThread.cpp:
+        (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
+        (WebCore::WorkerThread::WorkerThread):
+        * workers/WorkerThread.h:
+
 2017-01-19  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Provide API to set proxy settings

Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp (210922 => 210923)


--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -378,7 +378,7 @@
 
     auto& topDocument = document.topDocument();
     if (&document != &topDocument) {
-        auto& topOrigin = *topDocument.topOrigin();
+        auto& topOrigin = topDocument.topOrigin();
 
         if (!document.securityOrigin().isSameSchemeHostPort(topOrigin))
             return Exception { INVALID_ACCESS_ERR, "Trying to call an ApplePaySession API from a document with an different security origin than its top-level frame." };

Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp (210922 => 210923)


--- trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -413,11 +413,9 @@
         return std::nullopt;
 
     SecurityOrigin& origin = document->securityOrigin();
-    SecurityOrigin* topOrigin = document->topOrigin();
-    if (!topOrigin)
-        return std::nullopt;
+    SecurityOrigin& topOrigin = document->topOrigin();
 
-    if ((accumulatedConfiguration.distinctiveIdentifier == MediaKeysRequirement::Required || accumulatedConfiguration.persistentState == MediaKeysRequirement::Required) && !origin.canAccessLocalStorage(topOrigin))
+    if ((accumulatedConfiguration.distinctiveIdentifier == MediaKeysRequirement::Required || accumulatedConfiguration.persistentState == MediaKeysRequirement::Required) && !origin.canAccessLocalStorage(&topOrigin))
         return std::nullopt;
 
     return WTFMove(accumulatedConfiguration);
@@ -548,11 +546,7 @@
         }
 
         SecurityOrigin& origin = document->securityOrigin();
-        SecurityOrigin* topOrigin = document->topOrigin();
-        if (!topOrigin) {
-            callback(ConsentStatus::ConsentDenied, WTFMove(accumulatedConfiguration), WTFMove(restrictions));
-            return;
-        }
+        SecurityOrigin& topOrigin = document->topOrigin();
 
         // 3.1.1.2 Get Supported Configuration and Consent, ctd.
         // 21. If accumulated configuration's distinctiveIdentifier value is "required" and the Distinctive Identifier(s) associated
@@ -592,7 +586,7 @@
         // 3.2.1. Update restrictions to reflect the configurations for which consent was denied.
         // 3.2.1. Return ConsentDenied and restrictions.
         // NOTE: assume implied consent if the combination of origin and topOrigin allows it.
-        if (accumulatedConfiguration.distinctiveIdentifier == MediaKeysRequirement::Required && !origin.canAccessLocalStorage(topOrigin)) {
+        if (accumulatedConfiguration.distinctiveIdentifier == MediaKeysRequirement::Required && !origin.canAccessLocalStorage(&topOrigin)) {
             restrictions.distinctiveIdentifierDenied = true;
             callback(ConsentStatus::ConsentDenied, WTFMove(accumulatedConfiguration), WTFMove(restrictions));
             return;

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (210922 => 210923)


--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -94,8 +94,7 @@
         return Exception { SECURITY_ERR, ASCIILiteral("IDBFactory.open() called in an invalid security context") };
 
     ASSERT(context.securityOrigin());
-    ASSERT(context.topOrigin());
-    IDBDatabaseIdentifier databaseIdentifier(name, *context.securityOrigin(), *context.topOrigin());
+    IDBDatabaseIdentifier databaseIdentifier(name, *context.securityOrigin(), context.topOrigin());
     if (!databaseIdentifier.isValid())
         return Exception { TypeError, ASCIILiteral("IDBFactory.open() called with an invalid security origin") };
 
@@ -115,8 +114,7 @@
         return Exception { SECURITY_ERR, ASCIILiteral("IDBFactory.deleteDatabase() called in an invalid security context") };
 
     ASSERT(context.securityOrigin());
-    ASSERT(context.topOrigin());
-    IDBDatabaseIdentifier databaseIdentifier(name, *context.securityOrigin(), *context.topOrigin());
+    IDBDatabaseIdentifier databaseIdentifier(name, *context.securityOrigin(), context.topOrigin());
     if (!databaseIdentifier.isValid())
         return Exception { TypeError, ASCIILiteral("IDBFactory.deleteDatabase() called with an invalid security origin") };
 

Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevicesEnumerationRequest.cpp (210922 => 210923)


--- trunk/Source/WebCore/Modules/mediastream/MediaDevicesEnumerationRequest.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevicesEnumerationRequest.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -70,7 +70,7 @@
             return nullptr;
     }
 
-    return scriptExecutionContext()->topOrigin();
+    return &scriptExecutionContext()->topOrigin();
 }
 
 void MediaDevicesEnumerationRequest::contextDestroyed()

Modified: trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp (210922 => 210923)


--- trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -88,7 +88,7 @@
 {
     if (!m_scriptExecutionContext)
         return nullptr;
-    return m_scriptExecutionContext->topOrigin();
+    return &m_scriptExecutionContext->topOrigin();
 }
 
 static bool isSecure(DocumentLoader& documentLoader)
@@ -109,7 +109,7 @@
 
     auto& topDocument = document.topDocument();
     if (&document != &topDocument) {
-        auto& topOrigin = *topDocument.topOrigin();
+        auto& topOrigin = topDocument.topOrigin();
 
         if (!document.securityOrigin().isSameSchemeHostPort(topOrigin)) {
             errorMessage = "Trying to call getUserMedia from a document with a different security origin than its top-level frame.";

Modified: trunk/Source/WebCore/dom/Document.cpp (210922 => 210923)


--- trunk/Source/WebCore/dom/Document.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/dom/Document.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -5362,11 +5362,6 @@
         page->console().addMessage(source, level, message, sourceURL, lineNumber, columnNumber, WTFMove(callStack), state, requestIdentifier);
 }
 
-SecurityOrigin* Document::topOrigin() const
-{
-    return &topDocument().securityOrigin();
-}
-
 void Document::postTask(Task&& task)
 {
     callOnMainThread([documentReference = m_weakFactory.createWeakPtr(), task = WTFMove(task)]() mutable {

Modified: trunk/Source/WebCore/dom/Document.h (210922 => 210923)


--- trunk/Source/WebCore/dom/Document.h	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/dom/Document.h	2017-01-19 15:56:13 UTC (rev 210923)
@@ -912,7 +912,7 @@
     WEBCORE_EXPORT void setDesignMode(const String&);
 
     Document* parentDocument() const;
-    Document& topDocument() const;
+    WEBCORE_EXPORT Document& topDocument() const;
     
     ScriptRunner* scriptRunner() { return m_scriptRunner.get(); }
     ScriptModuleLoader* moduleLoader() { return m_moduleLoader.get(); }
@@ -1223,9 +1223,8 @@
     WEBCORE_EXPORT void addConsoleMessage(MessageSource, MessageLevel, const String& message, unsigned long requestIdentifier = 0) final;
 
     SecurityOrigin& securityOrigin() const { return *SecurityContext::securityOrigin(); }
+    SecurityOrigin& topOrigin() const final { return topDocument().securityOrigin(); }
 
-    WEBCORE_EXPORT SecurityOrigin* topOrigin() const final;
-
     Ref<FontFaceSet> fonts();
 
     void ensurePlugInsInjectedScript(DOMWrapperWorld&);

Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (210922 => 210923)


--- trunk/Source/WebCore/dom/ScriptExecutionContext.h	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h	2017-01-19 15:56:13 UTC (rev 210923)
@@ -98,7 +98,7 @@
     void addConsoleMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0);
     virtual void addConsoleMessage(MessageSource, MessageLevel, const String& message, unsigned long requestIdentifier = 0) = 0;
 
-    virtual SecurityOrigin* topOrigin() const = 0;
+    virtual SecurityOrigin& topOrigin() const = 0;
 
     virtual bool shouldBypassMainWorldContentSecurityPolicy() const { return false; }
 

Modified: trunk/Source/WebCore/html/DOMURL.cpp (210922 => 210923)


--- trunk/Source/WebCore/html/DOMURL.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/html/DOMURL.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -121,7 +121,7 @@
     URL url(URL(), urlString);
     ResourceRequest request(url);
 #if ENABLE(CACHE_PARTITIONING)
-    request.setDomainForCachePartition(scriptExecutionContext.topOrigin()->domainForCachePartition());
+    request.setDomainForCachePartition(scriptExecutionContext.topOrigin().domainForCachePartition());
 #endif
     MemoryCache::removeRequestFromSessionCaches(scriptExecutionContext, request);
 

Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (210922 => 210923)


--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -575,9 +575,7 @@
 
     auto& openingOrigin = document->securityOrigin();
 
-    auto* topOrigin = document->topOrigin();
-    if (!topOrigin)
-        return;
+    auto& topOrigin = document->topOrigin();
 
     IDBFactory* idbFactory = assertIDBFactory(errorString, document);
     if (!idbFactory)
@@ -584,7 +582,7 @@
         return;
 
     RefPtr<RequestDatabaseNamesCallback> callback = WTFMove(requestCallback);
-    idbFactory->getAllDatabaseNames(*topOrigin, openingOrigin, [callback](auto& databaseNames) {
+    idbFactory->getAllDatabaseNames(topOrigin, openingOrigin, [callback](auto& databaseNames) {
         if (!callback->isActive())
             return;
 

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (210922 => 210923)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -261,7 +261,7 @@
     if (!cachedResource) {
         ResourceRequest request(url);
 #if ENABLE(CACHE_PARTITIONING)
-        request.setDomainForCachePartition(frame->document()->topOrigin()->domainForCachePartition());
+        request.setDomainForCachePartition(frame->document()->topOrigin().domainForCachePartition());
 #endif
         cachedResource = MemoryCache::singleton().resourceForRequest(request, frame->page()->sessionID());
     }

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (210922 => 210923)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -135,7 +135,7 @@
     }
 
     // Don't access anything on disk if private browsing is enabled.
-    if (frame.page()->usesEphemeralSession() || !frame.document()->securityOrigin().canAccessApplicationCache(&frame.tree().top().document()->securityOrigin())) {
+    if (frame.page()->usesEphemeralSession() || !frame.document()->securityOrigin().canAccessApplicationCache(frame.tree().top().document()->securityOrigin())) {
         postListenerTask(eventNames().checkingEvent, documentLoader);
         postListenerTask(eventNames().errorEvent, documentLoader);
         return;
@@ -207,7 +207,7 @@
     ASSERT(!documentLoader.applicationCacheHost().applicationCache());
 
     // Don't access anything on disk if private browsing is enabled.
-    if (frame.page()->usesEphemeralSession() || !frame.document()->securityOrigin().canAccessApplicationCache(&frame.tree().top().document()->securityOrigin())) {
+    if (frame.page()->usesEphemeralSession() || !frame.document()->securityOrigin().canAccessApplicationCache(frame.tree().top().document()->securityOrigin())) {
         postListenerTask(eventNames().checkingEvent, documentLoader);
         postListenerTask(eventNames().errorEvent, documentLoader);
         return;
@@ -413,7 +413,7 @@
     }
 
     // Don't access anything on disk if private browsing is enabled.
-    if (frame.page()->usesEphemeralSession() || !frame.document()->securityOrigin().canAccessApplicationCache(&frame.tree().top().document()->securityOrigin())) {
+    if (frame.page()->usesEphemeralSession() || !frame.document()->securityOrigin().canAccessApplicationCache(frame.tree().top().document()->securityOrigin())) {
         ASSERT(m_pendingMasterResourceLoaders.isEmpty());
         ASSERT(m_pendingEntries.isEmpty());
         ASSERT(!m_cacheBeingUpdated);

Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp (210922 => 210923)


--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -515,7 +515,7 @@
 
                 ResourceRequest request(subresourceURL);
 #if ENABLE(CACHE_PARTITIONING)
-                request.setDomainForCachePartition(frame.document()->topOrigin()->domainForCachePartition());
+                request.setDomainForCachePartition(frame.document()->topOrigin().domainForCachePartition());
 #endif
                 if (auto* cachedResource = MemoryCache::singleton().resourceForRequest(request, frame.page()->sessionID())) {
                     if (auto resource = ArchiveResource::create(cachedResource->resourceBuffer(), subresourceURL, cachedResource->response())) {

Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp (210922 => 210923)


--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -132,8 +132,7 @@
 #if ENABLE(CACHE_PARTITIONING)
 void CachedResourceRequest::setDomainForCachePartition(Document& document)
 {
-    ASSERT(document.topOrigin());
-    m_resourceRequest.setDomainForCachePartition(document.topOrigin()->domainForCachePartition());
+    m_resourceRequest.setDomainForCachePartition(document.topOrigin().domainForCachePartition());
 }
 #endif
 

Modified: trunk/Source/WebCore/page/SecurityOrigin.h (210922 => 210923)


--- trunk/Source/WebCore/page/SecurityOrigin.h	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/page/SecurityOrigin.h	2017-01-19 15:56:13 UTC (rev 210923)
@@ -142,11 +142,11 @@
     WEBCORE_EXPORT String domainForCachePartition() const;
 #endif
 
-    bool canAccessDatabase(const SecurityOrigin* topOrigin = nullptr) const { return canAccessStorage(topOrigin); };
-    bool canAccessSessionStorage(const SecurityOrigin* topOrigin) const { return canAccessStorage(topOrigin, AlwaysAllowFromThirdParty); }
+    bool canAccessDatabase(const SecurityOrigin& topOrigin) const { return canAccessStorage(&topOrigin); };
+    bool canAccessSessionStorage(const SecurityOrigin& topOrigin) const { return canAccessStorage(&topOrigin, AlwaysAllowFromThirdParty); }
     bool canAccessLocalStorage(const SecurityOrigin* topOrigin) const { return canAccessStorage(topOrigin); };
-    bool canAccessPluginStorage(const SecurityOrigin* topOrigin) const { return canAccessStorage(topOrigin); }
-    bool canAccessApplicationCache(const SecurityOrigin* topOrigin) const { return canAccessStorage(topOrigin); }
+    bool canAccessPluginStorage(const SecurityOrigin& topOrigin) const { return canAccessStorage(&topOrigin); }
+    bool canAccessApplicationCache(const SecurityOrigin& topOrigin) const { return canAccessStorage(&topOrigin); }
     bool canAccessCookies() const { return !isUnique(); }
     bool canRequestGeolocation() const { return !isUnique(); }
     Policy canShowNotifications() const;

Modified: trunk/Source/WebCore/storage/StorageNamespaceProvider.cpp (210922 => 210923)


--- trunk/Source/WebCore/storage/StorageNamespaceProvider.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/storage/StorageNamespaceProvider.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -61,7 +61,7 @@
 
 RefPtr<StorageArea> StorageNamespaceProvider::localStorageArea(Document& document)
 {
-    auto& storageNamespace = document.securityOrigin().canAccessLocalStorage(document.topOrigin()) ? localStorageNamespace() : transientLocalStorageNamespace(*document.topOrigin());
+    auto& storageNamespace = document.securityOrigin().canAccessLocalStorage(&document.topOrigin()) ? localStorageNamespace() : transientLocalStorageNamespace(document.topOrigin());
 
     return storageNamespace.storageArea(SecurityOriginData::fromSecurityOrigin(document.securityOrigin()));
 }

Modified: trunk/Source/WebCore/testing/Internals.cpp (210922 => 210923)


--- trunk/Source/WebCore/testing/Internals.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/testing/Internals.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -547,7 +547,7 @@
 
     ResourceRequest request(contextDocument()->completeURL(url));
 #if ENABLE(CACHE_PARTITIONING)
-    request.setDomainForCachePartition(contextDocument()->topOrigin()->domainForCachePartition());
+    request.setDomainForCachePartition(contextDocument()->topOrigin().domainForCachePartition());
 #endif
     CachedResource* resource = MemoryCache::singleton().resourceForRequest(request, contextDocument()->page()->sessionID());
     return resource && resource->status() == CachedResource::Cached;

Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp (210922 => 210923)


--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -41,7 +41,7 @@
 
 namespace WebCore {
 
-Ref<DedicatedWorkerGlobalScope> DedicatedWorkerGlobalScope::create(const URL& url, const String& identifier, const String& userAgent, DedicatedWorkerThread& thread, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, RefPtr<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider)
+Ref<DedicatedWorkerGlobalScope> DedicatedWorkerGlobalScope::create(const URL& url, const String& identifier, const String& userAgent, DedicatedWorkerThread& thread, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider)
 {
     auto context = adoptRef(*new DedicatedWorkerGlobalScope(url, identifier, userAgent, thread, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), connectionProxy, socketProvider));
     if (!shouldBypassMainWorldContentSecurityPolicy)
@@ -49,7 +49,7 @@
     return context;
 }
 
-DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const URL& url, const String& identifier, const String& userAgent, DedicatedWorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, RefPtr<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider)
+DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const URL& url, const String& identifier, const String& userAgent, DedicatedWorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider)
     : WorkerGlobalScope(url, identifier, userAgent, thread, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), connectionProxy, socketProvider)
 {
 }

Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h (210922 => 210923)


--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h	2017-01-19 15:56:13 UTC (rev 210923)
@@ -48,7 +48,7 @@
 
 class DedicatedWorkerGlobalScope final : public WorkerGlobalScope {
 public:
-    static Ref<DedicatedWorkerGlobalScope> create(const URL&, const String& identifier, const String& userAgent, DedicatedWorkerThread&, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, RefPtr<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*);
+    static Ref<DedicatedWorkerGlobalScope> create(const URL&, const String& identifier, const String& userAgent, DedicatedWorkerThread&, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*);
     virtual ~DedicatedWorkerGlobalScope();
 
     ExceptionOr<void> postMessage(JSC::ExecState&, JSC::JSValue message, Vector<JSC::Strong<JSC::JSObject>>&&);
@@ -58,7 +58,7 @@
 private:
     using Base = WorkerGlobalScope;
 
-    DedicatedWorkerGlobalScope(const URL&, const String& identifier, const String& userAgent, DedicatedWorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, RefPtr<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*);
+    DedicatedWorkerGlobalScope(const URL&, const String& identifier, const String& userAgent, DedicatedWorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*);
 
     bool isDedicatedWorkerGlobalScope() const final { return true; }
     ExceptionOr<void> importScripts(const Vector<String>& urls) final;

Modified: trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp (210922 => 210923)


--- trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -38,7 +38,7 @@
 
 namespace WebCore {
 
-DedicatedWorkerThread::DedicatedWorkerThread(const URL& url, const String& identifier, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, JSC::RuntimeFlags runtimeFlags)
+DedicatedWorkerThread::DedicatedWorkerThread(const URL& url, const String& identifier, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, JSC::RuntimeFlags runtimeFlags)
     : WorkerThread(url, identifier, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin, connectionProxy, socketProvider, runtimeFlags)
     , m_workerObjectProxy(workerObjectProxy)
 {
@@ -48,7 +48,7 @@
 {
 }
 
-Ref<WorkerGlobalScope> DedicatedWorkerThread::createWorkerGlobalScope(const URL& url, const String& identifier, const String& userAgent, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, RefPtr<SecurityOrigin>&& topOrigin)
+Ref<WorkerGlobalScope> DedicatedWorkerThread::createWorkerGlobalScope(const URL& url, const String& identifier, const String& userAgent, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin)
 {
     return DedicatedWorkerGlobalScope::create(url, identifier, userAgent, *this, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), idbConnectionProxy(), socketProvider());
 }

Modified: trunk/Source/WebCore/workers/DedicatedWorkerThread.h (210922 => 210923)


--- trunk/Source/WebCore/workers/DedicatedWorkerThread.h	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/workers/DedicatedWorkerThread.h	2017-01-19 15:56:13 UTC (rev 210923)
@@ -49,11 +49,11 @@
     WorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; }
 
 protected:
-    Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& identifier, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, RefPtr<SecurityOrigin>&& topOrigin) override;
+    Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& identifier, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin) override;
     void runEventLoop() override;
 
 private:
-    DedicatedWorkerThread(const URL&, const String& identifier, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, JSC::RuntimeFlags);
+    DedicatedWorkerThread(const URL&, const String& identifier, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, JSC::RuntimeFlags);
 
     WorkerObjectProxy& m_workerObjectProxy;
 };

Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.cpp (210922 => 210923)


--- trunk/Source/WebCore/workers/WorkerGlobalScope.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -52,7 +52,7 @@
 
 namespace WebCore {
 
-WorkerGlobalScope::WorkerGlobalScope(const URL& url, const String& identifier, const String& userAgent, WorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, RefPtr<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider)
+WorkerGlobalScope::WorkerGlobalScope(const URL& url, const String& identifier, const String& userAgent, WorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider)
     : m_url(url)
     , m_identifier(identifier)
     , m_userAgent(userAgent)
@@ -61,7 +61,7 @@
     , m_inspectorController(std::make_unique<WorkerInspectorController>(*this))
     , m_shouldBypassMainWorldContentSecurityPolicy(shouldBypassMainWorldContentSecurityPolicy)
     , m_eventQueue(*this)
-    , m_topOrigin(topOrigin)
+    , m_topOrigin(WTFMove(topOrigin))
 #if ENABLE(INDEXED_DATABASE)
     , m_connectionProxy(connectionProxy)
 #endif

Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.h (210922 => 210923)


--- trunk/Source/WebCore/workers/WorkerGlobalScope.h	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.h	2017-01-19 15:56:13 UTC (rev 210923)
@@ -100,7 +100,7 @@
     Crypto& crypto();
 
 protected:
-    WorkerGlobalScope(const URL&, const String& identifier, const String& userAgent, WorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, RefPtr<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*);
+    WorkerGlobalScope(const URL&, const String& identifier, const String& userAgent, WorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*);
 
     void applyContentSecurityPolicyResponseHeaders(const ContentSecurityPolicyResponseHeaders&);
 
@@ -131,7 +131,7 @@
 
     bool shouldBypassMainWorldContentSecurityPolicy() const final { return m_shouldBypassMainWorldContentSecurityPolicy; }
     bool isJSExecutionForbidden() const final;
-    SecurityOrigin* topOrigin() const final { return m_topOrigin.get(); }
+    SecurityOrigin& topOrigin() const final { return m_topOrigin.get(); }
 
 #if ENABLE(SUBTLE_CRYPTO)
     // The following two functions are side effects of providing extra protection to serialized
@@ -161,7 +161,7 @@
 
     mutable WorkerEventQueue m_eventQueue;
 
-    RefPtr<SecurityOrigin> m_topOrigin;
+    Ref<SecurityOrigin> m_topOrigin;
 
 #if ENABLE(INDEXED_DATABASE)
     RefPtr<IDBClient::IDBConnectionProxy> m_connectionProxy;

Modified: trunk/Source/WebCore/workers/WorkerThread.cpp (210922 => 210923)


--- trunk/Source/WebCore/workers/WorkerThread.cpp	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/workers/WorkerThread.cpp	2017-01-19 15:56:13 UTC (rev 210923)
@@ -72,7 +72,7 @@
 struct WorkerThreadStartupData {
     WTF_MAKE_NONCOPYABLE(WorkerThreadStartupData); WTF_MAKE_FAST_ALLOCATED;
 public:
-    WorkerThreadStartupData(const URL& scriptURL, const String& identifier, const String& userAgent, const String& sourceCode, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin);
+    WorkerThreadStartupData(const URL& scriptURL, const String& identifier, const String& userAgent, const String& sourceCode, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin);
 
     URL m_scriptURL;
     String m_identifier;
@@ -81,10 +81,10 @@
     WorkerThreadStartMode m_startMode;
     ContentSecurityPolicyResponseHeaders m_contentSecurityPolicyResponseHeaders;
     bool m_shouldBypassMainWorldContentSecurityPolicy;
-    RefPtr<SecurityOrigin> m_topOrigin;
+    Ref<SecurityOrigin> m_topOrigin;
 };
 
-WorkerThreadStartupData::WorkerThreadStartupData(const URL& scriptURL, const String& identifier, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin)
+WorkerThreadStartupData::WorkerThreadStartupData(const URL& scriptURL, const String& identifier, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin)
     : m_scriptURL(scriptURL.isolatedCopy())
     , m_identifier(identifier.isolatedCopy())
     , m_userAgent(userAgent.isolatedCopy())
@@ -92,11 +92,11 @@
     , m_startMode(startMode)
     , m_contentSecurityPolicyResponseHeaders(contentSecurityPolicyResponseHeaders.isolatedCopy())
     , m_shouldBypassMainWorldContentSecurityPolicy(shouldBypassMainWorldContentSecurityPolicy)
-    , m_topOrigin(topOrigin ? &topOrigin->isolatedCopy().get() : nullptr)
+    , m_topOrigin(topOrigin.isolatedCopy())
 {
 }
 
-WorkerThread::WorkerThread(const URL& scriptURL, const String& identifier, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, JSC::RuntimeFlags runtimeFlags)
+WorkerThread::WorkerThread(const URL& scriptURL, const String& identifier, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, JSC::RuntimeFlags runtimeFlags)
     : m_threadID(0)
     , m_workerLoaderProxy(workerLoaderProxy)
     , m_workerReportingProxy(workerReportingProxy)

Modified: trunk/Source/WebCore/workers/WorkerThread.h (210922 => 210923)


--- trunk/Source/WebCore/workers/WorkerThread.h	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebCore/workers/WorkerThread.h	2017-01-19 15:56:13 UTC (rev 210923)
@@ -80,10 +80,10 @@
     JSC::RuntimeFlags runtimeFlags() const { return m_runtimeFlags; }
 
 protected:
-    WorkerThread(const URL&, const String& identifier, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, JSC::RuntimeFlags);
+    WorkerThread(const URL&, const String& identifier, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, JSC::RuntimeFlags);
 
     // Factory method for creating a new worker context for the thread.
-    virtual Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& identifier, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, RefPtr<SecurityOrigin>&& topOrigin) = 0;
+    virtual Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& identifier, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin) = 0;
 
     // Executes the event loop for the worker thread. Derived classes can override to perform actions before/after entering the event loop.
     virtual void runEventLoop();

Modified: trunk/Source/WebKit/mac/ChangeLog (210922 => 210923)


--- trunk/Source/WebKit/mac/ChangeLog	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-01-19 15:56:13 UTC (rev 210923)
@@ -1,3 +1,14 @@
+2017-01-19  Andreas Kling  <[email protected]>
+
+        ScriptExecutionContext::topOrigin() should return a reference.
+        <https://webkit.org/b/167190>
+
+        Reviewed by Sam Weinig.
+
+        * Misc/WebCache.mm:
+        (+[WebCache addImageToCache:forURL:forFrame:]):
+        (+[WebCache removeImageFromCacheForURL:forFrame:]):
+
 2017-01-18  Ryan Haddad  <[email protected]>
 
         Unreviewed fix for the macOS build.

Modified: trunk/Source/WebKit/mac/Misc/WebCache.mm (210922 => 210923)


--- trunk/Source/WebKit/mac/Misc/WebCache.mm	2017-01-19 11:50:31 UTC (rev 210922)
+++ trunk/Source/WebKit/mac/Misc/WebCache.mm	2017-01-19 15:56:13 UTC (rev 210923)
@@ -170,7 +170,7 @@
     WebCore::SecurityOrigin* topOrigin = nullptr;
 #if ENABLE(CACHE_PARTITIONING)
     if (frame)
-        topOrigin = core(frame)->document()->topOrigin();
+        topOrigin = &core(frame)->document()->topOrigin();
 #endif
     return WebCore::MemoryCache::singleton().addImageToCache(RetainPtr<CGImageRef>(image), url, topOrigin ? topOrigin->domainForCachePartition() : emptyString());
 }
@@ -187,7 +187,7 @@
     WebCore::SecurityOrigin* topOrigin = nullptr;
 #if ENABLE(CACHE_PARTITIONING)
     if (frame)
-        topOrigin = core(frame)->document()->topOrigin();
+        topOrigin = &core(frame)->document()->topOrigin();
 #endif
     WebCore::MemoryCache::singleton().removeImageFromCache(url, topOrigin ? topOrigin->domainForCachePartition() : emptyString());
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to