diff options
author | Guillaume Viguier-Just <guillaume@viguierjust.com> | 2018-09-19 18:30:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-19 18:30:24 +0300 |
commit | dc2453cb44d301cbcf079f1e285860f51a76eb3f (patch) | |
tree | d92a72b99ddcb60a10aba5dc888342792aa9636e | |
parent | 219cc1f444489a83f5ef0cb882fbf91a0f239105 (diff) | |
parent | 2db37548b094a2c3b9ca1749b195d99688f2ef5a (diff) |
Merge pull request #59 from uli-heller/thunderbird-60
Compatibility with thunderbird-60, fixes #55
-rw-r--r-- | src/components/nsNextcloud.js | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/components/nsNextcloud.js b/src/components/nsNextcloud.js index 69af4fa..e5bc7e3 100644 --- a/src/components/nsNextcloud.js +++ b/src/components/nsNextcloud.js @@ -35,6 +35,7 @@ Cu.import("resource:///modules/oauth.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource:///modules/gloda/log4moz.js"); Cu.import("resource:///modules/cloudFileAccounts.js"); +Cu.importGlobalProperties(["XMLHttpRequest"]); const kRestBase = "/ocs/v1.php"; const kAuthPath = kRestBase + "/cloud/user"; @@ -435,8 +436,7 @@ Nextcloud.prototype = { this.log.info("Sending login information..."); let args = "?format=json"; - let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"] - .createInstance(Ci.nsIXMLHttpRequest); + let req = new XMLHttpRequest(Ci.nsIXMLHttpRequest); req.open("GET", this._fullUrl + kAuthPath + args, true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); @@ -575,8 +575,7 @@ Nextcloud.prototype = { '</prop>' + '</propfind>'; - let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance( - Ci.nsIXMLHttpRequest); + let req = new XMLHttpRequest(Ci.nsIXMLHttpRequest); req.open("PROPFIND", this._fullUrl + kWebDavPath, true, this._userName, this._password); @@ -638,8 +637,7 @@ Nextcloud.prototype = { '</prop>' + '</propfind>'; - let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"] - .createInstance(Ci.nsIXMLHttpRequest); + let req = new XMLHttpRequest(Ci.nsIXMLHttpRequest); req.open("PROPFIND", this._fullUrl + kWebDavPath + ("/" + this._storageFolder + "/").replace(/\/+/g, '/'), true, this._userName, @@ -674,8 +672,7 @@ Nextcloud.prototype = { */ _createFolder: function createFolder(callback) { if (this._storageFolder !== '/') { - let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"] - .createInstance(Ci.nsIXMLHttpRequest); + let req = new XMLHttpRequest(Ci.nsIXMLHttpRequest); req.open("MKCOL", this._fullUrl + kWebDavPath + ("/" + this._storageFolder + "/").replace(/\/+/g, '/'), true, this._userName, @@ -778,8 +775,7 @@ NextcloudFileUploader.prototype = { bufStream = bufStream.QueryInterface(Ci.nsIInputStream); let contentLength = fstream.available(); - let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance( - Ci.nsIXMLHttpRequest); + let req = new XMLHttpRequest(Ci.nsIXMLHttpRequest); req.open("PUT", url, true, this._userName, this._password); @@ -835,8 +831,7 @@ NextcloudFileUploader.prototype = { this.file = aFile; let shareType = 3; let args = "?format=json"; - let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"] - .createInstance(Ci.nsIXMLHttpRequest); + let req = new XMLHttpRequest(Ci.nsIXMLHttpRequest); let path = wwwFormUrlEncode( ("/" + this.nextcloud._storageFolder + "/").replace(/\/+/g, '/') + this._fileUploadTS[this.file.path] + "_" + this.file.leafName); |