1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/testing/mochitest/tests/MochiKit-1.4.2/MochiKit/Async.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,682 @@ 1.4 +/*** 1.5 + 1.6 +MochiKit.Async 1.4.2 1.7 + 1.8 +See <http://mochikit.com/> for documentation, downloads, license, etc. 1.9 + 1.10 +(c) 2005 Bob Ippolito. All rights Reserved. 1.11 + 1.12 +***/ 1.13 + 1.14 +MochiKit.Base._deps('Async', ['Base']); 1.15 + 1.16 +MochiKit.Async.NAME = "MochiKit.Async"; 1.17 +MochiKit.Async.VERSION = "1.4.2"; 1.18 +MochiKit.Async.__repr__ = function () { 1.19 + return "[" + this.NAME + " " + this.VERSION + "]"; 1.20 +}; 1.21 +MochiKit.Async.toString = function () { 1.22 + return this.__repr__(); 1.23 +}; 1.24 + 1.25 +/** @id MochiKit.Async.Deferred */ 1.26 +MochiKit.Async.Deferred = function (/* optional */ canceller) { 1.27 + this.chain = []; 1.28 + this.id = this._nextId(); 1.29 + this.fired = -1; 1.30 + this.paused = 0; 1.31 + this.results = [null, null]; 1.32 + this.canceller = canceller; 1.33 + this.silentlyCancelled = false; 1.34 + this.chained = false; 1.35 +}; 1.36 + 1.37 +MochiKit.Async.Deferred.prototype = { 1.38 + /** @id MochiKit.Async.Deferred.prototype.repr */ 1.39 + repr: function () { 1.40 + var state; 1.41 + if (this.fired == -1) { 1.42 + state = 'unfired'; 1.43 + } else if (this.fired === 0) { 1.44 + state = 'success'; 1.45 + } else { 1.46 + state = 'error'; 1.47 + } 1.48 + return 'Deferred(' + this.id + ', ' + state + ')'; 1.49 + }, 1.50 + 1.51 + toString: MochiKit.Base.forwardCall("repr"), 1.52 + 1.53 + _nextId: MochiKit.Base.counter(), 1.54 + 1.55 + /** @id MochiKit.Async.Deferred.prototype.cancel */ 1.56 + cancel: function () { 1.57 + var self = MochiKit.Async; 1.58 + if (this.fired == -1) { 1.59 + if (this.canceller) { 1.60 + this.canceller(this); 1.61 + } else { 1.62 + this.silentlyCancelled = true; 1.63 + } 1.64 + if (this.fired == -1) { 1.65 + this.errback(new self.CancelledError(this)); 1.66 + } 1.67 + } else if ((this.fired === 0) && (this.results[0] instanceof self.Deferred)) { 1.68 + this.results[0].cancel(); 1.69 + } 1.70 + }, 1.71 + 1.72 + _resback: function (res) { 1.73 + /*** 1.74 + 1.75 + The primitive that means either callback or errback 1.76 + 1.77 + ***/ 1.78 + this.fired = ((res instanceof Error) ? 1 : 0); 1.79 + this.results[this.fired] = res; 1.80 + this._fire(); 1.81 + }, 1.82 + 1.83 + _check: function () { 1.84 + if (this.fired != -1) { 1.85 + if (!this.silentlyCancelled) { 1.86 + throw new MochiKit.Async.AlreadyCalledError(this); 1.87 + } 1.88 + this.silentlyCancelled = false; 1.89 + return; 1.90 + } 1.91 + }, 1.92 + 1.93 + /** @id MochiKit.Async.Deferred.prototype.callback */ 1.94 + callback: function (res) { 1.95 + this._check(); 1.96 + if (res instanceof MochiKit.Async.Deferred) { 1.97 + throw new Error("Deferred instances can only be chained if they are the result of a callback"); 1.98 + } 1.99 + this._resback(res); 1.100 + }, 1.101 + 1.102 + /** @id MochiKit.Async.Deferred.prototype.errback */ 1.103 + errback: function (res) { 1.104 + this._check(); 1.105 + var self = MochiKit.Async; 1.106 + if (res instanceof self.Deferred) { 1.107 + throw new Error("Deferred instances can only be chained if they are the result of a callback"); 1.108 + } 1.109 + if (!(res instanceof Error)) { 1.110 + res = new self.GenericError(res); 1.111 + } 1.112 + this._resback(res); 1.113 + }, 1.114 + 1.115 + /** @id MochiKit.Async.Deferred.prototype.addBoth */ 1.116 + addBoth: function (fn) { 1.117 + if (arguments.length > 1) { 1.118 + fn = MochiKit.Base.partial.apply(null, arguments); 1.119 + } 1.120 + return this.addCallbacks(fn, fn); 1.121 + }, 1.122 + 1.123 + /** @id MochiKit.Async.Deferred.prototype.addCallback */ 1.124 + addCallback: function (fn) { 1.125 + if (arguments.length > 1) { 1.126 + fn = MochiKit.Base.partial.apply(null, arguments); 1.127 + } 1.128 + return this.addCallbacks(fn, null); 1.129 + }, 1.130 + 1.131 + /** @id MochiKit.Async.Deferred.prototype.addErrback */ 1.132 + addErrback: function (fn) { 1.133 + if (arguments.length > 1) { 1.134 + fn = MochiKit.Base.partial.apply(null, arguments); 1.135 + } 1.136 + return this.addCallbacks(null, fn); 1.137 + }, 1.138 + 1.139 + /** @id MochiKit.Async.Deferred.prototype.addCallbacks */ 1.140 + addCallbacks: function (cb, eb) { 1.141 + if (this.chained) { 1.142 + throw new Error("Chained Deferreds can not be re-used"); 1.143 + } 1.144 + this.chain.push([cb, eb]); 1.145 + if (this.fired >= 0) { 1.146 + this._fire(); 1.147 + } 1.148 + return this; 1.149 + }, 1.150 + 1.151 + _fire: function () { 1.152 + /*** 1.153 + 1.154 + Used internally to exhaust the callback sequence when a result 1.155 + is available. 1.156 + 1.157 + ***/ 1.158 + var chain = this.chain; 1.159 + var fired = this.fired; 1.160 + var res = this.results[fired]; 1.161 + var self = this; 1.162 + var cb = null; 1.163 + while (chain.length > 0 && this.paused === 0) { 1.164 + // Array 1.165 + var pair = chain.shift(); 1.166 + var f = pair[fired]; 1.167 + if (f === null) { 1.168 + continue; 1.169 + } 1.170 + try { 1.171 + res = f(res); 1.172 + fired = ((res instanceof Error) ? 1 : 0); 1.173 + if (res instanceof MochiKit.Async.Deferred) { 1.174 + cb = function (res) { 1.175 + self._resback(res); 1.176 + self.paused--; 1.177 + if ((self.paused === 0) && (self.fired >= 0)) { 1.178 + self._fire(); 1.179 + } 1.180 + }; 1.181 + this.paused++; 1.182 + } 1.183 + } catch (err) { 1.184 + fired = 1; 1.185 + if (!(err instanceof Error)) { 1.186 + err = new MochiKit.Async.GenericError(err); 1.187 + } 1.188 + res = err; 1.189 + } 1.190 + } 1.191 + this.fired = fired; 1.192 + this.results[fired] = res; 1.193 + if (cb && this.paused) { 1.194 + // this is for "tail recursion" in case the dependent deferred 1.195 + // is already fired 1.196 + res.addBoth(cb); 1.197 + res.chained = true; 1.198 + } 1.199 + } 1.200 +}; 1.201 + 1.202 +MochiKit.Base.update(MochiKit.Async, { 1.203 + /** @id MochiKit.Async.evalJSONRequest */ 1.204 + evalJSONRequest: function (req) { 1.205 + return MochiKit.Base.evalJSON(req.responseText); 1.206 + }, 1.207 + 1.208 + /** @id MochiKit.Async.succeed */ 1.209 + succeed: function (/* optional */result) { 1.210 + var d = new MochiKit.Async.Deferred(); 1.211 + d.callback.apply(d, arguments); 1.212 + return d; 1.213 + }, 1.214 + 1.215 + /** @id MochiKit.Async.fail */ 1.216 + fail: function (/* optional */result) { 1.217 + var d = new MochiKit.Async.Deferred(); 1.218 + d.errback.apply(d, arguments); 1.219 + return d; 1.220 + }, 1.221 + 1.222 + /** @id MochiKit.Async.getXMLHttpRequest */ 1.223 + getXMLHttpRequest: function () { 1.224 + var self = arguments.callee; 1.225 + if (!self.XMLHttpRequest) { 1.226 + var tryThese = [ 1.227 + function () { return new XMLHttpRequest(); }, 1.228 + function () { return new ActiveXObject('Msxml2.XMLHTTP'); }, 1.229 + function () { return new ActiveXObject('Microsoft.XMLHTTP'); }, 1.230 + function () { return new ActiveXObject('Msxml2.XMLHTTP.4.0'); }, 1.231 + function () { 1.232 + throw new MochiKit.Async.BrowserComplianceError("Browser does not support XMLHttpRequest"); 1.233 + } 1.234 + ]; 1.235 + for (var i = 0; i < tryThese.length; i++) { 1.236 + var func = tryThese[i]; 1.237 + try { 1.238 + self.XMLHttpRequest = func; 1.239 + return func(); 1.240 + } catch (e) { 1.241 + // pass 1.242 + } 1.243 + } 1.244 + } 1.245 + return self.XMLHttpRequest(); 1.246 + }, 1.247 + 1.248 + _xhr_onreadystatechange: function (d) { 1.249 + // MochiKit.Logging.logDebug('this.readyState', this.readyState); 1.250 + var m = MochiKit.Base; 1.251 + if (this.readyState == 4) { 1.252 + // IE SUCKS 1.253 + try { 1.254 + this.onreadystatechange = null; 1.255 + } catch (e) { 1.256 + try { 1.257 + this.onreadystatechange = m.noop; 1.258 + } catch (e) { 1.259 + } 1.260 + } 1.261 + var status = null; 1.262 + try { 1.263 + status = this.status; 1.264 + if (!status && m.isNotEmpty(this.responseText)) { 1.265 + // 0 or undefined seems to mean cached or local 1.266 + status = 304; 1.267 + } 1.268 + } catch (e) { 1.269 + // pass 1.270 + // MochiKit.Logging.logDebug('error getting status?', repr(items(e))); 1.271 + } 1.272 + // 200 is OK, 201 is CREATED, 204 is NO CONTENT 1.273 + // 304 is NOT MODIFIED, 1223 is apparently a bug in IE 1.274 + if (status == 200 || status == 201 || status == 204 || 1.275 + status == 304 || status == 1223) { 1.276 + d.callback(this); 1.277 + } else { 1.278 + var err = new MochiKit.Async.XMLHttpRequestError(this, "Request failed"); 1.279 + if (err.number) { 1.280 + // XXX: This seems to happen on page change 1.281 + d.errback(err); 1.282 + } else { 1.283 + // XXX: this seems to happen when the server is unreachable 1.284 + d.errback(err); 1.285 + } 1.286 + } 1.287 + } 1.288 + }, 1.289 + 1.290 + _xhr_canceller: function (req) { 1.291 + // IE SUCKS 1.292 + try { 1.293 + req.onreadystatechange = null; 1.294 + } catch (e) { 1.295 + try { 1.296 + req.onreadystatechange = MochiKit.Base.noop; 1.297 + } catch (e) { 1.298 + } 1.299 + } 1.300 + req.abort(); 1.301 + }, 1.302 + 1.303 + 1.304 + /** @id MochiKit.Async.sendXMLHttpRequest */ 1.305 + sendXMLHttpRequest: function (req, /* optional */ sendContent) { 1.306 + if (typeof(sendContent) == "undefined" || sendContent === null) { 1.307 + sendContent = ""; 1.308 + } 1.309 + 1.310 + var m = MochiKit.Base; 1.311 + var self = MochiKit.Async; 1.312 + var d = new self.Deferred(m.partial(self._xhr_canceller, req)); 1.313 + 1.314 + try { 1.315 + req.onreadystatechange = m.bind(self._xhr_onreadystatechange, 1.316 + req, d); 1.317 + req.send(sendContent); 1.318 + } catch (e) { 1.319 + try { 1.320 + req.onreadystatechange = null; 1.321 + } catch (ignore) { 1.322 + // pass 1.323 + } 1.324 + d.errback(e); 1.325 + } 1.326 + 1.327 + return d; 1.328 + 1.329 + }, 1.330 + 1.331 + /** @id MochiKit.Async.doXHR */ 1.332 + doXHR: function (url, opts) { 1.333 + /* 1.334 + Work around a Firefox bug by dealing with XHR during 1.335 + the next event loop iteration. Maybe it's this one: 1.336 + https://bugzilla.mozilla.org/show_bug.cgi?id=249843 1.337 + */ 1.338 + var self = MochiKit.Async; 1.339 + return self.callLater(0, self._doXHR, url, opts); 1.340 + }, 1.341 + 1.342 + _doXHR: function (url, opts) { 1.343 + var m = MochiKit.Base; 1.344 + opts = m.update({ 1.345 + method: 'GET', 1.346 + sendContent: '' 1.347 + /* 1.348 + queryString: undefined, 1.349 + username: undefined, 1.350 + password: undefined, 1.351 + headers: undefined, 1.352 + mimeType: undefined 1.353 + */ 1.354 + }, opts); 1.355 + var self = MochiKit.Async; 1.356 + var req = self.getXMLHttpRequest(); 1.357 + if (opts.queryString) { 1.358 + var qs = m.queryString(opts.queryString); 1.359 + if (qs) { 1.360 + url += "?" + qs; 1.361 + } 1.362 + } 1.363 + // Safari will send undefined:undefined, so we have to check. 1.364 + // We can't use apply, since the function is native. 1.365 + if ('username' in opts) { 1.366 + req.open(opts.method, url, true, opts.username, opts.password); 1.367 + } else { 1.368 + req.open(opts.method, url, true); 1.369 + } 1.370 + if (req.overrideMimeType && opts.mimeType) { 1.371 + req.overrideMimeType(opts.mimeType); 1.372 + } 1.373 + req.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 1.374 + if (opts.headers) { 1.375 + var headers = opts.headers; 1.376 + if (!m.isArrayLike(headers)) { 1.377 + headers = m.items(headers); 1.378 + } 1.379 + for (var i = 0; i < headers.length; i++) { 1.380 + var header = headers[i]; 1.381 + var name = header[0]; 1.382 + var value = header[1]; 1.383 + req.setRequestHeader(name, value); 1.384 + } 1.385 + } 1.386 + return self.sendXMLHttpRequest(req, opts.sendContent); 1.387 + }, 1.388 + 1.389 + _buildURL: function (url/*, ...*/) { 1.390 + if (arguments.length > 1) { 1.391 + var m = MochiKit.Base; 1.392 + var qs = m.queryString.apply(null, m.extend(null, arguments, 1)); 1.393 + if (qs) { 1.394 + return url + "?" + qs; 1.395 + } 1.396 + } 1.397 + return url; 1.398 + }, 1.399 + 1.400 + /** @id MochiKit.Async.doSimpleXMLHttpRequest */ 1.401 + doSimpleXMLHttpRequest: function (url/*, ...*/) { 1.402 + var self = MochiKit.Async; 1.403 + url = self._buildURL.apply(self, arguments); 1.404 + return self.doXHR(url); 1.405 + }, 1.406 + 1.407 + /** @id MochiKit.Async.loadJSONDoc */ 1.408 + loadJSONDoc: function (url/*, ...*/) { 1.409 + var self = MochiKit.Async; 1.410 + url = self._buildURL.apply(self, arguments); 1.411 + var d = self.doXHR(url, { 1.412 + 'mimeType': 'text/plain', 1.413 + 'headers': [['Accept', 'application/json']] 1.414 + }); 1.415 + d = d.addCallback(self.evalJSONRequest); 1.416 + return d; 1.417 + }, 1.418 + 1.419 + /** @id MochiKit.Async.wait */ 1.420 + wait: function (seconds, /* optional */value) { 1.421 + var d = new MochiKit.Async.Deferred(); 1.422 + var m = MochiKit.Base; 1.423 + if (typeof(value) != 'undefined') { 1.424 + d.addCallback(function () { return value; }); 1.425 + } 1.426 + var timeout = setTimeout( 1.427 + m.bind("callback", d), 1.428 + Math.floor(seconds * 1000)); 1.429 + d.canceller = function () { 1.430 + try { 1.431 + clearTimeout(timeout); 1.432 + } catch (e) { 1.433 + // pass 1.434 + } 1.435 + }; 1.436 + return d; 1.437 + }, 1.438 + 1.439 + /** @id MochiKit.Async.callLater */ 1.440 + callLater: function (seconds, func) { 1.441 + var m = MochiKit.Base; 1.442 + var pfunc = m.partial.apply(m, m.extend(null, arguments, 1)); 1.443 + return MochiKit.Async.wait(seconds).addCallback( 1.444 + function (res) { return pfunc(); } 1.445 + ); 1.446 + } 1.447 +}); 1.448 + 1.449 + 1.450 +/** @id MochiKit.Async.DeferredLock */ 1.451 +MochiKit.Async.DeferredLock = function () { 1.452 + this.waiting = []; 1.453 + this.locked = false; 1.454 + this.id = this._nextId(); 1.455 +}; 1.456 + 1.457 +MochiKit.Async.DeferredLock.prototype = { 1.458 + __class__: MochiKit.Async.DeferredLock, 1.459 + /** @id MochiKit.Async.DeferredLock.prototype.acquire */ 1.460 + acquire: function () { 1.461 + var d = new MochiKit.Async.Deferred(); 1.462 + if (this.locked) { 1.463 + this.waiting.push(d); 1.464 + } else { 1.465 + this.locked = true; 1.466 + d.callback(this); 1.467 + } 1.468 + return d; 1.469 + }, 1.470 + /** @id MochiKit.Async.DeferredLock.prototype.release */ 1.471 + release: function () { 1.472 + if (!this.locked) { 1.473 + throw TypeError("Tried to release an unlocked DeferredLock"); 1.474 + } 1.475 + this.locked = false; 1.476 + if (this.waiting.length > 0) { 1.477 + this.locked = true; 1.478 + this.waiting.shift().callback(this); 1.479 + } 1.480 + }, 1.481 + _nextId: MochiKit.Base.counter(), 1.482 + repr: function () { 1.483 + var state; 1.484 + if (this.locked) { 1.485 + state = 'locked, ' + this.waiting.length + ' waiting'; 1.486 + } else { 1.487 + state = 'unlocked'; 1.488 + } 1.489 + return 'DeferredLock(' + this.id + ', ' + state + ')'; 1.490 + }, 1.491 + toString: MochiKit.Base.forwardCall("repr") 1.492 + 1.493 +}; 1.494 + 1.495 +/** @id MochiKit.Async.DeferredList */ 1.496 +MochiKit.Async.DeferredList = function (list, /* optional */fireOnOneCallback, fireOnOneErrback, consumeErrors, canceller) { 1.497 + 1.498 + // call parent constructor 1.499 + MochiKit.Async.Deferred.apply(this, [canceller]); 1.500 + 1.501 + this.list = list; 1.502 + var resultList = []; 1.503 + this.resultList = resultList; 1.504 + 1.505 + this.finishedCount = 0; 1.506 + this.fireOnOneCallback = fireOnOneCallback; 1.507 + this.fireOnOneErrback = fireOnOneErrback; 1.508 + this.consumeErrors = consumeErrors; 1.509 + 1.510 + var cb = MochiKit.Base.bind(this._cbDeferred, this); 1.511 + for (var i = 0; i < list.length; i++) { 1.512 + var d = list[i]; 1.513 + resultList.push(undefined); 1.514 + d.addCallback(cb, i, true); 1.515 + d.addErrback(cb, i, false); 1.516 + } 1.517 + 1.518 + if (list.length === 0 && !fireOnOneCallback) { 1.519 + this.callback(this.resultList); 1.520 + } 1.521 + 1.522 +}; 1.523 + 1.524 +MochiKit.Async.DeferredList.prototype = new MochiKit.Async.Deferred(); 1.525 + 1.526 +MochiKit.Async.DeferredList.prototype._cbDeferred = function (index, succeeded, result) { 1.527 + this.resultList[index] = [succeeded, result]; 1.528 + this.finishedCount += 1; 1.529 + if (this.fired == -1) { 1.530 + if (succeeded && this.fireOnOneCallback) { 1.531 + this.callback([index, result]); 1.532 + } else if (!succeeded && this.fireOnOneErrback) { 1.533 + this.errback(result); 1.534 + } else if (this.finishedCount == this.list.length) { 1.535 + this.callback(this.resultList); 1.536 + } 1.537 + } 1.538 + if (!succeeded && this.consumeErrors) { 1.539 + result = null; 1.540 + } 1.541 + return result; 1.542 +}; 1.543 + 1.544 +/** @id MochiKit.Async.gatherResults */ 1.545 +MochiKit.Async.gatherResults = function (deferredList) { 1.546 + var d = new MochiKit.Async.DeferredList(deferredList, false, true, false); 1.547 + d.addCallback(function (results) { 1.548 + var ret = []; 1.549 + for (var i = 0; i < results.length; i++) { 1.550 + ret.push(results[i][1]); 1.551 + } 1.552 + return ret; 1.553 + }); 1.554 + return d; 1.555 +}; 1.556 + 1.557 +/** @id MochiKit.Async.maybeDeferred */ 1.558 +MochiKit.Async.maybeDeferred = function (func) { 1.559 + var self = MochiKit.Async; 1.560 + var result; 1.561 + try { 1.562 + var r = func.apply(null, MochiKit.Base.extend([], arguments, 1)); 1.563 + if (r instanceof self.Deferred) { 1.564 + result = r; 1.565 + } else if (r instanceof Error) { 1.566 + result = self.fail(r); 1.567 + } else { 1.568 + result = self.succeed(r); 1.569 + } 1.570 + } catch (e) { 1.571 + result = self.fail(e); 1.572 + } 1.573 + return result; 1.574 +}; 1.575 + 1.576 + 1.577 +MochiKit.Async.EXPORT = [ 1.578 + "AlreadyCalledError", 1.579 + "CancelledError", 1.580 + "BrowserComplianceError", 1.581 + "GenericError", 1.582 + "XMLHttpRequestError", 1.583 + "Deferred", 1.584 + "succeed", 1.585 + "fail", 1.586 + "getXMLHttpRequest", 1.587 + "doSimpleXMLHttpRequest", 1.588 + "loadJSONDoc", 1.589 + "wait", 1.590 + "callLater", 1.591 + "sendXMLHttpRequest", 1.592 + "DeferredLock", 1.593 + "DeferredList", 1.594 + "gatherResults", 1.595 + "maybeDeferred", 1.596 + "doXHR" 1.597 +]; 1.598 + 1.599 +MochiKit.Async.EXPORT_OK = [ 1.600 + "evalJSONRequest" 1.601 +]; 1.602 + 1.603 +MochiKit.Async.__new__ = function () { 1.604 + var m = MochiKit.Base; 1.605 + var ne = m.partial(m._newNamedError, this); 1.606 + 1.607 + ne("AlreadyCalledError", 1.608 + /** @id MochiKit.Async.AlreadyCalledError */ 1.609 + function (deferred) { 1.610 + /*** 1.611 + 1.612 + Raised by the Deferred if callback or errback happens 1.613 + after it was already fired. 1.614 + 1.615 + ***/ 1.616 + this.deferred = deferred; 1.617 + } 1.618 + ); 1.619 + 1.620 + ne("CancelledError", 1.621 + /** @id MochiKit.Async.CancelledError */ 1.622 + function (deferred) { 1.623 + /*** 1.624 + 1.625 + Raised by the Deferred cancellation mechanism. 1.626 + 1.627 + ***/ 1.628 + this.deferred = deferred; 1.629 + } 1.630 + ); 1.631 + 1.632 + ne("BrowserComplianceError", 1.633 + /** @id MochiKit.Async.BrowserComplianceError */ 1.634 + function (msg) { 1.635 + /*** 1.636 + 1.637 + Raised when the JavaScript runtime is not capable of performing 1.638 + the given function. Technically, this should really never be 1.639 + raised because a non-conforming JavaScript runtime probably 1.640 + isn't going to support exceptions in the first place. 1.641 + 1.642 + ***/ 1.643 + this.message = msg; 1.644 + } 1.645 + ); 1.646 + 1.647 + ne("GenericError", 1.648 + /** @id MochiKit.Async.GenericError */ 1.649 + function (msg) { 1.650 + this.message = msg; 1.651 + } 1.652 + ); 1.653 + 1.654 + ne("XMLHttpRequestError", 1.655 + /** @id MochiKit.Async.XMLHttpRequestError */ 1.656 + function (req, msg) { 1.657 + /*** 1.658 + 1.659 + Raised when an XMLHttpRequest does not complete for any reason. 1.660 + 1.661 + ***/ 1.662 + this.req = req; 1.663 + this.message = msg; 1.664 + try { 1.665 + // Strange but true that this can raise in some cases. 1.666 + this.number = req.status; 1.667 + } catch (e) { 1.668 + // pass 1.669 + } 1.670 + } 1.671 + ); 1.672 + 1.673 + 1.674 + this.EXPORT_TAGS = { 1.675 + ":common": this.EXPORT, 1.676 + ":all": m.concat(this.EXPORT, this.EXPORT_OK) 1.677 + }; 1.678 + 1.679 + m.nameFunctions(this); 1.680 + 1.681 +}; 1.682 + 1.683 +MochiKit.Async.__new__(); 1.684 + 1.685 +MochiKit.Base._exportSymbols(this, MochiKit.Async);