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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 activeWindow->printErrorMessage("Unable to open a window with invalid UR
L '" + completedURL.string() + "'.\n"); | 126 activeWindow->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 String referrer = SecurityPolicy::generateReferrerHeader(firstFrame->documen
t()->referrerPolicy(), completedURL, firstFrame->document()->outgoingReferrer())
; | 131 String referrer = SecurityPolicy::generateReferrerHeader(firstFrame->documen
t()->referrerPolicy(), completedURL, firstFrame->document()->outgoingReferrer())
; |
132 | 132 |
133 ResourceRequest request(completedURL, referrer); | 133 ResourceRequest request(completedURL, AtomicString(referrer)); |
134 FrameLoader::addHTTPOriginIfNeeded(request, firstFrame->document()->outgoing
Origin()); | 134 FrameLoader::addHTTPOriginIfNeeded(request, AtomicString(firstFrame->documen
t()->outgoingOrigin())); |
135 FrameLoadRequest frameRequest(activeWindow->document(), request, frameName); | 135 FrameLoadRequest frameRequest(activeWindow->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 Frame* newFrame = createWindow(activeFrame, openerFrame, frameRequest, windo
wFeatures, NavigationPolicyIgnore, MaybeSendReferrer, created); | 140 Frame* newFrame = createWindow(activeFrame, openerFrame, frameRequest, windo
wFeatures, NavigationPolicyIgnore, MaybeSendReferrer, created); |
141 if (!newFrame) | 141 if (!newFrame) |
142 return 0; | 142 return 0; |
143 | 143 |
144 newFrame->loader().setOpener(openerFrame); | 144 newFrame->loader().setOpener(openerFrame); |
145 newFrame->page()->setOpenedByDOM(); | 145 newFrame->page()->setOpenedByDOM(); |
146 | 146 |
147 if (newFrame->domWindow()->isInsecureScriptAccess(activeWindow, completedURL
)) | 147 if (newFrame->domWindow()->isInsecureScriptAccess(activeWindow, completedURL
)) |
148 return newFrame; | 148 return newFrame; |
149 | 149 |
150 if (function) | 150 if (function) |
151 function(newFrame->domWindow(), functionContext); | 151 function(newFrame->domWindow(), functionContext); |
152 | 152 |
153 if (created) { | 153 if (created) { |
154 FrameLoadRequest request(activeWindow->document(), ResourceRequest(compl
etedURL, referrer)); | 154 FrameLoadRequest request(activeWindow->document(), ResourceRequest(compl
etedURL, AtomicString(referrer))); |
155 newFrame->loader().load(request); | 155 newFrame->loader().load(request); |
156 } else if (!urlString.isEmpty()) { | 156 } else if (!urlString.isEmpty()) { |
157 newFrame->navigationScheduler().scheduleLocationChange(activeWindow->doc
ument(), completedURL.string(), referrer, false); | 157 newFrame->navigationScheduler().scheduleLocationChange(activeWindow->doc
ument(), completedURL.string(), referrer, false); |
158 } | 158 } |
159 return newFrame; | 159 return newFrame; |
160 } | 160 } |
161 | 161 |
162 void createWindowForRequest(const FrameLoadRequest& request, Frame* openerFrame,
NavigationPolicy policy, ShouldSendReferrer shouldSendReferrer) | 162 void createWindowForRequest(const FrameLoadRequest& request, Frame* openerFrame,
NavigationPolicy policy, ShouldSendReferrer shouldSendReferrer) |
163 { | 163 { |
164 if (openerFrame->document()->pageDismissalEventBeingDispatched() != Document
::NoDismissal) | 164 if (openerFrame->document()->pageDismissalEventBeingDispatched() != Document
::NoDismissal) |
(...skipping 17 matching lines...) Expand all Loading... |
182 if (shouldSendReferrer == MaybeSendReferrer) { | 182 if (shouldSendReferrer == MaybeSendReferrer) { |
183 newFrame->loader().setOpener(openerFrame); | 183 newFrame->loader().setOpener(openerFrame); |
184 newFrame->document()->setReferrerPolicy(openerFrame->document()->referre
rPolicy()); | 184 newFrame->document()->setReferrerPolicy(openerFrame->document()->referre
rPolicy()); |
185 } | 185 } |
186 FrameLoadRequest newRequest(0, request.resourceRequest()); | 186 FrameLoadRequest newRequest(0, request.resourceRequest()); |
187 newRequest.setFormState(request.formState()); | 187 newRequest.setFormState(request.formState()); |
188 newFrame->loader().load(newRequest); | 188 newFrame->loader().load(newRequest); |
189 } | 189 } |
190 | 190 |
191 } // namespace WebCore | 191 } // namespace WebCore |
OLD | NEW |