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

Side by Side Diff: Source/core/page/CreateWindow.cpp

Issue 352313003: Make it possible to set the HTTP origin header from content (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/platform/exported/WebURLRequest.cpp » ('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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (!completedURL.isEmpty() && !completedURL.isValid()) { 124 if (!completedURL.isEmpty() && !completedURL.isValid()) {
125 // Don't expose client code to invalid URLs. 125 // Don't expose client code to invalid URLs.
126 callingWindow.printErrorMessage("Unable to open a window with invalid UR L '" + completedURL.string() + "'.\n"); 126 callingWindow.printErrorMessage("Unable to open a window with invalid UR L '" + completedURL.string() + "'.\n");
127 return 0; 127 return 0;
128 } 128 }
129 129
130 // For whatever reason, Firefox uses the first frame to determine the outgoi ngReferrer. We replicate that behavior here. 130 // For whatever reason, Firefox uses the first frame to determine the outgoi ngReferrer. We replicate that behavior here.
131 Referrer referrer(SecurityPolicy::generateReferrerHeader(firstFrame.document ()->referrerPolicy(), completedURL, firstFrame.document()->outgoingReferrer()), firstFrame.document()->referrerPolicy()); 131 Referrer referrer(SecurityPolicy::generateReferrerHeader(firstFrame.document ()->referrerPolicy(), completedURL, firstFrame.document()->outgoingReferrer()), firstFrame.document()->referrerPolicy());
132 132
133 ResourceRequest request(completedURL, referrer); 133 ResourceRequest request(completedURL, referrer);
134 FrameLoader::addHTTPOriginIfNeeded(request, AtomicString(firstFrame.document ()->outgoingOrigin())); 134 request.addHTTPOriginIfNeeded(AtomicString(firstFrame.document()->outgoingOr igin()));
135 FrameLoadRequest frameRequest(callingWindow.document(), request, frameName); 135 FrameLoadRequest frameRequest(callingWindow.document(), request, frameName);
136 136
137 // We pass the opener frame for the lookupFrame in case the active frame is different from 137 // We pass the opener frame for the lookupFrame in case the active frame is different from
138 // the opener frame, and the name references a frame relative to the opener frame. 138 // the opener frame, and the name references a frame relative to the opener frame.
139 bool created; 139 bool created;
140 LocalFrame* newFrame = createWindow(*activeFrame, openerFrame, frameRequest, windowFeatures, NavigationPolicyIgnore, MaybeSendReferrer, created); 140 LocalFrame* newFrame = createWindow(*activeFrame, openerFrame, frameRequest, windowFeatures, NavigationPolicyIgnore, MaybeSendReferrer, created);
141 if (!newFrame) 141 if (!newFrame)
142 return 0; 142 return 0;
143 143
144 if (newFrame != &openerFrame && newFrame != openerFrame.tree().top()) 144 if (newFrame != &openerFrame && newFrame != openerFrame.tree().top())
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 if (shouldSendReferrer == MaybeSendReferrer) { 183 if (shouldSendReferrer == MaybeSendReferrer) {
184 newFrame->loader().setOpener(&openerFrame); 184 newFrame->loader().setOpener(&openerFrame);
185 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer Policy()); 185 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer Policy());
186 } 186 }
187 FrameLoadRequest newRequest(0, request.resourceRequest()); 187 FrameLoadRequest newRequest(0, request.resourceRequest());
188 newRequest.setFormState(request.formState()); 188 newRequest.setFormState(request.formState());
189 newFrame->loader().load(newRequest); 189 newFrame->loader().load(newRequest);
190 } 190 }
191 191
192 } // namespace WebCore 192 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/platform/exported/WebURLRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698