commit 8e2ce9cb378d9cf2dd174e85dd69b8b149fbf0e6
parent 7435a65e04367e5b24165369fe256735fac148dc
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Tue, 30 Dec 2025 20:45:22 +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:
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);
}