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

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

Issue 2105503002: Skip foreign fetch when the skipServiceWorker flag is set on a request. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rephrase SkipServiceWorker comments. Created 4 years, 5 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 ResourceRequest createAccessControlPreflightRequest(const ResourceRequest& reque st, SecurityOrigin* securityOrigin) 76 ResourceRequest createAccessControlPreflightRequest(const ResourceRequest& reque st, SecurityOrigin* securityOrigin)
77 { 77 {
78 ResourceRequest preflightRequest(request.url()); 78 ResourceRequest preflightRequest(request.url());
79 updateRequestForAccessControl(preflightRequest, securityOrigin, DoNotAllowSt oredCredentials); 79 updateRequestForAccessControl(preflightRequest, securityOrigin, DoNotAllowSt oredCredentials);
80 preflightRequest.setHTTPMethod(HTTPNames::OPTIONS); 80 preflightRequest.setHTTPMethod(HTTPNames::OPTIONS);
81 preflightRequest.setHTTPHeaderField(HTTPNames::Access_Control_Request_Method , AtomicString(request.httpMethod())); 81 preflightRequest.setHTTPHeaderField(HTTPNames::Access_Control_Request_Method , AtomicString(request.httpMethod()));
82 preflightRequest.setPriority(request.priority()); 82 preflightRequest.setPriority(request.priority());
83 preflightRequest.setRequestContext(request.requestContext()); 83 preflightRequest.setRequestContext(request.requestContext());
84 preflightRequest.setSkipServiceWorker(true); 84 preflightRequest.setSkipServiceWorker(WebURLRequest::SkipServiceWorker::All) ;
85 85
86 if (request.isExternalRequest()) 86 if (request.isExternalRequest())
87 preflightRequest.setHTTPHeaderField(HTTPNames::Access_Control_Request_Ex ternal, "true"); 87 preflightRequest.setHTTPHeaderField(HTTPNames::Access_Control_Request_Ex ternal, "true");
88 88
89 const HTTPHeaderMap& requestHeaderFields = request.httpHeaderFields(); 89 const HTTPHeaderMap& requestHeaderFields = request.httpHeaderFields();
90 90
91 if (requestHeaderFields.size() > 0) { 91 if (requestHeaderFields.size() > 0) {
92 // Fetch API Spec: 92 // Fetch API Spec:
93 // https://fetch.spec.whatwg.org/#cors-preflight-fetch-0 93 // https://fetch.spec.whatwg.org/#cors-preflight-fetch-0
94 Vector<String> headers; 94 Vector<String> headers;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 newRequest.setHTTPOrigin(securityOrigin); 328 newRequest.setHTTPOrigin(securityOrigin);
329 // If the user didn't request credentials in the first place, update our 329 // If the user didn't request credentials in the first place, update our
330 // state so we neither request them nor expect they must be allowed. 330 // state so we neither request them nor expect they must be allowed.
331 if (options.credentialsRequested == ClientDidNotRequestCredentials) 331 if (options.credentialsRequested == ClientDidNotRequestCredentials)
332 options.allowCredentials = DoNotAllowStoredCredentials; 332 options.allowCredentials = DoNotAllowStoredCredentials;
333 } 333 }
334 return true; 334 return true;
335 } 335 }
336 336
337 } // namespace blink 337 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698