diff options
author | tyru | 2011-05-03 15:33:35 +0900 |
---|---|---|
committer | tyru | 2011-05-03 15:33:38 +0900 |
commit | f7f80e4488f07db0fd481aeaaad5b1264962c60e (patch) | |
tree | a87bdb544ecf6f9f63f506f44ac4ea1a737a9bc5 /_libly.js | |
parent | ac243eead73c4aa993493e4d254389e9a494c0da (diff) | |
download | vimperator-plugins-f7f80e4488f07db0fd481aeaaad5b1264962c60e.tar.bz2 |
handle a exception thrown from this.transport.onreadystatechange
Diffstat (limited to '_libly.js')
-rw-r--r-- | _libly.js | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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(); |