Fix option to force charset

This commit is contained in:
Simon Kornblith 2012-02-17 12:15:54 -05:00
parent 7dea22bd6e
commit 4aa81bd39f

View file

@ -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) {