Title: [280881] trunk
Revision
280881
Author
[email protected]
Date
2021-08-10 19:58:01 -0700 (Tue, 10 Aug 2021)

Log Message

Add Cross-Origin-Opener-Policy support for Blob URLs
https://bugs.webkit.org/show_bug.cgi?id=228924

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline WPT test that is now passing.

* web-platform-tests/html/cross-origin-opener-policy/blob-popup.https-expected.txt:

Source/WebCore:

Pass ScriptExecutionContext's cross-origin-opener-policy when registering a public
Blob URL and store it in the blob registry alongside the blob data. As a result,
we are able to service the right COOP headers on the blob response later on when
doing a load of this blob. In the future, we'll pass the cross-origin-embedder-policy
as well, once we support it.

No new tests, rebaselined existing test.

* Modules/fetch/FetchLoader.cpp:
(WebCore::FetchLoader::startLoadingBlobURL):
* dom/Document.h:
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::crossOriginOpenerPolicy const):
* dom/ScriptExecutionContext.h:
* fileapi/Blob.cpp:
(WebCore::BlobURLRegistry::registerURL):
(WebCore::Blob::Blob):
* fileapi/FileReaderLoader.cpp:
(WebCore::FileReaderLoader::start):
* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::registerBlobURL):
* fileapi/ThreadableBlobRegistry.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadResource):

* loader/CrossOriginEmbedderPolicy.cpp:
(WebCore::obtainCrossOriginEmbedderPolicy):
For WebKit1, the initial empty document seems to have an empty URL instead of
"about:blank" so I had to extend the check so that COEP properly gets enabled.

* loader/CrossOriginOpenerPolicy.cpp:
(WebCore::obtainCrossOriginOpenerPolicy):
For WebKit1, the initial empty document seems to have an empty URL instead of
"about:blank" so I had to extend the check so that COOP properly gets enabled.

(WebCore::crossOriginOpenerPolicyToString):
(WebCore::CrossOriginOpenerPolicy::isolatedCopy const):
(WebCore::addCrossOriginOpenerPolicyHeaders):
* loader/CrossOriginOpenerPolicy.h:
(WebCore::operator==):
(WebCore::CrossOriginOpenerPolicy::encode const):
(WebCore::CrossOriginOpenerPolicy::decode):
* platform/network/BlobData.cpp:
(WebCore::BlobData::clone const):
* platform/network/BlobData.h:
(WebCore::BlobData::crossOriginOpenerPolicy const):
(WebCore::BlobData::setCrossOriginOpenerPolicy):
* platform/network/BlobRegistry.h:
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::registerBlobURL):
(WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked):
* platform/network/BlobRegistryImpl.h:
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::notifyResponseOnSuccess):

