spasche / openinbrowser

Open in Browser Firefox add-on
Other
33 stars 8 forks source link

Convert to WebExtension? #23

Open theres-waldo opened 7 years ago

theres-waldo commented 7 years ago

Mozilla recently announced that starting in Firefox 57, Firefox will no longer support addons that are not WebExtensions.

Is it possible to convert Open In Browser to be a WebExtension, so it can continue working in Firefox 57 and beyond?

spasche commented 7 years ago

I haven't analyzed if and how that's possible to convert it to a WebExtension.

Unfortunately I won't have time to do that in the near future, I'd be happy if someone can help.

neroux commented 7 years ago

I'd assume an implementation of the general idea of an override functionality should be possible, however Webextensions seem to have a lot less possibilities to alter the UI and so it might not be possible to add the dropdown menu in the same way as it is currently done but an alternative might be required.

There is more information about the migration at https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Comparison_with_XUL_XPCOM_extensions

est31 commented 7 years ago

Seems like its not possible to port this to Web extensions. Yet i hope.

I've filed an issue on bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1344646

neroux commented 7 years ago

@est31 Why would you think so? It is probably not possible to port over the UI as it is now, but I wouldnt assume it is generally impossible.

est31 commented 7 years ago

Well from what I saw on that page, there are a couple of options:

None of them actually allow smooth interaction. I mean you only find out that it wants to download stuff when you are met with the "what to do with this MIME type" dialog. Cancelling that and then going back to the link to right click it or something doesn't feel smooth at all.

est31 commented 7 years ago

That dialog feels like the natural place for the extension to be.

neroux commented 7 years ago

I agree the selection dialog would appear to be the natural place, but it is also specific to Firefox, Chrome does not have it at all.

Maybe it is/will be possible to re-route qualifiying downloads to a similar intermediate dialog. Not being too familiar with the available API calls I cant comment on whether this is already possible or will be.

est31 commented 7 years ago

Okay, I've managed to assemble a proof of concept. See #28.

est31 commented 6 years ago

I've uploaded the Webextension version to AMO: https://addons.mozilla.org/en-us/firefox/addon/open-in-browser/versions/beta

Please try it out and report any feedback here or in issues on my repo.

neroux commented 6 years ago

@est31 Not sure how high of a priority it is, but right now the extension is pretty incompatible with Chrome.

As for Firefox, juding from a quick glance it seems to install and run fine. Of course some more thorough testing would be advised. Also, the UI could do with some polishing :).

est31 commented 6 years ago

right now the extension is pretty incompatible with Chrome.

Supporting Chrome is no goal for me. One browser with a bunch of versions is enough testing work, and I'm not a particular fan of Chrome either.

the UI could do with some polishing :)

I'm no expert on UI design, so PRs welcome! (As long as you don't use a framework, I want to keep it lean and simple). Originally I just had normally sized, "native" UI controls, but those didn't really dominate the site, if it opened your initial impression wasn't one of an UI but of a blank page. Also "native" buttons look pretty bad on the web nowadays, every site has to invent its own style of how buttons look like, so I did my own attempt.

Rob--W commented 6 years ago

4 years ago I tried to port this add-on to Chrome, but the APIs weren't good enough. Firefox's WebExtensions APIs contains everything that I need, so I blew off the dust and updated the extension so that it can be used in Firefox.

Here it is: https://github.com/Rob--W/open-in-browser Screenshot:

The objective is to have a UX that is at least as good as the current legacy add-on. If this goal is reached, would you be willing to add me to the add-on listing so I can publish my extension with your add-on ID?

I want to improve a few things, such as customizable external viewer support (the "Open with Google Docs" viewer is currently the only external viewer, but the system already supports any number of viewers) and updating the internal MIME database.

There is also a preference page (WIP too):

screenshot-options-page

est31 commented 6 years ago

@Rob--W I've checked out your add on. The UI looks much closer to the original, quite impressive!

Some nits:

Generally, I don't have a problem if instead of my rewrite yours gets taken (less maintenance work for me :)), but I'd also be okay if your extension gets published separately. Its @spasche 's choice. My priority is that I can continue using the add on!

spasche commented 6 years ago

@Rob--W: I tried your add-on with Firefox beta on Windows 10, but the popup window is very small and not usable: image.

Otherwise I agree with est31 that it looks quite close to the original. In that regard, it might be a smoother transition for existing users. If you're willing to maintain the add-on in the future and if @est31 is ok with it, I can give you access to AMO to publish it.

My comment in https://github.com/spasche/openinbrowser/pull/28#issuecomment-331468463 would also apply.

Rob--W commented 6 years ago

@spasche Do you see any error messages in the global JS console (Ctrl-Shift-J)? The dialog starts at 10x10 and is supposed to resize to be big enough to show the content. Apparently it is not working as intended in your setup (I'll investigate after improving MIME detection).

I'm fine with maintaining it. Just like the others in this thread, all I want is that Open in Browser continues to work. My AMO account is https://addons.mozilla.org/firefox/user/RobW/ , and my e-mail can be found at the bottom of my website.

I intend to set the min version to 57+ to avoid triggering this bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1401516

est31 commented 6 years ago

Another thing I observed after trying out @Rob--W 's extension is that when I restart firefox, the windows are now much smaller, having the same size as the dialog window.

spasche commented 6 years ago

@Rob--W: I see this error in the logs (which doesn't happen without the add-on): TypeError: invalid 'in' operand browser[Learn More] tabbrowser.xml:2408:1 _insertBrowser chrome://browser/content/tabbrowser.xml:2408:1 getRelatedElement chrome://browser/content/tabbrowser.xml:7048:11 set_selectedIndex chrome://global/content/bindings/tabbox.xml:406:31 tabs_XBL_Constructor chrome://global/content/bindings/tabbox.xml:275:13

chrome://browser/content/tabbrowser.xml:46:9 tabbrowser_XBL_Constructor chrome://browser/content/tabbrowser.xml:5802:11 I added you on the AMO project. By the way, I don't see license information in your repo. Could you clarify that? The current add-on is using MPL.
Rob--W commented 6 years ago

Another thing I observed after trying out @Rob--W 's extension is that when I restart firefox, the windows are now much smaller, having the same size as the dialog window.

Reported as https://github.com/Rob--W/open-in-browser/issues/2

I don't see license information in your repo. Could you clarify that? The current add-on is using MPL.

I use MPL 2.0 - https://github.com/Rob--W/open-in-browser/blob/e5d5386ca55dd1f845ff0e87682e6df0f2ec73ff/package.json#L18 I will revisit the README and other non-critical files (e.g. license, contributing guidelines) after the extension's functionality is fully ready.

Rob--W commented 6 years ago

@spasche I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1402703 for the other thing you mentioned. The extension seems to work fine despite the error message.

yan12125 commented 6 years ago

@Rob--W: I got the same situation as @spasche - the dialog is not resized automatically. After some trials, I find the 10x10 is not a good initial value. The height should be at least 23 on my machine to allow automatic resizing. Looks like 23 is the height of the title bar + 1 pixel. The value of width does not matter. An 1x23 dialog still gets resized.

My environment: OS: macOS Sierra Hardware: MacBook Air, screen resolution 1280x800 Firefox: 56.0, installed from official dmg

est31 commented 6 years ago

The 2.0 version of the extension using @Rob--W 's code has been uploaded to AMO! Firefox 57 can come :).