Open Bug 1753607 Opened 3 years ago Updated 3 years ago

Creating a tab with the openerTabId of the discarded tab resulted in an unexpected error

Categories

(WebExtensions :: Developer Tools, defect)

Firefox 98
Desktop
All
defect

Tracking

(firefox-esr91 unaffected, firefox97 unaffected, firefox98 affected, firefox99 affected)

Tracking Status
firefox-esr91 --- unaffected
firefox97 --- unaffected
firefox98 --- affected
firefox99 --- affected

People

(Reporter: mbnuqw, Unassigned, NeedInfo)

References

(Regression)

Details

(Keywords: regression)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:98.0) Gecko/20100101 Firefox/98.0

Steps to reproduce:

  • Create tab
  • Discard it
  • Try to create child tab with openerTabId of just created tab
(async () => {
  const parentTab = await browser.tabs.create({
    index: 0,
    url: 'https://example.com',
    active: false,
  })
  
  await browser.tabs.discard(parentTab.id)

  const childTab = await browser.tabs.create({
    index: 1,
    url: 'https://example.com',
    openerTabId: parentTab.id,
    active: false,
  })
})()

Actual results:

Uncaught (in promise) Error: An unexpected error occurred. Second tab is not created and indexing of tabs (in native Firefox strip) is shifted (clicking on a tab activates the previous).

Expected results:

Child tab should be created.

The Bugbug bot thinks this bug should belong to the 'Firefox::Tabbed Browser' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Tabbed Browser

I'm not sure how could I reproduce this in order to confirm it. Is this bug related to an addon you are trying to create?
Thanks.

Flags: needinfo?(maxbadryzlov)

Apologize for the unclear description. The problem occurs when using the WebExtentions API: browser.tabs.create. You can reproduce it by enabling debugging of any addon and running the above code. If the parent tab is not discarded or if the child tab is created without openerTabId there is no error.

I came across this while working on sidebery. Use cases: reopen a child tab of discarded parent tab in different container; Opening tree of discarded tabs...etc.

mozregression result:
INFO: Last good revision: 71a21bee6a2c0938856d37f90e8700d1a25d2b29
INFO: First bad revision: d97f89ceade52bf275d42367bd82f1e18db63808
INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=71a21bee6a2c0938856d37f90e8700d1a25d2b29&tochange=d97f89ceade52bf275d42367bd82f1e18db63808

Flags: needinfo?(maxbadryzlov)

Managed to reproduce the issue on Windows 10 x64, macOS 11.6 and on Ubuntu 20.04 x64.
I'm not sure if the component is set correctly, changing it to WebExtensions::Developer Tools component.

Severity: -- → S4
Status: UNCONFIRMED → NEW
Has Regression Range: --- → yes
Has STR: --- → yes
Component: Tabbed Browser → Developer Tools
Ever confirmed: true
OS: Unspecified → All
Product: Firefox → WebExtensions
Regressed by: 1752344
Hardware: Unspecified → Desktop

Set release status flags based on info from the regressing bug 1752344

A little bit more info, Browser Console output:

22:06:55.421 Failed to create tab tabbrowser.js:2848
    addTab chrome://browser/content/tabbrowser.js:2848
    create chrome://browser/content/parent/ext-tabs.js:824
22:06:55.421 CanonicalBrowsingContext.setCrossGroupOpener: Argument 1 is not an object. tabbrowser.js:2842
    addTab chrome://browser/content/tabbrowser.js:2842
    create chrome://browser/content/parent/ext-tabs.js:824
22:06:55.422 WeakSet value must be an object, got nativeTab ext-tabs.js:845
    create chrome://browser/content/parent/ext-tabs.js:845
22:06:55.432 Uncaught TypeError: can't access property "remoteTab", tab.linkedBrowser.frameLoader is null
    canWarmTab resource:///modules/AsyncTabSwitcher.jsm:964
    noteTabRequested resource:///modules/AsyncTabSwitcher.jsm:1398
    requestTab resource:///modules/AsyncTabSwitcher.jsm:1042
    updateCurrentBrowser chrome://browser/content/tabbrowser.js:1066
    _setupEventListeners chrome://browser/content/tabbrowser.js:5794
    set selectedIndex chrome://global/content/elements/tabbox.js:204
    set selectedPanel chrome://global/content/elements/tabbox.js:222
    set selectedIndex chrome://global/content/elements/tabbox.js:546
    set selectedItem chrome://global/content/elements/tabbox.js:565
    set selectedTab chrome://global/content/elements/tabbox.js:82
    set selectedTab chrome://browser/content/tabbrowser.js:309
    _blurTab chrome://browser/content/tabbrowser.js:4278
    _beginRemoveTab chrome://browser/content/tabbrowser.js:3920
    removeTab chrome://browser/content/tabbrowser.js:3788
    remove chrome://browser/content/parent/ext-tabs.js:860
    result resource://gre/modules/ExtensionParent.jsm:1152
    withCallContextData resource://gre/modules/ExtensionParent.jsm:635
    result resource://gre/modules/ExtensionParent.jsm:1151
    withPendingBrowser resource://gre/modules/ExtensionParent.jsm:645
    result resource://gre/modules/ExtensionParent.jsm:1150
    callAndLog resource://gre/modules/ExtensionParent.jsm:1103
    recvAPICall resource://gre/modules/ExtensionParent.jsm:1149
AsyncTabSwitcher.jsm:964:7
22:06:55.453 can't access property "isArticle", this.nativeTab.linkedBrowser is null ext-browser.js:862
    get isArticle chrome://browser/content/parent/ext-browser.js:862
    convert chrome://extensions/content/parent/ext-tabs-base.js:645
    query chrome://browser/content/parent/ext-tabs.js:1024
    from self-hosted:514
    query chrome://browser/content/parent/ext-tabs.js:1023
    query self-hosted:1356
    result resource://gre/modules/ExtensionParent.jsm:1152
    withCallContextData resource://gre/modules/ExtensionParent.jsm:635
    result resource://gre/modules/ExtensionParent.jsm:1151
    withPendingBrowser resource://gre/modules/ExtensionParent.jsm:645
    result resource://gre/modules/ExtensionParent.jsm:1150
    callAndLog resource://gre/modules/ExtensionParent.jsm:1103
    recvAPICall resource://gre/modules/ExtensionParent.jsm:1149
    AsyncFunctionNext self-hosted:807

Also, I think that the component shouldn't be the "Developer Tools" because it is not "Bugs about debugging, reloading add-ons, error messages and devtools APIs" but it is more like Frontend or General bug.

Another example to reproduce this bug (without debugging):

  • Install 'FoxyTab", "Firefox Multi-Account Container", "Tree Style Tab" addons
  • Open https://example.com and bind it to some container with Muli-Account Container
  • Open https://example.com again, In opened Muli-Account Container page select "Remember my decision for this site"
  • In Tree Style Tab create parent tab with two child tabs
  • Activate the first child tab
  • Open context menu on the parent tab and discard it using FoxyTab
  • Navigate to the https://example.com (in the first child tab)

Sidebery issue: https://github.com/mbnuqw/sidebery/issues/778
(with steps to reproduce this bug)

Flags: needinfo?(tomica)
You need to log in before you can comment on or make changes to this bug.