Correctly remove spies of window.onerror on IE

This commit is contained in:
Steve Gravrock
2017-12-18 16:34:37 -08:00
parent d3a3cf1ff3
commit b6cc34d9e9
4 changed files with 56 additions and 2 deletions

View File

@@ -4809,6 +4809,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
function SpyRegistry(options) {
options = options || {};
var global = options.global || j$.getGlobal();
var currentSpies = options.currentSpies || function() { return []; };
this.allowRespy = function(allow){
@@ -4852,7 +4853,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
spiedMethod = j$.createSpy(methodName, originalMethod),
restoreStrategy;
if (Object.prototype.hasOwnProperty.call(obj, methodName)) {
if (Object.prototype.hasOwnProperty.call(obj, methodName) || (obj === global && methodName === 'onerror')) {
restoreStrategy = function() {
obj[methodName] = originalMethod;
};