Source/WebKit:

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkDataTaskBlob.cpp:
(WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
* NetworkProcess/NetworkProcessPlatformStrategies.cpp:
(WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
* WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerBlobURL):
* WebProcess/FileAPI/BlobRegistryProxy.h:

Source/WebKitLegacy/mac:

* WebCoreSupport/WebPlatformStrategies.mm:

Source/WebKitLegacy/win:

* WebCoreSupport/WebPlatformStrategies.cpp:

Modified Paths

Diff

Modified: trunk/LayoutTests/TestExpectations (280880 => 280881)


--- trunk/LayoutTests/TestExpectations	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/LayoutTests/TestExpectations	2021-08-11 02:58:01 UTC (rev 280881)
@@ -719,10 +719,6 @@
 # test is served over HTTP.
 imported/w3c/web-platform-tests/html/cross-origin-opener-policy/no-https.html [ Skip ]
 
-# COOP tests that are failing and keep printing a different uuid in the error output.
-imported/w3c/web-platform-tests/html/cross-origin-opener-policy/blob-popup.https.html [ Failure Pass ]
-imported/w3c/web-platform-tests/html/cross-origin-opener-policy/coep-blob-popup.https.html [ Failure Pass ]
-
 # Newly imported WPT tests that are crashing.
 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-represent-nothing-04.html [ ImageOnlyFailure Crash ]
 

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (280880 => 280881)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-11 02:58:01 UTC (rev 280881)
@@ -1,5 +1,16 @@
 2021-08-10  Chris Dumez  <[email protected]>
 
+        Add Cross-Origin-Opener-Policy support for Blob URLs
+        https://bugs.webkit.org/show_bug.cgi?id=228924
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline WPT test that is now passing.
+
+        * web-platform-tests/html/cross-origin-opener-policy/blob-popup.https-expected.txt:
+
+2021-08-10  Chris Dumez  <[email protected]>
+
         Meta HTTP refresh should not navigate if document has sandboxed automatic features browsing context flag set
         https://bugs.webkit.org/show_bug.cgi?id=228965
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/blob-popup.https-expected.txt (280880 => 280881)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/blob-popup.https-expected.txt	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/blob-popup.https-expected.txt	2021-08-11 02:58:01 UTC (rev 280881)
@@ -1,4 +1,3 @@
-CONSOLE MESSAGE: TypeError: null is not an object (evaluating 'window.opener.furtherPopup = w')
 
-FAIL Cross-Origin-Opener-Policy and a blob URL popup assert_equals: expected 0 but got 36
+PASS Cross-Origin-Opener-Policy and a blob URL popup
 

Modified: trunk/Source/WebCore/ChangeLog (280880 => 280881)


--- trunk/Source/WebCore/ChangeLog	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/ChangeLog	2021-08-11 02:58:01 UTC (rev 280881)
@@ -1,3 +1,65 @@
+2021-08-10  Chris Dumez  <[email protected]>
+
+        Add Cross-Origin-Opener-Policy support for Blob URLs
+        https://bugs.webkit.org/show_bug.cgi?id=228924
+
+        Reviewed by Alex Christensen.
+
+        Pass ScriptExecutionContext's cross-origin-opener-policy when registering a public
+        Blob URL and store it in the blob registry alongside the blob data. As a result,
+        we are able to service the right COOP headers on the blob response later on when
+        doing a load of this blob. In the future, we'll pass the cross-origin-embedder-policy
+        as well, once we support it.
+
+        No new tests, rebaselined existing test.
+
+        * Modules/fetch/FetchLoader.cpp:
+        (WebCore::FetchLoader::startLoadingBlobURL):
+        * dom/Document.h:
+        * dom/ScriptExecutionContext.cpp:
+        (WebCore::ScriptExecutionContext::crossOriginOpenerPolicy const):
+        * dom/ScriptExecutionContext.h:
+        * fileapi/Blob.cpp:
+        (WebCore::BlobURLRegistry::registerURL):
+        (WebCore::Blob::Blob):
+        * fileapi/FileReaderLoader.cpp:
+        (WebCore::FileReaderLoader::start):
+        * fileapi/ThreadableBlobRegistry.cpp:
+        (WebCore::ThreadableBlobRegistry::registerBlobURL):
+        * fileapi/ThreadableBlobRegistry.h:
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::loadResource):
+
+        * loader/CrossOriginEmbedderPolicy.cpp:
+        (WebCore::obtainCrossOriginEmbedderPolicy):
+        For WebKit1, the initial empty document seems to have an empty URL instead of
+        "about:blank" so I had to extend the check so that COEP properly gets enabled.
+
+        * loader/CrossOriginOpenerPolicy.cpp:
+        (WebCore::obtainCrossOriginOpenerPolicy):
+        For WebKit1, the initial empty document seems to have an empty URL instead of
+        "about:blank" so I had to extend the check so that COOP properly gets enabled.
+
+        (WebCore::crossOriginOpenerPolicyToString):
+        (WebCore::CrossOriginOpenerPolicy::isolatedCopy const):
+        (WebCore::addCrossOriginOpenerPolicyHeaders):
+        * loader/CrossOriginOpenerPolicy.h:
+        (WebCore::operator==):
+        (WebCore::CrossOriginOpenerPolicy::encode const):
+        (WebCore::CrossOriginOpenerPolicy::decode):
+        * platform/network/BlobData.cpp:
+        (WebCore::BlobData::clone const):
+        * platform/network/BlobData.h:
+        (WebCore::BlobData::crossOriginOpenerPolicy const):
+        (WebCore::BlobData::setCrossOriginOpenerPolicy):
+        * platform/network/BlobRegistry.h:
+        * platform/network/BlobRegistryImpl.cpp:
+        (WebCore::BlobRegistryImpl::registerBlobURL):
+        (WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked):
+        * platform/network/BlobRegistryImpl.h:
+        * platform/network/BlobResourceHandle.cpp:
+        (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
+
 2021-08-10  Wenson Hsieh  <[email protected]>
 
         [Live Text] Unable to start drag on image when the first piece of text inside the image is selected

Modified: trunk/Source/WebCore/Modules/fetch/FetchLoader.cpp (280880 => 280881)


--- trunk/Source/WebCore/Modules/fetch/FetchLoader.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/Modules/fetch/FetchLoader.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -65,7 +65,7 @@
         return;
     }
 
-    ThreadableBlobRegistry::registerBlobURL(context.securityOrigin(), m_urlForReading, blobURL);
+    ThreadableBlobRegistry::registerBlobURL(context.securityOrigin(), context.crossOriginOpenerPolicy(), m_urlForReading, blobURL);
 
     ResourceRequest request(m_urlForReading);
     request.setInitiatorIdentifier(context.resourceRequestIdentifier());

Modified: trunk/Source/WebCore/dom/Document.h (280880 => 280881)


--- trunk/Source/WebCore/dom/Document.h	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/dom/Document.h	2021-08-11 02:58:01 UTC (rev 280881)
@@ -1354,7 +1354,7 @@
     bool isSameOriginAsTopDocument() const { return securityOrigin().isSameOriginAs(topOrigin()); }
     bool shouldForceNoOpenerBasedOnCOOP() const;
 
-    const CrossOriginOpenerPolicy& crossOriginOpenerPolicy() const;
+    const CrossOriginOpenerPolicy& crossOriginOpenerPolicy() const final;
     void setCrossOriginOpenerPolicy(const CrossOriginOpenerPolicy&);
 
     void willLoadScriptElement(const URL&);

Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.cpp (280880 => 280881)


--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -31,6 +31,7 @@
 #include "CSSValuePool.h"
 #include "CachedScript.h"
 #include "CommonVM.h"
+#include "CrossOriginOpenerPolicy.h"
 #include "DOMTimer.h"
 #include "DOMWindow.h"
 #include "DatabaseContext.h"
@@ -335,6 +336,12 @@
     });
 }
 
