mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-27 02:20:17 +00:00
LibWeb: Add a simplified Notification constructor
This allows the Notification object to be created in javascript without any additional functionalities. It passes two wpt tests which require a call to the notification constructor with no arguments. https://wpt.live/notifications/constructor-basic.https.html https://wpt.live/notifications/constructor-invalid.https.html
This commit is contained in:
parent
0aec8912c9
commit
a72b0c29bb
Notes:
github-actions[bot]
2025-09-24 10:54:18 +00:00
Author: https://github.com/NiccoloAntonelliDziri 🔰
Commit: a72b0c29bb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6219
Reviewed-by: https://github.com/AtkinsSJ ✅
12 changed files with 263 additions and 0 deletions
76
Libraries/LibWeb/NotificationsAPI/Notification.idl
Normal file
76
Libraries/LibWeb/NotificationsAPI/Notification.idl
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
#import <DOM/EventTarget.idl>
|
||||
#import <HighResolutionTime/EpochTimeStamp.idl>
|
||||
|
||||
// https://notifications.spec.whatwg.org/#notification
|
||||
[Exposed=(Window,Worker)]
|
||||
interface Notification : EventTarget {
|
||||
constructor(DOMString title, optional NotificationOptions options = {});
|
||||
|
||||
// FIXME: static readonly attribute NotificationPermission permission;
|
||||
// FIXME: [Exposed=Window] static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback deprecatedCallback);
|
||||
|
||||
// FIXME: static readonly attribute unsigned long maxActions;
|
||||
|
||||
[FIXME] attribute EventHandler onclick;
|
||||
[FIXME] attribute EventHandler onshow;
|
||||
[FIXME] attribute EventHandler onerror;
|
||||
[FIXME] attribute EventHandler onclose;
|
||||
|
||||
[FIXME] readonly attribute DOMString title;
|
||||
[FIXME] readonly attribute NotificationDirection dir;
|
||||
[FIXME] readonly attribute DOMString lang;
|
||||
[FIXME] readonly attribute DOMString body;
|
||||
[FIXME] readonly attribute USVString navigate;
|
||||
[FIXME] readonly attribute DOMString tag;
|
||||
[FIXME] readonly attribute USVString image;
|
||||
[FIXME] readonly attribute USVString icon;
|
||||
[FIXME] readonly attribute USVString badge;
|
||||
// FIXME: [SameObject] readonly attribute FrozenArray<unsigned long> vibrate;
|
||||
[FIXME] readonly attribute EpochTimeStamp timestamp;
|
||||
[FIXME] readonly attribute boolean renotify;
|
||||
[FIXME] readonly attribute boolean? silent;
|
||||
[FIXME] readonly attribute boolean requireInteraction;
|
||||
// FIXME: [SameObject] readonly attribute any data;
|
||||
// FIXME: [SameObject] readonly attribute FrozenArray<NotificationAction> actions;
|
||||
|
||||
[FIXME] undefined close();
|
||||
};
|
||||
|
||||
dictionary NotificationOptions {
|
||||
NotificationDirection dir = "auto";
|
||||
DOMString lang = "";
|
||||
DOMString body = "";
|
||||
USVString navigate;
|
||||
DOMString tag = "";
|
||||
USVString image;
|
||||
USVString icon;
|
||||
USVString badge;
|
||||
// FIXME: VibratePattern vibrate;
|
||||
EpochTimeStamp timestamp;
|
||||
boolean renotify = false;
|
||||
boolean? silent = null;
|
||||
boolean requireInteraction = false;
|
||||
any data = null;
|
||||
sequence<NotificationAction> actions = [];
|
||||
};
|
||||
|
||||
enum NotificationPermission {
|
||||
"default",
|
||||
"denied",
|
||||
"granted"
|
||||
};
|
||||
|
||||
enum NotificationDirection {
|
||||
"auto",
|
||||
"ltr",
|
||||
"rtl"
|
||||
};
|
||||
|
||||
dictionary NotificationAction {
|
||||
required DOMString action;
|
||||
required DOMString title;
|
||||
USVString navigate;
|
||||
USVString icon;
|
||||
};
|
||||
|
||||
[FIXME] callback NotificationPermissionCallback = undefined (NotificationPermission permission);
|
||||
Loading…
Add table
Add a link
Reference in a new issue