diff --git a/chrome/content/zotero/xpcom/file.js b/chrome/content/zotero/xpcom/file.js index 72c6647c82..af7feb4813 100644 --- a/chrome/content/zotero/xpcom/file.js +++ b/chrome/content/zotero/xpcom/file.js @@ -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); diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js index 56baa55ced..3404621264 100644 --- a/chrome/content/zotero/xpcom/http.js +++ b/chrome/content/zotero/xpcom/http.js @@ -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); diff --git a/chrome/content/zotero/xpcom/openurl.js b/chrome/content/zotero/xpcom/openurl.js index a96175ebba..9e6ad0bf78 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 bcbda180f2..c8d2c20b7a 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"); @@ -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);