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 chrome.storage.local.get without asking for permission you'll this in the browser console. TypeError: chrome.storage 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: http://searchfox.org/mozilla-central/rev/62db1c9021cfbde9fa5e6e9601de16c21f4c7ce4/js/src/vm/NativeObject.cpp#1932-2012
You need to log in before you can comment on or make changes to this bug.