Providing a more helpful message when a permission isn't requested



Developer Tools
2 years ago
28 days ago


(Reporter: Andy McKay, Unassigned)


Firefox Tracking Flags

(Not tracked)


(Whiteboard: triaged)



2 years ago
Currently if you use an API and ask for a permission, you will get an error, but its not too helpful. The permissions code returns the object as undefined. So if you do without asking for permission you'll this in the browser console.

TypeError: is undefined [Learn More]

It could also be an attribute on an enum, for example if you ask for a title on a tab without requesting the tabs permission, you'll get undefined returned.

I'm wondering if there's any way we can improve this message to show something that gives the developer a bit more of a clue.

One suggestion I had was to parse the error message and if the message starts with chrome or browser point to a different page... [Learn More] points to a different URL on MDN. That's crude and would only work in cases where the error contains that string. 

Another suggestion was to hook into the getter to see if it returns undefined. That would make it a problem if people do feature detection because it might trigger an error.

cc'ing a few other folks to see if there's any cunning ideas from them.
I hate to even mention this... but we can technically handle this at the JS engine level, where we already have heuristics for warning about references to undefined properties:


2 years ago
Priority: -- → P3
Whiteboard: triaged
Priority: P3 → P5


28 days ago
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.