The WebExtension-API for Firefox is quite complex. It is not easy to create a MWE for it.
Do you know a way how to create a Minimal, Complete and Verifiable example for Firefox WebExtensions-API related questions?
The WebExtension-API for Firefox is quite complex. It is not easy to create a MWE for it.
Do you know a way how to create a Minimal, Complete and Verifiable example for Firefox WebExtensions-API related questions?
Like all MCVE, the important thing is for people reading and attempting to answer your question to be able to duplicate the problem. While it should be Minimal, it also needs to provide the Complete information needed, that you've Verified, to provide an Example which can reproduce the problem.
For a Firefox WebExtension, or Chrome extension, you almost always need to include your manifest.json.
You will also need to provide enough of the rest of your code to allow the problem to be reproduced. This may include parts of, or all of:
You don't always need to include all of that, but you need to include enough such that the problem can be duplicated. Which portions of the above files are actually needed, is something that can only be answered on a question by question basis.
Basically, using only the code you've provided in the question, can the problem be reproduced? You should actually create a separate project using just the code from the question and see if it duplicates the problem. That's what people who are going to be answering your question are likely to be doing, so they can see what the problem is, and give you a good answer.
Usually, for debugging questions, the most important thing is that you include your manifest.json. The manifest.json defines the environment in which the other code you are including is running. It also defines the permissions which are granted to your extension.
Sure, we don't need to know the name
that you've called your extension, or the description
you've used, but most of the information in your manifest.json is needed, because it affects how your code works and what it can do.
While you can state in non-code ways much of what's included in the manifest.json, when you don't actually supply it, it still leaves ambiguity, even when you think there isn't. The reason for this is that the users asking questions often don't really understand the environment, and it's common for them to be confused about what they've set things in their manifest.json to do. Thus, when answering, without the manifest.json, you have to almost always consider that what was stated in the question as to how the asker things things are set, may be wrong.
There are three contexts in which your script may be operating:
background
pages remain loaded at all times.)The manifest.json defines which scripts are running in which context/environment, with what permissions, what HTML is loaded when a popup is displayed, etc. That information is necessary in order to understand what abilities and constraints your code is operating with/under.
Portions of this answer were copied from my answer to: Communicate between scripts in the background context (background script, browser action, page action, options page, etc.)
It is not easy to create a MWE for it.
It is. It's not like a MWE/MCVE should contain everything to get the application that contains the problem at hand up and running.
If for example your question is about some Android app, the question does not have to contain all metadata and resource XML and stuff that actually packages up an Android app; all code shown should only be relevant to the question.
That is, of course, unless the question actually is about that metadata or about resource strings.
So in the scenario where your question is about a browser plugin, you are bound to have a more specific question. Changes are that the plugin part is entirely irrelevant, and that your question actually is just about JavaScript, or whatever language you write the plugin in.