Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt ScopedURL in Document #8255

Closed
wants to merge 2 commits into from
Closed

Adopt ScopedURL in Document #8255

wants to merge 2 commits into from

Conversation

sysrqb
Copy link
Contributor

@sysrqb sysrqb commented Jan 5, 2023

37c552a

Adopt ScopedURL in Document
https://bugs.webkit.org/show_bug.cgi?id=250152
rdar://problem/103929390

Reviewed by NOBODY (OOPS!).

A ScopedURL carries the associated top frame SecurityOrigin along with the URL.
This tight coupling will provide easier seamless partitioning of Blob URLs in
the future. This patch does not make any semantic changes.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::setURL):
(WebCore::isURLPotentiallyTrustworthy):
* Source/WebCore/dom/Document.h:
* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::doCrossOriginOpenerHandlingOfResponse):
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::scheduleRefreshIfNeeded):
* Source/WebCore/plugins/PluginData.cpp:
(WebCore::PluginData::webVisiblePlugins const):
* Source/WebCore/xml/XSLTProcessor.cpp:
(WebCore::XSLTProcessor::createDocumentFromSource):
* Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
(WebKit::WebResourceLoadObserver::logSubresourceLoading):

5ac4aee

Introduce and adopt ScopedURL
https://bugs.webkit.org/show_bug.cgi?id=250032
rdar://problem/103840054

Reviewed by NOBODY (OOPS!).

We introduce a new ScopedURL type that inherits from URL. This is a special
type because it tightly couples a URL and the SecurityOrigin of the main frame
where the URL was created. The adoption of ScopedURL in this patch is a no-op,
and conversions between ScopedURL and URL are implicit. In this future, this
class will provide important context when the URL is a Blob URL.

* Source/WebCore/Headers.cmake:
* Source/WebCore/Modules/mediasource/MediaSourceRegistry.cpp:
(WebCore::MediaSourceRegistry::unregisterURL):
* Source/WebCore/Modules/mediasource/MediaSourceRegistry.h:
* Source/WebCore/Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::connect):
(WebCore::WebSocket::url const):
* Source/WebCore/Modules/websockets/WebSocket.h:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/fileapi/Blob.cpp:
(WebCore::BlobURLRegistry::unregisterURL):
* Source/WebCore/fileapi/Blob.h:
(WebCore::Blob::url const):
* Source/WebCore/fileapi/BlobLoader.h:
* Source/WebCore/fileapi/BlobURL.cpp:
(WebCore::BlobURL::getOriginURL):
(WebCore::BlobURL::isSecureBlobURL):
* Source/WebCore/fileapi/BlobURL.h:
* Source/WebCore/fileapi/FileReaderLoader.cpp:
(WebCore::FileReaderLoader::start):
* Source/WebCore/fileapi/FileReaderLoader.h:
* Source/WebCore/fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::registerFileBlobURL):
(WebCore::ThreadableBlobRegistry::registerBlobURL):
(WebCore::unregisterBlobURLOriginIfNecessary):
(WebCore::ThreadableBlobRegistry::registerBlobURLOptionallyFileBacked):
(WebCore::ThreadableBlobRegistry::registerBlobURLForSlice):
(WebCore::ThreadableBlobRegistry::blobSize):
(WebCore::ThreadableBlobRegistry::unregisterBlobURL):
(WebCore::ThreadableBlobRegistry::registerBlobURLHandle):
(WebCore::ThreadableBlobRegistry::unregisterBlobURLHandle):
* Source/WebCore/fileapi/ThreadableBlobRegistry.h:
* Source/WebCore/fileapi/URLKeepingBlobAlive.cpp:
(WebCore::URLKeepingBlobAlive::URLKeepingBlobAlive):
(WebCore::URLKeepingBlobAlive::operator=):
* Source/WebCore/fileapi/URLKeepingBlobAlive.h:
(WebCore::URLKeepingBlobAlive::URLKeepingBlobAlive):
(WebCore::URLKeepingBlobAlive::operator const ScopedURL& const):
(WebCore::URLKeepingBlobAlive::url const):
(WebCore::URLKeepingBlobAlive::operator=):
(WebCore::URLKeepingBlobAlive::operator const URL& const): Deleted.
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/PublicURLManager.cpp:
(WebCore::PublicURLManager::revoke):
* Source/WebCore/html/PublicURLManager.h:
* Source/WebCore/html/URLRegistry.h:
* Source/WebCore/loader/MixedContentChecker.cpp:
(WebCore::MixedContentChecker::isMixedContent):
* Source/WebCore/loader/MixedContentChecker.h:
* Source/WebCore/page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::create):
(WebCore::SecurityOrigin::emptyOrigin):
(WebCore::SecurityOrigin::isSecure):
(WebCore::SecurityOrigin::canRequest const):
* Source/WebCore/page/SecurityOrigin.h:
(WebCore::operator==):
(WebCore::operator!=):
* Source/WebCore/platform/network/BlobPart.h:
(WebCore::BlobPart::BlobPart):
(WebCore::BlobPart::url const):
* Source/WebCore/platform/network/BlobRegistry.h:
* Source/WebCore/platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::registerFileBlobURL):
(WebCore::BlobRegistryImpl::registerBlobURL):
(WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked):
(WebCore::BlobRegistryImpl::registerBlobURLForSlice):
(WebCore::BlobRegistryImpl::unregisterBlobURL):
(WebCore::BlobRegistryImpl::getBlobDataFromURL const):
(WebCore::BlobRegistryImpl::blobSize):
(WebCore::BlobRegistryImpl::writeBlobToFilePath):
(WebCore::BlobRegistryImpl::filesInBlob const):
(WebCore::BlobRegistryImpl::registerBlobURLHandle):
(WebCore::BlobRegistryImpl::unregisterBlobURLHandle):
* Source/WebCore/platform/network/BlobRegistryImpl.h:
* Source/WebCore/platform/network/FormData.cpp:
(WebCore::FormDataElement::lengthInBytes const):
(WebCore::FormData::appendBlob):
(WebCore::appendBlobResolved):
* Source/WebCore/platform/network/FormData.h:
(WebCore::FormDataElement::FormDataElement):
* Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp:
* Source/WebCore/workers/AbstractWorker.cpp:
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
(WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLHandle):
(WebKit::NetworkConnectionToWebProcess::unregisterBlobURLHandle):
(WebKit::NetworkConnectionToWebProcess::blobSize):
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:
* Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp:
(WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
* Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerFileBlobURL):
(WebKit::BlobRegistryProxy::registerBlobURL):
(WebKit::BlobRegistryProxy::registerBlobURLOptionallyFileBacked):
(WebKit::BlobRegistryProxy::unregisterBlobURL):
(WebKit::BlobRegistryProxy::registerBlobURLForSlice):
(WebKit::BlobRegistryProxy::registerBlobURLHandle):
(WebKit::BlobRegistryProxy::unregisterBlobURLHandle):
(WebKit::BlobRegistryProxy::blobSize):
* Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.h:
* Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm:
* Source/WebKitLegacy/mac/WebCoreSupport/WebSecurityOrigin.mm:
(-[WebSecurityOrigin initWithURL:]):
* Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp:
(TestWebKitAPI::TEST_F):

