commit 4aa81bd39f43d0c3e3056f3209c870ea3cb1d31a
parent 7dea22bd6e7bb0c53d55739c182324e65e44bb3b
Author: Simon Kornblith <simon@simonster.com>
Date: Fri, 17 Feb 2012 12:15:54 -0500
Fix option to force charset
Diffstat:
1 file changed, 19 insertions(+), 28 deletions(-)
diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js
@@ -43,6 +43,11 @@ Zotero.HTTP = new function() {
var channel = xmlhttp.channel;
channel.QueryInterface(Components.interfaces.nsIHttpChannelInternal);
channel.forceAllowThirdPartyCookie = true;
+
+ // Set charset
+ if (responseCharset) {
+ channel.contentCharset = responseCharset;
+ }
// Don't cache GET requests
xmlhttp.channel.loadFlags |= Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE;
@@ -94,34 +99,20 @@ Zotero.HTTP = new function() {
return false;
}
- // Workaround for "Accept third-party cookies" being off in Firefox 3.0.1
- // https://www.zotero.org/trac/ticket/1070
- if (Zotero.isFx30) {
- const Cc = Components.classes;
- const Ci = Components.interfaces;
- var ds = Cc["@mozilla.org/webshell;1"].
- createInstance(Components.interfaces.nsIDocShellTreeItem).
- QueryInterface(Ci.nsIInterfaceRequestor);
- ds.itemType = Ci.nsIDocShellTreeItem.typeContent;
- var xmlhttp = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
- createInstance(Ci.nsIXMLHttpRequest);
- xmlhttp.mozBackgroundRequest = true;
- xmlhttp.open("POST", url, true);
- xmlhttp.channel.loadGroup = ds.getInterface(Ci.nsILoadGroup);
- xmlhttp.channel.loadFlags |= Ci.nsIChannel.LOAD_DOCUMENT_URI;
- }
- else {
- var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
- .createInstance();
- // Prevent certificate/authentication dialogs from popping up
- xmlhttp.mozBackgroundRequest = true;
- xmlhttp.open('POST', url, true);
- // Send cookie even if "Allow third-party cookies" is disabled (>=Fx3.6 only)
- if (!Zotero.isFx35) {
- var channel = xmlhttp.channel;
- channel.QueryInterface(Components.interfaces.nsIHttpChannelInternal);
- channel.forceAllowThirdPartyCookie = true;
- }
+ var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
+ .createInstance();
+ // Prevent certificate/authentication dialogs from popping up
+ xmlhttp.mozBackgroundRequest = true;
+ xmlhttp.open('POST', url, true);
+
+ // 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 (responseCharset) {
+ channel.contentCharset = responseCharset;
}
if (headers) {