Diff
Modified: branches/safari-612-branch/LayoutTests/ChangeLog (287646 => 287647)
--- branches/safari-612-branch/LayoutTests/ChangeLog 2022-01-05 20:08:29 UTC (rev 287646)
+++ branches/safari-612-branch/LayoutTests/ChangeLog 2022-01-05 21:11:29 UTC (rev 287647)
@@ -45,53 +45,6 @@
2022-01-05 Russell Epstein <repst...@apple.com>
- Cherry-pick r287353. rdar://problem/87125345
-
- Use requester when calling updateRequestAndAddExtraFields
- https://bugs.webkit.org/show_bug.cgi?id=234507
- <rdar://problem/85049490>
-
- Reviewed by Brent Fulgham.
-
- Source/WebCore:
-
- In case of navigation loads, the requester is the fetch request client.
- As such, it should be the one used to determine whether the request is cross-origin is not.
- Pass the requester to updateRequestAndAddExtraFields to do the correct computation.
- Validate that some request fields are now correctly observed in service workers.
-
- Test: http/wpt/service-workers/navigation-iframe-site.https.html
-
- * loader/FrameLoader.cpp:
- * loader/FrameLoader.h:
- * testing/ServiceWorkerInternals.cpp:
- * testing/ServiceWorkerInternals.h:
- * testing/ServiceWorkerInternals.idl:
-
- LayoutTests:
-
- * http/wpt/service-workers/navigation-iframe-site-worker.js: Added.
- * http/wpt/service-workers/navigation-iframe-site.https-expected.txt: Added.
- * http/wpt/service-workers/navigation-iframe-site.https.html: Added.
- * http/wpt/service-workers/resources/navigation-iframe-site-frame.html: Added.
-
- git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287353 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 2021-12-22 Youenn Fablet <you...@apple.com>
-
- Use requester when calling updateRequestAndAddExtraFields
- https://bugs.webkit.org/show_bug.cgi?id=234507
- <rdar://problem/85049490>
-
- Reviewed by Brent Fulgham.
-
- * http/wpt/service-workers/navigation-iframe-site-worker.js: Added.
- * http/wpt/service-workers/navigation-iframe-site.https-expected.txt: Added.
- * http/wpt/service-workers/navigation-iframe-site.https.html: Added.
- * http/wpt/service-workers/resources/navigation-iframe-site-frame.html: Added.
-
-2022-01-05 Russell Epstein <repst...@apple.com>
-
Cherry-pick r285710. rdar://problem/87125070
REGRESSION(r285624) Using revert keyword with a css variable hits assert
Deleted: branches/safari-612-branch/LayoutTests/http/wpt/service-workers/navigation-iframe-site-worker.js (287646 => 287647)
--- branches/safari-612-branch/LayoutTests/http/wpt/service-workers/navigation-iframe-site-worker.js 2022-01-05 20:08:29 UTC (rev 287646)
+++ branches/safari-612-branch/LayoutTests/http/wpt/service-workers/navigation-iframe-site-worker.js 2022-01-05 21:11:29 UTC (rev 287647)
@@ -1,11 +0,0 @@
-addEventListener("message", (e) => {
- self.port = e.data.port;
-});
-
-addEventListener("fetch", (e) => {
- if (self.internals) {
- self.port.postMessage(self.internals.fetchEventIsSameSite(e) ? "FAIL" : "PASS");
- return;
- }
- self.port.postMessage("PASS");
-});
Deleted: branches/safari-612-branch/LayoutTests/http/wpt/service-workers/navigation-iframe-site.https-expected.txt (287646 => 287647)
--- branches/safari-612-branch/LayoutTests/http/wpt/service-workers/navigation-iframe-site.https-expected.txt 2022-01-05 20:08:29 UTC (rev 287646)
+++ branches/safari-612-branch/LayoutTests/http/wpt/service-workers/navigation-iframe-site.https-expected.txt 2022-01-05 21:11:29 UTC (rev 287647)
@@ -1,5 +0,0 @@
-
-PASS Setup worker
-PASS Validate worker gets right request after navigation
-PASS Validate worker gets right request after post navigation
-
Deleted: branches/safari-612-branch/LayoutTests/http/wpt/service-workers/navigation-iframe-site.https.html (287646 => 287647)
--- branches/safari-612-branch/LayoutTests/http/wpt/service-workers/navigation-iframe-site.https.html 2022-01-05 20:08:29 UTC (rev 287646)
+++ branches/safari-612-branch/LayoutTests/http/wpt/service-workers/navigation-iframe-site.https.html 2022-01-05 21:11:29 UTC (rev 287647)
@@ -1,68 +0,0 @@
-<html>
-<head>
-<title>Service Worker Fetch Event</title>
-<script src=""
-<script src=""
-</head>
-<body>
-<script>
-var scope = "resources/";
-var registration;
-const channel = new MessageChannel;
-
-function withFrame(url)
-{
- return new Promise((resolve) => {
- let frame = document.createElement('iframe');
- frame.src = ""
- frame._onload_ = function() { resolve(frame); };
- document.body.appendChild(frame);
- });
-}
-
-async function registerServiceWorker(scope)
-{
- var registration = await navigator.serviceWorker.register("navigation-iframe-site-worker.js", { scope : scope });
- var activeWorker = registration.active;
- if (activeWorker) {
- activeWorker.postMessage({ port: channel.port1 }, [channel.port1]);
- return;
- }
- activeWorker = registration.installing;
- activeWorker.postMessage({ port: channel.port1 }, [channel.port1]);
- return new Promise(resolve => {
- activeWorker.addEventListener('statechange', () => {
- if (activeWorker.state === "activated")
- resolve(registration);
- });
- });
-}
-
-promise_test(async (test) => {
- registration = await registerServiceWorker(scope);
-}, "Setup worker");
-
-promise_test(async (test) => {
- const resultPromise = new Promise(resolve => channel.port2._onmessage_ = (event) => resolve(event.data));
-
- // Cross-origin iframe that will redirect to iframe that will be controlled by registered service worker.
- const framePromise = withFrame("https://127.0.0.1:9443/WebKit/service-workers/resources/navigation-iframe-site-frame.html");
-
- assert_equals(await resultPromise, "PASS");
- const frame = await framePromise;
- frame.remove();
-}, "Validate worker gets right request after navigation");
-
-promise_test(async (test) => {
- const resultPromise = new Promise(resolve => channel.port2._onmessage_ = (event) => resolve(event.data));
-
- // Cross-origin iframe that will redirect to iframe that will be controlled by registered service worker through POST.
- const framePromise = withFrame("https://127.0.0.1:9443/WebKit/service-workers/resources/navigation-iframe-site-frame.html?post");
-
- assert_equals(await resultPromise, "PASS");
- const frame = await framePromise;
- frame.remove();
-}, "Validate worker gets right request after post navigation");
-</script>
-</body>
-</html>
Deleted: branches/safari-612-branch/LayoutTests/http/wpt/service-workers/resources/navigation-iframe-site-frame.html (287646 => 287647)
--- branches/safari-612-branch/LayoutTests/http/wpt/service-workers/resources/navigation-iframe-site-frame.html 2022-01-05 20:08:29 UTC (rev 287646)
+++ branches/safari-612-branch/LayoutTests/http/wpt/service-workers/resources/navigation-iframe-site-frame.html 2022-01-05 21:11:29 UTC (rev 287647)
@@ -1,13 +0,0 @@
-<form method="post" id="myForm" action=""
-<script>
-function doTest()
-{
- if (window.location.search !== "?post") {
- window.location = "https://localhost:9443/WebKit/service-workers/resources/";
- return;
- }
- myForm.submit();
-}
-
-doTest();
-</script>
Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (287646 => 287647)
--- branches/safari-612-branch/Source/WebCore/ChangeLog 2022-01-05 20:08:29 UTC (rev 287646)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog 2022-01-05 21:11:29 UTC (rev 287647)
@@ -1,60 +1,5 @@
2022-01-05 Russell Epstein <repst...@apple.com>
- Cherry-pick r287353. rdar://problem/87125345
-
- Use requester when calling updateRequestAndAddExtraFields
- https://bugs.webkit.org/show_bug.cgi?id=234507
- <rdar://problem/85049490>
-
- Reviewed by Brent Fulgham.
-
- Source/WebCore:
-
- In case of navigation loads, the requester is the fetch request client.
- As such, it should be the one used to determine whether the request is cross-origin is not.
- Pass the requester to updateRequestAndAddExtraFields to do the correct computation.
- Validate that some request fields are now correctly observed in service workers.
-
- Test: http/wpt/service-workers/navigation-iframe-site.https.html
-
- * loader/FrameLoader.cpp:
- * loader/FrameLoader.h:
- * testing/ServiceWorkerInternals.cpp:
- * testing/ServiceWorkerInternals.h:
- * testing/ServiceWorkerInternals.idl:
-
- LayoutTests:
-
- * http/wpt/service-workers/navigation-iframe-site-worker.js: Added.
- * http/wpt/service-workers/navigation-iframe-site.https-expected.txt: Added.
- * http/wpt/service-workers/navigation-iframe-site.https.html: Added.
- * http/wpt/service-workers/resources/navigation-iframe-site-frame.html: Added.
-
- git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287353 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 2021-12-22 Youenn Fablet <you...@apple.com>
-
- Use requester when calling updateRequestAndAddExtraFields
- https://bugs.webkit.org/show_bug.cgi?id=234507
- <rdar://problem/85049490>
-
- Reviewed by Brent Fulgham.
-
- In case of navigation loads, the requester is the fetch request client.
- As such, it should be the one used to determine whether the request is cross-origin is not.
- Pass the requester to updateRequestAndAddExtraFields to do the correct computation.
- Validate that some request fields are now correctly observed in service workers.
-
- Test: http/wpt/service-workers/navigation-iframe-site.https.html
-
- * loader/FrameLoader.cpp:
- * loader/FrameLoader.h:
- * testing/ServiceWorkerInternals.cpp:
- * testing/ServiceWorkerInternals.h:
- * testing/ServiceWorkerInternals.idl:
-
-2022-01-05 Russell Epstein <repst...@apple.com>
-
Cherry-pick r287286. rdar://problem/87124952
Don't include SVGImageForContainers in allCachedSVGImages
Modified: branches/safari-612-branch/Source/WebCore/loader/FrameLoader.cpp (287646 => 287647)
--- branches/safari-612-branch/Source/WebCore/loader/FrameLoader.cpp 2022-01-05 20:08:29 UTC (rev 287646)
+++ branches/safari-612-branch/Source/WebCore/loader/FrameLoader.cpp 2022-01-05 21:11:29 UTC (rev 287647)
@@ -1356,7 +1356,7 @@
if (!referrer.isEmpty())
request.setHTTPReferrer(referrer);
- updateRequestAndAddExtraFields(request, IsMainResource::Yes, newLoadType, ShouldUpdateAppInitiatedValue::Yes, FrameLoader::IsServiceWorkerNavigationLoad::No, &frameLoadRequest.requester());
+ updateRequestAndAddExtraFields(request, IsMainResource::Yes, newLoadType);
ASSERT(newLoadType != FrameLoadType::Same);
@@ -2905,7 +2905,7 @@
return ResourceRequestCachePolicy::UseProtocolCachePolicy;
}
-void FrameLoader::updateRequestAndAddExtraFields(ResourceRequest& request, IsMainResource mainResource, FrameLoadType loadType, ShouldUpdateAppInitiatedValue shouldUpdate, Document* initiator)
+void FrameLoader::updateRequestAndAddExtraFields(ResourceRequest& request, IsMainResource mainResource, FrameLoadType loadType, ShouldUpdateAppInitiatedValue shouldUpdate)
{
// If the request came from a previous process due to process-swap-on-navigation then we should not modify the request.
if (m_currentLoadContinuingState == LoadContinuingState::ContinuingWithRequest)
@@ -2923,16 +2923,14 @@
}
if (request.isSameSiteUnspecified()) {
- if (!initiator) {
- initiator = m_frame.document();
- if (isMainResource) {
- auto* ownerFrame = m_frame.tree().parent();
- if (!ownerFrame && m_stateMachine.isDisplayingInitialEmptyDocument())
- ownerFrame = m_opener.get();
- if (ownerFrame)
- initiator = ownerFrame->document();
- ASSERT(ownerFrame || m_frame.isMainFrame());
- }
+ auto* initiator = m_frame.document();
+ if (isMainResource) {
+ auto* ownerFrame = m_frame.tree().parent();
+ if (!ownerFrame && m_stateMachine.isDisplayingInitialEmptyDocument())
+ ownerFrame = m_opener.get();
+ if (ownerFrame)
+ initiator = ownerFrame->document();
+ ASSERT(ownerFrame || m_frame.isMainFrame());
}
addSameSiteInfoToRequestIfNeeded(request, initiator);
}
@@ -3066,7 +3064,7 @@
workingResourceRequest.setHTTPMethod("POST");
workingResourceRequest.setHTTPBody(inRequest.httpBody());
workingResourceRequest.setHTTPContentType(contentType);
- updateRequestAndAddExtraFields(workingResourceRequest, IsMainResource::Yes, loadType, ShouldUpdateAppInitiatedValue::Yes, FrameLoader::IsServiceWorkerNavigationLoad::No, &request.requester());
+ updateRequestAndAddExtraFields(workingResourceRequest, IsMainResource::Yes, loadType);
if (Document* document = m_frame.document())
document->contentSecurityPolicy()->upgradeInsecureRequestIfNeeded(workingResourceRequest, ContentSecurityPolicy::InsecureRequestType::Load);
Modified: branches/safari-612-branch/Source/WebCore/loader/FrameLoader.h (287646 => 287647)
--- branches/safari-612-branch/Source/WebCore/loader/FrameLoader.h 2022-01-05 20:08:29 UTC (rev 287646)
+++ branches/safari-612-branch/Source/WebCore/loader/FrameLoader.h 2022-01-05 21:11:29 UTC (rev 287647)
@@ -318,7 +318,7 @@
bool alwaysAllowLocalWebarchive() const { return m_alwaysAllowLocalWebarchive; }
// For subresource requests the FrameLoadType parameter has no effect and can be skipped.
- void updateRequestAndAddExtraFields(ResourceRequest&, IsMainResource, FrameLoadType = FrameLoadType::Standard, ShouldUpdateAppInitiatedValue = ShouldUpdateAppInitiatedValue::Yes, Document* = nullptr);
+ void updateRequestAndAddExtraFields(ResourceRequest&, IsMainResource, FrameLoadType = FrameLoadType::Standard, ShouldUpdateAppInitiatedValue = ShouldUpdateAppInitiatedValue::Yes);
void scheduleRefreshIfNeeded(Document&, const String& content, IsMetaRefresh);
Modified: branches/safari-612-branch/Source/WebCore/testing/ServiceWorkerInternals.cpp (287646 => 287647)
--- branches/safari-612-branch/Source/WebCore/testing/ServiceWorkerInternals.cpp 2022-01-05 20:08:29 UTC (rev 287646)
+++ branches/safari-612-branch/Source/WebCore/testing/ServiceWorkerInternals.cpp 2022-01-05 21:11:29 UTC (rev 287647)
@@ -136,11 +136,6 @@
});
}
-bool ServiceWorkerInternals::fetchEventIsSameSite(FetchEvent& event)
-{
- return event.request().internalRequest().isSameSite();
-}
-
} // namespace WebCore
#endif
Modified: branches/safari-612-branch/Source/WebCore/testing/ServiceWorkerInternals.h (287646 => 287647)
--- branches/safari-612-branch/Source/WebCore/testing/ServiceWorkerInternals.h 2022-01-05 20:08:29 UTC (rev 287646)
+++ branches/safari-612-branch/Source/WebCore/testing/ServiceWorkerInternals.h 2022-01-05 21:11:29 UTC (rev 287647)
@@ -62,8 +62,6 @@
void lastNavigationWasAppInitiated(Ref<DeferredPromise>&&);
- bool fetchEventIsSameSite(FetchEvent&);
-
private:
explicit ServiceWorkerInternals(ServiceWorkerIdentifier);
Modified: branches/safari-612-branch/Source/WebCore/testing/ServiceWorkerInternals.idl (287646 => 287647)
--- branches/safari-612-branch/Source/WebCore/testing/ServiceWorkerInternals.idl 2022-01-05 20:08:29 UTC (rev 287646)
+++ branches/safari-612-branch/Source/WebCore/testing/ServiceWorkerInternals.idl 2022-01-05 21:11:29 UTC (rev 287647)
@@ -44,6 +44,4 @@
readonly attribute long processIdentifier;
Promise<boolean> lastNavigationWasAppInitiated();
-
- boolean fetchEventIsSameSite(FetchEvent event);
};