+const CrossOriginOpenerPolicy& ScriptExecutionContext::crossOriginOpenerPolicy() const
+{
+    static NeverDestroyed<CrossOriginOpenerPolicy> coop;
+    return coop;
+}
+
 void ScriptExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject& activeDOMObject)
 {
     ASSERT(m_activeDOMObjects.contains(&activeDOMObject));

Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (280880 => 280881)


--- trunk/Source/WebCore/dom/ScriptExecutionContext.h	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h	2021-08-11 02:58:01 UTC (rev 280881)
@@ -78,6 +78,8 @@
 enum class ReferrerPolicy : uint8_t;
 enum class TaskSource : uint8_t;
 
+struct CrossOriginOpenerPolicy;
+
 #if ENABLE(SERVICE_WORKER)
 class ServiceWorker;
 class ServiceWorkerContainer;
@@ -146,6 +148,8 @@
     bool activeDOMObjectsAreSuspended() const { return m_activeDOMObjectsAreSuspended; }
     bool activeDOMObjectsAreStopped() const { return m_activeDOMObjectsAreStopped; }
 
+    virtual const CrossOriginOpenerPolicy& crossOriginOpenerPolicy() const;
+
     JSC::ScriptExecutionStatus jscScriptExecutionStatus() const;
 
     // Called from the constructor and destructors of ActiveDOMObject.

Modified: trunk/Source/WebCore/fileapi/Blob.cpp (280880 => 280881)


--- trunk/Source/WebCore/fileapi/Blob.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/fileapi/Blob.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -62,7 +62,7 @@
 void BlobURLRegistry::registerURL(ScriptExecutionContext& context, const URL& publicURL, URLRegistrable& blob)
 {
     ASSERT(&blob.registry() == this);
-    ThreadableBlobRegistry::registerBlobURL(context.securityOrigin(), publicURL, static_cast<Blob&>(blob).url());
+    ThreadableBlobRegistry::registerBlobURL(context.securityOrigin(), context.crossOriginOpenerPolicy(), publicURL, static_cast<Blob&>(blob).url());
 }
 
 void BlobURLRegistry::unregisterURL(const URL& url)
@@ -137,7 +137,7 @@
     , m_internalURL(BlobURL::createInternalURL())
 {
     if (fileBackedPath.isEmpty())
-        ThreadableBlobRegistry::registerBlobURL(nullptr, m_internalURL, srcURL);
+        ThreadableBlobRegistry::registerBlobURL(nullptr, { }, m_internalURL, srcURL);
     else
         ThreadableBlobRegistry::registerBlobURLOptionallyFileBacked(m_internalURL, srcURL, fileBackedPath, m_type);
 }

Modified: trunk/Source/WebCore/fileapi/FileReaderLoader.cpp (280880 => 280881)


--- trunk/Source/WebCore/fileapi/FileReaderLoader.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/fileapi/FileReaderLoader.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -82,7 +82,7 @@
         failed(SecurityError);
         return;
     }
-    ThreadableBlobRegistry::registerBlobURL(scriptExecutionContext->securityOrigin(), m_urlForReading, blob.url());
+    ThreadableBlobRegistry::registerBlobURL(scriptExecutionContext->securityOrigin(), scriptExecutionContext->crossOriginOpenerPolicy(), m_urlForReading, blob.url());
 
     // Construct and load the request.
     ResourceRequest request(m_urlForReading);

Modified: trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp (280880 => 280881)


--- trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -99,7 +99,7 @@
     return url.string().substring(startIndex, endIndex - startIndex - 1) == "null";
 }
 
