Moz-extension:// not allowed in tabs.query()

Hi,

I am working on a new WebExtension. Assuming the following code as onclick action for a browserAction:

browser.tabs.create({ url : browser.runtime.getURL(ADDON_PAGE) });

Everytime the user clicks the toolbar button a new tab will be opened with the page of the add-on. I want to check if the page is already opened and switch to the already opened tab, otherwise I open a new tab. The code could look like:

browser.tabs.query({ url : browser.runtime.getURL(ADDON_PAGE) }, function (tabs) {
      if (tabs.length > 0) {
        browser.tabs.update(tabs[0].id, { active : true });
      }
      else {
        browser.tabs.create({ url : browser.runtime.getURL(bookmarkchecker.UI_PAGE) });
      }
});

But it doesn’t work because of:

Invalid match pattern: 'moz-extension://7553818c-efb8-a544-b980-758bf58cb73b/html/ui.html'

There are Google Chrome extensions which do exactly this. So I wonder if this is a “bug or a feature”. Is there already a Bugzilla ticket or a public disscusion about this topic?

1 Like

Here’s the relevant bug report.

1 Like

Thank you, jorgev. I hope there will be some progress soon (because there was already a lot of activity in this bug until two months ago). :wink: