Diff
Modified: trunk/LayoutTests/ChangeLog (129139 => 129140)
--- trunk/LayoutTests/ChangeLog 2012-09-20 15:57:31 UTC (rev 129139)
+++ trunk/LayoutTests/ChangeLog 2012-09-20 17:49:31 UTC (rev 129140)
@@ -1,3 +1,20 @@
+2012-09-17 Jon Lee <[email protected]>
+
+ Safari 6 notifications' onclick handlers can't call window.open()
+ https://bugs.webkit.org/show_bug.cgi?id=96959
+ <rdar://problem/12132427>
+
+ Reviewed by Darin Adler.
+
+ The test shows and clicks a platform notification. The onclick handler calls window.open(),
+ which in turn calls a function on the main page to confirm that a window was opened.
+
+ * http/tests/notifications/legacy/window-show-on-click-expected.txt: Added.
+ * http/tests/notifications/legacy/window-show-on-click.html: Added.
+ * http/tests/notifications/resources/window-show-on-click.html: Added.
+ * http/tests/notifications/window-show-on-click-expected.txt: Added.
+ * http/tests/notifications/window-show-on-click.html: Added.
+
2012-09-20 Csaba Osztrogonác <[email protected]>
[Qt] Unreviewed gardening. Unskip fast/exclusions tests, because they pass now.
Added: trunk/LayoutTests/http/tests/notifications/legacy/window-show-on-click-expected.txt (0 => 129140)
--- trunk/LayoutTests/http/tests/notifications/legacy/window-show-on-click-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/legacy/window-show-on-click-expected.txt 2012-09-20 17:49:31 UTC (rev 129140)
@@ -0,0 +1,11 @@
+This test checks that a script can open windows when the user clicks on a native notification.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS webkitNotifications.checkPermission() is 0
+PASS clicking on notification successfully opened a window
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/notifications/legacy/window-show-on-click.html (0 => 129140)
--- trunk/LayoutTests/http/tests/notifications/legacy/window-show-on-click.html (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/legacy/window-show-on-click.html 2012-09-20 17:49:31 UTC (rev 129140)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<p id="description"></p>
+<div id="console"></div>
+<script>
+if (window.testRunner) {
+ testRunner.grantWebNotificationPermission(testURL);
+ testRunner.setCanOpenWindows(true);
+ testRunner.waitUntilDone();
+}
+
+description("This test checks that a script can open windows when the user clicks on a native notification.");
+
+shouldBe("webkitNotifications.checkPermission()", "0");
+var n = webkitNotifications.createNotification("", "", "");
+n._ondisplay_ = function() {
+ if (window.testRunner)
+ testRunner.simulateWebNotificationClick(this);
+};
+n._onclick_ = function() {
+ window.open('/notifications/resources/window-show-on-click.html');
+};
+n.show();
+
+function onWindowOpen() {
+ testPassed('clicking on notification successfully opened a window');
+ testCompleted();
+}
+
+setTimeout(function() {
+ testFailed('clicking on notification did not open a window');
+ testCompleted();
+}, 100);
+</script>
Added: trunk/LayoutTests/http/tests/notifications/resources/window-show-on-click.html (0 => 129140)
--- trunk/LayoutTests/http/tests/notifications/resources/window-show-on-click.html (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/resources/window-show-on-click.html 2012-09-20 17:49:31 UTC (rev 129140)
@@ -0,0 +1,5 @@
+<script>
+window._onload_ = function() {
+ window.opener.onWindowOpen();
+};
+</script>
\ No newline at end of file
Added: trunk/LayoutTests/http/tests/notifications/window-show-on-click-expected.txt (0 => 129140)
--- trunk/LayoutTests/http/tests/notifications/window-show-on-click-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/window-show-on-click-expected.txt 2012-09-20 17:49:31 UTC (rev 129140)
@@ -0,0 +1,11 @@
+This test checks that a script can open windows when the user clicks on a native notification.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Notification.permission is "granted"
+PASS clicking on notification successfully opened a window
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/notifications/window-show-on-click.html (0 => 129140)
--- trunk/LayoutTests/http/tests/notifications/window-show-on-click.html (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/window-show-on-click.html 2012-09-20 17:49:31 UTC (rev 129140)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<p id="description"></p>
+<div id="console"></div>
+<script>
+if (window.testRunner) {
+ testRunner.grantWebNotificationPermission(testURL);
+ testRunner.setCanOpenWindows(true);
+ testRunner.waitUntilDone();
+}
+
+description("This test checks that a script can open windows when the user clicks on a native notification.");
+
+shouldBeEqualToString("Notification.permission", "granted");
+var n = new Notification("Test");
+n._onshow_ = function() {
+ if (window.testRunner)
+ testRunner.simulateWebNotificationClick(this);
+};
+n._onclick_ = function() {
+ window.open('/notifications/resources/window-show-on-click.html');
+};
+
+function onWindowOpen() {
+ testPassed('clicking on notification successfully opened a window');
+ testCompleted();
+}
+
+setTimeout(function() {
+ testFailed('clicking on notification did not open a window');
+ testCompleted();
+}, 100);
+</script>
Modified: trunk/Source/WebKit2/ChangeLog (129139 => 129140)
--- trunk/Source/WebKit2/ChangeLog 2012-09-20 15:57:31 UTC (rev 129139)
+++ trunk/Source/WebKit2/ChangeLog 2012-09-20 17:49:31 UTC (rev 129140)
@@ -1,3 +1,17 @@
+2012-09-17 Jon Lee <[email protected]>
+
+ Safari 6 notifications' onclick handlers can't call window.open()
+ https://bugs.webkit.org/show_bug.cgi?id=96959
+ <rdar://problem/12132427>
+
+ Reviewed by Darin Adler.
+
+ The click is not being treated as a user gesture when the message is sent to the web process.
+
+ * WebProcess/Notifications/WebNotificationManager.cpp:
+ (WebKit::WebNotificationManager::didClickNotification): Gets called when the user clicks on the
+ platform notification. Set UserGestureIndicator to show the click event is due to user gesture.
+
2012-09-20 Eunmi Lee <[email protected]>
[EFL][WK2] Add APIs to create, delete and get ewk_context.
Modified: trunk/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp (129139 => 129140)
--- trunk/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp 2012-09-20 15:57:31 UTC (rev 129139)
+++ trunk/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp 2012-09-20 17:49:31 UTC (rev 129140)
@@ -39,6 +39,7 @@
#include <WebCore/ScriptExecutionContext.h>
#include <WebCore/SecurityOrigin.h>
#include <WebCore/Settings.h>
+#include <WebCore/UserGestureIndicator.h>
#endif
using namespace WebCore;
@@ -243,6 +244,8 @@
if (!notification)
return;
+ // Indicate that this event is being dispatched in reaction to a user's interaction with a platform notification.
+ UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
notification->dispatchClickEvent();
#else
UNUSED_PARAM(notificationID);