material-extensions / material-icons-browser-extension

Browser Addon that enhances file browsers of version controls with material icons.
MIT License
524 stars 39 forks source link

Firefox optional permissions #102

Closed mikeydevelops closed 2 months ago

mikeydevelops commented 2 months ago

I want to open this by saying I am sorry for not being thorough enough when implementing custom domains on Firefox. I misinterpreted the mdn page about optional_permissions for Firefox. Since Chrome had host_permissions and optional_host_permissions, I thought, when I saw that Firefox supports host_permissions, that it also supports optional_host_permissions and when I researched I didn't find that it [Firefox] did support it. It turns out Firefox accepts websites in optional_permissions.

So this pull request allows us to remove all origins from the permissions on install time, and request them when needed.

Due to fact that Firefox could not detect requesting permissions from background script as being triggered from user action I found a way to remove the background script fully. Previously I had a problem not correctly detecting when a permission was granted and the way I found to fix it was through the background script. Now when I last changed the background script to allow multiple custom domains to be registered, it now allowed me to move the whole logic in the settings popup.

On Firefox there was a warning in the devtools that it was running in quirks mode, whatever that is, and it suggested to add <DOCTYPE html to the html, so I did and the warning is no more.

Closes #99 and https://github.com/material-extensions/material-icons-browser-extension/issues/36#issuecomment-2212046677