-void ThreadableBlobRegistry::registerBlobURL(SecurityOrigin* origin, const URL& url, const URL& srcURL)
+void ThreadableBlobRegistry::registerBlobURL(SecurityOrigin* origin, const CrossOriginOpenerPolicy& coop, const URL& url, const URL& srcURL)
 {
     // If the blob URL contains null origin, as in the context with unique security origin or file URL, save the mapping between url and origin so that the origin can be retrived when doing security origin check.
     if (origin && isBlobURLContainsNullOrigin(url))
@@ -106,12 +106,12 @@
         originMap()->add(url.string(), origin);
 
     if (isMainThread()) {
-        blobRegistry().registerBlobURL(url, srcURL);
+        blobRegistry().registerBlobURL(url, srcURL, coop);
         return;
     }
 
-    callOnMainThread([url = "" srcURL = srcURL.isolatedCopy()] {
-        blobRegistry().registerBlobURL(url, srcURL);
+    callOnMainThread([url = "" srcURL = srcURL.isolatedCopy(), coop = crossThreadCopy(coop)] {
+        blobRegistry().registerBlobURL(url, srcURL, coop);
     });
 }
 

Modified: trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h (280880 => 280881)


--- trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h	2021-08-11 02:58:01 UTC (rev 280881)
@@ -38,11 +38,13 @@
 class BlobPart;
 class SecurityOrigin;
 
+struct CrossOriginOpenerPolicy;
+
 class ThreadableBlobRegistry {
 public:
     static void registerFileBlobURL(const URL&, const String& path, const String& replacementPath, const String& contentType);
     static void registerBlobURL(const URL&, Vector<BlobPart>&& blobParts, const String& contentType);
-    static void registerBlobURL(SecurityOrigin*, const URL&, const URL& srcURL);
+    static void registerBlobURL(SecurityOrigin*, const CrossOriginOpenerPolicy&, const URL&, const URL& srcURL);
     static void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, const String& fileBackedPath, const String& contentType);
     static void registerBlobURLForSlice(const URL& newURL, const URL& srcURL, long long start, long long end, const String& contentType);
     static void unregisterBlobURL(const URL&);

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (280880 => 280881)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -1552,7 +1552,7 @@
         if (!m_blobURLForReading.isEmpty())
             ThreadableBlobRegistry::unregisterBlobURL(m_blobURLForReading);
         m_blobURLForReading = BlobURL::createPublicURL(&document().securityOrigin());
-        ThreadableBlobRegistry::registerBlobURL(&document().securityOrigin(), m_blobURLForReading, m_blob->url());
+        ThreadableBlobRegistry::registerBlobURL(&document().securityOrigin(), document().crossOriginOpenerPolicy(), m_blobURLForReading, m_blob->url());
 
         if (!m_player->load(m_blobURLForReading, contentType, keySystem))
             mediaLoadingFailed(MediaPlayer::NetworkState::FormatError);

Modified: trunk/Source/WebCore/loader/CrossOriginEmbedderPolicy.cpp (280880 => 280881)


--- trunk/Source/WebCore/loader/CrossOriginEmbedderPolicy.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/loader/CrossOriginEmbedderPolicy.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -45,7 +45,7 @@
 
     CrossOriginEmbedderPolicy policy;
     // FIXME: about:blank should be marked as secure as per https://w3c.github.io/webappsec-secure-contexts/#potentially-trustworthy-url.
-    if (!context.isSecureContext() && context.url() != aboutBlankURL())
+    if (!context.isSecureContext() && context.url() != aboutBlankURL() && !context.url().isEmpty())
         return policy;
 
     parseCOEPHeader(HTTPHeaderName::CrossOriginEmbedderPolicy, policy.value, policy.reportingEndpoint);

Modified: trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.cpp (280880 => 280881)


--- trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -33,6 +33,20 @@
 
 namespace WebCore {
 
+static String crossOriginOpenerPolicyToString(const CrossOriginOpenerPolicyValue& coop)
+{
+    switch (coop) {
+    case CrossOriginOpenerPolicyValue::SameOrigin:
+    case CrossOriginOpenerPolicyValue::SameOriginPlusCOEP:
+        return "same-origin"_s;
+    case CrossOriginOpenerPolicyValue::SameOriginAllowPopups:
+        return "same-origin-allow-popups"_s;
+    case CrossOriginOpenerPolicyValue::UnsafeNone:
+        break;
+    }
+    return "unsafe-none"_s;
+}
+
 // https://html.spec.whatwg.org/multipage/origin.html#obtain-coop
 CrossOriginOpenerPolicy obtainCrossOriginOpenerPolicy(const ResourceResponse& response, const ScriptExecutionContext& context)
 {
@@ -61,7 +75,7 @@
 
     CrossOriginOpenerPolicy policy;
     // FIXME: about:blank should be marked as secure as per https://w3c.github.io/webappsec-secure-contexts/#potentially-trustworthy-url.
-    if (!context.isSecureContext() && context.url() != aboutBlankURL())
+    if (!context.isSecureContext() && context.url() != aboutBlankURL() && !context.url().isEmpty())
         return policy;
 
     parseCOOP(HTTPHeaderName::CrossOriginOpenerPolicy, policy.value, policy.reportingEndpoint);
@@ -69,4 +83,34 @@
     return policy;
 }
 
+CrossOriginOpenerPolicy CrossOriginOpenerPolicy::isolatedCopy() const
+{
+    return {
+        value,
+        reportingEndpoint.isolatedCopy(),
+        reportOnlyValue,
+        reportOnlyReportingEndpoint.isolatedCopy()
+    };
+}
+
+void addCrossOriginOpenerPolicyHeaders(ResourceResponse& response, const CrossOriginOpenerPolicy& coop)
+{
+    if (coop.value != CrossOriginOpenerPolicyValue::UnsafeNone) {
+        if (coop.reportingEndpoint.isEmpty())
+            response.setHTTPHeaderField(HTTPHeaderName::CrossOriginOpenerPolicy, crossOriginOpenerPolicyToString(coop.value));
+        else
+            response.setHTTPHeaderField(HTTPHeaderName::CrossOriginOpenerPolicy, makeString(crossOriginOpenerPolicyToString(coop.value), "; report-to=\"", coop.reportingEndpoint, '\"'));
+        if (coop.value == CrossOriginOpenerPolicyValue::SameOriginPlusCOEP)
+            response.setHTTPHeaderField(HTTPHeaderName::CrossOriginEmbedderPolicy, "require-corp"_s); // FIXME: Pass in coep and set header value correctly.
+    }
+    if (coop.reportOnlyValue != CrossOriginOpenerPolicyValue::UnsafeNone) {
+        if (coop.reportOnlyReportingEndpoint.isEmpty())
+            response.setHTTPHeaderField(HTTPHeaderName::CrossOriginOpenerPolicyReportOnly, crossOriginOpenerPolicyToString(coop.reportOnlyValue));
+        else
+            response.setHTTPHeaderField(HTTPHeaderName::CrossOriginOpenerPolicyReportOnly, makeString(crossOriginOpenerPolicyToString(coop.reportOnlyValue), "; report-to=\"", coop.reportOnlyReportingEndpoint, '\"'));
+        if (coop.reportOnlyValue == CrossOriginOpenerPolicyValue::SameOriginPlusCOEP)
+            response.setHTTPHeaderField(HTTPHeaderName::CrossOriginEmbedderPolicyReportOnly, "require-corp"_s); // FIXME: Pass in coep and set header value correctly.
+    }
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.h (280880 => 280881)


--- trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.h	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.h	2021-08-11 02:58:01 UTC (rev 280881)
@@ -48,8 +48,54 @@
     String reportingEndpoint;
     CrossOriginOpenerPolicyValue reportOnlyValue { CrossOriginOpenerPolicyValue::UnsafeNone };
     String reportOnlyReportingEndpoint;
+
+    CrossOriginOpenerPolicy isolatedCopy() const;
+    template<class Encoder> void encode(Encoder&) const;
+    template<class Decoder> static std::optional<CrossOriginOpenerPolicy> decode(Decoder&);
 };
 
+inline bool operator==(const CrossOriginOpenerPolicy& a, const CrossOriginOpenerPolicy& b)
+{
+    return a.value == b.value && a.reportingEndpoint == b.reportingEndpoint && a.reportOnlyValue == b.reportOnlyValue && a.reportOnlyReportingEndpoint == b.reportOnlyReportingEndpoint;
+}
+
+template<class Encoder>
+void CrossOriginOpenerPolicy::encode(Encoder& encoder) const
+{
+    encoder << value << reportingEndpoint << reportOnlyValue << reportOnlyReportingEndpoint;
+}
+
+template<class Decoder>
+std::optional<CrossOriginOpenerPolicy> CrossOriginOpenerPolicy::decode(Decoder& decoder)
+{
+    std::optional<CrossOriginOpenerPolicyValue> value;
+    decoder >> value;
+    if (!value)
+        return std::nullopt;
+
+    std::optional<String> reportingEndpoint;
+    decoder >> reportingEndpoint;
+    if (!reportingEndpoint)
+        return std::nullopt;
+
+    std::optional<CrossOriginOpenerPolicyValue> reportOnlyValue;
+    decoder >> reportOnlyValue;
+    if (!reportOnlyValue)
+        return std::nullopt;
+
+    std::optional<String> reportOnlyReportingEndpoint;
+    decoder >> reportOnlyReportingEndpoint;
+    if (!reportOnlyReportingEndpoint)
+        return std::nullopt;
+
+    return {{
+        *value,
+        WTFMove(*reportingEndpoint),
+        *reportOnlyValue,
+        WTFMove(*reportOnlyReportingEndpoint)
+    }};
+}
+
 // https://html.spec.whatwg.org/multipage/origin.html#coop-enforcement-result
 struct CrossOriginOpenerPolicyEnforcementResult {
     bool needsBrowsingContextGroupSwitch { false };
@@ -61,5 +107,20 @@
 };
 
 CrossOriginOpenerPolicy obtainCrossOriginOpenerPolicy(const ResourceResponse&, const ScriptExecutionContext&);
+WEBCORE_EXPORT void addCrossOriginOpenerPolicyHeaders(ResourceResponse&, const CrossOriginOpenerPolicy&);
 
 } // namespace WebCore
+
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::CrossOriginOpenerPolicyValue> {
+    using values = EnumValues<
+    WebCore::CrossOriginOpenerPolicyValue,
+    WebCore::CrossOriginOpenerPolicyValue::UnsafeNone,
+    WebCore::CrossOriginOpenerPolicyValue::SameOrigin,
+    WebCore::CrossOriginOpenerPolicyValue::SameOriginPlusCOEP,
+    WebCore::CrossOriginOpenerPolicyValue::SameOriginAllowPopups
+    >;
+};
+
+} // namespace WTF

Modified: trunk/Source/WebCore/platform/network/BlobData.cpp (280880 => 280881)


--- trunk/Source/WebCore/platform/network/BlobData.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/platform/network/BlobData.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -78,6 +78,14 @@
     m_items.append(BlobDataItem(WTFMove(file)));
 }
 
