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

Side by Side Diff: Source/core/fetch/CrossOriginAccessControl.cpp

Issue 600393004: [ServiceWorker] Set FetchRequestMode and handle wasFetchedViaServiceWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add setFetchCredentialsMode in PingLoader::PingLoader() Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 bool isOnAccessControlResponseHeaderWhitelist(const String& name) 57 bool isOnAccessControlResponseHeaderWhitelist(const String& name)
58 { 58 {
59 AtomicallyInitializedStatic(HTTPHeaderSet*, allowedCrossOriginResponseHeader s = createAllowedCrossOriginResponseHeadersSet().leakPtr()); 59 AtomicallyInitializedStatic(HTTPHeaderSet*, allowedCrossOriginResponseHeader s = createAllowedCrossOriginResponseHeadersSet().leakPtr());
60 60
61 return allowedCrossOriginResponseHeaders->contains(name); 61 return allowedCrossOriginResponseHeaders->contains(name);
62 } 62 }
63 63
64 void updateRequestForAccessControl(ResourceRequest& request, SecurityOrigin* sec urityOrigin, StoredCredentials allowCredentials) 64 void updateRequestForAccessControl(ResourceRequest& request, SecurityOrigin* sec urityOrigin, StoredCredentials allowCredentials)
65 { 65 {
66 request.removeCredentials(); 66 request.removeCredentials();
67 request.setAllowStoredCredentials(allowCredentials == AllowStoredCredentials ); 67 request.setAllowStoredCredentials(allowCredentials == AllowStoredCredentials );
yhirano 2014/10/07 08:03:14 Requiring to call two methods in all occurrences m
68 request.setFetchCredentialsMode(allowCredentials == AllowStoredCredentials ? WebURLRequest::FetchCredentialsModeInclude : WebURLRequest::FetchCredentialsMod eSameOrigin);
yhirano 2014/10/07 08:03:14 This behavior (setting same-origin if allowCredent
68 69
69 if (securityOrigin) 70 if (securityOrigin)
70 request.setHTTPOrigin(securityOrigin->toAtomicString()); 71 request.setHTTPOrigin(securityOrigin->toAtomicString());
71 } 72 }
72 73
73 ResourceRequest createAccessControlPreflightRequest(const ResourceRequest& reque st, SecurityOrigin* securityOrigin) 74 ResourceRequest createAccessControlPreflightRequest(const ResourceRequest& reque st, SecurityOrigin* securityOrigin)
74 { 75 {
75 ResourceRequest preflightRequest(request.url()); 76 ResourceRequest preflightRequest(request.url());
76 updateRequestForAccessControl(preflightRequest, securityOrigin, DoNotAllowSt oredCredentials); 77 updateRequestForAccessControl(preflightRequest, securityOrigin, DoNotAllowSt oredCredentials);
77 preflightRequest.setHTTPMethod("OPTIONS"); 78 preflightRequest.setHTTPMethod("OPTIONS");
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 request.setHTTPOrigin(securityOrigin->toAtomicString()); 240 request.setHTTPOrigin(securityOrigin->toAtomicString());
240 // If the user didn't request credentials in the first place, update our 241 // If the user didn't request credentials in the first place, update our
241 // state so we neither request them nor expect they must be allowed. 242 // state so we neither request them nor expect they must be allowed.
242 if (options.credentialsRequested == ClientDidNotRequestCredentials) 243 if (options.credentialsRequested == ClientDidNotRequestCredentials)
243 options.allowCredentials = DoNotAllowStoredCredentials; 244 options.allowCredentials = DoNotAllowStoredCredentials;
244 } 245 }
245 return true; 246 return true;
246 } 247 }
247 248
248 } // namespace blink 249 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698