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

Unified Diff: third_party/WebKit/Source/platform/loader/fetch/CrossOriginAccessControl.cpp

Issue 2807073002: Removed local RefPtr objects created from PassRefPtr arguments. (Closed)
Patch Set: Created 3 years, 8 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/platform/loader/fetch/CrossOriginAccessControl.cpp
diff --git a/third_party/WebKit/Source/platform/loader/fetch/CrossOriginAccessControl.cpp b/third_party/WebKit/Source/platform/loader/fetch/CrossOriginAccessControl.cpp
index 06d0234b67c6af8bcbd42bf367d70bd62bff85d5..82ad4097745ddb699a3af723877ca650e37b025d 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/CrossOriginAccessControl.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/CrossOriginAccessControl.cpp
@@ -472,7 +472,7 @@ void CrossOriginAccessControl::RedirectErrorString(
}
bool CrossOriginAccessControl::HandleRedirect(
- PassRefPtr<SecurityOrigin> security_origin,
+ RefPtr<SecurityOrigin> security_origin,
ResourceRequest& new_request,
const ResourceResponse& redirect_response,
StoredCredentials with_credentials,
@@ -482,13 +482,11 @@ bool CrossOriginAccessControl::HandleRedirect(
const KURL& last_url = redirect_response.Url();
const KURL& new_url = new_request.Url();
- RefPtr<SecurityOrigin> current_security_origin = security_origin;
-
- RefPtr<SecurityOrigin> new_security_origin = current_security_origin;
Yuta Kitamura 2017/04/10 07:00:11 I think the removal of new_security_origin causes
Bugs Nash 2017/04/11 01:47:51 I'm not removing new_security_origin, I'm setting
Yuta Kitamura 2017/04/11 05:49:39 Ah I see, I now see you didn't change the behavior
+ RefPtr<SecurityOrigin> new_security_origin = security_origin;
// TODO(tyoshino): This should be fixed to check not only the last one but
// all redirect responses.
- if (!current_security_origin->CanRequest(last_url)) {
+ if (!security_origin->CanRequest(last_url)) {
// Follow http://www.w3.org/TR/cors/#redirect-steps
CrossOriginAccessControl::RedirectStatus redirect_status =
CrossOriginAccessControl::CheckRedirectLocation(new_url);
@@ -506,15 +504,15 @@ bool CrossOriginAccessControl::HandleRedirect(
// Step 5: perform resource sharing access check.
CrossOriginAccessControl::AccessStatus cors_status =
CrossOriginAccessControl::CheckAccess(
- redirect_response, with_credentials, current_security_origin.Get());
+ redirect_response, with_credentials, security_origin.Get());
if (cors_status != kAccessAllowed) {
StringBuilder builder;
builder.Append("Redirect from '");
builder.Append(last_url.GetString());
builder.Append("' has been blocked by CORS policy: ");
CrossOriginAccessControl::AccessControlErrorString(
- builder, cors_status, redirect_response,
- current_security_origin.Get(), new_request.GetRequestContext());
+ builder, cors_status, redirect_response, security_origin.Get(),
+ new_request.GetRequestContext());
error_message = builder.ToString();
return false;
}
@@ -528,7 +526,7 @@ bool CrossOriginAccessControl::HandleRedirect(
}
}
- if (!current_security_origin->CanRequest(new_url)) {
+ if (!security_origin->CanRequest(new_url)) {
new_request.ClearHTTPOrigin();
new_request.SetHTTPOrigin(new_security_origin.Get());

Powered by Google App Engine
This is Rietveld 408576698