"openerTabId" not present in tab opened as a popup (getting opener tab of popup)

When getting information about a tab that has been opened as a popup and the tab has not been opened as a tab, but as a popup, you do not get the openerTabId property. It is just not present… (undefined) :thinking:

Thus it is not easily possible to get the tab, which opened a popup from the popup’s tab.

You can reproduce this e.g. by clicking on the follow button here (to open in a new tab instead, do this with right-click or so) here:

So is this a bug or is this intended?

Here is the example data, for comparsion (I’ve only removed this big crazy faviconUrl): https://gist.github.com/rugk/b8ac232c1044a24edb55d291c823f6eb

Firefox 69.0.3

The openerTabId is present when the user clicked a link in the tab or the tabs js opened it. Neither is the case for webext popups. The user opens the popup using the browser, not the tab. I would say this seems correct. If you want to get the tab the user is currently on, just query the active tab when the popup gets loaded.

No, that’s not the case. The tab got opened by JS on the site. Or even simple links.

Actually just go to https://mastodon.social/@Mastodon and click the “Follow” button e.g. (or one of the interaction buttons e.g. to reply below a toot).

So it’s not a popup opened by the WebExtension. The WebExtension only (later!) intercepts the load request and redirects it, but that should only be done afterwards, and of course should not change the tab data.
Also the WebExtension does the same for the new tab and the new popup, but only in one case, there is no openerTabId… :thinking:

Sorry about the delay. I guess I misunderstood… I thought you meant the extension popup. Maybe the openerTabId is only supplied if it’s within the same window. But it sounds like a bug to me. Have you created a bugzilla ticket for this?

Done now:

Got a reply, although unfortunately disappointing:

openerTabId is only valid for tabs in the same window. It is reset when a tab is moved to or opened in a different window from its opener.