|
1 |
| -<!doctype html> |
2 |
| -<meta charset=utf-8> |
3 |
| -<title>Notification interface IDL tests</title> |
4 |
| -<div id=log></div> |
5 |
| -<script src=/resources/testharness.js></script> |
6 |
| -<script src=/resources/testharnessreport.js></script> |
7 |
| -<script src=/resources/WebIDLParser.js></script> |
8 |
| -<script src=/resources/idlharness.js></script> |
9 |
| -<script type=text/plain class=untested> |
10 |
| -interface EventTarget { |
11 |
| - void addEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */); |
12 |
| - void removeEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */); |
13 |
| - boolean dispatchEvent(Event event); |
14 |
| -}; |
15 |
| -[TreatNonCallableAsNull] |
16 |
| -callback EventHandlerNonNull = any (Event event); |
17 |
| -typedef EventHandlerNonNull? EventHandler; |
18 |
| -</script> |
19 |
| -<script type=text/plain> |
20 | 1 | [Constructor(DOMString title, optional NotificationOptions options),
|
21 | 2 | Exposed=(Window,Worker)]
|
22 | 3 | interface Notification : EventTarget {
|
23 | 4 | static readonly attribute NotificationPermission permission;
|
24 |
| - [Exposed=Window] static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback deprecatedCallback); |
| 5 | + [Exposed=Window] static Promise<NotificationPermission> requestPermission( |
| 6 | + optional NotificationPermissionCallback deprecatedCallback); |
25 | 7 |
|
26 | 8 | static readonly attribute unsigned long maxActions;
|
27 | 9 |
|
|
79 | 61 | };
|
80 | 62 |
|
81 | 63 | dictionary NotificationAction {
|
| 64 | + NotificationActionType type = "button"; |
82 | 65 | required DOMString action;
|
83 | 66 | required DOMString title;
|
84 | 67 | USVString icon;
|
| 68 | + DOMString? placeholder = null; |
85 | 69 | };
|
86 | 70 |
|
87 | 71 | callback NotificationPermissionCallback = void (NotificationPermission permission);
|
88 |
| -</script> |
89 |
| -<script> |
90 |
| -"use strict"; |
91 |
| -var idlArray = new IdlArray(); |
92 |
| -[].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) { |
93 |
| - if (node.className == "untested") { |
94 |
| - idlArray.add_untested_idls(node.textContent); |
95 |
| - } else { |
96 |
| - idlArray.add_idls(node.textContent); |
97 |
| - } |
98 |
| -}); |
99 |
| -idlArray.add_objects({ |
100 |
| - Notification: ['new Notification("Running idlharness.")'], |
101 |
| -}); |
102 |
| -idlArray.test(); |
103 |
| -</script> |
| 72 | + |
| 73 | +dictionary GetNotificationOptions { |
| 74 | + DOMString tag = ""; |
| 75 | +}; |
| 76 | + |
| 77 | +partial interface ServiceWorkerRegistration { |
| 78 | + Promise<void> showNotification(DOMString title, optional NotificationOptions options); |
| 79 | + Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter); |
| 80 | +}; |
| 81 | + |
| 82 | +[Constructor(DOMString type, NotificationEventInit eventInitDict), |
| 83 | + Exposed=ServiceWorker] |
| 84 | +interface NotificationEvent : ExtendableEvent { |
| 85 | + readonly attribute Notification notification; |
| 86 | + readonly attribute DOMString action; |
| 87 | + readonly attribute DOMString? reply; |
| 88 | +}; |
| 89 | + |
| 90 | +dictionary NotificationEventInit : ExtendableEventInit { |
| 91 | + required Notification notification; |
| 92 | + DOMString action = ""; |
| 93 | + DOMString? reply = null; |
| 94 | +}; |
| 95 | + |
| 96 | +partial interface ServiceWorkerGlobalScope { |
| 97 | + attribute EventHandler onnotificationclick; |
| 98 | + attribute EventHandler onnotificationclose; |
| 99 | +}; |
0 commit comments