WebExtension Questions

Hi,

I am developing a WebExtension right now, more specifically a hybrid add-on (SDK based + WebExtension). But I have a few questions.

  1. In SDK based add-ons I was able to create new about:pages. For example the settings of my add-on New Tab Override are accessible via about:newtaboverride. Is something similar possible with WebExtensions? Because “moz-extension://ecd773ac-2a57-ce4a-bf3e-eb3c90ac16c8/html/options.html” is a really annonying URL.

  2. Why I can’t override the new tab page with all about:-pages? Let’s say I have the following code:

    browser.tabs.query({active : true}, function (tab) {
    browser.tabs.update(tab.id, {url : newTabUrl})
    });

It works for websites, it works for about:blank and it works for about:home, but about:newtab (the default) and about:sync-tabs generate an error:

Error: Illegal URL: about:sync-tabs

I really want the option to use about:sync-tabs as new tab page.

  1. Is there a way to read the user’s homepage? I don’t want to change it, only read it.

Thank you.

Since your add-on is working perfectly fine as it is, I guess you are trying to port to a WebExtension due to the pending deprecation of all other types of add-ons.
But unfortunately, they aren’t up to the task yet, you’ll probably file some bugsto get more stuff implemented:

  1. Nope. The moz-extension:// urls are not just long and ugly, they are also (install time) random, which will make hard linking from external documentation a big problem.
    I have actually tried to create an about:-page from a hybrid extension which points to an embedded moz-extension:// url, but that ether crashes the entire browser or the page will not be executed in the correct environment (no browseror chromeglobal).

  2. How about: (EDIT doesn’t work either, same error)

`data:text/html;base64,`+ btoa(`<script>location = 'about:sync-tabs'</script>`);
  1. Nope. I hoped that browser.windows.create({ }) would give you the same as hitting Ctrl+N(a new window with a single tab with the current homepage) but it only yield a tab with the newtab page.

So unfortunately I am pretty sure that the answer to all your questions is: Does not work (yet) -.-

1 Like

Hi NilkasG,

thank you for your answer!

Since your add-on is working perfectly fine as it is, I guess you are trying to port to a WebExtension due to the pending deprecation of all other types of add-ons.

Yes, that’s my plan. :wink:

There is still some time to port my extension, but I can’t wait till November '17 because that’s too late to get the missing APIs implemented. So I wanted to try a first WebExtension version so that I can see what’s possible and what’s not. And I like the concept of hyprid extensions to do the migration step by step.

So unfortunately I am pretty sure that the answer to all your questions is: Does not work (yet) -.-

That’s really sad. :frowning: I filed the follwing bugs:

https://bugzilla.mozilla.org/show_bug.cgi?id=1322304
https://bugzilla.mozilla.org/show_bug.cgi?id=1322306
https://bugzilla.mozilla.org/show_bug.cgi?id=1322308

1 Like