+Ref<BlobData> BlobData::clone() const
+{
+    auto blobData = BlobData::create(m_contentType);
+    blobData->m_coop = m_coop;
+    blobData->m_items = m_items;
+    return blobData;
+}
+
 void BlobData::appendFile(BlobDataFileReference* file, long long offset, long long length)
 {
     m_items.append(BlobDataItem(file, offset, length));

Modified: trunk/Source/WebCore/platform/network/BlobData.h (280880 => 280881)


--- trunk/Source/WebCore/platform/network/BlobData.h	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/platform/network/BlobData.h	2021-08-11 02:58:01 UTC (rev 280881)
@@ -32,6 +32,7 @@
 #define BlobData_h
 
 #include "BlobDataFileReference.h"
+#include "CrossOriginOpenerPolicy.h"
 #include "ThreadSafeDataBuffer.h"
 #include <wtf/Forward.h>
 #include <wtf/ThreadSafeRefCounted.h>
@@ -105,6 +106,9 @@
 
     const String& contentType() const { return m_contentType; }
 
+    const CrossOriginOpenerPolicy& crossOriginOpenerPolicy() const { return m_coop; }
+    void setCrossOriginOpenerPolicy(const CrossOriginOpenerPolicy& coop) { m_coop = coop; }
+
     const BlobDataItemList& items() const { return m_items; }
     void swapItems(BlobDataItemList&);
 
@@ -111,6 +115,8 @@
     void appendData(const ThreadSafeDataBuffer&);
     void appendFile(Ref<BlobDataFileReference>&&);
 
+    Ref<BlobData> clone() const;
+
 private:
     friend class BlobRegistryImpl;
     BlobData(const String& contentType);
@@ -119,6 +125,7 @@
     void appendFile(BlobDataFileReference*, long long offset, long long length);
 
     String m_contentType;
+    CrossOriginOpenerPolicy m_coop;
     BlobDataItemList m_items;
 };
 

Modified: trunk/Source/WebCore/platform/network/BlobRegistry.h (280880 => 280881)


--- trunk/Source/WebCore/platform/network/BlobRegistry.h	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/platform/network/BlobRegistry.h	2021-08-11 02:58:01 UTC (rev 280881)
@@ -31,6 +31,7 @@
 
 #pragma once
 
+#include <optional>
 #include <wtf/Forward.h>
 
 namespace WebCore {
@@ -40,6 +41,8 @@
 class BlobRegistry;
 class BlobRegistryImpl;
 
+struct CrossOriginOpenerPolicy;
+
 WEBCORE_EXPORT BlobRegistry& blobRegistry();
 
 // BlobRegistry is not thread-safe. It should only be called from main thread.
@@ -53,7 +56,7 @@
     virtual void registerBlobURL(const URL&, Vector<BlobPart>&&, const String& contentType) = 0;
     
     // Registers a new blob URL referring to the blob data identified by the specified srcURL.
-    virtual void registerBlobURL(const URL&, const URL& srcURL) = 0;
+    virtual void registerBlobURL(const URL&, const URL& srcURL, const CrossOriginOpenerPolicy&) = 0;
 
     // Registers a new blob URL referring to the blob data identified by the specified srcURL or, if none found, referring to the file found at the given path.
     virtual void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, RefPtr<BlobDataFileReference>&&, const String& contentType) = 0;

