Followup: modularity, WebExtensions, and going faster

Brunoais brunoaiss at gmail.com
Sat Oct 8 09:07:12 UTC 2016


Brendan Barnwell's answer touches a very important point, IMO. Here's a 
question for discussion:
Why choose firefox over chrome?

Firefox is slightly slower than chrome; specially in a computer with 
really high amount of RAM available.
If a tab crashes in Firefox, the whole Firefox crashes (in current 
stable). If a tab crashes in chrome, only that tab suffers (until you 
hit the 20's and beyond) so you, usually, can just continue working 
afterwards.
Chrome's v8 is faster in more tests than Firefox's SpiderMonkey than the 
other way around.
Chrome's interface seems to be the one inspiring Firefox's. At least, 
for the most part.
Chrome has a more useful developer tools toolset for least used features 
(E.g. inline svg)
Chrome supports more standards than Firefox (Firefox is in s struggle to 
implement them).
Both are free of charge.

*...But then... With those and more... Why sticking to Firefox?*

Firefox allows extensions to have *superb power!* With extensions, my 
firefox instance becomes *"my browser"*. Heck just look at my profile! I 
have (jump to the end of the list when you get the idea):

  * Colored tabs
  * Tabs opening relative to each other
  * A quick access to stored passwords (with a boost in use) with a
    master password
  * A share of the master password for all my SessionStorage,
    LocalStorage, cookies and history. (does not include indexedDB)
  * I have a variable proxy selector so I can access some websites I
    have on my server hidden from most of the world in an effortless way.
  * I have an inline translator that is translator independent (I choose
    which one to use)
  * I have tab groups (ex-panorama, now in extension)
  * I have a GUI to access to options only available in about:config
  * I have an F6 key override
  * I have a gif stopper (stops a gif in the current frame at the press
    of a button)
  * I have a mass file downloader (for many files, asks only 1ce where
    to save them)
  * I have a profile backup which backs up my profile every X time
    (super customizable and *FREE!!!!!*)
  * I have a CSS refresher which reloads and reapplies CSS to a page
    from a changed file (not as useful as it was but I still use it a
    lot during web development)
  * I have a form recovery addon which backs up encrypted (the key is
    stored in the Firefox's password manager) data on the status of the
    form. You may never believe how much this has helped me so far.
  * Being able to insert tabs in a textarea!!!
  * I got the addon bar back! It was getting cluttered up there without
    this addon.
  * ... And that's only 16 of them!

Is Firefox kinda slow? *YES!* Heck, it is even using ~1.2GB of ram most 
of the time and some page loads could be ~0.5s faster. It's worth it!!!

Could these extensions be made in WebExtensions? Heck no! Chrome never 
lets an extension touch Storage stuff. Forget them being protected with 
a password!
Colored tabs in WebExtensions? Pff... Who wants that, right? Tell that 
to the +200K users of a featured addon!
Metadata in stored passwords? Boom! Featured addon! 
(https://addons.mozilla.org/en-GB/firefox/addon/password-categories/)

WebExtensions is not ready for any of this on Chrome. For the time it 
has been like this, I don't think it will ever be.

In the late years, for many feature requests I have been directly or 
indirectly bombarded with "If you want feature X, do it yourself or get 
an addon for it". So far that can be true because the "legacy" 
extensions can do just about anything.
Now imagine this happened instead:

-  I had an addon on my browser that colors tabs based on the website 
name and a heuristic of the colors mix in the first page it finds. The 
browser now only supports WebExtensions. How do I update it so it works 
on my browser?
- You can't. We now do not support extensions that change the browser UI 
in any way except for adding a button.

Think as a user now. How do you react? You had an addon you could use 
and worked, now you cannot have and you can't even expect it to ever 
work on your browser. EVER!


      In conclusion

I think that WebExtensions is a very good tool for the majority of the 
extensions. It has a very direct API for use and simplifies the code 
complexity when you just want a small purposed extension that does 
changes to a web page, potentially with some extras.
We do still need that low level API, though. The one that allows 
changing the shape of the tabs, place the tabs on the left side of the 
browser window, change the color of the tabs, add toobars, access 
about:config configs...

I believe, with both API made in a correct fashion, most extensions will 
be WebExtensions. Only slightly less safe than a web page (but requires 
explicit permissions) and cannot do harm without warning. Reviewing 
those extensions should be a much easier task than the other extensions. 
The API (already in nightly) to communicate between WebExtensions and 
"legacy extensions" can be a huge thing here!


      Extra thought

While having this e-mail sitting here, I thought:

AFAIK, WebExtensions are limitless when acting inside a web page (I'm 
relating to content scripts). They have the same power as the legacy 
extensions.
It is on the background pages that WebExtensions  are limited which is 
exactly when they need to act on the browser itself and do the awesome 
(such as coloring the tabs or opening a popup that clearly belongs to 
the browser and not just a web page).

How about this:

Make 3 code groups:

 1. Page scripts (current WebExtensions API)
 2. Background pages (current WebExtensions API)
 3. Low level API (can only run on the same process as the background pages)

1 can only communicate with 2, 2 can communicate with either 1 or 3, 3 
can only communicate with 2, 2 and 3 can only share data using the 
message API (for consistency).
3 is not protected behind a tight permissions system like WebExtensions 
but it must specify the components it accesses in the manifest file 
(security). The components requested (as a key:value) are included in a 
global object since the start of the script.
The scripts for 3 may only be used for features that do not exist in 
WebExtensions (guaranteed by the manual review and, possibly, to certain 
extent by the automatic reviewer).

This should ease extension reviewing, keeping compatibility with other 
browsers (all that works in chrome works here) and stick the tongue out 
to chrome when you have colored tabs and chrome can't.

Thoughts?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/firefox-dev/attachments/20161008/f0535f49/attachment.html>


More information about the firefox-dev mailing list