37c552a

Misc iOS, tvOS & watchOS macOS Linux Windows
❌ πŸ§ͺ style ❌ πŸ›  ios ❌ πŸ›  mac βœ… πŸ›  wpe ❌ πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings ❌ πŸ›  ios-sim ❌ πŸ›  mac-AS-debug ❌ πŸ›  gtk ❌ πŸ›  wincairo
βœ… πŸ§ͺ webkitperl ❌ πŸ§ͺ ios-wk2 ❌ πŸ§ͺ api-mac ❌ πŸ§ͺ gtk-wk2
❌ πŸ§ͺ api-ios ❌ πŸ§ͺ mac-wk1 ❌ πŸ§ͺ api-gtk
❌ πŸ›  tv ❌ πŸ§ͺ mac-wk2
❌ πŸ›  tv-sim ❌ πŸ§ͺ mac-AS-debug-wk2
❌ πŸ›  watch ❌ πŸ§ͺ mac-wk2-stress
❌ πŸ›  watch-sim

https://bugs.webkit.org/show_bug.cgi?id=250032
rdar://problem/103840054

Reviewed by NOBODY (OOPS!).

We introduce a new ScopedURL type that inherits from URL. This is a special
type because it tightly couples a URL and the SecurityOrigin of the main frame
where the URL was created. The adoption of ScopedURL in this patch is a no-op,
and conversions between ScopedURL and URL are implicit. In this future, this
class will provide important context when the URL is a Blob URL.

