Questions tagged [firefox-addon-webextensions]

WebExtensions are a way to write Firefox extensions that are compatible with other browsers such as Google Chrome and Opera. Microsoft plans to bring support to their Edge browser soon. Questions requiring a MCVE (i.e. debugging questions) should include your manifest.json file in addition to all other files needed to duplicate the problem.

WebExtensions are a new way to write Firefox extensions. It is available in all current versions of Firefox (version 48.0+).

The WebExtensions API is designed for cross-browser compatibility. To a large extent, the API is compatible with the extension API supported by Google Chrome and Opera, with Microsoft Edge following soon.

The documentation for Firefox WebExtensions can be found at MDN :: Add-ons - WebExtensions.

The WebExtensions API is under active development. What is supported improves in each newer version of Firefox. You should pay attention to the Browser Compatibility section on the API documentation page for any part of the API you are using to verify the portions of the API you are using are supported in the version of Firefox you are using. You may want to strongly consider testing your extension with either Firefox Developer Edition, or Firefox Nightly.

Minimal, Complete, and Verifiable Examples will almost always need a manifest.json file in order to be complete, in addition to any other files needed. The manifest.json file contains key information which is necessary in many situations to determine why an extension is not working.

For more information on Firefox Add-on types see the full documentation on Mozilla Developer Network: Add-ons.

1541 questions
7
votes
1 answer

How to inspect the response body using WebExtensions WebRequest API?

I am writing a browser extension using modern Browsers generic WebExtensions framework. I try to figure out, how I can get (read) access or a copy of the data of an http response send by a regular server utilizing the stable WebRequest API.…
David
  • 71
  • 2
7
votes
1 answer

Firefox web extension Auto update unlisted-and-self-hosted extension

I have a firefox web extension ported from chrome. This is a site specific extension and I am hosting this on my web server to avoid lengthy review times on developer hub. Users install extension through a button click on my web page. Let's say the…
smk
  • 301
  • 6
  • 13
7
votes
1 answer

How to open a Firefox WebExtension options page as a tab, separate from about:addons

So, I've looked through the WebExtensions API, but I haven't been able to figure out how to open an HTML page separate from about:addons for options. In the Add-on SDK you could have resource://ext-id-/path/to/file.html. I've tried making a…
7
votes
1 answer

Chrome / Firefox extension - Content script not listening for messages

I am developing an extension for both Chrome and Firefox, and I have come across a problem. Basically, I am trying to get a content script to listen to messages using chrome.runtime.onMessage.addListener(...), however it doesn't seem to work. I…
7
votes
1 answer

XMLHttpRequest from Firefox WebExtension

I've seen loads of examples of creating xhr requests from Firefox Add-ons, but I am trying to use the new WebExtensions stuff (where require and Components are undefined) and can't seem to see why I can't send a simple XmlHttpRequest from within the…
tommed
  • 1,521
  • 2
  • 19
  • 33
7
votes
1 answer

How to execute a command line program in Firefox Webextensions?

I'd like to run a command (exe somewhere on disk) with arguments in a simple WebExtensions addon, and possibly get its stdout. Is there a way to do so in WebExtensions, since the older APIs are being deprecated?
dismantle
  • 91
  • 2
  • 6
7
votes
1 answer

Content Script Injection at Install for Firefox Web Extension

If content scripts are specified in manifest.json for Firefox, Firefox will also load content scripts for already opened tabs and execute them even the tabs are already in loaded and ready state. Google Chrome does not add any content script when…
John Sewell
  • 874
  • 8
  • 18
7
votes
1 answer

Detect Background Script Unload

For my chrome and firefox extension, I need a way to figure if the background script has unloaded or is unloading. Is there an event fired when this happens? I went through multiple links on stackoverflow and even some official chromium bug links…
discoverAnkit
  • 1,141
  • 1
  • 11
  • 25
6
votes
1 answer

How is unsafeWindow implemented by user script extensions?

Today I came across a situation where I need to make an extension to monkey-patch some objects in a web page. However I found little to none documentation on how it can actually be achieved, I've tried using the userScripts API (currently exclusive…
6
votes
1 answer

Where are the data for "Extension Storage" of a firefox extension stored in?

Suppose you have a Firefox extension. And then you go to about:debugging => this firefox => and then you click on "Inspect" on the extension... It will then open about:devtools-toolbox for that extension, and you can click on "Storage". One of the…
6
votes
3 answers

Run my JavaScript code on every page on my browser, similar to how a Chrome extension would

I know with Chrome I can use snippets to manually run some JavaScript code on a webpage. But this required manually executing the snippet. Is there a way to have some JavaScript code that my browser (Chrome or Firefox) would load every time I visit…
6
votes
0 answers

Extend time duration for displaying "PR_CONNECT_RESET_ERROR" error in Mozilla Firefox?

When a site receives high traffic, the tab in Mozilla Firefox stops loading and displays this error message "PR_CONNECT_RESET_ERROR" as shown in screen shot. What I want is, the tab should continuously keep loading until it receives the response…
6
votes
1 answer

Firefox extensions debugger says "This page has no sources"

Firefox's Extensions ("add-ons") debugger changed a few releases ago, and it's not working for me at all; it's not finding my extension's sources. Following the instructions at https://extensionworkshop.com/documentation/develop/debugging, I went…
6
votes
2 answers

using webpack to bundle webextension manifest with typescript

I'm developing a web extension in typescript. To organize the code, I would like to bundle the extension with webpack. Ideally, webpack should compile typescript and copy the resulting javascript, together with html, css, images to a dist/…
lhk
  • 27,458
  • 30
  • 122
  • 201
6
votes
1 answer

Firefox webextension don't produce exception

Many times I've faced this problem when a code will generate exception( eg. method not defined in object) it will not show up in the Firefox console. Firefox will simply skip that part of code. After unable to figure the problem out, I'd need to use…
user5858
  • 1,082
  • 4
  • 39
  • 79