Bug 1192720 - prevent re-entrancy in event handling in tabbrowser.xml's _switcher, r=billm

--HG--
extra : commitid : AZ2VdDPujAp
extra : rebase_source : 753ec1a07ea81fc35992065d67eaa1fedd93bbf7
extra : amend_source : d63d242d9f013f7aa5706b6b63d45d01d6390a07
This commit is contained in:
Gijs Kruitbosch 2015-08-13 16:55:09 +01:00
Родитель b6fbc5df6b
Коммит e91e642b81
1 изменённых файлов: 15 добавлений и 2 удалений

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

@ -3086,6 +3086,9 @@
STATE_LOADED: 2, STATE_LOADED: 2,
STATE_UNLOADING: 3, STATE_UNLOADING: 3,
// re-entrancy guard:
_processing: false,
getTabState: function(tab) { getTabState: function(tab) {
let state = this.tabState.get(tab); let state = this.tabState.get(tab);
if (state === undefined) { if (state === undefined) {
@ -3228,7 +3231,6 @@
} }
this.lastVisibleTab = this.visibleTab; this.lastVisibleTab = this.visibleTab;
}, },
assert: function(cond) { assert: function(cond) {
@ -3441,7 +3443,17 @@
this.postActions(); this.postActions();
}, },
handleEvent: function(event) { handleEvent: function(event, delayed = false) {
if (this._processing) {
setTimeout(() => this.handleEvent(event, true), 0);
return;
}
if (delayed && this.tabbrowser._switcher != this) {
// if we delayed processing this event, we might be out of date, in which
// case we drop the delayed events
return;
}
this._processing = true;
this.preActions(); this.preActions();
if (event.type == "MozLayerTreeReady") { if (event.type == "MozLayerTreeReady") {
@ -3455,6 +3467,7 @@
} }
this.postActions(); this.postActions();
this._processing = false;
}, },
/* /*