Skip to content

Commit

Permalink
Merge pull request #634 from GCheung55/bug-633
Browse files Browse the repository at this point in the history
Fix #633. Use a try/catch when deleting a property in IE8.
  • Loading branch information
cjohansen committed Jan 6, 2015
2 parents 1cbaec0 + c95aa3f commit 9502572
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/sinon/sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
}
Expand Down
2 changes: 1 addition & 1 deletion test/sinon/issues/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ buster.testCase("issues", {
tearDown: function () {
this.sandbox.restore();

if (this.clock){
if (this.clock) {
this.clock.restore();
}
},
Expand Down

0 comments on commit 9502572

Please sign in to comment.