tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 16ad3e5bbecf4f3cd119adfcdbc33a501cf6431b
parent 4eaf9717396aa173beadf74f12fed52acfd50592
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date:   Wed, 31 Dec 2025 10:58:47 +0000

Bug 2007958 - Deal with attributeChangedCallback before init. r=tabbrowser-reviewers,jswinarton,sthompson

There's nothing that really prevents it from happening before my patch,
but my patch triggers this in a couple browser tests that start failing
with:

> JavaScript Error: "TypeError: can't access property "setAttribute", this.pinnedTabsContainer is undefined

Deal with it gracefully.

While at it, make sure to call into the super class for other attribute
changes.

Differential Revision: https://phabricator.services.mozilla.com/D277664

Diffstat:
Mbrowser/components/tabbrowser/content/tabs.js | 21+++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js @@ -71,6 +71,10 @@ this.pinnedTabsContainer = document.getElementById( "pinned-tabs-container" ); + this.pinnedTabsContainer.setAttribute( + "orient", + this.getAttribute("orient") + ); // Override arrowscrollbox.js method, since our scrollbox's children are // inherited from the scrollbox binding parent (this). @@ -245,20 +249,13 @@ } attributeChangedCallback(name, oldValue, newValue) { - if (name != "orient") { - return; - } - - if (this.overflowing) { - // reset this value so we don't have incorrect styling for vertical tabs + if (name == "orient") { + // reset this attribute so we don't have incorrect styling for vertical tabs this.removeAttribute("overflow"); + this.#updateTabMinWidth(); + this.#updateTabMinHeight(); + this.pinnedTabsContainer?.setAttribute("orient", newValue); } - - this.#updateTabMinWidth(); - this.#updateTabMinHeight(); - - this.pinnedTabsContainer.setAttribute("orient", newValue); - super.attributeChangedCallback(name, oldValue, newValue); }