diff --git a/lib/sinon/sandbox.js b/lib/sinon/sandbox.js index fc46d73e2..9f324f158 100644 --- a/lib/sinon/sandbox.js +++ b/lib/sinon/sandbox.js @@ -100,7 +100,12 @@ restoreContext: function () { if (this.injectedKeys) { for (var i = 0, j = this.injectedKeys.length; i < j; i++) { - delete this.injectInto[this.injectedKeys[i]]; + // Use a try/catch to delete a property in IE8 + try { + delete this.injectInto[this.injectedKeys[i]]; + } catch (e) { + this.injectInto[this.injectedKeys[i]] = undefined; + } } this.injectedKeys = []; } diff --git a/test/sinon/issues/issues.js b/test/sinon/issues/issues.js index 032741af4..1271ab6ca 100644 --- a/test/sinon/issues/issues.js +++ b/test/sinon/issues/issues.js @@ -19,7 +19,7 @@ buster.testCase("issues", { tearDown: function () { this.sandbox.restore(); - if (this.clock){ + if (this.clock) { this.clock.restore(); } },