How to install my own firefox extension - firefox-addon

I am new to FF extensions development. I work on Windows OS. I am using web extensions. I started my first extension. I created a directory in My Documents which contains my extension files. The files are based on the example in: Your First WebExtension which are: manifest.json, icons/myicon.png, myextension.js. Like the example, all what the extension does is a border aroud mozilla page. This is the js code: document.body.style.border = "5px solid red";
When I come to installing the extension in my browser, I navigated to:about:debugging then I clicked in the Load Temprary Addon button and I selected the the .js file. I get this error: There was an error during installation: Extension is invalid. Can you point what the problem is?

Most likely an error in the manifest.json file. Double-check that code; if it all looks good, try temporarily removing optional things from it, then removing-and-reloading your addon in the debugger until it works. Then you can narrow down what's up (hard to say exactly, without seeing your code). The most minor error in the JSON will result in the addon failing to load (such as an out-of-place bracket, etc).
See also: Anatomy of a WebExtension

Problem with my setup was incorrect use of content_scripts.matches, correct solution for a "match-all" is
"matches": ["*://*/"],
Attribution : https://discourse.mozilla.org/t/web-extensions-noob-getting-there-was-an-error-during-installation-extension-is-invalid/12828/3

The problem was that extensions must be saved in specific directory. In winows, the directory is: C:\Users\"YourUser"\AppData\Roaming\Mozilla\Firefox\Profiles\"YourFireFoxProfile"\extensions
After that, try the steps I mentioned in the original post and you should find the extension added.

Related

WebView.LoadHtml file access error Android 30 Xamarin

I have a Hybrid app I rebuilt after setting the Target Android version to API 30, per a new warning that Google now requires this, and am trying it on a Tablet with Android 11. Originally following an old hybrid sample app, my app copies files from the resources to the file system. This seems to work, as no exceptions are thrown from the File operations. The first thing it does is display a splash screen from an HTML file copied from the afore-mentioned resource copy, using the LoadHtml function of a created WebView, and giving it a URL formatted like this:
file:///data/data/com.mycompanyname.myappnameandroid/files/Content/Splash.html
LoadHtml doesn't throw an exception, but then the screen displays an error message referencing this path and the error "ERR_ACCESS_DENIED". This file does reference CSS files copied to the same directory (referenced like "<link rel="stylesheet" href="site.css" />
" in the HTML header). It will continue on to display the main app pages, but it apparently failed to load CSS files and so forth, as all the styling and scripting is missing. What do I need to change to make this work?
Searching, I find talk of "Scoped Storage", but I can't make any sense of it. I'm hoping there is a simple fix.
There is a simple fix. Add the following to your set up of the WebView:
webView.Settings.AllowFileAccess = true;
Apparently the default changed from true to false.
Thanks to this posting for the clue: Load file into webView with scoped storage

Not able to load an unpacked edge extension, due to strange errors. How to fix that?

I am trying to load a half-made extension, to see if it works.
I have made the manifest file, and a few more files to test my extension to see if it works as expected.
the manifest:
but, I instead receive a strange error from edge.
I am putting an extension to load which looks error-free. This error would limit my extension to do nothing at all when I click on the button, if extensions with errors were allowed.
Can anyone take a close look at the manifest, and recommend changes? thanks.
note: This did not happen with chrome. I was looking forward to post my extension there, but instead went for edge, because I think edge has lesser extensions than chrome.
Also, making .json files require a programming head. I have that but just an unexpected error appeared. Dont ask to take from the internet, it simply can‘t give answers related to the topic.
paste your manifest into https://jsonformatter.curiousconcept.com/. I can see a missing comma for description.

Why can't I view or edit Umbraco templates?

