How to detect the Customize tab in add-on

I’m writing an add-on for Firefox using the browser extension api, and I’d like to be able to detect when the current tab is the Customize tab (the one that you see if you right-click on the address bar and click “Customize”)

So far as I can tell, using the windows and tabs apis (links below) there’s no way to detect that the user is viewing the Customize tab rather than a website or any other page, even though it’s apparently a special tab required by the system. I had expected maybe a special state or status for the tab, but looking at the properties of the tab at runtime I can see nothing useful.

Can anyone suggest a way of telling the Customize tab apart from a web-page?


I guess you could go on less-reliable signs like the favicon URL. I assume you don’t want to navigate it, since it says it’s about:blank?

Unfortunately to get the favicon url (or to navigate) I need to request the tabs permission for my add-on, and I’m trying to avoid that. One of my goals is to request as few permissions as possible, for security/privacy reasons, and so far I’ve not needed to add that permission. :slightly_frowning_face:

You might be right though - I assume the Customize tab does have a special url (and if I had the tabs permission I could detect it based on that)

As I said it does not have a special URL. I am still wondering why you’d want to find it though, since you don’t have the tabs or activeTab permission.

Edit: about:blank is a built in URL for an empty page, which is usually loaded first in a browser/window/tab.

My add-on disables tabbed browsing, for users who aren’t a big fan of that. I don’t care what the user is loading in the tabs, I just want to split off any new tab to it’s own window as it is created.

When the user opens the Customize tab, my add-on splits it off into it’s own window like any other tab. Firefox doesn’t normally allow this: if you open the Customize tab in Firefox and try to drag it to a new window, Firefox ignores the drag and the tab stays where it is. However it does allow you to detach it via the browser extension api, and when you do that the Customize tab disapears.

That might be a bug in the implementation of the browser extension api. However, if I could tell (from the tab properties) that this was a special tab, I could modify the code so it ignores any special tabs that Firefox doesn’t allow to be detached.

Oh, hello, is that what this is about? I have a similar extension and no one reported this problem to me yet.

https://addons.mozilla.org/firefox/addon/i-hate-tabs-sdi-for-firefox/

Yes, you’re right, our extensions are very, very similar. But when I install I Hate Tabs I can see the same issue. To reproduce, right click on the address bar, click Customize, and a new window opens but there is no Customize page - disable the tab and try the same thing and the user is shown a tab that lets them cutomize their address bar.

Yes, it has the same issue, it’s just that no one reported it to me yet. I added a note to the description about the problem. It seems you can work around it if you have the Tabs permission, as you mentioned. I just don’t know how many pages might have the same title:

// If new tab is first in window, don't move it
// Don't move Customize window (could be overly broad)
if (tab.index == 0 || tab.title === 'Customize Firefox'){
	return;
}

I’ve decided to file a bug on this: https://bugzilla.mozilla.org/show_bug.cgi?id=1494596

Note that this will only work for English users. You could use the internationalization system to get the title for the current browser language, but that seems like way too much work for something simple like this.