protz / LatexIt

An extension for Thunderbird that allows you to generate LaTeX in your emails and send it as inline images
http://www.xulforum.org/go_code
37 stars 16 forks source link

Call first run as a WebExtension page #83

Closed jobisoft closed 3 years ago

jobisoft commented 3 years ago

The reason for the NS_ERROR_ILLEGAL_VALUE when clicking on "take me to the options page", is probably caused by firstrun.html being an HTML page, which makes it look like a WebExtension page and that may not call openDialog. If you change that call to just open, you can see an error thrown by the ExtensionPopup.jsm which is part of the WebExtension framework, which led me to this conclusion.

Now it is of course not advised to turn it back into an XHTML page. Instead, this PR makes it a true WebExtension page, so it is no longer called by the WindowListener API, but by the tabs API from the background page. Everything that could be replaced by standard WebExtension calls has been replaced. The two functions search_in_path and file_exists have been pushed into a dedicated LatexIt API, where all your privileged code can exist.

jobisoft commented 3 years ago

I used this PR to also implement and test a few new functions for the WindowListener API, which were needed to open the (now) WebExtension FirstRunTab also from the (still) legacy options dialog.

I am done now. When reviewing this PR, the files in the /api/WindowListener/ and /api/LegacyPrefs/ folder are a 1-to-1 copy of those in the addon-developer-support repository.

sphh commented 3 years ago

Great, thanks @jobisoft!!!

I am not the maintainer, but in my view it would be enough to have just one preferences page. This page would be a combination about the preferences dialog and the first-run / autodetect dialog (all the features of the preferences dialog and one or two autodetect button). This preferences page is opened when the add-on is installed for the first time and when going to the preferences page. I believe, this would make live easier for the maintainer (just one page), but also for the user and is in line with many other add-ons.

I ventilated this idea with @protz, the maintainer, via email, but have not received any reply yet.

@jobisoft, what do you think?

jobisoft commented 3 years ago

Sure, you can do that in the next step. This PR mainly solves the issue with the broken button and makes the add-on ready to be updated more easily. Once you have merged this, you can redeclare the firstrunpage as the options page (= setting it as the options_ui manifest entry) and add the other options to it / redesign it.

sphh commented 3 years ago

OK, sounds like a sensible path. So I will merge this.

As far as I know, the add-on is now in a usable state where all features can be accessed. @protz: Maybe this can now be published on TB add-on's page for TB 78? There is still PR #82 to be merged for the legacy TB 68. Maybe that should be published first, so that users using TB 68 can find it in the history? (@jobisoft: Do you have super powers and can publish add-ons not maintained by you?)

Missing is the merged options & firststart/autodetect page. I am afraid, I will have to leave this to @protz to finish, since I don't have the time and energy at the moment to do it.

jobisoft commented 3 years ago

@jobisoft: Do you have super powers and can publish add-ons not maintained by you?

Sadly no. But I have heard from other sources, that @protz may have a little bit of spare time soon.

sphh commented 3 years ago

Than maybe not super powers, but super ears! That's great and I am sure he will put the finishing touches to it.

Thanks for your invaluable help. Without it, this add-on would have not survived this transition to TB 78! It was really a pleasure to "work" with you (well, you did most of the work)! 🙇