Modified: trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp (280880 => 280881)


--- trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -152,12 +152,12 @@
     addBlobData(url.string(), WTFMove(blobData));
 }
 
-void BlobRegistryImpl::registerBlobURL(const URL& url, const URL& srcURL)
+void BlobRegistryImpl::registerBlobURL(const URL& url, const URL& srcURL, const CrossOriginOpenerPolicy& coop)
 {
-    registerBlobURLOptionallyFileBacked(url, srcURL, nullptr, { });
+    registerBlobURLOptionallyFileBacked(url, srcURL, nullptr, { }, coop);
 }
 
-void BlobRegistryImpl::registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<BlobDataFileReference>&& file, const String& contentType)
+void BlobRegistryImpl::registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<BlobDataFileReference>&& file, const String& contentType, const CrossOriginOpenerPolicy& coop)
 {
     ASSERT(isMainThread());
     registerBlobResourceHandleConstructor();
@@ -164,7 +164,13 @@
 
     BlobData* src = ""
     if (src) {
-        addBlobData(url.string(), src);
+        if (src->crossOriginOpenerPolicy() == coop)
+            addBlobData(url.string(), src);
+        else {
+            auto clone = src->clone();
+            clone->setCrossOriginOpenerPolicy(coop);
+            addBlobData(url.string(), WTFMove(clone));
+        }
         return;
     }
 
@@ -173,6 +179,7 @@
 
     auto backingFile = BlobData::create(contentType);
     backingFile->appendFile(file.releaseNonNull());
+    backingFile->setCrossOriginOpenerPolicy(coop);
 
     addBlobData(url.string(), WTFMove(backingFile));
 }

Modified: trunk/Source/WebCore/platform/network/BlobRegistryImpl.h (280880 => 280881)


--- trunk/Source/WebCore/platform/network/BlobRegistryImpl.h	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/platform/network/BlobRegistryImpl.h	2021-08-11 02:58:01 UTC (rev 280881)
@@ -45,6 +45,7 @@
 class ResourceHandleClient;
 class ResourceRequest;
 class ThreadSafeDataBuffer;
+struct CrossOriginOpenerPolicy;
 
 // BlobRegistryImpl is not thread-safe. It should only be called from main thread.
 class WEBCORE_EXPORT BlobRegistryImpl {
@@ -61,8 +62,8 @@
 
     void registerFileBlobURL(const URL&, Ref<BlobDataFileReference>&&, const String& contentType);
     void registerBlobURL(const URL&, Vector<BlobPart>&&, const String& contentType);
-    void registerBlobURL(const URL&, const URL& srcURL);
-    void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, RefPtr<BlobDataFileReference>&&, const String& contentType);
+    void registerBlobURL(const URL&, const URL& srcURL, const CrossOriginOpenerPolicy&);
+    void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, RefPtr<BlobDataFileReference>&&, const String& contentType, const CrossOriginOpenerPolicy&);
     void registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end, const String& contentType);
     void unregisterBlobURL(const URL&);
 

Modified: trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp (280880 => 280881)


--- trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -34,6 +34,7 @@
 
 #include "AsyncFileStream.h"
 #include "BlobData.h"
+#include "CrossOriginOpenerPolicy.h"
 #include "FileStream.h"
 #include "HTTPHeaderNames.h"
 #include "HTTPParsers.h"
@@ -576,6 +577,7 @@
 
     response.setHTTPHeaderField(HTTPHeaderName::ContentType, m_blobData->contentType());
     response.setHTTPHeaderField(HTTPHeaderName::ContentLength, String::number(m_totalRemainingSize));
+    addCrossOriginOpenerPolicyHeaders(response, m_blobData->crossOriginOpenerPolicy());
 
     if (isRangeRequest)
         response.setHTTPHeaderField(HTTPHeaderName::ContentRange, ParsedContentRange(m_rangeOffset, m_rangeEnd, m_totalSize).headerValue());

Modified: trunk/Source/WebKit/ChangeLog (280880 => 280881)


--- trunk/Source/WebKit/ChangeLog	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebKit/ChangeLog	2021-08-11 02:58:01 UTC (rev 280881)
@@ -1,3 +1,23 @@
+2021-08-10  Chris Dumez  <[email protected]>
+
+        Add Cross-Origin-Opener-Policy support for Blob URLs
+        https://bugs.webkit.org/show_bug.cgi?id=228924
+
+        Reviewed by Alex Christensen.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
+        (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+        * NetworkProcess/NetworkDataTaskBlob.cpp:
+        (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
+        * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
+        (WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
+        * WebProcess/FileAPI/BlobRegistryProxy.cpp:
+        (WebKit::BlobRegistryProxy::registerBlobURL):
+        * WebProcess/FileAPI/BlobRegistryProxy.h:
+
 2021-08-10  Tim Horton  <[email protected]>
 
         Unreviewed build fix.

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (280880 => 280881)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -828,13 +828,13 @@
     session->blobRegistry().registerBlobURL(url, WTFMove(blobParts), contentType);
 }
 
-void NetworkConnectionToWebProcess::registerBlobURLFromURL(const URL& url, const URL& srcURL)
+void NetworkConnectionToWebProcess::registerBlobURLFromURL(const URL& url, const URL& srcURL, CrossOriginOpenerPolicy&& coop)
 {
     auto* session = networkSession();
     if (!session)
         return;
 
-    session->blobRegistry().registerBlobURL(url, srcURL);
+    session->blobRegistry().registerBlobURL(url, srcURL, WTFMove(coop));
 }
 
 void NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, const String& fileBackedPath, const String& contentType)
@@ -845,7 +845,7 @@
     if (!session)
         return;
 
-    session->blobRegistry().registerBlobURLOptionallyFileBacked(url, srcURL, BlobDataFileReferenceWithSandboxExtension::create(fileBackedPath), contentType);
+    session->blobRegistry().registerBlobURLOptionallyFileBacked(url, srcURL, BlobDataFileReferenceWithSandboxExtension::create(fileBackedPath), contentType, { });
 }
 
 void NetworkConnectionToWebProcess::registerBlobURLForSlice(const URL& url, const URL& srcURL, int64_t start, int64_t end, const String& contentType)

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h (280880 => 280881)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h	2021-08-11 02:58:01 UTC (rev 280881)
@@ -66,6 +66,7 @@
 class ResourceRequest;
 enum class StorageAccessScope : bool;
 enum class ShouldAskITP : bool;
