Index: LayoutTests/http/tests/notifications/resources/click-close-service-worker.js |
diff --git a/LayoutTests/http/tests/notifications/resources/click-close-service-worker.js b/LayoutTests/http/tests/notifications/resources/click-close-service-worker.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d71f84ea01507e048340bac3c5356c9836e43280 |
--- /dev/null |
+++ b/LayoutTests/http/tests/notifications/resources/click-close-service-worker.js |
@@ -0,0 +1,13 @@ |
+// Sends a message when the notificationclick event gets received, and closes the |
+// notification which was shown from that event. |
+var messagePort = null; |
+ |
+addEventListener('message', function(event) { |
+ messagePort = event.data; |
+ messagePort.postMessage('ready'); |
+}); |
+ |
+addEventListener('notificationclick', function(event) { |
+ event.notification.close(); |
+ messagePort.postMessage('Clicked on Notification: ' + event.notification.title); |
+}); |