mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 618188 followup - Do not remove observer twice. r=zpao
This commit is contained in:
parent
79d4162c33
commit
45be819b6d
@ -130,22 +130,26 @@ function waitForSaveState(aSaveStateCallback) {
|
||||
let sessionSaveTimeout = 1000 +
|
||||
Services.prefs.getIntPref("browser.sessionstore.interval");
|
||||
|
||||
let timeout = setTimeout(function () {
|
||||
function removeObserver() {
|
||||
if (!observing)
|
||||
return;
|
||||
Services.obs.removeObserver(observer, topic, false);
|
||||
observing = false;
|
||||
}
|
||||
|
||||
let timeout = setTimeout(function () {
|
||||
removeObserver();
|
||||
aSaveStateCallback();
|
||||
}, sessionSaveTimeout);
|
||||
|
||||
function observer(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(observer, topic, false);
|
||||
removeObserver();
|
||||
timeout = clearTimeout(timeout);
|
||||
observing = false;
|
||||
executeSoon(aSaveStateCallback);
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
if (observing) {
|
||||
Services.obs.removeObserver(observer, topic, false);
|
||||
}
|
||||
removeObserver();
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user