+struct CrossOriginOpenerPolicy;
 struct RequestStorageAccessResult;
 struct SameSiteInfo;
 
@@ -229,7 +230,7 @@
 
     void registerFileBlobURL(const URL&, const String& path, const String& replacementPath, SandboxExtension::Handle&&, const String& contentType);
     void registerBlobURL(const URL&, Vector<WebCore::BlobPart>&&, const String& contentType);
-    void registerBlobURLFromURL(const URL&, const URL& srcURL);
+    void registerBlobURLFromURL(const URL&, const URL& srcURL, WebCore::CrossOriginOpenerPolicy&&);
     void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, const String& fileBackedPath, const String& contentType);
     void registerBlobURLForSlice(const URL&, const URL& srcURL, int64_t start, int64_t end, const String& contentType);
     void blobSize(const URL&, CompletionHandler<void(uint64_t)>&&);

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in (280880 => 280881)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in	2021-08-11 02:58:01 UTC (rev 280881)
@@ -50,7 +50,7 @@
 
     RegisterFileBlobURL(URL url, String path, String replacementPath, WebKit::SandboxExtension::Handle extensionHandle, String contentType)
     RegisterBlobURL(URL url, Vector<WebCore::BlobPart> blobParts, String contentType)
-    RegisterBlobURLFromURL(URL url, URL srcURL)
+    RegisterBlobURLFromURL(URL url, URL srcURL, struct WebCore::CrossOriginOpenerPolicy coop)
     RegisterBlobURLOptionallyFileBacked(URL url, URL srcURL, String fileBackedPath, String contentType)
     RegisterBlobURLForSlice(URL url, URL srcURL, int64_t start, int64_t end, String contentType)
     UnregisterBlobURL(URL url)

Modified: trunk/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp (280880 => 280881)


--- trunk/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -41,6 +41,7 @@
 #include "WebErrors.h"
 #include <WebCore/AsyncFileStream.h>
 #include <WebCore/BlobRegistryImpl.h>
+#include <WebCore/CrossOriginOpenerPolicy.h>
 #include <WebCore/HTTPParsers.h>
 #include <WebCore/ParsedContentRange.h>
 #include <WebCore/ResourceError.h>
@@ -264,6 +265,7 @@
 
         response.setHTTPHeaderField(HTTPHeaderName::ContentType, m_blobData->contentType());
         response.setHTTPHeaderField(HTTPHeaderName::ContentLength, String::number(m_totalRemainingSize));
+        addCrossOriginOpenerPolicyHeaders(response, m_blobData->crossOriginOpenerPolicy());
 
         if (isRangeRequest)
             response.setHTTPHeaderField(HTTPHeaderName::ContentRange, ParsedContentRange(m_rangeOffset, m_rangeEnd, m_totalSize).headerValue());

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp (280880 => 280881)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -59,7 +59,7 @@
     class EmptyBlobRegistry : public WebCore::BlobRegistry {
         void registerFileBlobURL(const URL&, Ref<BlobDataFileReference>&&, const String& path, const String& contentType) final { ASSERT_NOT_REACHED(); }
         void registerBlobURL(const URL&, Vector<BlobPart>&&, const String& contentType) final { ASSERT_NOT_REACHED(); }
-        void registerBlobURL(const URL&, const URL& srcURL) final { ASSERT_NOT_REACHED(); }
+        void registerBlobURL(const URL&, const URL& srcURL, const WebCore::CrossOriginOpenerPolicy&) final { ASSERT_NOT_REACHED(); }
         void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, RefPtr<BlobDataFileReference>&&, const String& contentType) final { ASSERT_NOT_REACHED(); }
         void registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end, const String& contentType) final { ASSERT_NOT_REACHED(); }
         void unregisterBlobURL(const URL&) final { ASSERT_NOT_REACHED(); }

Modified: trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.cpp (280880 => 280881)


--- trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -31,6 +31,7 @@
 #include "WebCoreArgumentCoders.h"
 #include "WebProcess.h"
 #include <WebCore/BlobDataFileReference.h>
+#include <WebCore/CrossOriginOpenerPolicy.h>
 #include <WebCore/SWContextManager.h>
 
 namespace WebKit {
@@ -53,9 +54,9 @@
     WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RegisterBlobURL(url, blobParts, contentType), 0);
 }
 
-void BlobRegistryProxy::registerBlobURL(const URL& url, const URL& srcURL)
+void BlobRegistryProxy::registerBlobURL(const URL& url, const URL& srcURL, const CrossOriginOpenerPolicy& coop)
 {
-    WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLFromURL { url, srcURL }, 0);
+    WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLFromURL { url, srcURL, coop }, 0);
 }
 
 void BlobRegistryProxy::registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<WebCore::BlobDataFileReference>&& file, const String& contentType)

