I am starting out with WebExtensions and have a few questions. My first attempt at a WebExtension is at https://github.com/willsALMANJ/page_keys. It creates a keyboard shortcut (for a url regular expression that can be set as an option) that logs a message to the console. Here are my questions related to it:
-
I load the content script by using a
chrome.tabs.onUpdated
listener andchrome.tabs.executeScript
call for matching urls in background.js. Is this the right way? Because I want to be able to set the url as a preference, I can’t set the content_script url in manifest.json. It doesn’t seem like I can regiester the listener for only certain pages. -
I check for my urlmatch option and set it to the default value at the top of background.js. Is this the best way? In a Firefox addon, I would create a preference with a default value but it seems like WebExtensions don’t have anything like this.
-
Right now I am using the “tabs”,
<all_urls>
, and “storage” permissions. Could the addon work with less broad permissions? -
Is there a way to view and manipulate a WebExtension’s options/storage in Firefox (outside adding debugging statements to the add-on)? With an old Firefox addon, I would use about:config.