commit c0fdddbb5bacd88e7856aba24e6974371333d037
parent 2c5fc385158811acf9bed75d55dc04c711eefa21
Author: Kagami Sascha Rosylight <krosylight@proton.me>
Date: Thu, 20 Nov 2025 09:20:10 +0000
Bug 2000862 - Part 3: Make string attributes non-nullable r=smaug,webidl
Differential Revision: https://phabricator.services.mozilla.com/D273237
Diffstat:
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dom/webidl/Notification.webidl b/dom/webidl/Notification.webidl
@@ -41,16 +41,16 @@ interface Notification : EventTarget {
readonly attribute NotificationDirection dir;
[Pure]
- readonly attribute DOMString? lang;
+ readonly attribute DOMString lang;
[Pure]
- readonly attribute DOMString? body;
+ readonly attribute DOMString body;
[Constant]
- readonly attribute DOMString? tag;
+ readonly attribute DOMString tag;
[Pure]
- readonly attribute UTF8String? icon;
+ readonly attribute UTF8String icon;
[Constant, Pref="dom.webnotifications.requireinteraction.enabled"]
readonly attribute boolean requireInteraction;
diff --git a/testing/web-platform/tests/notifications/constructor-basic.https.html b/testing/web-platform/tests/notifications/constructor-basic.https.html
@@ -43,4 +43,12 @@ test(() => {
);
}
}, "constructing a notification with a NotificationOptions dictionary correctly sets and reflects the silent attribute.");
+
+test(() => {
+ const notification = new Notification("a");
+ assert_equals(notification.lang, "", "lang should default to an empty string");
+ assert_equals(notification.body, "", "body should default to an empty string");
+ assert_equals(notification.tag, "", "tag should default to an empty string");
+ assert_equals(notification.icon, "", "icon should default to an empty string");
+}, "String options should default to empty strings");
</script>