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

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

Issue 339593005: Set the target type when creating the request for main resource (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switched to constructors 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/NavigationScheduler.cpp ('k') | Source/core/page/DragController.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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, emptyString( )) : firstFrame.document()->completeURL(urlString); 123 KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, emptyString( )) : firstFrame.document()->completeURL(urlString);
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, true, referrer);
134 FrameLoader::addHTTPOriginIfNeeded(request, AtomicString(firstFrame.document ()->outgoingOrigin())); 134 FrameLoader::addHTTPOriginIfNeeded(request, AtomicString(firstFrame.document ()->outgoingOrigin()));
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())
145 newFrame->loader().forceSandboxFlags(openerFrame.document()->sandboxFlag s()); 145 newFrame->loader().forceSandboxFlags(openerFrame.document()->sandboxFlag s());
146 146
147 newFrame->loader().setOpener(&openerFrame); 147 newFrame->loader().setOpener(&openerFrame);
148 148
149 if (newFrame->domWindow()->isInsecureScriptAccess(callingWindow, completedUR L)) 149 if (newFrame->domWindow()->isInsecureScriptAccess(callingWindow, completedUR L))
150 return newFrame; 150 return newFrame;
151 151
152 if (function) 152 if (function)
153 function(newFrame->domWindow(), functionContext); 153 function(newFrame->domWindow(), functionContext);
154 154
155 if (created) { 155 if (created) {
156 FrameLoadRequest request(callingWindow.document(), ResourceRequest(compl etedURL, referrer)); 156 ResourceRequest resourceRequest = ResourceRequest(completedURL, newFrame ->isMainFrame(), referrer);
157 FrameLoadRequest request(callingWindow.document(), resourceRequest);
157 newFrame->loader().load(request); 158 newFrame->loader().load(request);
158 } else if (!urlString.isEmpty()) { 159 } else if (!urlString.isEmpty()) {
159 newFrame->navigationScheduler().scheduleLocationChange(callingWindow.doc ument(), completedURL.string(), referrer, false); 160 newFrame->navigationScheduler().scheduleLocationChange(callingWindow.doc ument(), completedURL.string(), referrer, false);
160 } 161 }
161 return newFrame; 162 return newFrame;
162 } 163 }
163 164
164 void createWindowForRequest(const FrameLoadRequest& request, LocalFrame& openerF rame, NavigationPolicy policy, ShouldSendReferrer shouldSendReferrer) 165 void createWindowForRequest(const FrameLoadRequest& request, LocalFrame& openerF rame, NavigationPolicy policy, ShouldSendReferrer shouldSendReferrer)
165 { 166 {
166 if (openerFrame.document()->pageDismissalEventBeingDispatched() != Document: :NoDismissal) 167 if (openerFrame.document()->pageDismissalEventBeingDispatched() != Document: :NoDismissal)
(...skipping 16 matching lines...) Expand all
183 if (shouldSendReferrer == MaybeSendReferrer) { 184 if (shouldSendReferrer == MaybeSendReferrer) {
184 newFrame->loader().setOpener(&openerFrame); 185 newFrame->loader().setOpener(&openerFrame);
185 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer Policy()); 186 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer Policy());
186 } 187 }
187 FrameLoadRequest newRequest(0, request.resourceRequest()); 188 FrameLoadRequest newRequest(0, request.resourceRequest());
188 newRequest.setFormState(request.formState()); 189 newRequest.setFormState(request.formState());
189 newFrame->loader().load(newRequest); 190 newFrame->loader().load(newRequest);
190 } 191 }
191 192
192 } // namespace WebCore 193 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/NavigationScheduler.cpp ('k') | Source/core/page/DragController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698