| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 FloatRect newWindowRect = DOMWindow::adjustWindowRect(frame, windowRect); | 107 FloatRect newWindowRect = DOMWindow::adjustWindowRect(frame, windowRect); |
| 108 | 108 |
| 109 host->chrome().setWindowRect(newWindowRect); | 109 host->chrome().setWindowRect(newWindowRect); |
| 110 host->chrome().show(policy); | 110 host->chrome().show(policy); |
| 111 | 111 |
| 112 created = true; | 112 created = true; |
| 113 return frame; | 113 return frame; |
| 114 } | 114 } |
| 115 | 115 |
| 116 Frame* createWindow(const String& urlString, const AtomicString& frameName, cons
t WindowFeatures& windowFeatures, | 116 Frame* createWindow(const String& urlString, const AtomicString& frameName, cons
t WindowFeatures& windowFeatures, |
| 117 DOMWindow* callingWindow, Frame* firstFrame, Frame* openerFrame, DOMWindow::
PrepareDialogFunction function, void* functionContext) | 117 DOMWindow* callingWindow, Frame* firstFrame, Frame* openerFrame) |
| 118 { | 118 { |
| 119 Frame* activeFrame = callingWindow->frame(); | 119 Frame* activeFrame = callingWindow->frame(); |
| 120 | 120 |
| 121 KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, emptyString(
)) : firstFrame->document()->completeURL(urlString); | 121 KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, emptyString(
)) : firstFrame->document()->completeURL(urlString); |
| 122 if (!completedURL.isEmpty() && !completedURL.isValid()) { | 122 if (!completedURL.isEmpty() && !completedURL.isValid()) { |
| 123 // Don't expose client code to invalid URLs. | 123 // Don't expose client code to invalid URLs. |
| 124 callingWindow->printErrorMessage("Unable to open a window with invalid U
RL '" + completedURL.string() + "'.\n"); | 124 callingWindow->printErrorMessage("Unable to open a window with invalid U
RL '" + completedURL.string() + "'.\n"); |
| 125 return 0; | 125 return 0; |
| 126 } | 126 } |
| 127 | 127 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 138 Frame* newFrame = createWindow(activeFrame, openerFrame, frameRequest, windo
wFeatures, NavigationPolicyIgnore, MaybeSendReferrer, created); | 138 Frame* newFrame = createWindow(activeFrame, openerFrame, frameRequest, windo
wFeatures, NavigationPolicyIgnore, MaybeSendReferrer, created); |
| 139 if (!newFrame) | 139 if (!newFrame) |
| 140 return 0; | 140 return 0; |
| 141 | 141 |
| 142 newFrame->loader().setOpener(openerFrame); | 142 newFrame->loader().setOpener(openerFrame); |
| 143 newFrame->page()->setOpenedByDOM(); | 143 newFrame->page()->setOpenedByDOM(); |
| 144 | 144 |
| 145 if (newFrame->domWindow()->isInsecureScriptAccess(callingWindow, completedUR
L)) | 145 if (newFrame->domWindow()->isInsecureScriptAccess(callingWindow, completedUR
L)) |
| 146 return newFrame; | 146 return newFrame; |
| 147 | 147 |
| 148 if (function) | |
| 149 function(newFrame->domWindow(), functionContext); | |
| 150 | |
| 151 if (created) { | 148 if (created) { |
| 152 FrameLoadRequest request(callingWindow->document(), ResourceRequest(comp
letedURL, referrer)); | 149 FrameLoadRequest request(callingWindow->document(), ResourceRequest(comp
letedURL, referrer)); |
| 153 newFrame->loader().load(request); | 150 newFrame->loader().load(request); |
| 154 } else if (!urlString.isEmpty()) { | 151 } else if (!urlString.isEmpty()) { |
| 155 newFrame->navigationScheduler().scheduleLocationChange(callingWindow->do
cument(), completedURL.string(), referrer, false); | 152 newFrame->navigationScheduler().scheduleLocationChange(callingWindow->do
cument(), completedURL.string(), referrer, false); |
| 156 } | 153 } |
| 157 return newFrame; | 154 return newFrame; |
| 158 } | 155 } |
| 159 | 156 |
| 160 void createWindowForRequest(const FrameLoadRequest& request, Frame* openerFrame,
NavigationPolicy policy, ShouldSendReferrer shouldSendReferrer) | 157 void createWindowForRequest(const FrameLoadRequest& request, Frame* openerFrame,
NavigationPolicy policy, ShouldSendReferrer shouldSendReferrer) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 180 if (shouldSendReferrer == MaybeSendReferrer) { | 177 if (shouldSendReferrer == MaybeSendReferrer) { |
| 181 newFrame->loader().setOpener(openerFrame); | 178 newFrame->loader().setOpener(openerFrame); |
| 182 newFrame->document()->setReferrerPolicy(openerFrame->document()->referre
rPolicy()); | 179 newFrame->document()->setReferrerPolicy(openerFrame->document()->referre
rPolicy()); |
| 183 } | 180 } |
| 184 FrameLoadRequest newRequest(0, request.resourceRequest()); | 181 FrameLoadRequest newRequest(0, request.resourceRequest()); |
| 185 newRequest.setFormState(request.formState()); | 182 newRequest.setFormState(request.formState()); |
| 186 newFrame->loader().load(newRequest); | 183 newFrame->loader().load(newRequest); |
| 187 } | 184 } |
| 188 | 185 |
| 189 } // namespace WebCore | 186 } // namespace WebCore |
| OLD | NEW |