Fx60: Switch to new XMLHttpRequest()

This commit is contained in:
Dan Stillman 2018-02-25 12:55:54 -05:00
parent c0da6c0427
commit 6fd879fc16
4 changed files with 9 additions and 14 deletions

View file

@ -333,8 +333,7 @@ Zotero.File = new function(){
* Runs synchronously, so should only be run on local (e.g. chrome) URLs
*/
function getContentsFromURL(url) {
var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance();
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', url, false);
xmlhttp.overrideMimeType("text/plain");
xmlhttp.send(null);

View file

@ -175,8 +175,7 @@ Zotero.HTTP = new function() {
var deferred = Zotero.Promise.defer();
if (!this.mock) {
var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance();
var xmlhttp = new XMLHttpRequest();
}
else {
var xmlhttp = new this.mock;
@ -456,8 +455,7 @@ Zotero.HTTP = new function() {
return false;
}
var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance();
var xmlhttp = new XMLHttpRequest();
// Prevent certificate/authentication dialogs from popping up
xmlhttp.mozBackgroundRequest = true;
@ -530,8 +528,7 @@ Zotero.HTTP = new function() {
return false;
}
var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance();
var xmlhttp = new XMLHttpRequest();
// Prevent certificate/authentication dialogs from popping up
xmlhttp.mozBackgroundRequest = true;
xmlhttp.open('POST', url, true);
@ -608,8 +605,7 @@ Zotero.HTTP = new function() {
// Workaround for "Accept third-party cookies" being off in Firefox 3.0.1
// https://www.zotero.org/trac/ticket/1070
var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance();
var xmlhttp = new XMLHttpRequest();
// Prevent certificate/authentication dialogs from popping up
xmlhttp.mozBackgroundRequest = true;
xmlhttp.open('HEAD', url, true);
@ -656,8 +652,7 @@ Zotero.HTTP = new function() {
return false;
}
var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance();
var xmlhttp = new XMLHttpRequest();
// Prevent certificate/authentication dialogs from popping up
xmlhttp.mozBackgroundRequest = true;
xmlhttp.open('OPTIONS', uri.spec, true);

View file

@ -47,7 +47,7 @@ Zotero.OpenURL = new function() {
* Queries OCLC's OpenURL resolver registry and returns an address and version
*/
function discoverResolvers() {
var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();
var req = new XMLHttpRequest();
req.open("GET", "http://worldcatlibraries.org/registry/lookup?IP=requestor", false);
req.send(null);

View file

@ -24,6 +24,7 @@
*/
// Commonly used imports accessible anywhere
Components.utils.importGlobalProperties(["XMLHttpRequest"]);
Components.utils.import("resource://zotero/config.js");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
@ -239,7 +240,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
Zotero.browser = "g";
Zotero.Intl.init();
Zotero.Prefs.init();
Zotero.Debug.init(options && options.forceDebugLog);