Title: [128959] trunk
Revision
128959
Author
[email protected]
Date
2012-09-18 18:36:24 -0700 (Tue, 18 Sep 2012)

Log Message

[V8] Notification.requestPermission(function() {alert();}) crashes
https://bugs.webkit.org/show_bug.cgi?id=94462

Reviewed by Adam Barth.

Source/WebCore:

Since Notification.requestPermission() is a static method,
we need to use getExecutionContext() instead of retrieving a context
from a DOM object.

Test: http/tests/notifications/notification-request-permission.html

* bindings/v8/custom/V8NotificationCustom.cpp:
(WebCore::V8Notification::requestPermissionCallback):

LayoutTests:

The added test checks if Notification.requestPermission() does not crash.

* http/tests/notifications/notification-request-permission-expected.txt: Added.
* http/tests/notifications/notification-request-permission.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (128958 => 128959)


--- trunk/LayoutTests/ChangeLog	2012-09-19 01:33:05 UTC (rev 128958)
+++ trunk/LayoutTests/ChangeLog	2012-09-19 01:36:24 UTC (rev 128959)
@@ -1,3 +1,15 @@
+2012-09-18  Kentaro Hara  <[email protected]>
+
+        [V8] Notification.requestPermission(function() {alert();}) crashes
+        https://bugs.webkit.org/show_bug.cgi?id=94462
+
+        Reviewed by Adam Barth.
+
+        The added test checks if Notification.requestPermission() does not crash.
+
+        * http/tests/notifications/notification-request-permission-expected.txt: Added.
+        * http/tests/notifications/notification-request-permission.html: Added.
+
 2012-09-18  Dirk Pranke  <[email protected]>
 
         Adjust expectation for fast/workers/storage/interrupt-database.html

Added: trunk/LayoutTests/http/tests/notifications/notification-request-permission-expected.txt (0 => 128959)


--- trunk/LayoutTests/http/tests/notifications/notification-request-permission-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/notification-request-permission-expected.txt	2012-09-19 01:36:24 UTC (rev 128959)
@@ -0,0 +1,5 @@
+PASS Notification.requestPermission does not crash.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/http/tests/notifications/notification-request-permission.html (0 => 128959)


--- trunk/LayoutTests/http/tests/notifications/notification-request-permission.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/notification-request-permission.html	2012-09-19 01:36:24 UTC (rev 128959)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+if (!window.Notification)
+    testFailed("window.Notification does not exist.");
+
+window.Notification.requestPermission(function() { });
+testPassed("Notification.requestPermission does not crash.");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (128958 => 128959)


--- trunk/Source/WebCore/ChangeLog	2012-09-19 01:33:05 UTC (rev 128958)
+++ trunk/Source/WebCore/ChangeLog	2012-09-19 01:36:24 UTC (rev 128959)
@@ -1,3 +1,19 @@
+2012-09-18  Kentaro Hara  <[email protected]>
+
+        [V8] Notification.requestPermission(function() {alert();}) crashes
+        https://bugs.webkit.org/show_bug.cgi?id=94462
+
+        Reviewed by Adam Barth.
+
+        Since Notification.requestPermission() is a static method,
+        we need to use getExecutionContext() instead of retrieving a context
+        from a DOM object.
+
+        Test: http/tests/notifications/notification-request-permission.html
+
+        * bindings/v8/custom/V8NotificationCustom.cpp:
+        (WebCore::V8Notification::requestPermissionCallback):
+
 2012-09-18  Shinya Kawanaka  <[email protected]>
 
         [Refactoring] ContentDistributor::distributeSelectionsTo should not change ContentDistribution pool.

Modified: trunk/Source/WebCore/bindings/v8/custom/V8NotificationCustom.cpp (128958 => 128959)


--- trunk/Source/WebCore/bindings/v8/custom/V8NotificationCustom.cpp	2012-09-19 01:33:05 UTC (rev 128958)
+++ trunk/Source/WebCore/bindings/v8/custom/V8NotificationCustom.cpp	2012-09-19 01:36:24 UTC (rev 128959)
@@ -44,9 +44,7 @@
         return v8::Undefined();
     ASSERT(callback);
 
-    Notification* notification = V8Notification::toNative(args.Holder());
-    ScriptExecutionContext* context = notification->scriptExecutionContext();
-    Notification::requestPermission(context, callback.release());
+    Notification::requestPermission(getScriptExecutionContext(), callback.release());
     return v8::Undefined();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to