| 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 13 matching lines...) Expand all Loading... |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/page/CreateWindow.h" | 28 #include "core/page/CreateWindow.h" |
| 29 | 29 |
| 30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
| 31 #include "core/frame/FrameHost.h" | 31 #include "core/frame/FrameHost.h" |
| 32 #include "core/frame/LocalFrame.h" | 32 #include "core/frame/LocalFrame.h" |
| 33 #include "core/frame/Settings.h" | 33 #include "core/frame/Settings.h" |
| 34 #include "core/inspector/ConsoleMessage.h" |
| 34 #include "core/loader/FrameLoadRequest.h" | 35 #include "core/loader/FrameLoadRequest.h" |
| 35 #include "core/page/Chrome.h" | 36 #include "core/page/Chrome.h" |
| 36 #include "core/page/ChromeClient.h" | 37 #include "core/page/ChromeClient.h" |
| 37 #include "core/page/FocusController.h" | 38 #include "core/page/FocusController.h" |
| 38 #include "core/page/Page.h" | 39 #include "core/page/Page.h" |
| 39 #include "core/page/WindowFeatures.h" | 40 #include "core/page/WindowFeatures.h" |
| 40 #include "platform/network/ResourceRequest.h" | 41 #include "platform/network/ResourceRequest.h" |
| 41 #include "platform/weborigin/KURL.h" | 42 #include "platform/weborigin/KURL.h" |
| 42 #include "platform/weborigin/SecurityOrigin.h" | 43 #include "platform/weborigin/SecurityOrigin.h" |
| 43 #include "platform/weborigin/SecurityPolicy.h" | 44 #include "platform/weborigin/SecurityPolicy.h" |
| 44 | 45 |
| 45 namespace WebCore { | 46 namespace WebCore { |
| 46 | 47 |
| 47 static LocalFrame* createWindow(LocalFrame& openerFrame, LocalFrame& lookupFrame
, const FrameLoadRequest& request, const WindowFeatures& features, NavigationPol
icy policy, ShouldSendReferrer shouldSendReferrer, bool& created) | 48 static LocalFrame* createWindow(LocalFrame& openerFrame, LocalFrame& lookupFrame
, const FrameLoadRequest& request, const WindowFeatures& features, NavigationPol
icy policy, ShouldSendReferrer shouldSendReferrer, bool& created) |
| 48 { | 49 { |
| 49 ASSERT(!features.dialog || request.frameName().isEmpty()); | 50 ASSERT(!features.dialog || request.frameName().isEmpty()); |
| 50 | 51 |
| 51 if (!request.frameName().isEmpty() && request.frameName() != "_blank" && pol
icy == NavigationPolicyIgnore) { | 52 if (!request.frameName().isEmpty() && request.frameName() != "_blank" && pol
icy == NavigationPolicyIgnore) { |
| 52 if (LocalFrame* frame = lookupFrame.loader().findFrameForNavigation(requ
est.frameName(), openerFrame.document())) { | 53 if (LocalFrame* frame = lookupFrame.loader().findFrameForNavigation(requ
est.frameName(), openerFrame.document())) { |
| 53 if (request.frameName() != "_self") | 54 if (request.frameName() != "_self") |
| 54 frame->page()->focusController().setFocusedFrame(frame); | 55 frame->page()->focusController().setFocusedFrame(frame); |
| 55 created = false; | 56 created = false; |
| 56 return frame; | 57 return frame; |
| 57 } | 58 } |
| 58 } | 59 } |
| 59 | 60 |
| 60 // Sandboxed frames cannot open new auxiliary browsing contexts. | 61 // Sandboxed frames cannot open new auxiliary browsing contexts. |
| 61 if (openerFrame.document()->isSandboxed(SandboxPopups)) { | 62 if (openerFrame.document()->isSandboxed(SandboxPopups)) { |
| 62 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. | 63 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. |
| 63 openerFrame.document()->addConsoleMessage(SecurityMessageSource, ErrorMe
ssageLevel, "Blocked opening '" + request.resourceRequest().url().elidedString()
+ "' in a new window because the request was made in a sandboxed frame whose 'a
llow-popups' permission is not set."); | 64 openerFrame.document()->addConsoleMessage(ConsoleMessage::create(Securit
yMessageSource, ErrorMessageLevel, "Blocked opening '" + request.resourceRequest
().url().elidedString() + "' in a new window because the request was made in a s
andboxed frame whose 'allow-popups' permission is not set.")); |
| 64 return 0; | 65 return 0; |
| 65 } | 66 } |
| 66 | 67 |
| 67 if (openerFrame.settings() && !openerFrame.settings()->supportsMultipleWindo
ws()) { | 68 if (openerFrame.settings() && !openerFrame.settings()->supportsMultipleWindo
ws()) { |
| 68 created = false; | 69 created = false; |
| 69 if (!openerFrame.tree().top()->isLocalFrame()) | 70 if (!openerFrame.tree().top()->isLocalFrame()) |
| 70 return 0; | 71 return 0; |
| 71 return toLocalFrame(openerFrame.tree().top()); | 72 return toLocalFrame(openerFrame.tree().top()); |
| 72 } | 73 } |
| 73 | 74 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |