Closed Bug 1763712 Opened 2 years ago Closed 2 years ago

Empty string passed to getElementById() when creating lazy tab

Categories

(Firefox :: Tabbed Browser, defect)

defect

Tracking

()

VERIFIED FIXED
101 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox99 --- wontfix
firefox100 --- wontfix
firefox101 --- verified

People

(Reporter: Oriol, Assigned: Oriol)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

  1. Open the Browser Toolbox, switch to the Accessibility tab. I think this enables the accessibility service or something.

  2. Then switch to the Console tab and run:

    gBrowser.addTrustedTab("http://example.com", {createLazyBrowser: true, skipLoad: true})
    

Expected: no warning
Actual: tabbrowser-tabs.js:2099:22 triggers this warning:

Empty string passed to getElementById().

https://searchfox.org/mozilla-central/rev/fc5c4461124b8572442c71bc34947bee68b75551/browser/base/content/tabbrowser-tabs.js#2076-2100

    /**
     * Returns the panel associated with a tab if it has a connected browser
     * and/or it is the selected tab.
     * For background lazy browsers, this will return null.
     */
    getRelatedElement(aTab) {
      if (!aTab) {
        return null;
      }

      // Cannot access gBrowser before it's initialized.
      if (!gBrowser._initialized) {
        return this.tabbox.tabpanels.firstElementChild;
      }

      // If the tab's browser is lazy, we need to `_insertBrowser` in order
      // to have a linkedPanel.  This will also serve to bind the browser
      // and make it ready to use. We only do this if the tab is selected
      // because otherwise, callers might end up unintentionally binding the
      // browser for lazy background tabs.
      if (aTab.selected) {
        gBrowser._insertBrowser(aTab);
      }
      return document.getElementById(aTab.linkedPanel);
    }

Well, of course, if lazy browsers should return null, then this should be done explicitly, not by relying on document.getElementById("").

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

Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/9286536a7dbe
Prevent getRelatedElement() from passing empty string to getElementById(). r=Gijs
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 101 Branch
Has Regression Range: --- → yes

The patch landed in nightly and beta is affected.
:Oriol, is this bug important enough to require an uplift?
If not please set status_beta to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(oriol-bugzilla)

Warning in console doesn't seem important enough.

Flags: qe-verify+

I managed to reproduce this on Firefox 100.0(20220428192727) on macOS 11. Verified as fixed on Firefox 101.0b7(20220515185854), Nightly 102.0a1(20220515214519) on Win10 64-bits, Ubuntu 20.04 and macOS 11.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: