Bug 1368940 - Avoid potential race condition in adjustTabstrip. r?mconley
The early this.getAttribute("overflow") == "true" check + requestAnimationFrame + _closeButtonsUpdatePending can make us skip an adjustTabstrip call from the overflow event that would remove the overflow attribute.
MozReview-Commit-ID: 4cCdotvWmIa
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -6036,30 +6036,27 @@
else
this.visible = true;
]]></body>
</method>
<field name="_closeButtonsUpdatePending">false</field>
<method name="adjustTabstrip">
<body><![CDATA[
+ // If we're overflowing, tabs are at their minimum widths.
+ if (this.getAttribute("overflow") == "true") {
+ this.setAttribute("closebuttons", "activetab");
+ return;
+ }
+
if (this._closeButtonsUpdatePending) {
return;
}
this._closeButtonsUpdatePending = true;
- // If we're overflowing, tabs are at their minimum widths.
- if (this.getAttribute("overflow") == "true") {
- window.requestAnimationFrame(() => {
- this._closeButtonsUpdatePending = false;
- this.setAttribute("closebuttons", "activetab");
- });
- return;
- }
-
// Wait until after the next paint to get current layout data from
// getBoundsWithoutFlushing.
window.requestAnimationFrame(() => {
window.requestAnimationFrame(() => {
this._closeButtonsUpdatePending = false;
// The scrollbox may have started overflowing since we checked
// overflow earlier, so check again.