io-monad / textlint-chrome-extension

textlint Chrome Extension
https://chrome.google.com/webstore/detail/textlint-proofreader/hdongmdneapmhfblomidbafplpanpdmm
GNU General Public License v3.0
50 stars 9 forks source link

Any plans to support other browsers? #18

Open nodaguti opened 8 years ago

nodaguti commented 8 years ago

Hi, thank you for creating and maintaining such a great extension!

I would like you to ask if you have any plans to support other browsers, such as Firefox, Opera and Edge.

Recently these browsers are getting to support Chrome-compatible extension API and it's said that you may need only few changes to make Chrome extensions work on other browsers. As just a try, I'm starting to work on Firefox compatibility. https://github.com/nodaguti/textlint-chrome-extension/commits/webextensions

As a result, I managed to let the add-on partially work on Firefox Developer Edition:

textlint-webextensions

During the porting, I noticed that every chrome-extension:// URLs should be replaced with moz-extension:// for Firefox and opera-extension:// for Opera (maybe ms-extension:// for Edge but no documentations are available for now).

Also, the applications key in manifest.json is mandatory for Firefox extensions while Chrome puts a warning against this "unknown" key.

To resolve the above problems, we need a vendor-specific compilation process, which is in fact removed by #12.

So my question is, are there any possibilities to improve compatibilities with other browsers?

I know there are lots of more important things to do, so I think it's too early and too hard to officially support non-Chrome browsers, but as an experimental support, it's cool and exciting to work this extension outside of Chrome browser, isn't it? :smile:

If you would agree with me, I want to re-implement the vendor-specific compilation mechanism and send PR. :+1:

Thanks again!

io-monad commented 8 years ago

@nodaguti Hi, thank you for the good suggestion!

Answer: I have not tried to do so, but it would be great to support those browsers. PR is very welcome.

Since I mainly use Chrome for daily works, I was not pretty sure would it be easy to support Firefox and Opera with one source code. For rapid release and simplicity, I omitted supports for other browsers and took Chrome as a main target. I agree that it is pretty cool to experimentally support those browsers if such only small tweak is needed for working on them properly.

As you mentioned, the compilation task had got multi-vendor support before, but it was removed by #12. This project was actually generated by Yeoman's generator-chrome-extension-kickstart first, and it had multi-vendor support from the beginning.

Be careful that reverting #12 will conflict with changes by #13 which introduced Karma testing tasks.

Thanks!

nodaguti commented 8 years ago

@io-monad Thank you for quick reply! I send PR to add WebExtensions and Opera support.

Firefox has not completed to implement WebExtensions API, which prevents me from porting the extension perfectly. (I wrote about this incompatibilities in ReadMe)

But I think most of the problems will be resolved when WebExtensions API reaches ver 1.0.

nodaguti commented 8 years ago

Thanks again for merging!

By the way, I gave it a try to avoid Firefox's storage bugs using appMessage.send(). The result is here: d79ae1acb775d55e28da5507184fcb6debe30483

I feel it's only to add more complexities to the code. :disappointed: Also, I think it's not beautiful to add a popup-related file (popup-settings-store.js) under background/ directory.

What do you think?

io-monad commented 8 years ago

Hmm... Yeah that looks not so beautiful, aside from my codebase, haha.

I believe that the popup should share the context with the background and should be able to access to app storages without any restrictions since they are a part of application.

Firefox's behavior is obviously a bug for developers because they might want Chrome extensions working on Firefox without big changes. That is also a point of WebExtension support by Firefox and Opera.

According to Mozilla Wiki

The goals of this API are:

  • Porting add-ons to and from other browsers should be easier.

So they WILL fix this problem until the official release, and making big changes on the current implementation may be fruitless.

nodaguti commented 8 years ago

Yes, I agree with you. Let's keep untouched and stay tuned. Thank you for taking your time anyways!