Changeset 280881 in webkit
- Timestamp:
- Aug 10, 2021 7:58:01 PM (11 months ago)
- Location:
- trunk
- Files:
-
- 34 edited
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/blob-popup.https-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/fetch/FetchLoader.cpp (modified) (1 diff)
-
Source/WebCore/dom/Document.h (modified) (1 diff)
-
Source/WebCore/dom/ScriptExecutionContext.cpp (modified) (2 diffs)
-
Source/WebCore/dom/ScriptExecutionContext.h (modified) (2 diffs)
-
Source/WebCore/fileapi/Blob.cpp (modified) (2 diffs)
-
Source/WebCore/fileapi/FileReaderLoader.cpp (modified) (1 diff)
-
Source/WebCore/fileapi/ThreadableBlobRegistry.cpp (modified) (2 diffs)
-
Source/WebCore/fileapi/ThreadableBlobRegistry.h (modified) (1 diff)
-
Source/WebCore/html/HTMLMediaElement.cpp (modified) (1 diff)
-
Source/WebCore/loader/CrossOriginEmbedderPolicy.cpp (modified) (1 diff)
-
Source/WebCore/loader/CrossOriginOpenerPolicy.cpp (modified) (3 diffs)
-
Source/WebCore/loader/CrossOriginOpenerPolicy.h (modified) (2 diffs)
-
Source/WebCore/platform/network/BlobData.cpp (modified) (1 diff)
-
Source/WebCore/platform/network/BlobData.h (modified) (4 diffs)
-
Source/WebCore/platform/network/BlobRegistry.h (modified) (3 diffs)
-
Source/WebCore/platform/network/BlobRegistryImpl.cpp (modified) (3 diffs)
-
Source/WebCore/platform/network/BlobRegistryImpl.h (modified) (2 diffs)
-
Source/WebCore/platform/network/BlobResourceHandle.cpp (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (modified) (3 diffs)
-
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h (modified) (2 diffs)
-
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp (modified) (2 diffs)
-
Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp (modified) (1 diff)
-
Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.cpp (modified) (2 diffs)
-
Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.h (modified) (1 diff)
-
Source/WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm (modified) (1 diff)
-
Source/WebKitLegacy/win/ChangeLog (modified) (1 diff)
-
Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/TestExpectations
r280870 r280881 719 719 # test is served over HTTP. 720 720 imported/w3c/web-platform-tests/html/cross-origin-opener-policy/no-https.html [ Skip ] 721 722 # COOP tests that are failing and keep printing a different uuid in the error output.723 imported/w3c/web-platform-tests/html/cross-origin-opener-policy/blob-popup.https.html [ Failure Pass ]724 imported/w3c/web-platform-tests/html/cross-origin-opener-policy/coep-blob-popup.https.html [ Failure Pass ]725 721 726 722 # Newly imported WPT tests that are crashing. -
trunk/LayoutTests/imported/w3c/ChangeLog
r280870 r280881 1 2021-08-10 Chris Dumez <cdumez@apple.com> 2 3 Add Cross-Origin-Opener-Policy support for Blob URLs 4 https://bugs.webkit.org/show_bug.cgi?id=228924 5 6 Reviewed by Alex Christensen. 7 8 Rebaseline WPT test that is now passing. 9 10 * web-platform-tests/html/cross-origin-opener-policy/blob-popup.https-expected.txt: 11 1 12 2021-08-10 Chris Dumez <cdumez@apple.com> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/blob-popup.https-expected.txt
r280504 r280881 1 CONSOLE MESSAGE: TypeError: null is not an object (evaluating 'window.opener.furtherPopup = w')2 1 3 FAIL Cross-Origin-Opener-Policy and a blob URL popup assert_equals: expected 0 but got 36 2 PASS Cross-Origin-Opener-Policy and a blob URL popup 4 3 -
trunk/Source/WebCore/ChangeLog
r280872 r280881 1 2021-08-10 Chris Dumez <cdumez@apple.com> 2 3 Add Cross-Origin-Opener-Policy support for Blob URLs 4 https://bugs.webkit.org/show_bug.cgi?id=228924 5 6 Reviewed by Alex Christensen. 7 8 Pass ScriptExecutionContext's cross-origin-opener-policy when registering a public 9 Blob URL and store it in the blob registry alongside the blob data. As a result, 10 we are able to service the right COOP headers on the blob response later on when 11 doing a load of this blob. In the future, we'll pass the cross-origin-embedder-policy 12 as well, once we support it. 13 14 No new tests, rebaselined existing test. 15 16 * Modules/fetch/FetchLoader.cpp: 17 (WebCore::FetchLoader::startLoadingBlobURL): 18 * dom/Document.h: 19 * dom/ScriptExecutionContext.cpp: 20 (WebCore::ScriptExecutionContext::crossOriginOpenerPolicy const): 21 * dom/ScriptExecutionContext.h: 22 * fileapi/Blob.cpp: 23 (WebCore::BlobURLRegistry::registerURL): 24 (WebCore::Blob::Blob): 25 * fileapi/FileReaderLoader.cpp: 26 (WebCore::FileReaderLoader::start): 27 * fileapi/ThreadableBlobRegistry.cpp: 28 (WebCore::ThreadableBlobRegistry::registerBlobURL): 29 * fileapi/ThreadableBlobRegistry.h: 30 * html/HTMLMediaElement.cpp: 31 (WebCore::HTMLMediaElement::loadResource): 32 33 * loader/CrossOriginEmbedderPolicy.cpp: 34 (WebCore::obtainCrossOriginEmbedderPolicy): 35 For WebKit1, the initial empty document seems to have an empty URL instead of 36 "about:blank" so I had to extend the check so that COEP properly gets enabled. 37 38 * loader/CrossOriginOpenerPolicy.cpp: 39 (WebCore::obtainCrossOriginOpenerPolicy): 40 For WebKit1, the initial empty document seems to have an empty URL instead of 41 "about:blank" so I had to extend the check so that COOP properly gets enabled. 42 43 (WebCore::crossOriginOpenerPolicyToString): 44 (WebCore::CrossOriginOpenerPolicy::isolatedCopy const): 45 (WebCore::addCrossOriginOpenerPolicyHeaders): 46 * loader/CrossOriginOpenerPolicy.h: 47 (WebCore::operator==): 48 (WebCore::CrossOriginOpenerPolicy::encode const): 49 (WebCore::CrossOriginOpenerPolicy::decode): 50 * platform/network/BlobData.cpp: 51 (WebCore::BlobData::clone const): 52 * platform/network/BlobData.h: 53 (WebCore::BlobData::crossOriginOpenerPolicy const): 54 (WebCore::BlobData::setCrossOriginOpenerPolicy): 55 * platform/network/BlobRegistry.h: 56 * platform/network/BlobRegistryImpl.cpp: 57 (WebCore::BlobRegistryImpl::registerBlobURL): 58 (WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked): 59 * platform/network/BlobRegistryImpl.h: 60 * platform/network/BlobResourceHandle.cpp: 61 (WebCore::BlobResourceHandle::notifyResponseOnSuccess): 62 1 63 2021-08-10 Wenson Hsieh <wenson_hsieh@apple.com> 2 64 -
trunk/Source/WebCore/Modules/fetch/FetchLoader.cpp
r278516 r280881 66 66 } 67 67 68 ThreadableBlobRegistry::registerBlobURL(context.securityOrigin(), m_urlForReading, blobURL);68 ThreadableBlobRegistry::registerBlobURL(context.securityOrigin(), context.crossOriginOpenerPolicy(), m_urlForReading, blobURL); 69 69 70 70 ResourceRequest request(m_urlForReading); -
trunk/Source/WebCore/dom/Document.h
r280870 r280881 1355 1355 bool shouldForceNoOpenerBasedOnCOOP() const; 1356 1356 1357 const CrossOriginOpenerPolicy& crossOriginOpenerPolicy() const ;1357 const CrossOriginOpenerPolicy& crossOriginOpenerPolicy() const final; 1358 1358 void setCrossOriginOpenerPolicy(const CrossOriginOpenerPolicy&); 1359 1359 -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r277958 r280881 32 32 #include "CachedScript.h" 33 33 #include "CommonVM.h" 34 #include "CrossOriginOpenerPolicy.h" 34 35 #include "DOMTimer.h" 35 36 #include "DOMWindow.h" … … 336 337 } 337 338 339 const CrossOriginOpenerPolicy& ScriptExecutionContext::crossOriginOpenerPolicy() const 340 { 341 static NeverDestroyed<CrossOriginOpenerPolicy> coop; 342 return coop; 343 } 344 338 345 void ScriptExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject& activeDOMObject) 339 346 { -
trunk/Source/WebCore/dom/ScriptExecutionContext.h
r278426 r280881 79 79 enum class TaskSource : uint8_t; 80 80 81 struct CrossOriginOpenerPolicy; 82 81 83 #if ENABLE(SERVICE_WORKER) 82 84 class ServiceWorker; … … 146 148 bool activeDOMObjectsAreSuspended() const { return m_activeDOMObjectsAreSuspended; } 147 149 bool activeDOMObjectsAreStopped() const { return m_activeDOMObjectsAreStopped; } 150 151 virtual const CrossOriginOpenerPolicy& crossOriginOpenerPolicy() const; 148 152 149 153 JSC::ScriptExecutionStatus jscScriptExecutionStatus() const; -
trunk/Source/WebCore/fileapi/Blob.cpp
r280824 r280881 63 63 { 64 64 ASSERT(&blob.registry() == this); 65 ThreadableBlobRegistry::registerBlobURL(context.securityOrigin(), publicURL, static_cast<Blob&>(blob).url());65 ThreadableBlobRegistry::registerBlobURL(context.securityOrigin(), context.crossOriginOpenerPolicy(), publicURL, static_cast<Blob&>(blob).url()); 66 66 } 67 67 … … 138 138 { 139 139 if (fileBackedPath.isEmpty()) 140 ThreadableBlobRegistry::registerBlobURL(nullptr, m_internalURL, srcURL);140 ThreadableBlobRegistry::registerBlobURL(nullptr, { }, m_internalURL, srcURL); 141 141 else 142 142 ThreadableBlobRegistry::registerBlobURLOptionallyFileBacked(m_internalURL, srcURL, fileBackedPath, m_type); -
trunk/Source/WebCore/fileapi/FileReaderLoader.cpp
r278516 r280881 83 83 return; 84 84 } 85 ThreadableBlobRegistry::registerBlobURL(scriptExecutionContext->securityOrigin(), m_urlForReading, blob.url());85 ThreadableBlobRegistry::registerBlobURL(scriptExecutionContext->securityOrigin(), scriptExecutionContext->crossOriginOpenerPolicy(), m_urlForReading, blob.url()); 86 86 87 87 // Construct and load the request. -
trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp
r280824 r280881 100 100 } 101 101 102 void ThreadableBlobRegistry::registerBlobURL(SecurityOrigin* origin, const URL& url, const URL& srcURL)102 void ThreadableBlobRegistry::registerBlobURL(SecurityOrigin* origin, const CrossOriginOpenerPolicy& coop, const URL& url, const URL& srcURL) 103 103 { 104 104 // 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. … … 107 107 108 108 if (isMainThread()) { 109 blobRegistry().registerBlobURL(url, srcURL );109 blobRegistry().registerBlobURL(url, srcURL, coop); 110 110 return; 111 111 } 112 112 113 callOnMainThread([url = url.isolatedCopy(), srcURL = srcURL.isolatedCopy() ] {114 blobRegistry().registerBlobURL(url, srcURL );113 callOnMainThread([url = url.isolatedCopy(), srcURL = srcURL.isolatedCopy(), coop = crossThreadCopy(coop)] { 114 blobRegistry().registerBlobURL(url, srcURL, coop); 115 115 }); 116 116 } -
trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h
r280824 r280881 39 39 class SecurityOrigin; 40 40 41 struct CrossOriginOpenerPolicy; 42 41 43 class ThreadableBlobRegistry { 42 44 public: 43 45 static void registerFileBlobURL(const URL&, const String& path, const String& replacementPath, const String& contentType); 44 46 static void registerBlobURL(const URL&, Vector<BlobPart>&& blobParts, const String& contentType); 45 static void registerBlobURL(SecurityOrigin*, const URL&, const URL& srcURL);47 static void registerBlobURL(SecurityOrigin*, const CrossOriginOpenerPolicy&, const URL&, const URL& srcURL); 46 48 static void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, const String& fileBackedPath, const String& contentType); 47 49 static void registerBlobURLForSlice(const URL& newURL, const URL& srcURL, long long start, long long end, const String& contentType); -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r280720 r280881 1553 1553 ThreadableBlobRegistry::unregisterBlobURL(m_blobURLForReading); 1554 1554 m_blobURLForReading = BlobURL::createPublicURL(&document().securityOrigin()); 1555 ThreadableBlobRegistry::registerBlobURL(&document().securityOrigin(), m_blobURLForReading, m_blob->url());1555 ThreadableBlobRegistry::registerBlobURL(&document().securityOrigin(), document().crossOriginOpenerPolicy(), m_blobURLForReading, m_blob->url()); 1556 1556 1557 1557 if (!m_player->load(m_blobURLForReading, contentType, keySystem)) -
trunk/Source/WebCore/loader/CrossOriginEmbedderPolicy.cpp
r280504 r280881 46 46 CrossOriginEmbedderPolicy policy; 47 47 // FIXME: about:blank should be marked as secure as per https://w3c.github.io/webappsec-secure-contexts/#potentially-trustworthy-url. 48 if (!context.isSecureContext() && context.url() != aboutBlankURL() )48 if (!context.isSecureContext() && context.url() != aboutBlankURL() && !context.url().isEmpty()) 49 49 return policy; 50 50 -
trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.cpp
r280504 r280881 34 34 namespace WebCore { 35 35 36 static String crossOriginOpenerPolicyToString(const CrossOriginOpenerPolicyValue& coop) 37 { 38 switch (coop) { 39 case CrossOriginOpenerPolicyValue::SameOrigin: 40 case CrossOriginOpenerPolicyValue::SameOriginPlusCOEP: 41 return "same-origin"_s; 42 case CrossOriginOpenerPolicyValue::SameOriginAllowPopups: 43 return "same-origin-allow-popups"_s; 44 case CrossOriginOpenerPolicyValue::UnsafeNone: 45 break; 46 } 47 return "unsafe-none"_s; 48 } 49 36 50 // https://html.spec.whatwg.org/multipage/origin.html#obtain-coop 37 51 CrossOriginOpenerPolicy obtainCrossOriginOpenerPolicy(const ResourceResponse& response, const ScriptExecutionContext& context) … … 62 76 CrossOriginOpenerPolicy policy; 63 77 // FIXME: about:blank should be marked as secure as per https://w3c.github.io/webappsec-secure-contexts/#potentially-trustworthy-url. 64 if (!context.isSecureContext() && context.url() != aboutBlankURL() )78 if (!context.isSecureContext() && context.url() != aboutBlankURL() && !context.url().isEmpty()) 65 79 return policy; 66 80 … … 70 84 } 71 85 86 CrossOriginOpenerPolicy CrossOriginOpenerPolicy::isolatedCopy() const 87 { 88 return { 89 value, 90 reportingEndpoint.isolatedCopy(), 91 reportOnlyValue, 92 reportOnlyReportingEndpoint.isolatedCopy() 93 }; 94 } 95 96 void addCrossOriginOpenerPolicyHeaders(ResourceResponse& response, const CrossOriginOpenerPolicy& coop) 97 { 98 if (coop.value != CrossOriginOpenerPolicyValue::UnsafeNone) { 99 if (coop.reportingEndpoint.isEmpty()) 100 response.setHTTPHeaderField(HTTPHeaderName::CrossOriginOpenerPolicy, crossOriginOpenerPolicyToString(coop.value)); 101 else 102 response.setHTTPHeaderField(HTTPHeaderName::CrossOriginOpenerPolicy, makeString(crossOriginOpenerPolicyToString(coop.value), "; report-to=\"", coop.reportingEndpoint, '\"')); 103 if (coop.value == CrossOriginOpenerPolicyValue::SameOriginPlusCOEP) 104 response.setHTTPHeaderField(HTTPHeaderName::CrossOriginEmbedderPolicy, "require-corp"_s); // FIXME: Pass in coep and set header value correctly. 105 } 106 if (coop.reportOnlyValue != CrossOriginOpenerPolicyValue::UnsafeNone) { 107 if (coop.reportOnlyReportingEndpoint.isEmpty()) 108 response.setHTTPHeaderField(HTTPHeaderName::CrossOriginOpenerPolicyReportOnly, crossOriginOpenerPolicyToString(coop.reportOnlyValue)); 109 else 110 response.setHTTPHeaderField(HTTPHeaderName::CrossOriginOpenerPolicyReportOnly, makeString(crossOriginOpenerPolicyToString(coop.reportOnlyValue), "; report-to=\"", coop.reportOnlyReportingEndpoint, '\"')); 111 if (coop.reportOnlyValue == CrossOriginOpenerPolicyValue::SameOriginPlusCOEP) 112 response.setHTTPHeaderField(HTTPHeaderName::CrossOriginEmbedderPolicyReportOnly, "require-corp"_s); // FIXME: Pass in coep and set header value correctly. 113 } 114 } 115 72 116 } // namespace WebCore -
trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.h
r280504 r280881 49 49 CrossOriginOpenerPolicyValue reportOnlyValue { CrossOriginOpenerPolicyValue::UnsafeNone }; 50 50 String reportOnlyReportingEndpoint; 51 52 CrossOriginOpenerPolicy isolatedCopy() const; 53 template<class Encoder> void encode(Encoder&) const; 54 template<class Decoder> static std::optional<CrossOriginOpenerPolicy> decode(Decoder&); 51 55 }; 56 57 inline bool operator==(const CrossOriginOpenerPolicy& a, const CrossOriginOpenerPolicy& b) 58 { 59 return a.value == b.value && a.reportingEndpoint == b.reportingEndpoint && a.reportOnlyValue == b.reportOnlyValue && a.reportOnlyReportingEndpoint == b.reportOnlyReportingEndpoint; 60 } 61 62 template<class Encoder> 63 void CrossOriginOpenerPolicy::encode(Encoder& encoder) const 64 { 65 encoder << value << reportingEndpoint << reportOnlyValue << reportOnlyReportingEndpoint; 66 } 67 68 template<class Decoder> 69 std::optional<CrossOriginOpenerPolicy> CrossOriginOpenerPolicy::decode(Decoder& decoder) 70 { 71 std::optional<CrossOriginOpenerPolicyValue> value; 72 decoder >> value; 73 if (!value) 74 return std::nullopt; 75 76 std::optional<String> reportingEndpoint; 77 decoder >> reportingEndpoint; 78 if (!reportingEndpoint) 79 return std::nullopt; 80 81 std::optional<CrossOriginOpenerPolicyValue> reportOnlyValue; 82 decoder >> reportOnlyValue; 83 if (!reportOnlyValue) 84 return std::nullopt; 85 86 std::optional<String> reportOnlyReportingEndpoint; 87 decoder >> reportOnlyReportingEndpoint; 88 if (!reportOnlyReportingEndpoint) 89 return std::nullopt; 90 91 return {{ 92 *value, 93 WTFMove(*reportingEndpoint), 94 *reportOnlyValue, 95 WTFMove(*reportOnlyReportingEndpoint) 96 }}; 97 } 52 98 53 99 // https://html.spec.whatwg.org/multipage/origin.html#coop-enforcement-result … … 62 108 63 109 CrossOriginOpenerPolicy obtainCrossOriginOpenerPolicy(const ResourceResponse&, const ScriptExecutionContext&); 110 WEBCORE_EXPORT void addCrossOriginOpenerPolicyHeaders(ResourceResponse&, const CrossOriginOpenerPolicy&); 64 111 65 112 } // namespace WebCore 113 114 namespace WTF { 115 116 template<> struct EnumTraits<WebCore::CrossOriginOpenerPolicyValue> { 117 using values = EnumValues< 118 WebCore::CrossOriginOpenerPolicyValue, 119 WebCore::CrossOriginOpenerPolicyValue::UnsafeNone, 120 WebCore::CrossOriginOpenerPolicyValue::SameOrigin, 121 WebCore::CrossOriginOpenerPolicyValue::SameOriginPlusCOEP, 122 WebCore::CrossOriginOpenerPolicyValue::SameOriginAllowPopups 123 >; 124 }; 125 126 } // namespace WTF -
trunk/Source/WebCore/platform/network/BlobData.cpp
r204466 r280881 79 79 } 80 80 81 Ref<BlobData> BlobData::clone() const 82 { 83 auto blobData = BlobData::create(m_contentType); 84 blobData->m_coop = m_coop; 85 blobData->m_items = m_items; 86 return blobData; 87 } 88 81 89 void BlobData::appendFile(BlobDataFileReference* file, long long offset, long long length) 82 90 { -
trunk/Source/WebCore/platform/network/BlobData.h
r218799 r280881 33 33 34 34 #include "BlobDataFileReference.h" 35 #include "CrossOriginOpenerPolicy.h" 35 36 #include "ThreadSafeDataBuffer.h" 36 37 #include <wtf/Forward.h> … … 106 107 const String& contentType() const { return m_contentType; } 107 108 109 const CrossOriginOpenerPolicy& crossOriginOpenerPolicy() const { return m_coop; } 110 void setCrossOriginOpenerPolicy(const CrossOriginOpenerPolicy& coop) { m_coop = coop; } 111 108 112 const BlobDataItemList& items() const { return m_items; } 109 113 void swapItems(BlobDataItemList&); … … 111 115 void appendData(const ThreadSafeDataBuffer&); 112 116 void appendFile(Ref<BlobDataFileReference>&&); 117 118 Ref<BlobData> clone() const; 113 119 114 120 private: … … 120 126 121 127 String m_contentType; 128 CrossOriginOpenerPolicy m_coop; 122 129 BlobDataItemList m_items; 123 130 }; -
trunk/Source/WebCore/platform/network/BlobRegistry.h
r280824 r280881 32 32 #pragma once 33 33 34 #include <optional> 34 35 #include <wtf/Forward.h> 35 36 … … 40 41 class BlobRegistry; 41 42 class BlobRegistryImpl; 43 44 struct CrossOriginOpenerPolicy; 42 45 43 46 WEBCORE_EXPORT BlobRegistry& blobRegistry(); … … 54 57 55 58 // Registers a new blob URL referring to the blob data identified by the specified srcURL. 56 virtual void registerBlobURL(const URL&, const URL& srcURL ) = 0;59 virtual void registerBlobURL(const URL&, const URL& srcURL, const CrossOriginOpenerPolicy&) = 0; 57 60 58 61 // 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. -
trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp
r280824 r280881 153 153 } 154 154 155 void BlobRegistryImpl::registerBlobURL(const URL& url, const URL& srcURL )156 { 157 registerBlobURLOptionallyFileBacked(url, srcURL, nullptr, { } );158 } 159 160 void BlobRegistryImpl::registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<BlobDataFileReference>&& file, const String& contentType )155 void BlobRegistryImpl::registerBlobURL(const URL& url, const URL& srcURL, const CrossOriginOpenerPolicy& coop) 156 { 157 registerBlobURLOptionallyFileBacked(url, srcURL, nullptr, { }, coop); 158 } 159 160 void BlobRegistryImpl::registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<BlobDataFileReference>&& file, const String& contentType, const CrossOriginOpenerPolicy& coop) 161 161 { 162 162 ASSERT(isMainThread()); … … 165 165 BlobData* src = getBlobDataFromURL(srcURL); 166 166 if (src) { 167 addBlobData(url.string(), src); 167 if (src->crossOriginOpenerPolicy() == coop) 168 addBlobData(url.string(), src); 169 else { 170 auto clone = src->clone(); 171 clone->setCrossOriginOpenerPolicy(coop); 172 addBlobData(url.string(), WTFMove(clone)); 173 } 168 174 return; 169 175 } … … 174 180 auto backingFile = BlobData::create(contentType); 175 181 backingFile->appendFile(file.releaseNonNull()); 182 backingFile->setCrossOriginOpenerPolicy(coop); 176 183 177 184 addBlobData(url.string(), WTFMove(backingFile)); -
trunk/Source/WebCore/platform/network/BlobRegistryImpl.h
r280824 r280881 46 46 class ResourceRequest; 47 47 class ThreadSafeDataBuffer; 48 struct CrossOriginOpenerPolicy; 48 49 49 50 // BlobRegistryImpl is not thread-safe. It should only be called from main thread. … … 62 63 void registerFileBlobURL(const URL&, Ref<BlobDataFileReference>&&, const String& contentType); 63 64 void registerBlobURL(const URL&, Vector<BlobPart>&&, const String& contentType); 64 void registerBlobURL(const URL&, const URL& srcURL );65 void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, RefPtr<BlobDataFileReference>&&, const String& contentType );65 void registerBlobURL(const URL&, const URL& srcURL, const CrossOriginOpenerPolicy&); 66 void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, RefPtr<BlobDataFileReference>&&, const String& contentType, const CrossOriginOpenerPolicy&); 66 67 void registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end, const String& contentType); 67 68 void unregisterBlobURL(const URL&); -
trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp
r278738 r280881 35 35 #include "AsyncFileStream.h" 36 36 #include "BlobData.h" 37 #include "CrossOriginOpenerPolicy.h" 37 38 #include "FileStream.h" 38 39 #include "HTTPHeaderNames.h" … … 577 578 response.setHTTPHeaderField(HTTPHeaderName::ContentType, m_blobData->contentType()); 578 579 response.setHTTPHeaderField(HTTPHeaderName::ContentLength, String::number(m_totalRemainingSize)); 580 addCrossOriginOpenerPolicyHeaders(response, m_blobData->crossOriginOpenerPolicy()); 579 581 580 582 if (isRangeRequest) -
trunk/Source/WebKit/ChangeLog
r280879 r280881 1 2021-08-10 Chris Dumez <cdumez@apple.com> 2 3 Add Cross-Origin-Opener-Policy support for Blob URLs 4 https://bugs.webkit.org/show_bug.cgi?id=228924 5 6 Reviewed by Alex Christensen. 7 8 * NetworkProcess/NetworkConnectionToWebProcess.cpp: 9 (WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL): 10 (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked): 11 * NetworkProcess/NetworkConnectionToWebProcess.h: 12 * NetworkProcess/NetworkConnectionToWebProcess.messages.in: 13 * NetworkProcess/NetworkDataTaskBlob.cpp: 14 (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse): 15 * NetworkProcess/NetworkProcessPlatformStrategies.cpp: 16 (WebKit::NetworkProcessPlatformStrategies::createBlobRegistry): 17 * WebProcess/FileAPI/BlobRegistryProxy.cpp: 18 (WebKit::BlobRegistryProxy::registerBlobURL): 19 * WebProcess/FileAPI/BlobRegistryProxy.h: 20 1 21 2021-08-10 Tim Horton <timothy_horton@apple.com> 2 22 -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
r280824 r280881 829 829 } 830 830 831 void NetworkConnectionToWebProcess::registerBlobURLFromURL(const URL& url, const URL& srcURL )831 void NetworkConnectionToWebProcess::registerBlobURLFromURL(const URL& url, const URL& srcURL, CrossOriginOpenerPolicy&& coop) 832 832 { 833 833 auto* session = networkSession(); … … 835 835 return; 836 836 837 session->blobRegistry().registerBlobURL(url, srcURL );837 session->blobRegistry().registerBlobURL(url, srcURL, WTFMove(coop)); 838 838 } 839 839 … … 846 846 return; 847 847 848 session->blobRegistry().registerBlobURLOptionallyFileBacked(url, srcURL, BlobDataFileReferenceWithSandboxExtension::create(fileBackedPath), contentType );848 session->blobRegistry().registerBlobURLOptionallyFileBacked(url, srcURL, BlobDataFileReferenceWithSandboxExtension::create(fileBackedPath), contentType, { }); 849 849 } 850 850 -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
r280824 r280881 67 67 enum class StorageAccessScope : bool; 68 68 enum class ShouldAskITP : bool; 69 struct CrossOriginOpenerPolicy; 69 70 struct RequestStorageAccessResult; 70 71 struct SameSiteInfo; … … 230 231 void registerFileBlobURL(const URL&, const String& path, const String& replacementPath, SandboxExtension::Handle&&, const String& contentType); 231 232 void registerBlobURL(const URL&, Vector<WebCore::BlobPart>&&, const String& contentType); 232 void registerBlobURLFromURL(const URL&, const URL& srcURL );233 void registerBlobURLFromURL(const URL&, const URL& srcURL, WebCore::CrossOriginOpenerPolicy&&); 233 234 void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, const String& fileBackedPath, const String& contentType); 234 235 void registerBlobURLForSlice(const URL&, const URL& srcURL, int64_t start, int64_t end, const String& contentType); -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
r280824 r280881 51 51 RegisterFileBlobURL(URL url, String path, String replacementPath, WebKit::SandboxExtension::Handle extensionHandle, String contentType) 52 52 RegisterBlobURL(URL url, Vector<WebCore::BlobPart> blobParts, String contentType) 53 RegisterBlobURLFromURL(URL url, URL srcURL )53 RegisterBlobURLFromURL(URL url, URL srcURL, struct WebCore::CrossOriginOpenerPolicy coop) 54 54 RegisterBlobURLOptionallyFileBacked(URL url, URL srcURL, String fileBackedPath, String contentType) 55 55 RegisterBlobURLForSlice(URL url, URL srcURL, int64_t start, int64_t end, String contentType) -
trunk/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp
r278532 r280881 42 42 #include <WebCore/AsyncFileStream.h> 43 43 #include <WebCore/BlobRegistryImpl.h> 44 #include <WebCore/CrossOriginOpenerPolicy.h> 44 45 #include <WebCore/HTTPParsers.h> 45 46 #include <WebCore/ParsedContentRange.h> … … 265 266 response.setHTTPHeaderField(HTTPHeaderName::ContentType, m_blobData->contentType()); 266 267 response.setHTTPHeaderField(HTTPHeaderName::ContentLength, String::number(m_totalRemainingSize)); 268 addCrossOriginOpenerPolicyHeaders(response, m_blobData->crossOriginOpenerPolicy()); 267 269 268 270 if (isRangeRequest) -
trunk/Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp
r280824 r280881 60 60 void registerFileBlobURL(const URL&, Ref<BlobDataFileReference>&&, const String& path, const String& contentType) final { ASSERT_NOT_REACHED(); } 61 61 void registerBlobURL(const URL&, Vector<BlobPart>&&, const String& contentType) final { ASSERT_NOT_REACHED(); } 62 void registerBlobURL(const URL&, const URL& srcURL ) final { ASSERT_NOT_REACHED(); }62 void registerBlobURL(const URL&, const URL& srcURL, const WebCore::CrossOriginOpenerPolicy&) final { ASSERT_NOT_REACHED(); } 63 63 void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, RefPtr<BlobDataFileReference>&&, const String& contentType) final { ASSERT_NOT_REACHED(); } 64 64 void registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end, const String& contentType) final { ASSERT_NOT_REACHED(); } -
trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.cpp
r280824 r280881 32 32 #include "WebProcess.h" 33 33 #include <WebCore/BlobDataFileReference.h> 34 #include <WebCore/CrossOriginOpenerPolicy.h> 34 35 #include <WebCore/SWContextManager.h> 35 36 … … 54 55 } 55 56 56 void BlobRegistryProxy::registerBlobURL(const URL& url, const URL& srcURL )57 void BlobRegistryProxy::registerBlobURL(const URL& url, const URL& srcURL, const CrossOriginOpenerPolicy& coop) 57 58 { 58 WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLFromURL { url, srcURL }, 0);59 WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLFromURL { url, srcURL, coop }, 0); 59 60 } 60 61 -
trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.h
r280824 r280881 34 34 void registerFileBlobURL(const URL&, Ref<WebCore::BlobDataFileReference>&&, const String& path, const String& contentType) final; 35 35 void registerBlobURL(const URL&, Vector<WebCore::BlobPart>&&, const String& contentType) final; 36 void registerBlobURL(const URL&, const URL& srcURL ) final;36 void registerBlobURL(const URL&, const URL& srcURL, const WebCore::CrossOriginOpenerPolicy&) final; 37 37 void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, RefPtr<WebCore::BlobDataFileReference>&&, const String& contentType) final; 38 38 void unregisterBlobURL(const URL&) final; -
trunk/Source/WebKitLegacy/mac/ChangeLog
r280855 r280881 1 2021-08-10 Chris Dumez <cdumez@apple.com> 2 3 Add Cross-Origin-Opener-Policy support for Blob URLs 4 https://bugs.webkit.org/show_bug.cgi?id=228924 5 6 Reviewed by Alex Christensen. 7 8 * WebCoreSupport/WebPlatformStrategies.mm: 9 1 10 2021-08-10 Chris Dumez <cdumez@apple.com> 2 11 -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm
r280824 r280881 86 86 void registerFileBlobURL(const URL& url, Ref<BlobDataFileReference>&& reference, const String&, const String& contentType) final { m_blobRegistry.registerFileBlobURL(url, WTFMove(reference), contentType); } 87 87 void registerBlobURL(const URL& url, Vector<BlobPart>&& parts, const String& contentType) final { m_blobRegistry.registerBlobURL(url, WTFMove(parts), contentType); } 88 void registerBlobURL(const URL& url, const URL& srcURL ) final { m_blobRegistry.registerBlobURL(url, srcURL); }89 void registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<BlobDataFileReference>&& reference, const String& contentType) final { m_blobRegistry.registerBlobURLOptionallyFileBacked(url, srcURL, WTFMove(reference), contentType ); }88 void registerBlobURL(const URL& url, const URL& srcURL, const CrossOriginOpenerPolicy& coop) final { m_blobRegistry.registerBlobURL(url, srcURL, coop); } 89 void registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<BlobDataFileReference>&& reference, const String& contentType) final { m_blobRegistry.registerBlobURLOptionallyFileBacked(url, srcURL, WTFMove(reference), contentType, { }); } 90 90 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); } 91 91 void unregisterBlobURL(const URL& url) final { m_blobRegistry.unregisterBlobURL(url); } -
trunk/Source/WebKitLegacy/win/ChangeLog
r280824 r280881 1 2021-08-10 Chris Dumez <cdumez@apple.com> 2 3 Add Cross-Origin-Opener-Policy support for Blob URLs 4 https://bugs.webkit.org/show_bug.cgi?id=228924 5 6 Reviewed by Alex Christensen. 7 8 * WebCoreSupport/WebPlatformStrategies.cpp: 9 1 10 2021-08-09 Chris Dumez <cdumez@apple.com> 2 11 -
trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp
r280824 r280881 82 82 void registerFileBlobURL(const URL& url, Ref<BlobDataFileReference>&& reference, const String&, const String& contentType) final { m_blobRegistry.registerFileBlobURL(url, WTFMove(reference), contentType); } 83 83 void registerBlobURL(const URL& url, Vector<BlobPart>&& parts, const String& contentType) final { m_blobRegistry.registerBlobURL(url, WTFMove(parts), contentType); } 84 void registerBlobURL(const URL& url, const URL& srcURL ) final { m_blobRegistry.registerBlobURL(url, srcURL); }85 void registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<BlobDataFileReference>&& reference, const String& contentType) final { m_blobRegistry.registerBlobURLOptionallyFileBacked(url, srcURL, WTFMove(reference), contentType ); }84 void registerBlobURL(const URL& url, const URL& srcURL, const CrossOriginOpenerPolicy& coop) final { m_blobRegistry.registerBlobURL(url, srcURL, coop); } 85 void registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<BlobDataFileReference>&& reference, const String& contentType) final { m_blobRegistry.registerBlobURLOptionallyFileBacked(url, srcURL, WTFMove(reference), contentType, { }); } 86 86 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); } 87 87 void unregisterBlobURL(const URL& url) final { m_blobRegistry.unregisterBlobURL(url); }
Note: See TracChangeset
for help on using the changeset viewer.