Modified: trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.h (280880 => 280881)


--- trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.h	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.h	2021-08-11 02:58:01 UTC (rev 280881)
@@ -33,7 +33,7 @@
 public:
     void registerFileBlobURL(const URL&, Ref<WebCore::BlobDataFileReference>&&, const String& path, const String& contentType) final;
     void registerBlobURL(const URL&, Vector<WebCore::BlobPart>&&, const String& contentType) final;
-    void registerBlobURL(const URL&, const URL& srcURL) final;
+    void registerBlobURL(const URL&, const URL& srcURL, const WebCore::CrossOriginOpenerPolicy&) final;
     void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, RefPtr<WebCore::BlobDataFileReference>&&, const String& contentType) final;
     void unregisterBlobURL(const URL&) final;
     void registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end, const String& contentType) final;

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (280880 => 280881)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2021-08-11 02:58:01 UTC (rev 280881)
@@ -1,5 +1,14 @@
 2021-08-10  Chris Dumez  <[email protected]>
 
+        Add Cross-Origin-Opener-Policy support for Blob URLs
+        https://bugs.webkit.org/show_bug.cgi?id=228924
+
+        Reviewed by Alex Christensen.
+
+        * WebCoreSupport/WebPlatformStrategies.mm:
+
+2021-08-10  Chris Dumez  <[email protected]>
+
         Document.baseURI is inaccurate for iframe srcdoc documents
         https://bugs.webkit.org/show_bug.cgi?id=228933
 

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm (280880 => 280881)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm	2021-08-11 02:58:01 UTC (rev 280881)
@@ -85,8 +85,8 @@
 private:
     void registerFileBlobURL(const URL& url, Ref<BlobDataFileReference>&& reference, const String&, const String& contentType) final { m_blobRegistry.registerFileBlobURL(url, WTFMove(reference), contentType); }
     void registerBlobURL(const URL& url, Vector<BlobPart>&& parts, const String& contentType) final { m_blobRegistry.registerBlobURL(url, WTFMove(parts), contentType); }
-    void registerBlobURL(const URL& url, const URL& srcURL) final { m_blobRegistry.registerBlobURL(url, srcURL); }
-    void registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<BlobDataFileReference>&& reference, const String& contentType) final { m_blobRegistry.registerBlobURLOptionallyFileBacked(url, srcURL, WTFMove(reference), contentType); }
+    void registerBlobURL(const URL& url, const URL& srcURL, const CrossOriginOpenerPolicy& coop) final { m_blobRegistry.registerBlobURL(url, srcURL, coop); }
+    void registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<BlobDataFileReference>&& reference, const String& contentType) final { m_blobRegistry.registerBlobURLOptionallyFileBacked(url, srcURL, WTFMove(reference), contentType, { }); }
     void registerBlobURLForSlice(const URL& url, const URL& srcURL, long long start, long long end, const String& contentType) final { m_blobRegistry.registerBlobURLForSlice(url, srcURL, start, end, contentType); }
     void unregisterBlobURL(const URL& url) final { m_blobRegistry.unregisterBlobURL(url); }
     unsigned long long blobSize(const URL& url) final { return m_blobRegistry.blobSize(url); }

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (280880 => 280881)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2021-08-11 02:58:01 UTC (rev 280881)
@@ -1,3 +1,12 @@
+2021-08-10  Chris Dumez  <[email protected]>
+
+        Add Cross-Origin-Opener-Policy support for Blob URLs
+        https://bugs.webkit.org/show_bug.cgi?id=228924
+
+        Reviewed by Alex Christensen.
+
+        * WebCoreSupport/WebPlatformStrategies.cpp:
+
 2021-08-09  Chris Dumez  <[email protected]>
 
         Blob URL changes after loading it

Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp (280880 => 280881)


--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp	2021-08-11 01:55:16 UTC (rev 280880)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp	2021-08-11 02:58:01 UTC (rev 280881)
@@ -81,8 +81,8 @@
 private:
     void registerFileBlobURL(const URL& url, Ref<BlobDataFileReference>&& reference, const String&, const String& contentType) final { m_blobRegistry.registerFileBlobURL(url, WTFMove(reference), contentType); }
     void registerBlobURL(const URL& url, Vector<BlobPart>&& parts, const String& contentType) final { m_blobRegistry.registerBlobURL(url, WTFMove(parts), contentType); }
-    void registerBlobURL(const URL& url, const URL& srcURL) final { m_blobRegistry.registerBlobURL(url, srcURL); }
-    void registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<BlobDataFileReference>&& reference, const String& contentType) final { m_blobRegistry.registerBlobURLOptionallyFileBacked(url, srcURL, WTFMove(reference), contentType); }
+    void registerBlobURL(const URL& url, const URL& srcURL, const CrossOriginOpenerPolicy& coop) final { m_blobRegistry.registerBlobURL(url, srcURL, coop); }
+    void registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<BlobDataFileReference>&& reference, const String& contentType) final { m_blobRegistry.registerBlobURLOptionallyFileBacked(url, srcURL, WTFMove(reference), contentType, { }); }
     void registerBlobURLForSlice(const URL& url, const URL& srcURL, long long start, long long end, const String& contentType) final { m_blobRegistry.registerBlobURLForSlice(url, srcURL, start, end, contentType); }
     void unregisterBlobURL(const URL& url) final { m_blobRegistry.unregisterBlobURL(url); }
     unsigned long long blobSize(const URL& url) final { return m_blobRegistry.blobSize(url); }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to