aboutsummaryrefslogtreecommitdiffstats
path: root/_libly.js
diff options
context:
space:
mode:
authoranekos2011-05-03 07:04:16 -0700
committeranekos2011-05-03 07:04:16 -0700
commit41951ab91a0c1072724347e6c1594f669888a7e4 (patch)
tree6646a62f972a7559367e23583ed36244a7bf0740 /_libly.js
parentac243eead73c4aa993493e4d254389e9a494c0da (diff)
parent6974c188200faec5160d63d3fa3684b3116892de (diff)
downloadvimperator-plugins-41951ab91a0c1072724347e6c1594f669888a7e4.tar.bz2
Merge pull request #9 from tyru/detect-ldr-auth.
subscldr.jsでLDRにログインしてなかったらそれとわかるメッセージを出すように
Diffstat (limited to '_libly.js')
-rw-r--r--_libly.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/_libly.js b/_libly.js
index 4f96654..b62e34a 100644
--- a/_libly.js
+++ b/_libly.js
@@ -544,7 +544,14 @@ libly.Request.prototype = {
this.transport = new XMLHttpRequest();
this.transport.open(method, this.url, this.options.asynchronous, this.options.username, this.options.password);
- this.transport.onreadystatechange = libly.$U.bind(this, this._onStateChange);
+ var stateChangeException;
+ this.transport.onreadystatechange = libly.$U.bind(this, function () {
+ try {
+ this._onStateChange();
+ } catch (e) {
+ stateChangeException = e;
+ }
+ });
this.setRequestHeaders();
this.transport.overrideMimeType('text/html; charset=' + this.options.encoding);
@@ -552,6 +559,8 @@ libly.Request.prototype = {
this.transport.send(this.body);
+ if (!this.options.asynchronous && stateChangeException) throw stateChangeException;
+
// Force Firefox to handle ready state 4 for synchronous requests
if (!this.options.asynchronous && this.transport.overrideMimeType)
this._onStateChange();