Workaround IE's defficient handling of finally statements in PeriodicalExecuter. [#696 state:resolved]
This commit is contained in:
parent
e41ccba6d8
commit
49090bc957
|
@ -1,4 +1,4 @@
|
|||
* Re-throw error in otherwise-empty `catch` clause so that `PeriodicalExecuter` does not suppress exceptions. (Samuel Lebeau)
|
||||
* Fix `PeriodicalExecuter` so that it no longer suppresses exceptions. [#696 state:resolved] (Samuel Lebeau, Yaffle)
|
||||
|
||||
* Fix issue related to escaping of selectors for querySelectorAll. [#559 state:resolved] (Jorn Holm)
|
||||
|
||||
|
|
|
@ -49,15 +49,20 @@ var PeriodicalExecuter = Class.create({
|
|||
|
||||
onTimerEvent: function() {
|
||||
if (!this.currentlyExecuting) {
|
||||
try {
|
||||
this.currentlyExecuting = true;
|
||||
this.execute();
|
||||
} catch(e) {
|
||||
// Catch clause for clients that don't support try/finally.
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
this.currentlyExecuting = false;
|
||||
if (!this.currentlyExecuting) {
|
||||
// IE doesn't support `finally` statements unless all errors are caught.
|
||||
// We mimic the behaviour of `finally` statements by duplicating code
|
||||
// that would belong in it. First at the bottom of the `try` statement
|
||||
// (for errorless cases). Secondly, inside a `catch` statement which
|
||||
// rethrows any caught errors.
|
||||
try {
|
||||
this.currentlyExecuting = true;
|
||||
this.execute();
|
||||
this.currentlyExecuting = false;
|
||||
} catch(e) {
|
||||
this.currentlyExecuting = false;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue