Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency: notifications.NotificationOptions #445

Open
erosman opened this issue Sep 4, 2023 · 5 comments
Open

Inconsistency: notifications.NotificationOptions #445

erosman opened this issue Sep 4, 2023 · 5 comments
Labels
inconsistency Inconsistent behavior across browsers next manifest version Consider for the next manifest version

Comments

@erosman
Copy link

erosman commented Sep 4, 2023

Available options in notifications.NotificationOptions (Chrome NotificationOptions) differ considerably between browsers, as evident in the Browser compatibility.

🖥 desktop 📱 mobile
Chrome Edge Firefox Opera Safari Firefox
for Android
Safari
on iOS
NotificationOptions ✅ (17) ✅ (45) ✅ (48)
appIconMaskUrl ✅ (79)
buttons ✅ (79)
contextMessage ✅ (31) ✅ (79)
eventTime ✅ (79)
imageUrl ✅ (79)
isClickable ✅ (32) ✅ (79)
items ✅ (79)
priority ✅ (79)
progress ✅ (30) ✅ (79)
requireInteraction ✅ (50) ✅ (79)
@xeenon xeenon added inconsistency Inconsistent behavior across browsers and removed needs-triage labels Sep 28, 2023
@dotproto dotproto added the next manifest version Consider for the next manifest version label Sep 28, 2023
@carlosjeurissen
Copy link
Contributor

@erosman what happens when you use any of the unsupported properties? Will they be ignored or will an exception be thrown? If browsers just ignore unsupported properties I do not see any big issue for now.

@erosman
Copy link
Author

erosman commented Sep 29, 2023

Example:

browser.notifications.create('', {
  type: 'basic',
  iconUrl: '/image/icon48.png',
  title: 'Reminder',
  message: "Proceed?",
  buttons: [
    {
      title: "Yes, get me there"
    }, 
    {
      title: "Get out of my way"
    }
  ]
});

It results in an error.

Uncaught Error: Type error for parameter options (Property "buttons" is unsupported by Firefox) for notifications.create.
Schemas.sys.mjs:2704:19

https://searchfox.org/mozilla-central/source/toolkit/components/extensions/Schemas.sys.mjs#2703,2705

  throwError(context, msg) {
    throw context.makeError(`${msg} for ${this.path.join(".")}.${this.name}.`);
  }

@patrickkettner
Copy link
Contributor

As requested during the 2023-09-28 meeting , I pulled the notification API usage from Chrome. In the below chart, 100% represents all usages of notifications.create. Each section makes up the percentage of extensions that use that API.

Note that the usages are not mutually exclusive. A single call could use multiple listed options. The exception is the (None) section. That is made up of calls to notifications.create that explicitly do not use any of the other listed options.

image

@patrickkettner
Copy link
Contributor

TIL github supports mermaid charts

pie  title browser.notification API usage in Chrome Web Store
        "NotificationOptions": 1
        ".appIconMaskUrl": 1
        ".buttons": 16
        ".contextMessage": 5
        ".eventTime": 4
        ".imageUrl": 5
        ".isClickable": 5
        ".items": 16
        ".priority": 14
        ".progress": 12
        ".requireInteraction": 9
        "(None)": 14
Loading

@Rob--W
Copy link
Member

Rob--W commented Oct 26, 2023

@patrickkettner Is there any difference if you filter by extensions with users?

E.g. >10 users to exclude extensions with barely any usage
vs >1000
vs >10000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inconsistency Inconsistent behavior across browsers next manifest version Consider for the next manifest version
Projects
None yet
Development

No branches or pull requests

6 participants