Title: [288936] trunk/Source/WebCore
- Revision
- 288936
- Author
- [email protected]
- Date
- 2022-02-01 18:45:44 -0800 (Tue, 01 Feb 2022)
Log Message
Replace WebCore::topOriginURL() to SecurityOrigin::toURL()
https://bugs.webkit.org/show_bug.cgi?id=235987
Reviewed by Geoffrey Garen.
Replace WebCore::topOriginURL() to SecurityOrigin::toURL() so that it can be reused by Shared Workers.
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::toURL const):
* page/SecurityOrigin.h:
* page/SecurityOriginData.cpp:
(WebCore::SecurityOriginData::toURL const):
* page/SecurityOriginData.h:
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::setupPageForServiceWorker):
(WebCore::topOriginURL): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (288935 => 288936)
--- trunk/Source/WebCore/ChangeLog 2022-02-02 02:08:23 UTC (rev 288935)
+++ trunk/Source/WebCore/ChangeLog 2022-02-02 02:45:44 UTC (rev 288936)
@@ -1,3 +1,22 @@
+2022-02-01 Chris Dumez <[email protected]>
+
+ Replace WebCore::topOriginURL() to SecurityOrigin::toURL()
+ https://bugs.webkit.org/show_bug.cgi?id=235987
+
+ Reviewed by Geoffrey Garen.
+
+ Replace WebCore::topOriginURL() to SecurityOrigin::toURL() so that it can be reused by Shared Workers.
+
+ * page/SecurityOrigin.cpp:
+ (WebCore::SecurityOrigin::toURL const):
+ * page/SecurityOrigin.h:
+ * page/SecurityOriginData.cpp:
+ (WebCore::SecurityOriginData::toURL const):
+ * page/SecurityOriginData.h:
+ * workers/service/context/ServiceWorkerThreadProxy.cpp:
+ (WebCore::ServiceWorkerThreadProxy::setupPageForServiceWorker):
+ (WebCore::topOriginURL): Deleted.
+
2022-02-01 Simon Fraser <[email protected]>
Crash under ScrollingCoordinatorMac::hasNodeWithAnimatedScrollChanged()
Modified: trunk/Source/WebCore/page/SecurityOrigin.cpp (288935 => 288936)
--- trunk/Source/WebCore/page/SecurityOrigin.cpp 2022-02-02 02:08:23 UTC (rev 288935)
+++ trunk/Source/WebCore/page/SecurityOrigin.cpp 2022-02-02 02:45:44 UTC (rev 288936)
@@ -546,6 +546,11 @@
return m_data.toString();
}
+URL SecurityOrigin::toURL() const
+{
+ return m_data.toURL();
+}
+
static inline bool areOriginsMatching(const SecurityOrigin& origin1, const SecurityOrigin& origin2)
{
ASSERT(&origin1 != &origin2);
Modified: trunk/Source/WebCore/page/SecurityOrigin.h (288935 => 288936)
--- trunk/Source/WebCore/page/SecurityOrigin.h 2022-02-02 02:08:23 UTC (rev 288935)
+++ trunk/Source/WebCore/page/SecurityOrigin.h 2022-02-02 02:45:44 UTC (rev 288936)
@@ -190,6 +190,8 @@
// could make the string return "null".
WEBCORE_EXPORT String toRawString() const;
+ URL toURL() const;
+
// This method checks for equality between SecurityOrigins, not whether
// one origin can access another. It is used for hash table keys.
// For access checks, use isSameOriginDomain().
Modified: trunk/Source/WebCore/page/SecurityOriginData.cpp (288935 => 288936)
--- trunk/Source/WebCore/page/SecurityOriginData.cpp 2022-02-02 02:08:23 UTC (rev 288935)
+++ trunk/Source/WebCore/page/SecurityOriginData.cpp 2022-02-02 02:45:44 UTC (rev 288936)
@@ -49,6 +49,11 @@
return makeString(protocol, "://", host, ':', static_cast<uint32_t>(*port));
}
+URL SecurityOriginData::toURL() const
+{
+ return URL { URL(), toString() };
+}
+
SecurityOriginData SecurityOriginData::fromFrame(Frame* frame)
{
if (!frame)
Modified: trunk/Source/WebCore/page/SecurityOriginData.h (288935 => 288936)
--- trunk/Source/WebCore/page/SecurityOriginData.h 2022-02-02 02:08:23 UTC (rev 288935)
+++ trunk/Source/WebCore/page/SecurityOriginData.h 2022-02-02 02:45:44 UTC (rev 288936)
@@ -87,6 +87,8 @@
WEBCORE_EXPORT String toString() const;
+ URL toURL() const;
+
#if !LOG_DISABLED
String debugString() const { return toString(); }
#endif
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp (288935 => 288936)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp 2022-02-02 02:08:23 UTC (rev 288935)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp 2022-02-02 02:45:44 UTC (rev 288936)
@@ -51,11 +51,6 @@
namespace WebCore {
-static URL topOriginURL(const SecurityOrigin& origin)
-{
- return URL { URL { }, origin.toRawString() };
-}
-
void ServiceWorkerThreadProxy::setupPageForServiceWorker(Page& page, const ServiceWorkerContextData& data)
{
auto& mainFrame = page.mainFrame();
@@ -68,8 +63,9 @@
auto origin = data.registration.key.topOrigin().securityOrigin();
origin->setStorageBlockingPolicy(page.settings().storageBlockingPolicy());
- document->setSiteForCookies(topOriginURL(origin));
- document->setFirstPartyForCookies(topOriginURL(origin));
+ auto originURL = origin->toURL();
+ document->setSiteForCookies(originURL);
+ document->setFirstPartyForCookies(originURL);
document->setDomainForCachePartition(origin->domainForCachePartition());
if (auto policy = parseReferrerPolicy(data.referrerPolicy, ReferrerPolicySource::HTTPHeader))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes