www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 2b8c28ccaf7af8485981cf6df85140fac2cfcd5f
parent 5e237a27230f0fd961718eadd4c90ee9d81345b4
Author: Simon Kornblith <simon@simonster.com>
Date:   Wed,  3 Apr 2013 14:37:02 -0400

Support file:/// URIs in Zotero.HTTP.promise()

Diffstat:
Mchrome/content/zotero/xpcom/http.js | 29+++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js @@ -121,18 +121,20 @@ Zotero.HTTP = new function() { } // Send cookie even if "Allow third-party cookies" is disabled (>=Fx3.6 only) - var channel = xmlhttp.channel; - channel.QueryInterface(Components.interfaces.nsIHttpChannelInternal); - channel.forceAllowThirdPartyCookie = true; - - // Set charset - if (options && options.responseCharset) { - channel.contentCharset = responseCharset; - } - - // Disable caching if requested - if(options && options.dontCache) { - channel.loadFlags |= Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE; + var channel = xmlhttp.channel, + isFile = channel instanceof Components.interfaces.nsIFileChannel; + if(channel instanceof Components.interfaces.nsIHttpChannelInternal) { + channel.forceAllowThirdPartyCookie = true; + + // Set charset + if (options && options.responseCharset) { + channel.contentCharset = responseCharset; + } + + // Disable caching if requested + if(options && options.dontCache) { + channel.loadFlags |= Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE; + } } // Set responseType @@ -155,6 +157,9 @@ Zotero.HTTP = new function() { if (options && options.successCodes) { var success = options.successCodes.indexOf(status) != -1; } + else if(isFile) { + var success = status == 200 || status == 0; + } else { var success = status >= 200 && status < 300; }