* Source/WebCore/Headers.cmake:
* Source/WebCore/Modules/mediasource/MediaSourceRegistry.cpp:
(WebCore::MediaSourceRegistry::unregisterURL):
* Source/WebCore/Modules/mediasource/MediaSourceRegistry.h:
* Source/WebCore/Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::connect):
(WebCore::WebSocket::url const):
* Source/WebCore/Modules/websockets/WebSocket.h:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/fileapi/Blob.cpp:
(WebCore::BlobURLRegistry::unregisterURL):
* Source/WebCore/fileapi/Blob.h:
(WebCore::Blob::url const):
* Source/WebCore/fileapi/BlobLoader.h:
* Source/WebCore/fileapi/BlobURL.cpp:
(WebCore::BlobURL::getOriginURL):
(WebCore::BlobURL::isSecureBlobURL):
* Source/WebCore/fileapi/BlobURL.h:
* Source/WebCore/fileapi/FileReaderLoader.cpp:
(WebCore::FileReaderLoader::start):
* Source/WebCore/fileapi/FileReaderLoader.h:
* Source/WebCore/fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::registerFileBlobURL):
(WebCore::ThreadableBlobRegistry::registerBlobURL):
(WebCore::unregisterBlobURLOriginIfNecessary):
(WebCore::ThreadableBlobRegistry::registerBlobURLOptionallyFileBacked):
(WebCore::ThreadableBlobRegistry::registerBlobURLForSlice):
(WebCore::ThreadableBlobRegistry::blobSize):
(WebCore::ThreadableBlobRegistry::unregisterBlobURL):
(WebCore::ThreadableBlobRegistry::registerBlobURLHandle):
(WebCore::ThreadableBlobRegistry::unregisterBlobURLHandle):
* Source/WebCore/fileapi/ThreadableBlobRegistry.h:
* Source/WebCore/fileapi/URLKeepingBlobAlive.cpp:
(WebCore::URLKeepingBlobAlive::URLKeepingBlobAlive):
(WebCore::URLKeepingBlobAlive::operator=):
* Source/WebCore/fileapi/URLKeepingBlobAlive.h:
(WebCore::URLKeepingBlobAlive::URLKeepingBlobAlive):
(WebCore::URLKeepingBlobAlive::operator const ScopedURL& const):
(WebCore::URLKeepingBlobAlive::url const):
(WebCore::URLKeepingBlobAlive::operator=):
(WebCore::URLKeepingBlobAlive::operator const URL& const): Deleted.
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/PublicURLManager.cpp:
(WebCore::PublicURLManager::revoke):
* Source/WebCore/html/PublicURLManager.h:
* Source/WebCore/html/URLRegistry.h:
* Source/WebCore/loader/MixedContentChecker.cpp:
(WebCore::MixedContentChecker::isMixedContent):
* Source/WebCore/loader/MixedContentChecker.h:
* Source/WebCore/page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::create):
(WebCore::SecurityOrigin::emptyOrigin):
(WebCore::SecurityOrigin::isSecure):
(WebCore::SecurityOrigin::canRequest const):
* Source/WebCore/page/SecurityOrigin.h:
(WebCore::operator==):
(WebCore::operator!=):
* Source/WebCore/platform/network/BlobPart.h:
(WebCore::BlobPart::BlobPart):
(WebCore::BlobPart::url const):
* Source/WebCore/platform/network/BlobRegistry.h:
* Source/WebCore/platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::registerFileBlobURL):
(WebCore::BlobRegistryImpl::registerBlobURL):
(WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked):
(WebCore::BlobRegistryImpl::registerBlobURLForSlice):
(WebCore::BlobRegistryImpl::unregisterBlobURL):
(WebCore::BlobRegistryImpl::getBlobDataFromURL const):
(WebCore::BlobRegistryImpl::blobSize):
(WebCore::BlobRegistryImpl::writeBlobToFilePath):
(WebCore::BlobRegistryImpl::filesInBlob const):
(WebCore::BlobRegistryImpl::registerBlobURLHandle):
(WebCore::BlobRegistryImpl::unregisterBlobURLHandle):
* Source/WebCore/platform/network/BlobRegistryImpl.h:
* Source/WebCore/platform/network/FormData.cpp:
(WebCore::FormDataElement::lengthInBytes const):
(WebCore::FormData::appendBlob):
(WebCore::appendBlobResolved):
* Source/WebCore/platform/network/FormData.h:
(WebCore::FormDataElement::FormDataElement):
* Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp:
* Source/WebCore/workers/AbstractWorker.cpp:
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
(WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLHandle):
(WebKit::NetworkConnectionToWebProcess::unregisterBlobURLHandle):
(WebKit::NetworkConnectionToWebProcess::blobSize):
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:
* Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp:
(WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
* Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerFileBlobURL):
(WebKit::BlobRegistryProxy::registerBlobURL):
(WebKit::BlobRegistryProxy::registerBlobURLOptionallyFileBacked):
(WebKit::BlobRegistryProxy::unregisterBlobURL):
(WebKit::BlobRegistryProxy::registerBlobURLForSlice):
(WebKit::BlobRegistryProxy::registerBlobURLHandle):
(WebKit::BlobRegistryProxy::unregisterBlobURLHandle):
(WebKit::BlobRegistryProxy::blobSize):
* Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.h:
* Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm:
* Source/WebKitLegacy/mac/WebCoreSupport/WebSecurityOrigin.mm:
(-[WebSecurityOrigin initWithURL:]):
* Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp:
(TestWebKitAPI::TEST_F):
https://bugs.webkit.org/show_bug.cgi?id=250152
rdar://problem/103929390

Reviewed by NOBODY (OOPS!).

A ScopedURL carries the associated top frame SecurityOrigin along with the URL.
This tight coupling will provide easier seamless partitioning of Blob URLs in
the future. This patch does not make any semantic changes.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::setURL):
(WebCore::isURLPotentiallyTrustworthy):
* Source/WebCore/dom/Document.h:
* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::doCrossOriginOpenerHandlingOfResponse):
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::scheduleRefreshIfNeeded):
* Source/WebCore/plugins/PluginData.cpp:
(WebCore::PluginData::webVisiblePlugins const):
* Source/WebCore/xml/XSLTProcessor.cpp:
(WebCore::XSLTProcessor::createDocumentFromSource):
* Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
(WebKit::WebResourceLoadObserver::logSubresourceLoading):
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jan 5, 2023
@sysrqb sysrqb marked this pull request as draft January 5, 2023 23:34
@sysrqb sysrqb closed this Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merging-blocked Applied to prevent a change from being merged
Projects
None yet
3 participants