Noitidart / Chrome-Store-Foxified

Point and click to install extensions into your browser from the AMO, Chrome Web Store, Microsoft Store, or Opera Addons websites.
https://addons.mozilla.org/en-US/firefox/addon/chrome-store-foxified/?src=github
Mozilla Public License 2.0
363 stars 54 forks source link

Request for companion addon/program to convert XPI to Chromium format. #116

Open mikhoul opened 6 years ago

mikhoul commented 6 years ago

I'm slowly migrating to Chrome and I would really like to be able to use Firefox webext in Chrome.

There is many new addon (webExt) in AMO that are not available in the Chrome Store so my request is to have an Extension that take Firefox addon and convert it to Chrome extension.

The main differences are in the manifest that need formatting and for the installation of the addon in Chrome you just use the Dev mode and load the unpacked addon.

This way we could really have the best of both world (Firefox/Chrome) for all users....

It could also be just an external "standlone" converter tha process the XPI file, so this way the would be no limitation from Chrome API to access local file and more easy to do. Since the XPI file are very easy to download for power users and intermediate users it would make sense to just make a standalone program companion to Chrome-Store-Foxified.

You could even name it AMO-Store-Chomified :wink:

Regards :octocat:

Noitidart commented 6 years ago

Very cool idea! I hope to do this as soon as I get some time. :)

mikhoul commented 6 years ago

In meantime since I'm transitioning slowly to Chromium for my daily browser I will "convert" slowly some Firefox addon to Chromium and let you know which changes they needed to be fully compatible and how I think those changes could be achieved automatically to save you some time. :smile:

Regards :octocat:

Noitidart commented 6 years ago

<3 Thanks very much I really appreciate the help!

PatrickGuthridge commented 6 years ago

Firefox uses promises instead of callbacks for the WebExt APIs, and refers to 'chrome' rather than 'browser'. Firefox is compatible with chrome's callback functions, however Chrome is not compatible with Firefox's.

mikhoul commented 6 years ago

@QWERTYUIOPYOZO I was looking at this since one addon I'd like to convert to Chrome have some of those errors: https://i.imgur.com/cI8CMUo.png

I'm not really fluent in JS but I understand the concept and how it work.

I was not knowing about the callback/promises issue so I took a quick look with google to have a better understanding of the issue. Google seem to be really interested to implement promises with backward compatibilities https://bugs.chromium.org/p/chromium/issues/detail?id=328932#c27 .

But I understand that it is not now their main priority so in meantime we could use some kind of universal solution like this library https://github.com/tfoxy/chrome-promise this way just adding 2 lines at the beginning of the scripts containing "promises" it could be run/used in Chrome.

Example:

import ChromePromise from 'chrome-promise';
var browser = new ChromePromise(); 

There is another library here: https://github.com/lawlietmester/webextension with the same purpose but I don't understand exactly how to use it so for myself now I will give a try to the first one to see how it work.

What could be effective would be to have an external program who parse the Firefox Addon to see if there is "promises" and if it has injecting the library automatically and adding the 2 polyfill lines at the beginning of the JS scripts to load the library and make the call to the functions needed.

N.B.: I'm more a self-taught guy than anything else so in the next few months I will take the time to take a basic course on JS in the internet, so I will loss lot less time trying to figure how simple things work in JS :stuck_out_tongue_winking_eye:

Most of the information I've found started here: https://stackoverflow.com/questions/42191030/promise-support-for-chrome-extensions-api?

Regards :octocat: