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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 windowRect.setY(features.y); | 109 windowRect.setY(features.y); |
110 if (features.widthSet) | 110 if (features.widthSet) |
111 windowRect.setWidth(features.width + (windowRect.width() - viewportSize.
width())); | 111 windowRect.setWidth(features.width + (windowRect.width() - viewportSize.
width())); |
112 if (features.heightSet) | 112 if (features.heightSet) |
113 windowRect.setHeight(features.height + (windowRect.height() - viewportSi
ze.height())); | 113 windowRect.setHeight(features.height + (windowRect.height() - viewportSi
ze.height())); |
114 | 114 |
115 host->chromeClient().setWindowRectWithAdjustment(windowRect); | 115 host->chromeClient().setWindowRectWithAdjustment(windowRect); |
116 host->chromeClient().show(policy); | 116 host->chromeClient().show(policy); |
117 | 117 |
118 if (openerFrame.document()->isSandboxed(SandboxPropagatesToAuxiliaryBrowsing
Contexts)) | 118 if (openerFrame.document()->isSandboxed(SandboxPropagatesToAuxiliaryBrowsing
Contexts)) |
119 frame.loader().forceSandboxFlags(openerFrame.securityContext()->sandboxF
lags()); | 119 frame.loader().forceSandboxFlags(openerFrame.securityContext()->getSandb
oxFlags()); |
120 | 120 |
121 // This call may suspend the execution by running nested message loop. | 121 // This call may suspend the execution by running nested message loop. |
122 InspectorInstrumentation::windowCreated(&openerFrame, &frame); | 122 InspectorInstrumentation::windowCreated(&openerFrame, &frame); |
123 created = true; | 123 created = true; |
124 return &frame; | 124 return &frame; |
125 } | 125 } |
126 | 126 |
127 DOMWindow* createWindow(const String& urlString, const AtomicString& frameName,
const WindowFeatures& windowFeatures, | 127 DOMWindow* createWindow(const String& urlString, const AtomicString& frameName,
const WindowFeatures& windowFeatures, |
128 LocalDOMWindow& callingWindow, LocalFrame& firstFrame, LocalFrame& openerFra
me) | 128 LocalDOMWindow& callingWindow, LocalFrame& firstFrame, LocalFrame& openerFra
me) |
129 { | 129 { |
130 LocalFrame* activeFrame = callingWindow.frame(); | 130 LocalFrame* activeFrame = callingWindow.frame(); |
131 ASSERT(activeFrame); | 131 ASSERT(activeFrame); |
132 | 132 |
133 KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, emptyString(
)) : firstFrame.document()->completeURL(urlString); | 133 KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, emptyString(
)) : firstFrame.document()->completeURL(urlString); |
134 if (!completedURL.isEmpty() && !completedURL.isValid()) { | 134 if (!completedURL.isEmpty() && !completedURL.isValid()) { |
135 // Don't expose client code to invalid URLs. | 135 // Don't expose client code to invalid URLs. |
136 callingWindow.printErrorMessage("Unable to open a window with invalid UR
L '" + completedURL.string() + "'.\n"); | 136 callingWindow.printErrorMessage("Unable to open a window with invalid UR
L '" + completedURL.string() + "'.\n"); |
137 return nullptr; | 137 return nullptr; |
138 } | 138 } |
139 | 139 |
140 FrameLoadRequest frameRequest(callingWindow.document(), completedURL, frameN
ame); | 140 FrameLoadRequest frameRequest(callingWindow.document(), completedURL, frameN
ame); |
141 frameRequest.resourceRequest().setFrameType(WebURLRequest::FrameTypeAuxiliar
y); | 141 frameRequest.resourceRequest().setFrameType(WebURLRequest::FrameTypeAuxiliar
y); |
142 frameRequest.resourceRequest().setRequestorOrigin(SecurityOrigin::create(act
iveFrame->document()->url())); | 142 frameRequest.resourceRequest().setRequestorOrigin(SecurityOrigin::create(act
iveFrame->document()->url())); |
143 | 143 |
144 // Normally, FrameLoader would take care of setting the referrer for a navig
ation that is | 144 // Normally, FrameLoader would take care of setting the referrer for a navig
ation that is |
145 // triggered from javascript. However, creating a window goes through suffic
ient processing | 145 // triggered from javascript. However, creating a window goes through suffic
ient processing |
146 // that it eventually enters FrameLoader as an embedder-initiated navigation
. FrameLoader | 146 // that it eventually enters FrameLoader as an embedder-initiated navigation
. FrameLoader |
147 // assumes no responsibility for generating an embedder-initiated navigation
's referrer, | 147 // assumes no responsibility for generating an embedder-initiated navigation
's referrer, |
148 // so we need to ensure the proper referrer is set now. | 148 // so we need to ensure the proper referrer is set now. |
149 frameRequest.resourceRequest().setHTTPReferrer(SecurityPolicy::generateRefer
rer(activeFrame->document()->referrerPolicy(), completedURL, activeFrame->docume
nt()->outgoingReferrer())); | 149 frameRequest.resourceRequest().setHTTPReferrer(SecurityPolicy::generateRefer
rer(activeFrame->document()->getReferrerPolicy(), completedURL, activeFrame->doc
ument()->outgoingReferrer())); |
150 | 150 |
151 // Records HasUserGesture before the value is invalidated inside createWindo
w(LocalFrame& openerFrame, ...). | 151 // Records HasUserGesture before the value is invalidated inside createWindo
w(LocalFrame& openerFrame, ...). |
152 // This value will be set in ResourceRequest loaded in a new LocalFrame. | 152 // This value will be set in ResourceRequest loaded in a new LocalFrame. |
153 bool hasUserGesture = UserGestureIndicator::processingUserGesture(); | 153 bool hasUserGesture = UserGestureIndicator::processingUserGesture(); |
154 | 154 |
155 // We pass the opener frame for the lookupFrame in case the active frame is
different from | 155 // We pass the opener frame for the lookupFrame in case the active frame is
different from |
156 // the opener frame, and the name references a frame relative to the opener
frame. | 156 // the opener frame, and the name references a frame relative to the opener
frame. |
157 bool created; | 157 bool created; |
158 ShouldSetOpener opener = windowFeatures.noopener ? NeverSetOpener : MaybeSet
Opener; | 158 ShouldSetOpener opener = windowFeatures.noopener ? NeverSetOpener : MaybeSet
Opener; |
159 Frame* newFrame = createWindow(*activeFrame, openerFrame, frameRequest, wind
owFeatures, NavigationPolicyIgnore, opener, created); | 159 Frame* newFrame = createWindow(*activeFrame, openerFrame, frameRequest, wind
owFeatures, NavigationPolicyIgnore, opener, created); |
(...skipping 29 matching lines...) Expand all Loading... |
189 WindowFeatures features; | 189 WindowFeatures features; |
190 bool created; | 190 bool created; |
191 Frame* newFrame = createWindow(openerFrame, openerFrame, request, features,
policy, shouldSetOpener, created); | 191 Frame* newFrame = createWindow(openerFrame, openerFrame, request, features,
policy, shouldSetOpener, created); |
192 if (!newFrame) | 192 if (!newFrame) |
193 return; | 193 return; |
194 if (shouldSetOpener == MaybeSetOpener) | 194 if (shouldSetOpener == MaybeSetOpener) |
195 newFrame->client()->setOpener(&openerFrame); | 195 newFrame->client()->setOpener(&openerFrame); |
196 if (shouldSendReferrer == MaybeSendReferrer) { | 196 if (shouldSendReferrer == MaybeSendReferrer) { |
197 // TODO(japhet): Does ReferrerPolicy need to be proagated for RemoteFram
es? | 197 // TODO(japhet): Does ReferrerPolicy need to be proagated for RemoteFram
es? |
198 if (newFrame->isLocalFrame()) | 198 if (newFrame->isLocalFrame()) |
199 toLocalFrame(newFrame)->document()->setReferrerPolicy(openerFrame.do
cument()->referrerPolicy()); | 199 toLocalFrame(newFrame)->document()->setReferrerPolicy(openerFrame.do
cument()->getReferrerPolicy()); |
200 } | 200 } |
201 | 201 |
202 // TODO(japhet): Form submissions on RemoteFrames don't work yet. | 202 // TODO(japhet): Form submissions on RemoteFrames don't work yet. |
203 FrameLoadRequest newRequest(0, request.resourceRequest()); | 203 FrameLoadRequest newRequest(0, request.resourceRequest()); |
204 newRequest.setForm(request.form()); | 204 newRequest.setForm(request.form()); |
205 if (newFrame->isLocalFrame()) | 205 if (newFrame->isLocalFrame()) |
206 toLocalFrame(newFrame)->loader().load(newRequest); | 206 toLocalFrame(newFrame)->loader().load(newRequest); |
207 } | 207 } |
208 | 208 |
209 } // namespace blink | 209 } // namespace blink |
OLD | NEW |