wexond / browser-base

Modern and feature-rich web browser base based on Electron
https://wexond.net
2.68k stars 406 forks source link

Notification.permission defaults to "granted" when it should be "default" #574

Open floatzeI opened 3 years ago

floatzeI commented 3 years ago

Bug description Notification.permission (mdn) defaults to "granted", when all other browsers default to the string "default". It should only be "granted" once someone explicitly approves the notification permission for a website.

It's (probably) worth noting that this doesn't affect the actual permission - visiting a site and trying to send a notification to a user will still create the prompt asking the user to approve/decline notifications.

This can lead to a weird user experience if a website reads the Notification.permission value and only creates a notification if they've been granted permission. Trying to create a notification without permission will create a box asking the user to accept/decline the notification permission, which may not be what a website wants to happen.

To Reproduce

  1. Visit a webpage you haven't granted notification permissions to, such as https://en.wikipedia.org/wiki/Dog
  2. Open up inspect element (Right Click => Inspect)
  3. Open up the javascript console if it isn't already open
  4. Paste this into the console: console.log(Notification.permission)
  5. You should see the string "granted" printed out in the console

Expected behavior At step 5 of the above reproduction example, the string "default" should be printed

Screenshots N/A

Details:

Additional context I've only been testing this in a regular website, so I don't know if the issue exists in web workers.