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 25 matching lines...) Expand all Loading... |
36 #include "core/page/Chrome.h" | 36 #include "core/page/Chrome.h" |
37 #include "core/page/ChromeClient.h" | 37 #include "core/page/ChromeClient.h" |
38 #include "core/page/FocusController.h" | 38 #include "core/page/FocusController.h" |
39 #include "core/page/Page.h" | 39 #include "core/page/Page.h" |
40 #include "core/page/WindowFeatures.h" | 40 #include "core/page/WindowFeatures.h" |
41 #include "platform/UserGestureIndicator.h" | 41 #include "platform/UserGestureIndicator.h" |
42 #include "platform/network/ResourceRequest.h" | 42 #include "platform/network/ResourceRequest.h" |
43 #include "platform/weborigin/KURL.h" | 43 #include "platform/weborigin/KURL.h" |
44 #include "platform/weborigin/SecurityOrigin.h" | 44 #include "platform/weborigin/SecurityOrigin.h" |
45 #include "platform/weborigin/SecurityPolicy.h" | 45 #include "platform/weborigin/SecurityPolicy.h" |
| 46 #include "public/platform/WebURLRequest.h" |
46 | 47 |
47 namespace blink { | 48 namespace blink { |
48 | 49 |
49 static LocalFrame* createWindow(LocalFrame& openerFrame, LocalFrame& lookupFrame
, const FrameLoadRequest& request, const WindowFeatures& features, NavigationPol
icy policy, ShouldSendReferrer shouldSendReferrer, bool& created) | 50 static LocalFrame* createWindow(LocalFrame& openerFrame, LocalFrame& lookupFrame
, const FrameLoadRequest& request, const WindowFeatures& features, NavigationPol
icy policy, ShouldSendReferrer shouldSendReferrer, bool& created) |
50 { | 51 { |
51 ASSERT(!features.dialog || request.frameName().isEmpty()); | 52 ASSERT(!features.dialog || request.frameName().isEmpty()); |
| 53 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeAuxi
liary); |
52 | 54 |
53 if (!request.frameName().isEmpty() && request.frameName() != "_blank" && pol
icy == NavigationPolicyIgnore) { | 55 if (!request.frameName().isEmpty() && request.frameName() != "_blank" && pol
icy == NavigationPolicyIgnore) { |
54 if (Frame* frame = lookupFrame.findFrameForNavigation(request.frameName(
), openerFrame)) { | 56 if (Frame* frame = lookupFrame.findFrameForNavigation(request.frameName(
), openerFrame)) { |
55 if (request.frameName() != "_self") { | 57 if (request.frameName() != "_self") { |
56 if (FrameHost* host = frame->host()) { | 58 if (FrameHost* host = frame->host()) { |
57 if (host == openerFrame.host()) | 59 if (host == openerFrame.host()) |
58 frame->page()->focusController().setFocusedFrame(frame); | 60 frame->page()->focusController().setFocusedFrame(frame); |
59 else | 61 else |
60 host->chrome().focus(); | 62 host->chrome().focus(); |
61 } | 63 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 ASSERT(activeFrame); | 134 ASSERT(activeFrame); |
133 | 135 |
134 KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, emptyString(
)) : firstFrame.document()->completeURL(urlString); | 136 KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, emptyString(
)) : firstFrame.document()->completeURL(urlString); |
135 if (!completedURL.isEmpty() && !completedURL.isValid()) { | 137 if (!completedURL.isEmpty() && !completedURL.isValid()) { |
136 // Don't expose client code to invalid URLs. | 138 // Don't expose client code to invalid URLs. |
137 callingWindow.printErrorMessage("Unable to open a window with invalid UR
L '" + completedURL.string() + "'.\n"); | 139 callingWindow.printErrorMessage("Unable to open a window with invalid UR
L '" + completedURL.string() + "'.\n"); |
138 return nullptr; | 140 return nullptr; |
139 } | 141 } |
140 | 142 |
141 FrameLoadRequest frameRequest(callingWindow.document(), completedURL, frameN
ame); | 143 FrameLoadRequest frameRequest(callingWindow.document(), completedURL, frameN
ame); |
| 144 frameRequest.resourceRequest().setFrameType(WebURLRequest::FrameTypeAuxiliar
y); |
142 | 145 |
143 // Normally, FrameLoader would take care of setting the referrer for a navig
ation that is | 146 // Normally, FrameLoader would take care of setting the referrer for a navig
ation that is |
144 // triggered from javascript. However, creating a window goes through suffic
ient processing | 147 // triggered from javascript. However, creating a window goes through suffic
ient processing |
145 // that it eventually enters FrameLoader as an embedder-initiated navigation
. FrameLoader | 148 // that it eventually enters FrameLoader as an embedder-initiated navigation
. FrameLoader |
146 // assumes no responsibility for generating an embedder-initiated navigation
's referrer, | 149 // assumes no responsibility for generating an embedder-initiated navigation
's referrer, |
147 // so we need to ensure the proper referrer is set now. | 150 // so we need to ensure the proper referrer is set now. |
148 frameRequest.resourceRequest().setHTTPReferrer(SecurityPolicy::generateRefer
rer(activeFrame->document()->referrerPolicy(), completedURL, activeFrame->docume
nt()->outgoingReferrer())); | 151 frameRequest.resourceRequest().setHTTPReferrer(SecurityPolicy::generateRefer
rer(activeFrame->document()->referrerPolicy(), completedURL, activeFrame->docume
nt()->outgoingReferrer())); |
149 | 152 |
150 bool hasUserGesture = UserGestureIndicator::processingUserGesture(); | 153 bool hasUserGesture = UserGestureIndicator::processingUserGesture(); |
151 | 154 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if (shouldSendReferrer == MaybeSendReferrer) { | 196 if (shouldSendReferrer == MaybeSendReferrer) { |
194 newFrame->loader().setOpener(&openerFrame); | 197 newFrame->loader().setOpener(&openerFrame); |
195 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer
Policy()); | 198 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer
Policy()); |
196 } | 199 } |
197 FrameLoadRequest newRequest(0, request.resourceRequest()); | 200 FrameLoadRequest newRequest(0, request.resourceRequest()); |
198 newRequest.setFormState(request.formState()); | 201 newRequest.setFormState(request.formState()); |
199 newFrame->loader().load(newRequest); | 202 newFrame->loader().load(newRequest); |
200 } | 203 } |
201 | 204 |
202 } // namespace blink | 205 } // namespace blink |
OLD | NEW |