Title: [228961] branches/safari-605-branch/Source
- Revision
- 228961
- Author
- [email protected]
- Date
- 2018-02-23 13:39:02 -0800 (Fri, 23 Feb 2018)
Log Message
Cherry-pick r228919. rdar://problem/37836719
Modified Paths
Diff
Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (228960 => 228961)
--- branches/safari-605-branch/Source/WebCore/ChangeLog 2018-02-23 20:30:11 UTC (rev 228960)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog 2018-02-23 21:39:02 UTC (rev 228961)
@@ -1,5 +1,26 @@
2018-02-23 Jason Marcell <[email protected]>
+ Cherry-pick r228919. rdar://problem/37836719
+
+ 2018-02-22 Youenn Fablet <[email protected]>
+
+ Add release asserts for service worker fetch and postMessage events
+ https://bugs.webkit.org/show_bug.cgi?id=183025
+ rdar://problem/37765052
+
+ Reviewed by Daniel Bates.
+
+ Add release assertion so that a service worker will only dispatch a message event
+ for clients and service workers with the same origin.
+ No change of behavior.
+
+ * platform/network/ResourceRequestBase.h:
+ * workers/service/context/ServiceWorkerThread.cpp:
+ (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
+ * workers/service/context/ServiceWorkerThreadProxy.h:
+
+2018-02-23 Jason Marcell <[email protected]>
+
Cherry-pick r228947. rdar://problem/37833040
2018-02-22 Antoine Quint <[email protected]>
Modified: branches/safari-605-branch/Source/WebCore/platform/network/ResourceRequestBase.h (228960 => 228961)
--- branches/safari-605-branch/Source/WebCore/platform/network/ResourceRequestBase.h 2018-02-23 20:30:11 UTC (rev 228960)
+++ branches/safari-605-branch/Source/WebCore/platform/network/ResourceRequestBase.h 2018-02-23 21:39:02 UTC (rev 228961)
@@ -112,7 +112,7 @@
WEBCORE_EXPORT void setHTTPReferrer(const String&);
WEBCORE_EXPORT void clearHTTPReferrer();
- String httpOrigin() const;
+ WEBCORE_EXPORT String httpOrigin() const;
bool hasHTTPOrigin() const;
void setHTTPOrigin(const String&);
WEBCORE_EXPORT void clearHTTPOrigin();
Modified: branches/safari-605-branch/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp (228960 => 228961)
--- branches/safari-605-branch/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2018-02-23 20:30:11 UTC (rev 228960)
+++ branches/safari-605-branch/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2018-02-23 21:39:02 UTC (rev 228961)
@@ -119,10 +119,16 @@
ExtendableMessageEventSource source;
if (WTF::holds_alternative<ServiceWorkerClientData>(sourceData)) {
RefPtr<ServiceWorkerClient> sourceClient = ServiceWorkerClient::getOrCreate(serviceWorkerGlobalScope, WTFMove(WTF::get<ServiceWorkerClientData>(sourceData)));
+
+ RELEASE_ASSERT(!sourceClient->url().protocolIsInHTTPFamily() || !serviceWorkerGlobalScope.url().protocolIsInHTTPFamily() || protocolHostAndPortAreEqual(serviceWorkerGlobalScope.url(), sourceClient->url()));
+
sourceOrigin = SecurityOrigin::create(sourceClient->url());
source = WTFMove(sourceClient);
} else {
RefPtr<ServiceWorker> sourceWorker = ServiceWorker::getOrCreate(serviceWorkerGlobalScope, WTFMove(WTF::get<ServiceWorkerData>(sourceData)));
+
+ RELEASE_ASSERT(!sourceWorker->scriptURL().protocolIsInHTTPFamily() || !serviceWorkerGlobalScope.url().protocolIsInHTTPFamily() || protocolHostAndPortAreEqual(serviceWorkerGlobalScope.url(), sourceWorker->scriptURL()));
+
sourceOrigin = SecurityOrigin::create(sourceWorker->scriptURL());
source = WTFMove(sourceWorker);
}
Modified: branches/safari-605-branch/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h (228960 => 228961)
--- branches/safari-605-branch/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h 2018-02-23 20:30:11 UTC (rev 228960)
+++ branches/safari-605-branch/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h 2018-02-23 21:39:02 UTC (rev 228961)
@@ -65,6 +65,8 @@
WEBCORE_EXPORT std::unique_ptr<FetchLoader> createBlobLoader(FetchLoaderClient&, const URL&);
+ const URL& scriptURL() const { return m_document->url(); }
+
// Public only for testing purposes.
WEBCORE_TESTSUPPORT_EXPORT void notifyNetworkStateChange(bool isOnline);
Modified: branches/safari-605-branch/Source/WebKit/ChangeLog (228960 => 228961)
--- branches/safari-605-branch/Source/WebKit/ChangeLog 2018-02-23 20:30:11 UTC (rev 228960)
+++ branches/safari-605-branch/Source/WebKit/ChangeLog 2018-02-23 21:39:02 UTC (rev 228961)
@@ -1,5 +1,23 @@
2018-02-23 Jason Marcell <[email protected]>
+ Cherry-pick r228919. rdar://problem/37836719
+
+ 2018-02-22 Youenn Fablet <[email protected]>
+
+ Add release asserts for service worker fetch and postMessage events
+ https://bugs.webkit.org/show_bug.cgi?id=183025
+ rdar://problem/37765052
+
+ Reviewed by Daniel Bates.
+
+ Add assertion to protect interception of a fetch load by a service worker with
+ a different origin from the page.
+
+ * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+ (WebKit::WebSWContextManagerConnection::startFetch):
+
+2018-02-23 Jason Marcell <[email protected]>
+
Cherry-pick r228937. rdar://problem/37833035
2018-02-22 Matt Baker <[email protected]>
Modified: branches/safari-605-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (228960 => 228961)
--- branches/safari-605-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2018-02-23 20:30:11 UTC (rev 228960)
+++ branches/safari-605-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2018-02-23 21:39:02 UTC (rev 228961)
@@ -182,6 +182,11 @@
return;
}
+ String origin = request.httpOrigin();
+ URL url { URL(), origin.isEmpty() ? referrer : origin };
+ URL serviceWorkerURL = serviceWorkerThreadProxy->scriptURL();
+ RELEASE_ASSERT(!url.protocolIsInHTTPFamily() || !serviceWorkerURL.protocolIsInHTTPFamily() || protocolHostAndPortAreEqual(url, serviceWorkerURL));
+
auto client = WebServiceWorkerFetchTaskClient::create(m_connectionToStorageProcess.copyRef(), serviceWorkerIdentifier, serverConnectionIdentifier, fetchIdentifier);
std::optional<ServiceWorkerClientIdentifier> clientId;
if (options.clientIdentifier)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes