Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
feat(zone.js): support Android browser
Browse files Browse the repository at this point in the history
  • Loading branch information
marclaval authored and vicb committed Aug 20, 2015
1 parent 3b0ca3f commit 93b5555
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
9 changes: 6 additions & 3 deletions lib/patch/property-descriptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,24 @@ function apply() {
return;
}

var supportsWebSocket = typeof WebSocket !== 'undefined';
if (canPatchViaPropertyDescriptor()) {
// for browsers that we can patch the descriptor: Chrome & Firefox
var onEventNames = eventNames.map(function (property) {
return 'on' + property;
});
utils.patchProperties(HTMLElement.prototype, onEventNames);
utils.patchProperties(XMLHttpRequest.prototype);
if (typeof WebSocket !== 'undefined') {
if (supportsWebSocket) {
utils.patchProperties(WebSocket.prototype);
}
} else {
// Safari
// Safari, Android browsers (Jelly Bean)
patchViaCapturingAllTheEvents();
utils.patchClass('XMLHttpRequest');
webSocketPatch.apply();
if (supportsWebSocket) {
webSocketPatch.apply();
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions sauce.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ module.exports = function (config) {
browserName: 'internet explorer',
platform: 'Windows 8.1',
version: '11'
},
'SL_ANDROID4.3': {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '4.3'
}
};

Expand Down
9 changes: 7 additions & 2 deletions test/patch/XMLHttpRequest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ describe('XMLHttpRequest', function () {
var req = new XMLHttpRequest();
req.open('get', '/', true);
req.send();
req.responseType = 'document';
expect(req.responseType).toBe('document');
try {
req.responseType = 'document';
expect(req.responseType).toBe('document');
} catch (e) {
//Android browser: using this setter throws, this should be preserved
expect(e.message).toBe('INVALID_STATE_ERR: DOM Exception 11');
}
});

it('should preserve static constants', function() {
Expand Down

0 comments on commit 93b5555

Please sign in to comment.