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

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

Issue 196043002: HTML Imports: Send credentials for same origin requests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Landing again with another fix Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/resolver/StyleResourceLoader.cpp ('k') | Source/core/fetch/FetchRequest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 235
236 // Same-origin request URLs that redirect are allowed without checking acces s. 236 // Same-origin request URLs that redirect are allowed without checking acces s.
237 if (!securityOrigin->canRequest(originalURL)) { 237 if (!securityOrigin->canRequest(originalURL)) {
238 // Follow http://www.w3.org/TR/cors/#redirect-steps 238 // Follow http://www.w3.org/TR/cors/#redirect-steps
239 String errorDescription; 239 String errorDescription;
240 240
241 // Steps 3 & 4 - check if scheme and other URL restrictions hold. 241 // Steps 3 & 4 - check if scheme and other URL restrictions hold.
242 bool allowRedirect = isLegalRedirectLocation(requestURL, errorDescriptio n); 242 bool allowRedirect = isLegalRedirectLocation(requestURL, errorDescriptio n);
243 if (allowRedirect) { 243 if (allowRedirect) {
244 // Step 5: perform resource sharing access check. 244 // Step 5: perform resource sharing access check.
245 StoredCredentials withCredentials = resource->resourceRequest().allo wStoredCredentials() ? AllowStoredCredentials : DoNotAllowStoredCredentials; 245 StoredCredentials withCredentials = resource->lastResourceRequest(). allowStoredCredentials() ? AllowStoredCredentials : DoNotAllowStoredCredentials;
246 allowRedirect = passesAccessControlCheck(redirectResponse, withCrede ntials, securityOrigin, errorDescription); 246 allowRedirect = passesAccessControlCheck(redirectResponse, withCrede ntials, securityOrigin, errorDescription);
247 if (allowRedirect) { 247 if (allowRedirect) {
248 RefPtr<SecurityOrigin> originalOrigin = SecurityOrigin::create(o riginalURL); 248 RefPtr<SecurityOrigin> originalOrigin = SecurityOrigin::create(o riginalURL);
249 // Step 6: if the request URL origin is not same origin as the o riginal URL's, 249 // Step 6: if the request URL origin is not same origin as the o riginal URL's,
250 // set the source origin to a globally unique identifier. 250 // set the source origin to a globally unique identifier.
251 if (!originalOrigin->canRequest(requestURL)) { 251 if (!originalOrigin->canRequest(requestURL)) {
252 options.securityOrigin = SecurityOrigin::createUnique(); 252 options.securityOrigin = SecurityOrigin::createUnique();
253 securityOrigin = options.securityOrigin.get(); 253 securityOrigin = options.securityOrigin.get();
254 } 254 }
255 } 255 }
(...skipping 10 matching lines...) Expand all
266 request.setHTTPOrigin(securityOrigin->toAtomicString()); 266 request.setHTTPOrigin(securityOrigin->toAtomicString());
267 // If the user didn't request credentials in the first place, update our 267 // If the user didn't request credentials in the first place, update our
268 // state so we neither request them nor expect they must be allowed. 268 // state so we neither request them nor expect they must be allowed.
269 if (options.credentialsRequested == ClientDidNotRequestCredentials) 269 if (options.credentialsRequested == ClientDidNotRequestCredentials)
270 options.allowCredentials = DoNotAllowStoredCredentials; 270 options.allowCredentials = DoNotAllowStoredCredentials;
271 } 271 }
272 return true; 272 return true;
273 } 273 }
274 274
275 } // namespace WebCore 275 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResourceLoader.cpp ('k') | Source/core/fetch/FetchRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698