| 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 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 Loading... |
| 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 |
| OLD | NEW |