Title: [147454] trunk
- Revision
- 147454
- Author
- [email protected]
- Date
- 2013-04-02 10:53:16 -0700 (Tue, 02 Apr 2013)
Log Message
Check whether popups are allowed before creating a new window
https://bugs.webkit.org/show_bug.cgi?id=113782
Reviewed by Adam Barth.
Source/WebCore:
Otherwise, firing a generated mouse event at an anchor is enough to
work around the popup blocker.
Test: fast/loader/url-selected-user-gesture.html
* loader/PolicyChecker.cpp:
(WebCore::PolicyChecker::checkNewWindowPolicy):
LayoutTests:
* fast/loader/url-selected-user-gesture-expected.txt: Added.
* fast/loader/url-selected-user-gesture.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (147453 => 147454)
--- trunk/LayoutTests/ChangeLog 2013-04-02 17:50:59 UTC (rev 147453)
+++ trunk/LayoutTests/ChangeLog 2013-04-02 17:53:16 UTC (rev 147454)
@@ -1,5 +1,15 @@
2013-04-02 Jochen Eisinger <[email protected]>
+ Check whether popups are allowed before creating a new window
+ https://bugs.webkit.org/show_bug.cgi?id=113782
+
+ Reviewed by Adam Barth.
+
+ * fast/loader/url-selected-user-gesture-expected.txt: Added.
+ * fast/loader/url-selected-user-gesture.html: Added.
+
+2013-04-02 Jochen Eisinger <[email protected]>
+
When computing the percentage of the logical height, use the logical top and bottom
https://bugs.webkit.org/show_bug.cgi?id=113761
Added: trunk/LayoutTests/fast/loader/url-selected-user-gesture-expected.txt (0 => 147454)
--- trunk/LayoutTests/fast/loader/url-selected-user-gesture-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/loader/url-selected-user-gesture-expected.txt 2013-04-02 17:53:16 UTC (rev 147454)
@@ -0,0 +1,3 @@
+Check that a _javascript_ generated mouse click is not enough to open a new tab. The test passes, if no new window is opened.
+
+
Added: trunk/LayoutTests/fast/loader/url-selected-user-gesture.html (0 => 147454)
--- trunk/LayoutTests/fast/loader/url-selected-user-gesture.html (rev 0)
+++ trunk/LayoutTests/fast/loader/url-selected-user-gesture.html 2013-04-02 17:53:16 UTC (rev 147454)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<p>
+ Check that a _javascript_ generated mouse click is not enough to open
+ a new tab. The test passes, if no new window is opened.
+</p>
+<a href='' target='_blank'></a>
+<script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.dumpCreateView();
+ testRunner.setCanOpenWindows();
+ testRunner.setPopupBlockingEnabled(true);
+ }
+
+ document.querySelector('a').dispatchEvent(new MouseEvent('click', {ctrlKey: true, metaKey: true}));
+</script>
Modified: trunk/Source/WebCore/ChangeLog (147453 => 147454)
--- trunk/Source/WebCore/ChangeLog 2013-04-02 17:50:59 UTC (rev 147453)
+++ trunk/Source/WebCore/ChangeLog 2013-04-02 17:53:16 UTC (rev 147454)
@@ -1,5 +1,20 @@
2013-04-02 Jochen Eisinger <[email protected]>
+ Check whether popups are allowed before creating a new window
+ https://bugs.webkit.org/show_bug.cgi?id=113782
+
+ Reviewed by Adam Barth.
+
+ Otherwise, firing a generated mouse event at an anchor is enough to
+ work around the popup blocker.
+
+ Test: fast/loader/url-selected-user-gesture.html
+
+ * loader/PolicyChecker.cpp:
+ (WebCore::PolicyChecker::checkNewWindowPolicy):
+
+2013-04-02 Jochen Eisinger <[email protected]>
+
When computing the percentage of the logical height, use the logical top and bottom
https://bugs.webkit.org/show_bug.cgi?id=113761
Modified: trunk/Source/WebCore/loader/PolicyChecker.cpp (147453 => 147454)
--- trunk/Source/WebCore/loader/PolicyChecker.cpp 2013-04-02 17:50:59 UTC (rev 147453)
+++ trunk/Source/WebCore/loader/PolicyChecker.cpp 2013-04-02 17:53:16 UTC (rev 147454)
@@ -32,6 +32,7 @@
#include "PolicyChecker.h"
#include "ContentSecurityPolicy.h"
+#include "DOMWindow.h"
#include "DocumentLoader.h"
#include "FormState.h"
#include "Frame.h"
@@ -105,6 +106,9 @@
if (m_frame->document() && m_frame->document()->isSandboxed(SandboxPopups))
return continueAfterNavigationPolicy(PolicyIgnore);
+ if (!DOMWindow::allowPopUp(m_frame))
+ return continueAfterNavigationPolicy(PolicyIgnore);
+
m_callback.set(request, formState, frameName, action, function, argument);
m_frame->loader()->client()->dispatchDecidePolicyForNewWindowAction(&PolicyChecker::continueAfterNewWindowPolicy,
action, request, formState, frameName);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes