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

--HG--
extra : rebase_source : b59fb10778e01d5856e52366eeb461a2faba3697
This commit is contained in:
Dão Gottwald 2017-05-31 09:31:44 +02:00
Родитель 93714d3413
Коммит 421284b7d3
1 изменённых файлов: 6 добавлений и 9 удалений

Просмотреть файл

@ -6041,20 +6041,17 @@
<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(() => {