177 points · by nkjoep · 6y ago · 62 comments
I have a few web extensions I wrote in order to customize a few web sites (automate tasks, alter display, etc). After a Firefox update, they were not allowed anymore, because they're not signed. The extensions page cannot load local extensions. Then I discovered the secret debug-extensions page of Firefox where I could load them.
Unfortunately, Firefox removes local extension when it closes. I had the choice between loading each local extension after launching a new Firefox, which mean a dozen of clicks, or installing web-ext in order to sign my extensions, and sign them again after each change (no idea if there were extra actions needed in the process, like manual reload). I opted for a much simple option: with Chromium-based browsers, you can enable the extension-developer mode, and then you're allowed to load local extensions from the normal extensions page. Extensions are kept across restarts.
If that ever changes i'll look into making my own Firefox binaries or whatever that have this check removed.
There isn't even a manual review gate for AMO releases after the first one (but it can happen after that fact).
I find Mozilla's policies friendlier than Google's but this is the first I've heard of "extension developer mode" - will have to look into that as my extension is cross browser.
https://extensionworkshop.com/documentation/publish/signing-...
The way I do it now is to package the extension as zip (no webext needed) with a custom manifest, which can be installed by setting xpinstall.signatures.required to false in the about:config page.
On the manifest side, you just need to include this snippet:
"browser_specific_settings": {
"gecko": {
"id": "example@gmail.com"
}
}about:config xpinstall.signatures.required -> false
zip -0 mywebext.xpi manifest.json *.js *.png *.html
about:addons -> install xpi "browser_specific_settings": {
"gecko": {
"id": "example@gmail.com"
}
}It’s game changing.
https://github.com/binaryage/chromex is a good starting point if you're curious.
The downside of this is that it means no HMR support whatsoever.
The first time I tested my extension on Firefox after developing it one Chrome for months it worked the first time. I was so shocked how seamless it was I actually thought something must be really wrong, it wasn't.
[1] https://github.com/webextension-toolbox/webextension-toolbox
Please don't install npm packages globally. Use npx.
You can `npm install web-ext`, then run it with `npx web-ext arg1 arg2`.
Or just run `npx web-ext arg1 arg2` without installing, npx will install it first (if the package name matches the command).
So in the 'for your project' section, if you want to run without setting stuff up,
npx web-ext run --source-dir ./extension-dist/Just… update your global packages occasionally too. I use `npx npm-check -u -g`
For myself, I always install global-recommended packages as dev dependencies. It can be a little painful, but it also means there are no special install instructions, and it _just works_ (tm).
Off-topic: didn't Google recently announce they were using transformers for almost all English language queries?
I tried "testing for web extensions" in Google and got:
FAIL - 8 Best Chrome Extensions for QA Testing (featured result)
OK - Testing your web extension with integration tests
OK - How to test web extensions?
So the featured result was bad but results one and two were good.
1. yarn add web-ext fails with a bunch of errors on macOS 10.15, but npm install works. Not sure why.
2. The chrome.storage (or is it only storage.sync? can’t recall) API doesn’t work when the extension is loaded temporarily (since there’s no stable extension ID assigned or something), which is how `web-ext run` loads the extension, and the only way I could find to test the extension without submitting it to Mozilla for signing. Yeah I tweaked all the related settings in Firefox Developer Edition but couldn’t for the life of me figure out how to non-temporarily install my unsigned extension. So in the end I just gave up on testing the part of the extension that used chrome.storage, which was like 75% of the extension. A really hostile experience that will make sure I don’t port my extensions to Firefox in the future.
Error: The storage API will not work with a temporary addon ID. Please add an explicit addon ID to your manifest. For more information see https://bugzil.la/1323228.
It's an error, not a warning, and set/get definitely don't work.If I replace all storage.sync invocations with storage.local then it's okay, not error/warning, and setting/getting seems to work.
So the problem is limited to storage.sync, but it's not just a warning.
Edit: now that I googled the problem again, it seems adding an explicit addon ID according to https://extensionworkshop.com/documentation/develop/extensio... should work. I don't recall what I did back then, but I definitely did quite a few things to no avail.
[0] https://github.com/karlicoss/promnesia/blob/b9e59262b2fc51ef...
Definitely agree that the docs could be improved on web extension development & testing in general, I often feel the whole ecosystem is a bit hostile.
Does anybody know how far it is from that aim? Is it useful at all if you're trying to build Chrome or Safari or all-3 webextensions?
[0] https://github.com/karlicoss/promnesia/blob/master/extension...
Chrome is pushing for manifest v3 and not seeking buy-in from the other web extension standard bearers. Also the new Firefox Mobile has incredibly spotty support for the API. Given these recent events, I worry that the cross-browser nature of this tool will be lost in time. And web extension development in general may be entering a dark age.
Was it ever not in a dark age? The overlap between FF and Chrome extension tech has actually existed for what, two years or so...?
- The npm install fails on Windows if you don't have Visual Studio 2017+ installed. How is this acceptable for a utility that will mostly do some simple text-mangling?
- Mozilla is the birthplace of Rust. Why do I have to install Node to get a pretty simple utility like this? This should be a basic Rust executable you can just drop anywhere, no installation required.
- the very first line of `npm install web-ext` is a warning that some library is obsolete and should not be used. It's promptly followed by tons of similar ones. Again, how is this acceptable in 2020 for something so basic?
In the end I just dropped it.
Web-ext is not doing machine-learning billion-pageview-crunching rocket-launching stuff. It's a utility to roll up a few text files. The fact that it was built with Node seems yet another sign that Mozilla is dominated by SFBA cargo-cultism.
If you call communication with two different browsers (at least), validating source code, signing code and packing it up "simple text-mangling", I understand you're a bit frustrated. But I'm quite sure many see those features as a bit more than that, hence it is quite a popular tool to use in conjunction with browser extensions.
> Why do I have to install Node
Because web developers who do JavaScript for a living find it easier to write JavaScript to support their developer tools. Not a huge surprise here. I'm sure if you find the time to write the "simple text-mangling" in Rust, support it and maintain it, people would be more than happy to use it. But why rewrite something that works well enough for the intended users?
Speaking of cargo-cultism, you seem to have a bit of that stench on yourself as well, where suddenly every utility "should of course" be written in Rust, or otherwise be rewritten in Rust if they are not doing it yet.
Programmers will scratch their own itch with the languages that are familiar to them. Of course web extension dev tools will be written in languages and platforms that are the closest to the web ecosystem, which today is JavaScript.
... is not something that requires a massive engine like Node. It just isn't.
> Because web developers who do JavaScript for a living find it easier to write JavaScript
This is an argument I can accept from a random free-time-opensource developer, not from a well-funded behemoth like Mozilla. An org that big should pay attention to what their objectives are, not what they feel like hacking together on any given day. How can they not see that making this sort of tool significantly burdensome to install on 90% of desktops is bound to limit its impact?
> suddenly every utility "should of course" be written in Rust
No. Write it in Go if you prefer. Write it in brainfuck, I don't care. What I care about, as a user, is that I can just get a single executable I can run on my machine. I care about usability, that's all I care about. How can it be acceptable for a tool like web-ext to have a setup story that is "figure out how to install npm; npm install web-ext and see it fail; figure out how to install Visual Studio (will it even work with the free version? I hope so); re-do npm install web-ext, ignoring a bunch of warnings about everything being horribly insecure and unmaintained"...? And then they have the gall to say in their copy that "you only need a text editor", just before pushing this crap. I mentioned Rust only because it's terrible optics that its very home doesn't dogfood it. Again, not rocket science to notice, at organizational level.
As a fervent Firefox advocate, this is the sort of thing that really riles me up.
I maybe wouldn't have written web-ext in js with nodejs myself, but I do understand why others would make the choice to do so.
Although I agree that the whole nodejs/npm ecosystem is just a insecure clusterfuck waiting to be properly exploited at this point. About the Mozilla objectives, I don't think they even know them themselves at this point, even less so around 2015 when this tool first appeared.
How is asking for a Node install for a Javascript developer a problem?
My non-programmer wife recently started doing some Youtube tutorials to learn Javascript as her first coding experience and almost every single one has step 1 as "Install Node". Installing Nodejs is literally Javascript 101.
Also "Massive"? The Nodejs installer for Windows is 27MB (and requires like 4 clicks to install). On Linux, its available via the native installers and is a 1-click install.