When I open the Umbraco (7.6.3) backoffice, I'm unable to view or make changes to templates. It seems like other functionality is unaffected, and I can create & edit specific pages. However, attempting to open the templates themselves just leads to a white screen. This problem exists across browsers:
Other screens render just fine:
What gives?
Checking the console when attempting to load gives an interesting error:
Error: Argument 'Umbraco.Editors.Templates.EditController' is not a function, got undefined...
Resolution:
The issue seemed to be caused by outdated files in the Umbraco folder. Copying most directories over from packages\UmbracoCms.7.6.3\UmbracoFiles\umbraco\ seems to have done the trick.
Looking at the changelog, it seems like the JS folder was the most influential in getting this fixed.
Are you sure that you're on 7.6.3? The UI appears to be pre-7.6 (I can tell because the colours haven't been updated).
If you have just upgraded, it's possible that your browser has cached the JS which is used - hard refresh your browser to see if the UI updates.
Umbraco also uses a dependency service to compile all of the used JS/CSS files together into one large one. This service will not be used if your website is in debug mode. Either:
Turn debug mode on in the Web.config
Delete any files in the \App_Data\ClientDependency\ folder as this is where the cached compiled files are kept (these will be regenerated)
My first thought would be file permissions.
Have you run the health check for permissions in the developer section? Need to make sure that your application pool user has write permissions on the Views folder.

icons in a firefox android bootstrapped extension

I'm working on a bootstrapped extension for firefox android, and I have a problem with displaying icons in a new menu item:
itemMenuId = window.NativeWindow.menu.add("Show more details",ico , function() { showToast(window); });
in ico I wrote the uri of the icon file existing in the root of my extension (icon.png is next to bootstrap.js), using data: and file://, like described here but the icon isn't displayed. I don't know how to fix the path for that. Beside I'm having the same problem with the iconURL in the install.rdf file, when I use chrome:// I get nothing, and when I use resource:// I get a missing image. Should I have chrome.manifest to use chrome://? and even if I don't specify the url,to let the image be displayed by default like here it still doesn't work.
<em:iconURL>resource://trackdetect/icon.png</em:iconURL>
I googled it ,but, I couldn't fix it. Please help and thanks.
For the issue, just make sure you have a file named icon.png in the root of the XPI (the same folder as bootstrap.js) and the image will be used. You don't even need the entry in the manifest. See: https://developer.mozilla.org/en-US/docs/Install_Manifests#iconURL
Erik Vold's guide explains how to reference files packaged within a bootstrapped extension.
However it is strange that the icon doesn't appear at the addons list (you don't specify a iconURL, just place icon.png next to bootstrap.js, as you did). Perhaps you should check if the tool you use creates PNGs that conform to the standard.

Running a packaged exe in the same folder as the installed firefox add-on

I have read this thread, and some other
How to run a local exe in my firefox extension
The problem is, at deployment and using firefox 4.0.1, if I install the .xpi extension, the xpi is put inside the \Profiles...\extensions as ****.xpi, which is a compressed format
All the solutions assume that the the extension is put in a folder, thus they are accessing the folder as is, which I cannot do
for example this guy says
//**** get profile folder path ****
var dsprops = Components.classes['#mozilla.org/file/directory_service;1']
.getService(Components.interfaces.nsIProperties);
var ProfilePath = dsprops.get("ProfD", Components.interfaces.nsIFile).path;
//**** initialize file ****
var file = Components.classes["#mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(ProfilePath);
//**** append each step in the path ****
file.append("extensions");
file.append("guid");
file.append("sample.exe");
guid in my case is installed as {f13b157f-b174-47e7-a34d-4815ddfdfeb8}.xpi which cannot be accessible this way
First of all, please do not locate files like this - you are making lots of assumptions about the directory structure of the Firefox profile, any of those could turn out false in a future Firefox version (or even in uncommon extension setup scenarios). See Reference a binary-component to js-ctypes instead for code to locate a file in your extension install directory, simply replace components/linux/myLib.so by sample.exe and execute uri.file.
Second: that's a scenario where packed XPI installation won't work unless you want to extract your executable into a temporary file before running it (which will be complicated). Windows doesn't support running executables from ZIP archives. So you need to add <em:unpack>true</em:unpack> to your extension's install.rdf to ensure that it is installed as an unpacked directory.
The best answer is to get flashgot Firefox addon , which contanins already executable inside , and is open source , and , study it , this is great way to observe how this actually works. Based on this , You can make as much as You wish addons with executable inside , or add entire program as FF addon. I hope this helps , even if this answer is rather than outdated.

Resources