diff --git a/dist/long-stack-trace-zone.js b/dist/long-stack-trace-zone.js index 47d1c127d..04dabccd1 100644 --- a/dist/long-stack-trace-zone.js +++ b/dist/long-stack-trace-zone.js @@ -8,7 +8,7 @@ Zone.Stacktrace = function (e) { this._e = e; }; Zone.Stacktrace.prototype.get = function () { - if (zone.stackFramesFilter) { + if (zone.stackFramesFilter && this._e.stack) { return this._e.stack. split('\n'). filter(zone.stackFramesFilter). @@ -47,7 +47,7 @@ Zone.longStackTraceZone = { var trace = []; var zone = this; if (exception) { - if (zone.stackFramesFilter) { + if (zone.stackFramesFilter && exception.stack) { trace.push(exception.stack.split('\n'). filter(zone.stackFramesFilter). join('\n')); diff --git a/lib/patch/event-target.js b/lib/patch/event-target.js index 7edc069ad..eb5cc73c4 100644 --- a/lib/patch/event-target.js +++ b/lib/patch/event-target.js @@ -27,6 +27,7 @@ function apply() { 'Window', 'Worker', 'WorkerGlobalScope', + 'XMLHttpRequest', 'XMLHttpRequestEventTarget', 'XMLHttpRequestUpload' ]; diff --git a/lib/patch/property-descriptor.js b/lib/patch/property-descriptor.js index 8765efde7..8484c2b56 100644 --- a/lib/patch/property-descriptor.js +++ b/lib/patch/property-descriptor.js @@ -13,7 +13,9 @@ function apply() { }); utils.patchProperties(HTMLElement.prototype, onEventNames); utils.patchProperties(XMLHttpRequest.prototype); - utils.patchProperties(WebSocket.prototype); + if (typeof WebSocket !== 'undefined') { + utils.patchProperties(WebSocket.prototype); + } } else { // Safari patchViaCapturingAllTheEvents(); diff --git a/sauce.conf.js b/sauce.conf.js index a8c69aed7..e49cc5b08 100644 --- a/sauce.conf.js +++ b/sauce.conf.js @@ -31,6 +31,24 @@ module.exports = function (config) { browserName: 'safari', platform: 'OS X 10.10', version: '8' + }, + 'SL_IE_9': { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 2008', + version: '9' + }, + 'SL_IE_10': { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 2012', + version: '10' + }, + 'SL_IE_11': { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 8.1', + version: '11' } }; diff --git a/test/microtasks.spec.js b/test/microtasks.spec.js index c27c79c2a..da3350a36 100644 --- a/test/microtasks.spec.js +++ b/test/microtasks.spec.js @@ -17,7 +17,7 @@ describe('Microtasks', function () { setTimeout(function() { expect(log).toEqual([1, 2, 3]); done(); - }, 0); + }, 10); }); it('should correctly schedule microtasks vs macrotasks', function(done) { @@ -33,11 +33,11 @@ describe('Microtasks', function () { log.push('mat1.mit'); }); log.push('-mat1'); - }, 0); + }, 10); setTimeout(function() { log.push('mat2'); - }, 0); + }, 20); setTimeout(function() { expect(log).toEqual([ @@ -45,7 +45,7 @@ describe('Microtasks', function () { '+mat1', '-mat1', 'mat1.mit', 'mat2']); done(); - }, 0); + }, 30); log.push('-root'); }); diff --git a/test/patch/WebSocket.spec.js b/test/patch/WebSocket.spec.js index 6c1496fce..eb19039b5 100644 --- a/test/patch/WebSocket.spec.js +++ b/test/patch/WebSocket.spec.js @@ -1,6 +1,6 @@ 'use strict'; -describe('WebSocket', function () { +describe('WebSocket', ifEnvSupports('WebSocket', function () { var socket; var TEST_SERVER_URL = 'ws://localhost:8001'; var flag; @@ -104,4 +104,4 @@ describe('WebSocket', function () { done(); }, 500); }); -}); +})); diff --git a/test/patch/XMLHttpRequest.spec.js b/test/patch/XMLHttpRequest.spec.js index 7123589b1..ff53f1a4c 100644 --- a/test/patch/XMLHttpRequest.spec.js +++ b/test/patch/XMLHttpRequest.spec.js @@ -21,22 +21,28 @@ describe('XMLHttpRequest', function () { req.send(); }); - it('should work with onprogress', function (done) { - var req; - - testZone.run(function() { - req = new XMLHttpRequest(); - req.onprogress = function () { - // Make sure that the callback will only be called once - req.onprogress = null; - expect(window.zone).toBeDirectChildOf(testZone); - done(); - }; - req.open('get', '/', true); + var supportsOnProgress = function() { + return 'onprogress' in new XMLHttpRequest(); + } + supportsOnProgress.message = "XMLHttpRequest.onprogress"; + + describe('onprogress', ifEnvSupports(supportsOnProgress, function () { + it('should work with onprogress', function (done) { + var req; + testZone.run(function() { + req = new XMLHttpRequest(); + req.onprogress = function () { + // Make sure that the callback will only be called once + req.onprogress = null; + expect(window.zone).toBeDirectChildOf(testZone); + done(); + }; + req.open('get', '/', true); + }); + + req.send(); }); - - req.send(); - }); + })); it('should preserve other setters', function () { var req = new XMLHttpRequest(); @@ -47,3 +53,4 @@ describe('XMLHttpRequest', function () { }); }); + diff --git a/test/patch/element.spec.js b/test/patch/element.spec.js index 369898e69..3e24b481a 100644 --- a/test/patch/element.spec.js +++ b/test/patch/element.spec.js @@ -12,7 +12,6 @@ describe('element', function () { afterEach(function () { document.body.removeChild(button); - button.remove(); }); it('should work with addEventListener', function () { @@ -35,7 +34,9 @@ describe('element', function () { button.addEventListener('focus', logFunction); button.click(); expect(log).toEqual('a'); - button.dispatchEvent(new Event('focus')); + var focusEvent = document.createEvent('Event'); + focusEvent.initEvent('focus', true, true) + button.dispatchEvent(focusEvent); expect(log).toEqual('aa'); button.removeEventListener('click', logFunction);