Removed support for IE <10

[#150527985]
This commit is contained in:
Steve Gravrock
2017-11-07 21:03:38 -08:00
committed by Steve Gravrock
parent 1526d5e2a8
commit 419470e9df
15 changed files with 15 additions and 215 deletions

View File

@@ -1948,22 +1948,10 @@ getJasmineRequireObj().Clock = function() {
};
self.setTimeout = function(fn, delay, params) {
if (legacyIE()) {
if (arguments.length > 2) {
throw new Error('IE < 9 cannot support extra params to setTimeout without a polyfill');
}
return timer.setTimeout(fn, delay);
}
return Function.prototype.apply.apply(timer.setTimeout, [global, arguments]);
};
self.setInterval = function(fn, delay, params) {
if (legacyIE()) {
if (arguments.length > 2) {
throw new Error('IE < 9 cannot support extra params to setInterval without a polyfill');
}
return timer.setInterval(fn, delay);
}
return Function.prototype.apply.apply(timer.setInterval, [global, arguments]);
};
@@ -1998,11 +1986,6 @@ getJasmineRequireObj().Clock = function() {
global.clearInterval === realTimingFunctions.clearInterval;
}
function legacyIE() {
//if these methods are polyfilled, apply will be present
return !(realTimingFunctions.setTimeout || realTimingFunctions.setInterval).apply;
}
function replace(dest, source) {
for (var prop in source) {
dest[prop] = source[prop];
@@ -2667,28 +2650,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
var bIsDomNode = j$.isDomNode(b);
if (aIsDomNode && bIsDomNode) {
// At first try to use DOM3 method isEqualNode
if (a.isEqualNode) {
result = a.isEqualNode(b);
if (!result) {
diffBuilder.record(a, b);
}
return result;
}
// IE8 doesn't support isEqualNode, try to use outerHTML && innerText
var aIsElement = a instanceof Element;
var bIsElement = b instanceof Element;
if (aIsElement && bIsElement) {
result = a.outerHTML == b.outerHTML;
if (!result) {
diffBuilder.record(a, b);
}
return result;
}
if (aIsElement || bIsElement) {
diffBuilder.record(a, b);
return false;
}
result = a.innerText == b.innerText && a.textContent == b.textContent;
result = a.isEqualNode(b);
if (!result) {
diffBuilder.record(a, b);
}
@@ -4840,12 +4802,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
}
}
var descriptor;
try {
descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
} catch(e) {
// IE 8 doesn't support `definePropery` on non-DOM nodes
}
var descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
if (descriptor && !(descriptor.writable || descriptor.set)) {
throw new Error(getErrorMsg(methodName + ' is not declared writable or has no setter'));
@@ -4887,12 +4844,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
throw new Error('No property name supplied');
}
var descriptor;
try {
descriptor = j$.util.getPropertyDescriptor(obj, propertyName);
} catch(e) {
// IE 8 doesn't support `definePropery` on non-DOM nodes
}
var descriptor = j$.util.getPropertyDescriptor(obj, propertyName);
if (!descriptor) {
throw new Error(propertyName + ' property does not exist');

View File

@@ -389,37 +389,6 @@ describe("Clock", function() {
clock.tick(50);
}).toThrow();
});
it("on IE < 9, fails if extra args are passed to fake clock", function() {
//fail, because this would break in IE9.
var fakeSetTimeout = jasmine.createSpy('setTimeout'),
fakeSetInterval = jasmine.createSpy('setInterval'),
delayedFunctionScheduler = jasmine.createSpyObj('delayedFunctionScheduler', ['scheduleFunction']),
fn = jasmine.createSpy('fn'),
fakeGlobal = {
setTimeout: fakeSetTimeout,
setInterval: fakeSetInterval
},
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate);
fakeSetTimeout.apply = null;
fakeSetInterval.apply = null;
clock.install();
clock.setTimeout(fn, 0);
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(fn, 0, []);
expect(function() {
clock.setTimeout(fn, 0, 'extra');
}).toThrow();
clock.setInterval(fn, 0);
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(fn, 0, [], true);
expect(function() {
clock.setInterval(fn, 0, 'extra');
}).toThrow();
});
});
describe("Clock (acceptance)", function() {

View File

@@ -47,8 +47,8 @@ describe("ExceptionFormatter", function() {
});
describe("#stack", function() {
it("formats stack traces from Webkit, Firefox, node.js or IE10+", function() {
if (jasmine.getEnv().ieVersion < 10 || jasmine.getEnv().safariVersion < 6) { return; }
it("formats stack traces", function() {
if (jasmine.getEnv().safariVersion < 6) { return; }
var error;
try { throw new Error("an error") } catch(e) { error = e; }

View File

@@ -250,11 +250,7 @@ describe("jasmineUnderTest.pp", function () {
toString: function () { return Object.prototype.toString.call(this); }
};
if (jasmine.getEnv().ieVersion < 9) {
expect(jasmineUnderTest.pp(objFromOtherContext)).toEqual("Object({ foo: 'bar' })");
} else {
expect(jasmineUnderTest.pp(objFromOtherContext)).toEqual("Object({ foo: 'bar', toString: Function })");
}
expect(jasmineUnderTest.pp(objFromOtherContext)).toEqual("Object({ foo: 'bar', toString: Function })");
});
it("should stringify objects have have a toString that isn't a function", function() {
@@ -262,11 +258,7 @@ describe("jasmineUnderTest.pp", function () {
toString: "foo"
};
if (jasmine.getEnv().ieVersion < 9) {
expect(jasmineUnderTest.pp(obj)).toEqual("Object({ })");
} else {
expect(jasmineUnderTest.pp(obj)).toEqual("Object({ toString: 'foo' })");
}
expect(jasmineUnderTest.pp(obj)).toEqual("Object({ toString: 'foo' })");
});
it("should stringify objects from anonymous constructors with custom toString", function () {
@@ -279,8 +271,6 @@ describe("jasmineUnderTest.pp", function () {
});
it("should handle objects with null prototype", function() {
if (jasmine.getEnv().ieVersion < 9) { return; }
var obj = Object.create(null);
obj.foo = 'bar';

View File

@@ -54,9 +54,6 @@ describe("SpyRegistry", function() {
});
it("checks if it can be spied upon", function() {
// IE 8 doesn't support `definePropery` on non-DOM nodes
if (jasmine.getEnv().ieVersion < 9) { return; }
var scope = {};
function myFunc() {
@@ -94,9 +91,6 @@ describe("SpyRegistry", function() {
});
describe("#spyOnProperty", function() {
// IE 8 doesn't support `definePropery` on non-DOM nodes
if (jasmine.getEnv().ieVersion < 9) { return; }
it("checks for the existence of the object", function() {
var spyRegistry = new jasmineUnderTest.SpyRegistry();
expect(function() {
@@ -246,9 +240,6 @@ describe("SpyRegistry", function() {
});
it("does not add a property that the spied-upon object didn't originally have", function() {
// IE 8 doesn't support `Object.create`
if (jasmine.getEnv().ieVersion < 9) { return; }
var spies = [],
spyRegistry = new jasmineUnderTest.SpyRegistry({currentSpies: function() { return spies; }}),
originalFunction = function() {},
@@ -266,9 +257,6 @@ describe("SpyRegistry", function() {
});
it("restores the original function when it\'s inherited and cannot be deleted", function() {
// IE 8 doesn't support `Object.create` or `Object.defineProperty`
if (jasmine.getEnv().ieVersion < 9) { return; }
var spies = [],
spyRegistry = new jasmineUnderTest.SpyRegistry({currentSpies: function() { return spies; }}),
originalFunction = function() {},
@@ -291,9 +279,6 @@ describe("SpyRegistry", function() {
describe('spying on properties', function() {
it("restores the original properties on the spied-upon objects", function() {
// IE 8 doesn't support `definePropery` on non-DOM nodes
if (jasmine.getEnv().ieVersion < 9) { return; }
var spies = [],
spyRegistry = new jasmineUnderTest.SpyRegistry({currentSpies: function() { return spies; }}),
originalReturn = 1,
@@ -311,9 +296,6 @@ describe("SpyRegistry", function() {
});
it("does not add a property that the spied-upon object didn't originally have", function() {
// IE 8 doesn't support `Object.create`
if (jasmine.getEnv().ieVersion < 9) { return; }
var spies = [],
spyRegistry = new jasmineUnderTest.SpyRegistry({currentSpies: function() { return spies; }}),
originalReturn = 1,

View File

@@ -43,9 +43,6 @@ describe("jasmineUnderTest.util", function() {
});
describe("getPropertyDescriptor", function() {
// IE 8 doesn't support `definePropery` on non-DOM nodes
if (jasmine.getEnv().ieVersion < 9) { return; }
it("get property descriptor from object", function() {
var obj = {prop: 1},
actual = jasmineUnderTest.util.getPropertyDescriptor(obj, 'prop'),

View File

@@ -57,9 +57,6 @@ describe("ObjectContaining", function() {
});
it("matches defined properties", function(){
// IE 8 doesn't support `definePropery` on non-DOM nodes
if (jasmine.getEnv().ieVersion < 9) { return; }
var containing = new jasmineUnderTest.ObjectContaining({ foo: "fooVal" });
var definedPropertyObject = {};

View File

@@ -1164,12 +1164,9 @@ describe("Env integration", function() {
env.describe('suite', function() {
env.afterAll(function() {
if (jasmine.getEnv().ieVersion < 9) {
} else {
realSetTimeout(function() {
jasmine.clock().tick(10);
}, 100);
}
realSetTimeout(function() {
jasmine.clock().tick(10);
}, 100);
});
env.describe('beforeAll', function() {
env.beforeAll(function(innerDone) {

View File

@@ -156,8 +156,6 @@ describe("matchersUtil", function() {
});
it("passes for equivalent frozen objects (GitHub issue #266)", function() {
if (jasmine.getEnv().ieVersion < 9) { return; }
var a = { foo: 1 },
b = {foo: 1 };
@@ -191,10 +189,6 @@ describe("matchersUtil", function() {
if (isNotRunningInBrowser()) {
return;
}
// iframe.contentWindow.eval isn't supported in ie8
if (jasmine.getEnv().ieVersion < 9) {
return;
}
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.contentWindow.eval('window.testObject = {}');
@@ -356,8 +350,6 @@ describe("matchersUtil", function() {
});
it("passes for null prototype objects with same properties", function () {
if (jasmine.getEnv().ieVersion < 9) { return; }
var objA = Object.create(null),
objB = Object.create(null);
@@ -368,8 +360,6 @@ describe("matchersUtil", function() {
});
it("fails for null prototype objects with different properties", function () {
if (jasmine.getEnv().ieVersion < 9) { return; }
var objA = Object.create(null),
objB = Object.create(null);
@@ -449,9 +439,6 @@ describe("matchersUtil", function() {
});
describe("when running in an environment with array polyfills", function() {
// IE 8 doesn't support `definePropery` on non-DOM nodes
if (jasmine.getEnv().ieVersion < 9) { return; }
var findIndexDescriptor = Object.getOwnPropertyDescriptor(Array.prototype, 'findIndex');
if (!findIndexDescriptor) {
return;

View File

@@ -299,22 +299,7 @@ describe("toEqual", function() {
expect(compareEquals(actual, expected).message).toEqual(message);
});
function constructorIsNotEnumerable() {
// in IE8, the constructor property is not enumerable, even if it is an
// own property of the object.
// Objects that differ only by an own `constructor` property are thus
// considered equal in IE8.
for (var key in {constructor: 1}) {
return false;
}
return true;
}
it("reports mismatches between objects with their own constructor property", function () {
if (constructorIsNotEnumerable()) {
return;
}
function Foo() {}
function Bar() {}
@@ -326,10 +311,6 @@ describe("toEqual", function() {
});
it("reports mismatches between an object with a real constructor and one with its own constructor property", function () {
if (constructorIsNotEnumerable()) {
return;
}
function Foo() {}
function Bar() {}

View File

@@ -79,7 +79,7 @@ describe("toThrowError", function() {
});
it("passes if thrown is an instanceof Error regardless of global that contains its constructor", function() {
if (isNotRunningInBrowser() || jasmine.getEnv().phantomVersion < 2 || jasmine.getEnv().ieVersion < 10) {
if (isNotRunningInBrowser() || jasmine.getEnv().phantomVersion < 2) {
return;
}
@@ -92,7 +92,7 @@ describe("toThrowError", function() {
iframeDocument.body.appendChild(iframeDocument.createElement("script"))
.textContent = "function method() { throw new Error('foo'); }";
} else {
// older IE
// IE 10 and older
iframeDocument.write("<html><head><script>function method() { throw new Error('foo'); }</script></head></html>");
}

View File

@@ -8,10 +8,6 @@
return match ? parseFloat(match[1]) : void 0;
}
env.ieVersion = browserVersion(function(userAgent) {
return /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(userAgent);
});
env.safariVersion = browserVersion(function(userAgent) {
return /Safari/.exec(userAgent) && /Version\/([0-9]{0,})/.exec(userAgent);
});

View File

@@ -83,22 +83,10 @@ getJasmineRequireObj().Clock = function() {
};
self.setTimeout = function(fn, delay, params) {
if (legacyIE()) {
if (arguments.length > 2) {
throw new Error('IE < 9 cannot support extra params to setTimeout without a polyfill');
}
return timer.setTimeout(fn, delay);
}
return Function.prototype.apply.apply(timer.setTimeout, [global, arguments]);
};
self.setInterval = function(fn, delay, params) {
if (legacyIE()) {
if (arguments.length > 2) {
throw new Error('IE < 9 cannot support extra params to setInterval without a polyfill');
}
return timer.setInterval(fn, delay);
}
return Function.prototype.apply.apply(timer.setInterval, [global, arguments]);
};
@@ -133,11 +121,6 @@ getJasmineRequireObj().Clock = function() {
global.clearInterval === realTimingFunctions.clearInterval;
}
function legacyIE() {
//if these methods are polyfilled, apply will be present
return !(realTimingFunctions.setTimeout || realTimingFunctions.setInterval).apply;
}
function replace(dest, source) {
for (var prop in source) {
dest[prop] = source[prop];

View File

@@ -32,12 +32,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
}
}
var descriptor;
try {
descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
} catch(e) {
// IE 8 doesn't support `definePropery` on non-DOM nodes
}
var descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
if (descriptor && !(descriptor.writable || descriptor.set)) {
throw new Error(getErrorMsg(methodName + ' is not declared writable or has no setter'));
@@ -79,12 +74,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
throw new Error('No property name supplied');
}
var descriptor;
try {
descriptor = j$.util.getPropertyDescriptor(obj, propertyName);
} catch(e) {
// IE 8 doesn't support `definePropery` on non-DOM nodes
}
var descriptor = j$.util.getPropertyDescriptor(obj, propertyName);
if (!descriptor) {
throw new Error(propertyName + ' property does not exist');

View File

@@ -182,28 +182,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
var bIsDomNode = j$.isDomNode(b);
if (aIsDomNode && bIsDomNode) {
// At first try to use DOM3 method isEqualNode
if (a.isEqualNode) {
result = a.isEqualNode(b);
if (!result) {
diffBuilder.record(a, b);
}
return result;
}
// IE8 doesn't support isEqualNode, try to use outerHTML && innerText
var aIsElement = a instanceof Element;
var bIsElement = b instanceof Element;
if (aIsElement && bIsElement) {
result = a.outerHTML == b.outerHTML;
if (!result) {
diffBuilder.record(a, b);
}
return result;
}
if (aIsElement || bIsElement) {
diffBuilder.record(a, b);
return false;
}
result = a.innerText == b.innerText && a.textContent == b.textContent;
result = a.isEqualNode(b);
if (!result) {
diffBuilder.record(a, b);
}