[Pkg-javascript-commits] [sockjs-client] 162/350: don't override global XMLHttpRequest
tonnerre at ancient-solutions.com
tonnerre at ancient-solutions.com
Fri Aug 5 01:03:58 UTC 2016
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch upstream
in repository sockjs-client.
commit f42093e9206bd02db77be2706634da22f5ac3307
Author: Bryce Kahle <bkahle at gmail.com>
Date: Fri Oct 17 10:56:39 2014 -0400
don't override global XMLHttpRequest
---
lib/transport/browser/abstract-xhr.js | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/transport/browser/abstract-xhr.js b/lib/transport/browser/abstract-xhr.js
index b157b15..a29465b 100644
--- a/lib/transport/browser/abstract-xhr.js
+++ b/lib/transport/browser/abstract-xhr.js
@@ -4,6 +4,7 @@ var EventEmitter = require('events').EventEmitter
, util = require('util')
, utils = require('../../utils/event')
, debug = require('debug')('sockjs-client:browser:xhr')
+ , XHR = global.XMLHttpRequest
;
function AbstractXHRObject(method, url, payload, opts) {
@@ -12,7 +13,7 @@ function AbstractXHRObject(method, url, payload, opts) {
EventEmitter.call(this);
try {
- this.xhr = new global.XMLHttpRequest();
+ this.xhr = new XHR();
} catch(x) {}
if (!this.xhr) {
@@ -137,18 +138,18 @@ AbstractXHRObject.prototype.close = function() {
this._cleanup(true);
};
-AbstractXHRObject.enabled = !!global.XMLHttpRequest;
+AbstractXHRObject.enabled = !!XHR;
// override XMLHttpRequest for IE6/7
if (!AbstractXHRObject.enabled && global.ActiveXObject) {
debug('overriding xmlhttprequest');
- global.XMLHttpRequest = function () {
+ XHR = function () {
try {
return new global.ActiveXObject('Microsoft.XMLHTTP');
} catch (e) {
return null;
}
};
- AbstractXHRObject.enabled = !!new global.XMLHttpRequest();
+ AbstractXHRObject.enabled = !!new XHR();
}
var cors = false;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git
More information about the Pkg-javascript-commits
mailing list