Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Unified Diff: third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp

Issue 1965013002: Implement headers attributes in ForeignFetchResponse (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: using instead of typedef Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp
diff --git a/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp b/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp
index 68e0771c46eb4c19200370b97b9d5ddd6a8db7cf..2818bf9bdb29e22d2b3541f083cd0aace44e1c64 100644
--- a/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp
+++ b/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp
@@ -255,6 +255,21 @@ void parseAccessControlExposeHeadersAllowList(const String& headerValue, HTTPHea
}
}
+void extractCorsExposedHeaderNamesList(const ResourceResponse& response, HTTPHeaderSet& headerSet)
+{
+ // If a response was fetched via a service worker, it will always have
+ // corsExposedHeaderNames set, either from the Access-Control-Expose-Headers
+ // header, or explicitly via foreign fetch. For requests that didn't come
+ // from a service worker, foreign fetch doesn't apply so just parse the CORS
+ // header.
+ if (response.wasFetchedViaServiceWorker()) {
+ for (const auto& header : response.corsExposedHeaderNames())
+ headerSet.add(header);
+ return;
+ }
+ parseAccessControlExposeHeadersAllowList(response.httpHeaderField(HTTPNames::Access_Control_Expose_Headers), headerSet);
+}
+
bool CrossOriginAccessControl::isLegalRedirectLocation(const KURL& requestURL, String& errorDescription)
{
// CORS restrictions imposed on Location: URL -- http://www.w3.org/TR/cors/#redirect-steps (steps 2 + 3.)

Powered by Google App Engine
This is Rietveld 408576698