<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[286656] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/286656">286656</a></dd>
<dt>Author</dt> <dd>youenn@apple.com</dd>
<dt>Date</dt> <dd>2021-12-08 08:27:03 -0800 (Wed, 08 Dec 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Same-site lax cookies not sent by fetch event handler after page reload
https://bugs.webkit.org/show_bug.cgi?id=226386
<rdar://problem/78878853>

Reviewed by Chris Dumez.

Source/WebCore:

When a service worker fetches a navigation request exposed from the fetch event, we need to keep isTopSite intact as
the service worker does not really have the information of which frame is actually loaded and whether it is a main frame or not.

Tests: http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https.html
       http/wpt/service-workers/same-cookie-lax.https.html

* loader/cache/CachedResource.cpp:

Source/WebKit:

StorageBlockingPolicy handling is not covered by generated code so explicit update StorageBlockingPolicy setting from preference store.
This impacts the computation of cookie/cache partitioning.

* WebProcess/Storage/WebSWContextManagerConnection.cpp:

LayoutTests:

* http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https-expected.txt: Added.
* http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https.html: Added.
* http/wpt/service-workers/resources/get-cookie.py: Added.
* http/wpt/service-workers/resources/get-document-cookie.py: Added.
* http/wpt/service-workers/resources/set-cookie-lax.py: Added.
* http/wpt/service-workers/same-cookie-lax-worker.js: Added.
* http/wpt/service-workers/same-cookie-lax.https-expected.txt: Added.
* http/wpt/service-workers/same-cookie-lax.https.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoaderh">trunk/Source/WebCore/loader/FrameLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourcecpp">trunk/Source/WebCore/loader/cache/CachedResource.cpp</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitWebProcessStorageWebSWContextManagerConnectioncpp">trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttpwptserviceworkerscrosssitenavigationsamecookielaxhttpsexpectedtxt">trunk/LayoutTests/http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttpwptserviceworkerscrosssitenavigationsamecookielaxhttpshtml">trunk/LayoutTests/http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https.html</a></li>
<li><a href="#trunkLayoutTestshttpwptserviceworkersresourcesgetcookiepy">trunk/LayoutTests/http/wpt/service-workers/resources/get-cookie.py</a></li>
<li><a href="#trunkLayoutTestshttpwptserviceworkersresourcesgetdocumentcookiepy">trunk/LayoutTests/http/wpt/service-workers/resources/get-document-cookie.py</a></li>
<li><a href="#trunkLayoutTestshttpwptserviceworkersresourcessetcookielaxpy">trunk/LayoutTests/http/wpt/service-workers/resources/set-cookie-lax.py</a></li>
<li><a href="#trunkLayoutTestshttpwptserviceworkerssamecookielaxworkerjs">trunk/LayoutTests/http/wpt/service-workers/same-cookie-lax-worker.js</a></li>
<li><a href="#trunkLayoutTestshttpwptserviceworkerssamecookielaxhttpsexpectedtxt">trunk/LayoutTests/http/wpt/service-workers/same-cookie-lax.https-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttpwptserviceworkerssamecookielaxhttpshtml">trunk/LayoutTests/http/wpt/service-workers/same-cookie-lax.https.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (286655 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-12-08 15:59:47 UTC (rev 286655)
+++ trunk/LayoutTests/ChangeLog 2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -1,5 +1,22 @@
</span><span class="cx"> 2021-12-08  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><ins>+        Same-site lax cookies not sent by fetch event handler after page reload
+        https://bugs.webkit.org/show_bug.cgi?id=226386
+        <rdar://problem/78878853>
+
+        Reviewed by Chris Dumez.
+
+        * http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https-expected.txt: Added.
+        * http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https.html: Added.
+        * http/wpt/service-workers/resources/get-cookie.py: Added.
+        * http/wpt/service-workers/resources/get-document-cookie.py: Added.
+        * http/wpt/service-workers/resources/set-cookie-lax.py: Added.
+        * http/wpt/service-workers/same-cookie-lax-worker.js: Added.
+        * http/wpt/service-workers/same-cookie-lax.https-expected.txt: Added.
+        * http/wpt/service-workers/same-cookie-lax.https.html: Added.
+
+2021-12-08  Youenn Fablet  <youenn@apple.com>
+
</ins><span class="cx">         Safari Bug "no-cache" network error
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=233916
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestshttpwptserviceworkerscrosssitenavigationsamecookielaxhttpsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https-expected.txt (0 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https-expected.txt                              (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https-expected.txt 2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS: got samesite-cookie-test=1
</ins></span></pre></div>
<a id="trunkLayoutTestshttpwptserviceworkerscrosssitenavigationsamecookielaxhttpshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https.html (0 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https.html                              (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https.html 2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+<html>
+<head>
+</head>
+<body>
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+var scope = "";
+
+async function doTest()
+{
+    if (window.origin == "https://127.0.0.1:9443") {
+        window.location = "https://localhost:9443/WebKit/service-workers/resources/get-document-cookie.py?fetchTest";
+        return;
+    }
+
+    const registration = await navigator.serviceWorker.register("same-cookie-lax-worker.js", { scope : scope });
+    if (!registration.active) {
+        const worker = registration.installing;
+        await new Promise(resolve => {
+            worker.addEventListener('statechange', () => {
+                if (worker.state === "activated")
+                    resolve();
+            });
+        });
+    }
+    const cookieValue = "PASS: got samesite-cookie-test";
+    await fetch("resources/set-cookie-lax.py?name=" + cookieValue);
+
+    window.location = "https://127.0.0.1:9443/WebKit/service-workers/cross-site-navigation-same-cookie-lax.https.html?fetchTest";
+}
+doTest();
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestshttpwptserviceworkersresourcesgetcookiepy"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/wpt/service-workers/resources/get-cookie.py (0 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/wpt/service-workers/resources/get-cookie.py                               (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/resources/get-cookie.py  2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+def main(request, response):
+    headers = [
+        ("Content-Type", "text/ascii"),
+    ]
+    body = request.headers.get("Cookie", "")
+    return headers, body
</ins></span></pre></div>
<a id="trunkLayoutTestshttpwptserviceworkersresourcesgetdocumentcookiepy"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/wpt/service-workers/resources/get-document-cookie.py (0 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/wpt/service-workers/resources/get-document-cookie.py                              (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/resources/get-document-cookie.py 2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+def main(request, response):
+    headers = [
+        ("Content-Type", "text/html"),
+    ]
+    cookie = request.headers.get("Cookie", "no cookie")
+
+    return headers, "<html><body><div>%s</div><script>if (window.testRunner) testRunner.notifyDone();</script></body></html>" % cookie.decode()
</ins></span></pre></div>
<a id="trunkLayoutTestshttpwptserviceworkersresourcessetcookielaxpy"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/wpt/service-workers/resources/set-cookie-lax.py (0 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/wpt/service-workers/resources/set-cookie-lax.py                           (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/resources/set-cookie-lax.py      2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+import sys
+from urllib.parse import urlparse, parse_qs
+
+
+def main(request, response):
+    params = parse_qs(request.url_parts.query)
+    headers = [
+        ("Content-Type", "application/json"),
+        ("Set-Cookie", "{name[0]}=1; path=/; secure; HttpOnly; SameSite=Lax".format(**params))
+    ]
+    body = "{}"
+    return headers, body
</ins></span></pre></div>
<a id="trunkLayoutTestshttpwptserviceworkerssamecookielaxworkerjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/wpt/service-workers/same-cookie-lax-worker.js (0 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/wpt/service-workers/same-cookie-lax-worker.js                             (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/same-cookie-lax-worker.js        2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+async function doTest(event)
+{
+    try {
+        if (!event.data.startsWith("test-cookie")) {
+            event.source.postMessage("FAIL: received unexpected message from client");
+            return;
+        }
+
+        const response = await fetch("resources/get-cookie.py");
+        event.source.postMessage(await response.text());
+    } catch (e) {
+        event.source.postMessage(e);
+    }
+}
+
+function doFetch(event)
+{
+    if (event.request.url.includes("fetchTest"))
+        event.respondWith(fetch(event.request));
+}
+
+self.addEventListener("message", doTest);
+self.addEventListener("fetch", doFetch);
</ins></span></pre></div>
<a id="trunkLayoutTestshttpwptserviceworkerssamecookielaxhttpsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/wpt/service-workers/same-cookie-lax.https-expected.txt (0 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/wpt/service-workers/same-cookie-lax.https-expected.txt                            (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/same-cookie-lax.https-expected.txt       2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+
+PASS Setup worker
+PASS Test service worker samesite lax cookie - service worker internal fetch
+PASS Test service worker samesite lax cookie - fetch served from service worker
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttpwptserviceworkerssamecookielaxhttpshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/wpt/service-workers/same-cookie-lax.https.html (0 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/wpt/service-workers/same-cookie-lax.https.html                            (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/same-cookie-lax.https.html       2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+<html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<script>
+var scope = "";
+var activeWorker;
+
+promise_test(async (test) => {
+    var registration = await navigator.serviceWorker.register("same-cookie-lax-worker.js", { scope : scope });
+    activeWorker = registration.active;
+    if (activeWorker)
+        return;
+    activeWorker = registration.installing;
+    return new Promise(resolve => {
+        activeWorker.addEventListener('statechange', () => {
+            if (activeWorker.state === "activated")
+                resolve();
+        });
+    });
+}, "Setup worker");
+
+promise_test(async (test) => {
+    const cookieValue = "samesite-cookie-test";
+    await fetch("resources/set-cookie-lax.py?name=" + cookieValue);
+
+    var promise = new Promise((resolve, reject) => {
+        navigator.serviceWorker.addEventListener("message", (event) => {
+            resolve(event.data);
+        });
+    });
+
+    activeWorker.postMessage("test-cookie");
+    const result = await promise;
+    assert_true(result.includes(cookieValue + "=1"));
+}, "Test service worker samesite lax cookie - service worker internal fetch");
+
+promise_test(async (test) => {
+    const cookieValue = "samesite-cookie-test-fetch";
+    await fetch("resources/set-cookie-lax.py?name=" + cookieValue);
+
+    const response = await fetch("resources/get-cookie.py?fetchTest");
+    const result = await response.text();
+    assert_true(result.includes(cookieValue + "=1"));
+}, "Test service worker samesite lax cookie - fetch served from service worker");
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (286655 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-12-08 15:59:47 UTC (rev 286655)
+++ trunk/Source/WebCore/ChangeLog      2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -1,5 +1,21 @@
</span><span class="cx"> 2021-12-08  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><ins>+        Same-site lax cookies not sent by fetch event handler after page reload
+        https://bugs.webkit.org/show_bug.cgi?id=226386
+        <rdar://problem/78878853>
+
+        Reviewed by Chris Dumez.
+
+        When a service worker fetches a navigation request exposed from the fetch event, we need to keep isTopSite intact as
+        the service worker does not really have the information of which frame is actually loaded and whether it is a main frame or not.
+
+        Tests: http/wpt/service-workers/cross-site-navigation-same-cookie-lax.https.html
+               http/wpt/service-workers/same-cookie-lax.https.html
+
+        * loader/cache/CachedResource.cpp:
+
+2021-12-08  Youenn Fablet  <youenn@apple.com>
+
</ins><span class="cx">         Safari Bug "no-cache" network error
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=233916
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (286655 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp      2021-12-08 15:59:47 UTC (rev 286655)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -2899,8 +2899,10 @@
</span><span class="cx">     return ResourceRequestCachePolicy::UseProtocolCachePolicy;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FrameLoader::updateRequestAndAddExtraFields(ResourceRequest& request, IsMainResource mainResource, FrameLoadType loadType, ShouldUpdateAppInitiatedValue shouldUpdate)
</del><ins>+void FrameLoader::updateRequestAndAddExtraFields(ResourceRequest& request, IsMainResource mainResource, FrameLoadType loadType, ShouldUpdateAppInitiatedValue shouldUpdate, IsServiceWorkerNavigationLoad isServiceWorkerNavigationLoad)
</ins><span class="cx"> {
</span><ins>+    ASSERT(isServiceWorkerNavigationLoad == IsServiceWorkerNavigationLoad::No || mainResource != IsMainResource::Yes);
+
</ins><span class="cx">     // If the request came from a previous process due to process-swap-on-navigation then we should not modify the request.
</span><span class="cx">     if (m_currentLoadContinuingState == LoadContinuingState::ContinuingWithRequest)
</span><span class="cx">         return;
</span><span class="lines">@@ -2928,8 +2930,11 @@
</span><span class="cx">         }
</span><span class="cx">         addSameSiteInfoToRequestIfNeeded(request, initiator);
</span><span class="cx">     }
</span><del>-    request.setIsTopSite(isMainFrameMainResource);
</del><span class="cx"> 
</span><ins>+    // In case of service worker navigation load, we inherit isTopSite from the FetchEvent request directly.
+    if (isServiceWorkerNavigationLoad == IsServiceWorkerNavigationLoad::No)
+        request.setIsTopSite(isMainFrameMainResource);
+
</ins><span class="cx">     Page* page = frame().page();
</span><span class="cx">     bool hasSpecificCachePolicy = request.cachePolicy() != ResourceRequestCachePolicy::UseProtocolCachePolicy;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.h (286655 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.h        2021-12-08 15:59:47 UTC (rev 286655)
+++ trunk/Source/WebCore/loader/FrameLoader.h   2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -317,8 +317,9 @@
</span><span class="cx">     void setAlwaysAllowLocalWebarchive(bool alwaysAllowLocalWebarchive) { m_alwaysAllowLocalWebarchive = alwaysAllowLocalWebarchive; }
</span><span class="cx">     bool alwaysAllowLocalWebarchive() const { return m_alwaysAllowLocalWebarchive; }
</span><span class="cx"> 
</span><ins>+    enum class IsServiceWorkerNavigationLoad : bool { No, Yes };
</ins><span class="cx">     // For subresource requests the FrameLoadType parameter has no effect and can be skipped.
</span><del>-    void updateRequestAndAddExtraFields(ResourceRequest&, IsMainResource, FrameLoadType = FrameLoadType::Standard, ShouldUpdateAppInitiatedValue = ShouldUpdateAppInitiatedValue::Yes);
</del><ins>+    void updateRequestAndAddExtraFields(ResourceRequest&, IsMainResource, FrameLoadType = FrameLoadType::Standard, ShouldUpdateAppInitiatedValue = ShouldUpdateAppInitiatedValue::Yes, IsServiceWorkerNavigationLoad = IsServiceWorkerNavigationLoad::No);
</ins><span class="cx"> 
</span><span class="cx">     void scheduleRefreshIfNeeded(Document&, const String& content, IsMetaRefresh);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (286655 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResource.cpp     2021-12-08 15:59:47 UTC (rev 286655)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp        2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -241,8 +241,10 @@
</span><span class="cx"> 
</span><span class="cx">     // Navigation algorithm is setting up the request before sending it to CachedResourceLoader?CachedResource.
</span><span class="cx">     // So no need for extra fields for MainResource.
</span><del>-    if (type() != Type::MainResource)
-        frameLoader.updateRequestAndAddExtraFields(m_resourceRequest, IsMainResource::No);
</del><ins>+    if (type() != Type::MainResource) {
+        bool isServiceWorkerNavigationLoad = type() != Type::SVGDocumentResource && m_options.serviceWorkersMode == ServiceWorkersMode::None && (m_options.destination == FetchOptions::Destination::Document || m_options.destination == FetchOptions::Destination::Iframe);
+        frameLoader.updateRequestAndAddExtraFields(m_resourceRequest, IsMainResource::No, FrameLoadType::Standard, ShouldUpdateAppInitiatedValue::Yes, isServiceWorkerNavigationLoad ? FrameLoader::IsServiceWorkerNavigationLoad::Yes : FrameLoader::IsServiceWorkerNavigationLoad::No);
+    }
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: It's unfortunate that the cache layer and below get to know anything about fragment identifiers.
</span><span class="cx">     // We should look into removing the expectation of that knowledge from the platform network stacks.
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (286655 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-12-08 15:59:47 UTC (rev 286655)
+++ trunk/Source/WebKit/ChangeLog       2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -1,5 +1,18 @@
</span><span class="cx"> 2021-12-08  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><ins>+        Same-site lax cookies not sent by fetch event handler after page reload
+        https://bugs.webkit.org/show_bug.cgi?id=226386
+        <rdar://problem/78878853>
+
+        Reviewed by Chris Dumez.
+
+        StorageBlockingPolicy handling is not covered by generated code so explicit update StorageBlockingPolicy setting from preference store.
+        This impacts the computation of cookie/cache partitioning.
+
+        * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+
+2021-12-08  Youenn Fablet  <youenn@apple.com>
+
</ins><span class="cx">         Let RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit switch to VPIO unit if VPIO is running
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=233316
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessStorageWebSWContextManagerConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (286655 => 286656)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2021-12-08 15:59:47 UTC (rev 286655)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp    2021-12-08 16:27:03 UTC (rev 286656)
</span><span class="lines">@@ -167,8 +167,10 @@
</span><span class="cx">     
</span><span class="cx">     auto lastNavigationWasAppInitiated = contextData.lastNavigationWasAppInitiated;
</span><span class="cx">     auto page = makeUniqueRef<Page>(WTFMove(pageConfiguration));
</span><del>-    if (m_preferencesStore)
</del><ins>+    if (m_preferencesStore) {
</ins><span class="cx">         WebPage::updateSettingsGenerated(*m_preferencesStore, page->settings());
</span><ins>+        page->settings().setStorageBlockingPolicy(static_cast<StorageBlockingPolicy>(m_preferencesStore->getUInt32ValueForKey(WebPreferencesKey::storageBlockingPolicyKey())));
+    }
</ins><span class="cx">     ServiceWorkerThreadProxy::setupPageForServiceWorker(page.get(), contextData);
</span><span class="cx">     auto serviceWorkerThreadProxy = ServiceWorkerThreadProxy::create(WTFMove(page), WTFMove(contextData), WTFMove(workerData), WTFMove(effectiveUserAgent), workerThreadMode, WebProcess::singleton().cacheStorageProvider());
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>