diff --git a/chrome/content/zotero/xpcom/file.js b/chrome/content/zotero/xpcom/file.js index c28217e6e..84d3982c0 100644 --- a/chrome/content/zotero/xpcom/file.js +++ b/chrome/content/zotero/xpcom/file.js @@ -332,8 +332,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); diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js index 6b7591947..c8ee5ee5a 100644 --- a/chrome/content/zotero/xpcom/http.js +++ b/chrome/content/zotero/xpcom/http.js @@ -158,8 +158,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; @@ -367,8 +366,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; @@ -441,8 +439,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); @@ -519,8 +516,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); @@ -567,8 +563,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); @@ -737,8 +732,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('MKCOL', uri.spec, true); @@ -769,8 +763,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("DELETE", uri.spec, true); diff --git a/chrome/content/zotero/xpcom/openurl.js b/chrome/content/zotero/xpcom/openurl.js index b7b32c3fc..bb0e1116c 100644 --- a/chrome/content/zotero/xpcom/openurl.js +++ b/chrome/content/zotero/xpcom/openurl.js @@ -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); diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index ed097ace9..95eeb1964 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -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"); @@ -267,8 +268,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); // Set the locale direction to Zotero.dir // DEBUG: is there a better way to get the entity from JS? - var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"] - .createInstance(); + var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET', 'chrome://global/locale/global.dtd', false); xmlhttp.overrideMimeType('text/plain'); xmlhttp.send(null);