WebKit Bugzilla
Attachment 343362 Details for
Bug 186939
: NetworkLoadChecker should not check CORS for 304 responses triggered by WebProcess revalidation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186939-20180622135446.patch (text/plain), 5.37 KB, created by
youenn fablet
on 2018-06-22 13:54:47 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2018-06-22 13:54:47 PDT
Size:
5.37 KB
patch
obsolete
>Subversion Revision: 233079 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 8ef6b1c6d75859062aa0a10cbcb57ba7c58b9212..0039e0dc654de8bd134c54114d459c80de22f168 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,14 @@ >+2018-06-22 Youenn Fablet <youenn@apple.com> >+ >+ NetworkLoadChecker should not check CORS for 304 responses triggered by WebProcess revalidation >+ https://bugs.webkit.org/show_bug.cgi?id=186939 >+ <rdar://problem/40941725> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * NetworkProcess/NetworkLoadChecker.cpp: >+ (WebKit::NetworkLoadChecker::validateResponse): >+ > 2018-06-20 Darin Adler <darin@apple.com> > > [Cocoa] Use the isDirectory: variants of NSURL methods more to eliminate unnecessary file system activity >diff --git a/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp b/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp >index 757b985c29182308bbe2e1c5fc524e1a484cedd7..3a60d1ed400203f264859f0d08cf501242c93c06 100644 >--- a/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp >@@ -160,6 +160,10 @@ ResourceError NetworkLoadChecker::validateResponse(ResourceResponse& response) > > ASSERT(m_options.mode == FetchOptions::Mode::Cors); > >+ // If we have a 304, the cached response is in WebProcess so we let WebProcess do the CORS check on the cached response. >+ if (response.httpStatusCode() == 304) >+ return { }; >+ > String errorMessage; > if (!passesAccessControlCheck(response, m_storedCredentialsPolicy, *m_origin, errorMessage)) > return ResourceError { String { }, 0, m_url, WTFMove(errorMessage), ResourceError::Type::AccessControl }; >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index b89b82b4fe2ca509fe5435769ef463d3594af696..19e4e6dc0328f4bb501dacac969db7d93f7b0fec 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,15 @@ >+2018-06-22 Youenn Fablet <youenn@apple.com> >+ >+ NetworkLoadChecker should not check CORS for 304 responses triggered by WebProcess revalidation >+ https://bugs.webkit.org/show_bug.cgi?id=186939 >+ <rdar://problem/40941725> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/cors/resources/cache-304.py: Added. >+ * web-platform-tests/cors/script-304-expected.txt: Added. >+ * web-platform-tests/cors/script-304.html: Added. >+ > 2018-06-19 Youenn Fablet <youenn@apple.com> > > RTCRtpSender.replaceTrack(null) ends current track >diff --git a/LayoutTests/imported/w3c/web-platform-tests/cors/resources/cache-304.py b/LayoutTests/imported/w3c/web-platform-tests/cors/resources/cache-304.py >new file mode 100644 >index 0000000000000000000000000000000000000000..7acdfd69768200df10981bb31c97634800c77441 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/cors/resources/cache-304.py >@@ -0,0 +1,10 @@ >+def main(request, response): >+ match = request.headers.get("If-None-Match", None) >+ if match is not None and match == "mybestscript-v1": >+ response.status = (304, "YEP") >+ return "" >+ response.headers.set("Access-Control-Allow-Origin", "*") >+ response.headers.set("Cache-Control", "must-revalidate") >+ response.headers.set("ETag", "mybestscript-v1") >+ response.headers.set("Content-Type", "text/javascript") >+ return "function hep() { }" >diff --git a/LayoutTests/imported/w3c/web-platform-tests/cors/script-304-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/cors/script-304-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..72851fa925b7dffc65e4e3d57a8f993e7c65a94e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/cors/script-304-expected.txt >@@ -0,0 +1,4 @@ >+ >+PASS Load a fresh cross-origin script >+PASS Reload same cross-origin script from the memory cache after revalidation >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/cors/script-304.html b/LayoutTests/imported/w3c/web-platform-tests/cors/script-304.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e164ca6f41b761c93884854298742ddf50c79a97 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/cors/script-304.html >@@ -0,0 +1,40 @@ >+<!doctype html> >+<html> >+ <head> >+ <meta charset="utf-8"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ <script src="/common/get-host-info.sub.js"></script> >+ <script src="/common/utils.js"></script> >+ </head> >+ <body> >+ <div id="testDiv"></div> >+ <script> >+ >+const scriptURL = get_host_info().HTTP_REMOTE_ORIGIN + "/cors/resources/cache-304.py?" + token(); >+ >+function loadScript(test) >+{ >+ const script = document.createElement("script"); >+ script.crossOrigin = "anonymous"; >+ script.src = scriptURL; >+ return new Promise((resolve, reject) => { >+ // Let's add a small timeout so that the script is fully loaded in memory cache before reloading it. >+ script.onload = test.step_timeout(resolve, 50); >+ script.onerror = reject; >+ testDiv.appendChild(script); >+ }); >+} >+ >+promise_test((test) => { >+ return loadScript(test); >+}, "Load a fresh cross-origin script"); >+ >+promise_test((test) => { >+ return loadScript(test); >+}, "Reload same cross-origin script from the memory cache after revalidation"); >+ >+</script> >+ </body> >+</html> >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186939
: 343362