Need help porting a XUL addon to WebExtension

Hi,

I’m looking to port an existing XUL addon over to a WebExtension.

The addon is Auto Focus URL Bar:
https://addons.mozilla.org/en-US/firefox/addon/auto-focus-url-bar/

This addon is extremely helpful for everyday surfers because it saves time in having to focus the address bar in order to surf to another site.

I don’t think it is currently possible to focus the address bar by any means with WebExtension APIs. If there isn’t, how would I go about creating a WebExtension Experiment to enable this functionality?

Any help would be appreciated.

Thanks for reading.

I don’t think you can do this with just a webextension.

What you can do is create binary, which focus the url bar by either:

  • sends the key combintation to focus the (on windows - ctrl + l on mac - cmd + l)
  • other methods? (graphic analysis of screen and click in it?)

And then your addon would trigger that function using NativeMessaging. Down sides of native messaging are users have to install your addon && your binary/exe - so this drastically reduces the userbase willing to use.

Need an API to focus on the awesomebar is NEW Unassigned, but Whiteboard: [design-decision-denied]triaged. So you need to put a better ideas to let Mozilla accept it. If you use the WebExtension experiment, the user must install it in order and use Nightly (or maybe developer edition).

Thanks for the reply, but this goes against what I want to do.

I don’t really care for other users at the moment :slight_smile:

I just want to preserve my usual workflow for Firefox 57.

I’m not too familiar with XUL, but if someone can walk me through how I would create a WebExtension Experiment to enable this functionality, that would help.

I’ve already ported one extension, URL Alias, for my own usage so I do have some experience writing WebExtensions.

The WebExtensions Experiments documents is lacking, some examples see https://github.com/web-ext-experiments, and an list of my collection:
gecko-profiler-webextension
password-exporter
tabstrip-experiment
tracking-protection-experiment
webext-experiment-hello

May be gURLBar.focus(); & gURLBar.select(); according to https://addons.mozilla.org/firefox/addon/url-focus/.