feat: add Notification Web API binding (#34842)

* feat: add Notification Web API binding

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: update spec link

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: fix clippy

Signed-off-by: Jason Tsai <git@pews.dev>

* fix: index overflow

Signed-off-by: Jason Tsai <git@pews.dev>

* test(tidy): add notification WebIDL standard URL

Signed-off-by: Jason Tsai <git@pews.dev>

* fix: allow crown::unrooted_must_root

Signed-off-by: Jason Tsai <git@pews.dev>

* implement GetPermission

Signed-off-by: Jason Tsai <git@pews.dev>

* fix silent type

Signed-off-by: Jason Tsai <git@pews.dev>

* add all properties

Signed-off-by: Jason Tsai <git@pews.dev>

* test: add Notification to global

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: update wpt manifest and fix clippy

Signed-off-by: Jason Tsai <git@pews.dev>

* test: temp skip notifications

Signed-off-by: Jason Tsai <git@pews.dev>

* add vibration and apply suggestions

Signed-off-by: Jason Tsai <git@pews.dev>

* partially implement RequestPermission

Signed-off-by: Jason Tsai <git@pews.dev>

* call Permission request permission algorithm

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: pub crate Notification

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: fix clippy

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: crown attribute

Signed-off-by: Jason Tsai <git@pews.dev>

* fix part of suggestions

Signed-off-by: Jason Tsai <git@pews.dev>

* fix: store private `Action` structure

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: fix typo

Signed-off-by: Jason Tsai <git@pews.dev>

* fix: serialize images URL

Signed-off-by: Jason Tsai <git@pews.dev>

* fix: use globalscope as environment settings object

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: add pref `dom_notification_enabled` and default to disabled

Signed-off-by: Jason Tsai <git@pews.dev>

* fix: use `descriptor_permission_state`

Signed-off-by: Jason Tsai <git@pews.dev>

* apply suggestions

Signed-off-by: Jason Tsai <git@pews.dev>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>

* test: remove passed meta

Signed-off-by: Jason Tsai <git@pews.dev>

* test: enable notification prefs in mozilla tests

Signed-off-by: Jason Tsai <git@pews.dev>

---------

Signed-off-by: Jason Tsai <git@pews.dev>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Jason Tsai 2025-02-19 00:56:57 +08:00 committed by GitHub
parent 14d591c462
commit 22c3a63737
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 717 additions and 370 deletions

View file

@ -1 +1 @@
prefs: ["dom_imagebitmap_enabled:true", "dom_offscreen_canvas_enabled:true", "dom_shadowdom_enabled:true", "dom_xpath_enabled:true", "dom_intersection_observer_enabled:true", "dom_resize_observer_enabled:true"]
prefs: ["dom_imagebitmap_enabled:true", "dom_offscreen_canvas_enabled:true", "dom_shadowdom_enabled:true", "dom_xpath_enabled:true", "dom_intersection_observer_enabled:true", "dom_resize_observer_enabled:true", "dom_notification_enabled:true"]

View file

@ -1,9 +0,0 @@
[constructor-basic.https.html]
[Called the notification constructor with one argument.]
expected: FAIL
[Constructing a notification without a NotificationOptions defaults to null.]
expected: FAIL
[constructing a notification with a NotificationOptions dictionary correctly sets and reflects the silent attribute.]
expected: FAIL

View file

@ -1,3 +0,0 @@
[constructor-invalid.https.html]
[Called the notification constructor with no arguments.]
expected: FAIL

View file

@ -1,3 +0,0 @@
[constructor-non-secure.html]
[new Notification calls onerror in non-secure contexts]
expected: FAIL

View file

@ -1,8 +0,0 @@
[historical.any.worker.html]
[Notification.get is obsolete]
expected: FAIL
[historical.any.html]
[Notification.get is obsolete]
expected: FAIL

View file

@ -2,171 +2,6 @@
expected: ERROR
[idlharness.https.any.worker.html]
[idl_test setup]
expected: FAIL
[Notification interface: existence and properties of interface object]
expected: FAIL
[Notification interface object length]
expected: FAIL
[Notification interface object name]
expected: FAIL
[Notification interface: existence and properties of interface prototype object]
expected: FAIL
[Notification interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[Notification interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[Notification interface: attribute permission]
expected: FAIL
[Notification interface: member requestPermission]
expected: FAIL
[Notification interface: attribute maxActions]
expected: FAIL
[Notification interface: attribute onclick]
expected: FAIL
[Notification interface: attribute onshow]
expected: FAIL
[Notification interface: attribute onerror]
expected: FAIL
[Notification interface: attribute onclose]
expected: FAIL
[Notification interface: attribute title]
expected: FAIL
[Notification interface: attribute dir]
expected: FAIL
[Notification interface: attribute lang]
expected: FAIL
[Notification interface: attribute body]
expected: FAIL
[Notification interface: attribute tag]
expected: FAIL
[Notification interface: attribute image]
expected: FAIL
[Notification interface: attribute icon]
expected: FAIL
[Notification interface: attribute badge]
expected: FAIL
[Notification interface: attribute vibrate]
expected: FAIL
[Notification interface: attribute timestamp]
expected: FAIL
[Notification interface: attribute renotify]
expected: FAIL
[Notification interface: attribute silent]
expected: FAIL
[Notification interface: attribute requireInteraction]
expected: FAIL
[Notification interface: attribute data]
expected: FAIL
[Notification interface: attribute actions]
expected: FAIL
[Notification interface: operation close()]
expected: FAIL
[Notification must be primary interface of notification]
expected: FAIL
[Stringification of notification]
expected: FAIL
[Notification interface: notification must inherit property "permission" with the proper type]
expected: FAIL
[Notification interface: notification must not have property "requestPermission"]
expected: FAIL
[Notification interface: notification must inherit property "maxActions" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "onclick" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "onshow" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "onerror" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "onclose" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "title" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "dir" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "lang" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "body" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "tag" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "image" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "icon" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "badge" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "vibrate" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "timestamp" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "renotify" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "silent" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "requireInteraction" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "data" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "actions" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "close()" with the proper type]
expected: FAIL
[ServiceWorkerRegistration interface: operation showNotification(DOMString, optional NotificationOptions)]
expected: FAIL
@ -175,174 +10,6 @@
[idlharness.https.any.html]
[idl_test setup]
expected: FAIL
[Notification interface: existence and properties of interface object]
expected: FAIL
[Notification interface object length]
expected: FAIL
[Notification interface object name]
expected: FAIL
[Notification interface: existence and properties of interface prototype object]
expected: FAIL
[Notification interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[Notification interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[Notification interface: attribute permission]
expected: FAIL
[Notification interface: operation requestPermission(optional NotificationPermissionCallback)]
expected: FAIL
[Notification interface: attribute maxActions]
expected: FAIL
[Notification interface: attribute onclick]
expected: FAIL
[Notification interface: attribute onshow]
expected: FAIL
[Notification interface: attribute onerror]
expected: FAIL
[Notification interface: attribute onclose]
expected: FAIL
[Notification interface: attribute title]
expected: FAIL
[Notification interface: attribute dir]
expected: FAIL
[Notification interface: attribute lang]
expected: FAIL
[Notification interface: attribute body]
expected: FAIL
[Notification interface: attribute tag]
expected: FAIL
[Notification interface: attribute image]
expected: FAIL
[Notification interface: attribute icon]
expected: FAIL
[Notification interface: attribute badge]
expected: FAIL
[Notification interface: attribute vibrate]
expected: FAIL
[Notification interface: attribute timestamp]
expected: FAIL
[Notification interface: attribute renotify]
expected: FAIL
[Notification interface: attribute silent]
expected: FAIL
[Notification interface: attribute requireInteraction]
expected: FAIL
[Notification interface: attribute data]
expected: FAIL
[Notification interface: attribute actions]
expected: FAIL
[Notification interface: operation close()]
expected: FAIL
[Notification must be primary interface of notification]
expected: FAIL
[Stringification of notification]
expected: FAIL
[Notification interface: notification must inherit property "permission" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "requestPermission(optional NotificationPermissionCallback)" with the proper type]
expected: FAIL
[Notification interface: calling requestPermission(optional NotificationPermissionCallback) on notification with too few arguments must throw TypeError]
expected: FAIL
[Notification interface: notification must inherit property "maxActions" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "onclick" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "onshow" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "onerror" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "onclose" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "title" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "dir" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "lang" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "body" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "tag" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "image" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "icon" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "badge" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "vibrate" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "timestamp" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "renotify" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "silent" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "requireInteraction" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "data" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "actions" with the proper type]
expected: FAIL
[Notification interface: notification must inherit property "close()" with the proper type]
expected: FAIL
[ServiceWorkerRegistration interface: operation showNotification(DOMString, optional NotificationOptions)]
expected: FAIL

View file

@ -1,3 +0,0 @@
[permission.html]
[Checked the Notification.permission property.]
expected: FAIL

View file

@ -1,10 +1,4 @@
[permissions-non-secure.html]
expected: ERROR
[Notification.requestPermission must be called from a secure context]
expected: FAIL
[Notification.permission must be called from a secure context]
expected: FAIL
[Notification.permission must be called from a secure worker]
expected: TIMEOUT

View file

@ -10518,7 +10518,7 @@
[]
],
"interfaces.js": [
"e2c2de8556c7fa88f54a76a3c18e06be14722de9",
"fbfc396b62c55415c0493b7528bd5e2b959452e6",
[]
],
"max-session-history-frame.html": [
@ -13506,14 +13506,14 @@
]
],
"interfaces.https.html": [
"501caf7410bba6533e11c0d83acb2729da48a289",
"4e9a583f82479e20dfa932459d3eff607e530d01",
[
null,
{}
]
],
"interfaces.worker.js": [
"5288c40b0fb6e67f2b903f82f074580faa4dca33",
"fc621bbafeec167942f802caae43b9f2ef23b29b",
[
"mozilla/interfaces.worker.html",
{}

View file

@ -1 +1 @@
prefs: [dom_webxr_test: false]
prefs: [dom_webxr_test: false, dom_notification_enabled: true]

View file

@ -0,0 +1 @@
prefs: [dom_notification_enabled: true]

View file

@ -210,6 +210,7 @@ test_interfaces([
"NodeFilter",
"NodeIterator",
"NodeList",
"Notification",
"OfflineAudioCompletionEvent",
"OfflineAudioContext",
"Option",

View file

@ -34,6 +34,7 @@ function test_interfaces(interfaceNamesInGlobalScope) {
"MessageChannel",
"MessagePort",
"NaN",
"Notification",
"Number",
"Object",
"Promise",

View file

@ -42,6 +42,7 @@ test_interfaces([
"MessageChannel",
"MessageEvent",
"MessagePort",
"Notification",
"Performance",
"PerformanceEntry",
"PerformanceMark",