OLD | NEW |
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 : first_frame.GetDocument()->CompleteURL(url_string); | 188 : first_frame.GetDocument()->CompleteURL(url_string); |
189 if (!completed_url.IsEmpty() && !completed_url.IsValid()) { | 189 if (!completed_url.IsEmpty() && !completed_url.IsValid()) { |
190 UseCounter::Count(active_frame, UseCounter::kWindowOpenWithInvalidURL); | 190 UseCounter::Count(active_frame, UseCounter::kWindowOpenWithInvalidURL); |
191 // Don't expose client code to invalid URLs. | 191 // Don't expose client code to invalid URLs. |
192 calling_window.PrintErrorMessage( | 192 calling_window.PrintErrorMessage( |
193 "Unable to open a window with invalid URL '" + | 193 "Unable to open a window with invalid URL '" + |
194 completed_url.GetString() + "'.\n"); | 194 completed_url.GetString() + "'.\n"); |
195 return nullptr; | 195 return nullptr; |
196 } | 196 } |
197 | 197 |
198 FrameLoadRequest frame_request(calling_window.document(), completed_url, | 198 FrameLoadRequest frame_request(calling_window.document(), |
199 frame_name); | 199 ResourceRequest(completed_url), frame_name); |
200 frame_request.SetShouldSetOpener(window_features.noopener ? kNeverSetOpener | 200 frame_request.SetShouldSetOpener(window_features.noopener ? kNeverSetOpener |
201 : kMaybeSetOpener); | 201 : kMaybeSetOpener); |
202 frame_request.GetResourceRequest().SetFrameType( | 202 frame_request.GetResourceRequest().SetFrameType( |
203 WebURLRequest::kFrameTypeAuxiliary); | 203 WebURLRequest::kFrameTypeAuxiliary); |
204 frame_request.GetResourceRequest().SetRequestorOrigin( | 204 frame_request.GetResourceRequest().SetRequestorOrigin( |
205 SecurityOrigin::Create(active_frame->GetDocument()->Url())); | 205 SecurityOrigin::Create(active_frame->GetDocument()->Url())); |
206 | 206 |
207 // Normally, FrameLoader would take care of setting the referrer for a | 207 // Normally, FrameLoader would take care of setting the referrer for a |
208 // navigation that is triggered from javascript. However, creating a window | 208 // navigation that is triggered from javascript. However, creating a window |
209 // goes through sufficient processing that it eventually enters FrameLoader as | 209 // goes through sufficient processing that it eventually enters FrameLoader as |
(...skipping 26 matching lines...) Expand all Loading... |
236 // TODO(dcheng): Special case for window.open("about:blank") to ensure it | 236 // TODO(dcheng): Special case for window.open("about:blank") to ensure it |
237 // loads synchronously into a new window. This is our historical behavior, and | 237 // loads synchronously into a new window. This is our historical behavior, and |
238 // it's consistent with the creation of a new iframe with src="about:blank". | 238 // it's consistent with the creation of a new iframe with src="about:blank". |
239 // Perhaps we could get rid of this if we started reporting the initial empty | 239 // Perhaps we could get rid of this if we started reporting the initial empty |
240 // document's url as about:blank? See crbug.com/471239. | 240 // document's url as about:blank? See crbug.com/471239. |
241 // TODO(japhet): This special case is also necessary for behavior asserted by | 241 // TODO(japhet): This special case is also necessary for behavior asserted by |
242 // some extensions tests. Using NavigationScheduler::scheduleNavigationChange | 242 // some extensions tests. Using NavigationScheduler::scheduleNavigationChange |
243 // causes the navigation to be flagged as a client redirect, which is | 243 // causes the navigation to be flagged as a client redirect, which is |
244 // observable via the webNavigation extension api. | 244 // observable via the webNavigation extension api. |
245 if (created) { | 245 if (created) { |
246 FrameLoadRequest request(calling_window.document(), completed_url); | 246 FrameLoadRequest request(calling_window.document(), |
| 247 ResourceRequest(completed_url)); |
247 request.GetResourceRequest().SetHasUserGesture(has_user_gesture); | 248 request.GetResourceRequest().SetHasUserGesture(has_user_gesture); |
248 new_frame->Navigate(request); | 249 new_frame->Navigate(request); |
249 } else if (!url_string.IsEmpty()) { | 250 } else if (!url_string.IsEmpty()) { |
250 new_frame->Navigate(*calling_window.document(), completed_url, false, | 251 new_frame->Navigate(*calling_window.document(), completed_url, false, |
251 has_user_gesture ? UserGestureStatus::kActive | 252 has_user_gesture ? UserGestureStatus::kActive |
252 : UserGestureStatus::kNone); | 253 : UserGestureStatus::kNone); |
253 } | 254 } |
254 return new_frame->DomWindow(); | 255 return new_frame->DomWindow(); |
255 } | 256 } |
256 | 257 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 } | 292 } |
292 | 293 |
293 // TODO(japhet): Form submissions on RemoteFrames don't work yet. | 294 // TODO(japhet): Form submissions on RemoteFrames don't work yet. |
294 FrameLoadRequest new_request(0, request.GetResourceRequest()); | 295 FrameLoadRequest new_request(0, request.GetResourceRequest()); |
295 new_request.SetForm(request.Form()); | 296 new_request.SetForm(request.Form()); |
296 if (new_frame->IsLocalFrame()) | 297 if (new_frame->IsLocalFrame()) |
297 ToLocalFrame(new_frame)->Loader().Load(new_request); | 298 ToLocalFrame(new_frame)->Loader().Load(new_request); |
298 } | 299 } |
299 | 300 |
300 } // namespace blink | 301 } // namespace blink |
OLD | NEW |