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

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

Issue 650023003: Make generateReferrerHeader() return a Referrer instead of a String (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/PrerenderHandle.cpp ('k') | Source/platform/Prerender.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) 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Don't expose client code to invalid URLs. 126 // Don't expose client code to invalid URLs.
127 callingWindow.printErrorMessage("Unable to open a window with invalid UR L '" + completedURL.string() + "'.\n"); 127 callingWindow.printErrorMessage("Unable to open a window with invalid UR L '" + completedURL.string() + "'.\n");
128 return 0; 128 return 0;
129 } 129 }
130 130
131 FrameLoadRequest frameRequest(callingWindow.document(), completedURL, frameN ame); 131 FrameLoadRequest frameRequest(callingWindow.document(), completedURL, frameN ame);
132 132
133 // Normally, FrameLoader would take care of setting the referrer for a navig ation that is 133 // Normally, FrameLoader would take care of setting the referrer for a navig ation that is
134 // triggered from javascript. However, creating a window goes through suffic ient processing 134 // triggered from javascript. However, creating a window goes through suffic ient processing
135 // that it eventually enters FrameLoader as an embedder-initiated navigation . FrameLoader 135 // that it eventually enters FrameLoader as an embedder-initiated navigation . FrameLoader
136 // assumes no responsibility for generating an embedder-initiated navigatio n's referrer, 136 // assumes no responsibility for generating an embedder-initiated navigation 's referrer,
137 // so we need to ensure the proper referrer is set now. 137 // so we need to ensure the proper referrer is set now.
138 Referrer referrer(SecurityPolicy::generateReferrerHeader(activeFrame->docume nt()->referrerPolicy(), completedURL, activeFrame->document()->outgoingReferrer( )), activeFrame->document()->referrerPolicy()); 138 frameRequest.resourceRequest().setHTTPReferrer(SecurityPolicy::generateRefer rer(activeFrame->document()->referrerPolicy(), completedURL, activeFrame->docume nt()->outgoingReferrer()));
139 frameRequest.resourceRequest().setHTTPReferrer(referrer);
140 139
141 // We pass the opener frame for the lookupFrame in case the active frame is different from 140 // We pass the opener frame for the lookupFrame in case the active frame is different from
142 // the opener frame, and the name references a frame relative to the opener frame. 141 // the opener frame, and the name references a frame relative to the opener frame.
143 bool created; 142 bool created;
144 LocalFrame* newFrame = createWindow(*activeFrame, openerFrame, frameRequest, windowFeatures, NavigationPolicyIgnore, MaybeSendReferrer, created); 143 LocalFrame* newFrame = createWindow(*activeFrame, openerFrame, frameRequest, windowFeatures, NavigationPolicyIgnore, MaybeSendReferrer, created);
145 if (!newFrame) 144 if (!newFrame)
146 return 0; 145 return 0;
147 146
148 if (newFrame != &openerFrame && newFrame != openerFrame.tree().top()) 147 if (newFrame != &openerFrame && newFrame != openerFrame.tree().top())
149 newFrame->loader().forceSandboxFlags(openerFrame.document()->sandboxFlag s()); 148 newFrame->loader().forceSandboxFlags(openerFrame.document()->sandboxFlag s());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 if (shouldSendReferrer == MaybeSendReferrer) { 184 if (shouldSendReferrer == MaybeSendReferrer) {
186 newFrame->loader().setOpener(&openerFrame); 185 newFrame->loader().setOpener(&openerFrame);
187 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer Policy()); 186 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer Policy());
188 } 187 }
189 FrameLoadRequest newRequest(0, request.resourceRequest()); 188 FrameLoadRequest newRequest(0, request.resourceRequest());
190 newRequest.setFormState(request.formState()); 189 newRequest.setFormState(request.formState());
191 newFrame->loader().load(newRequest); 190 newFrame->loader().load(newRequest);
192 } 191 }
193 192
194 } // namespace blink 193 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/PrerenderHandle.cpp ('k') | Source/platform/Prerender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698