@@ -272,14 +272,14 @@ Nextcloud.prototype = {
272272 // XXX: replace this with a better function
273273 let successCb = function ( ) {
274274 let folderExists = function ( exists ) {
275- if ( exists ) {
276- aRequestObserver . onStopRequest ( null , this , Cr . NS_OK ) ;
277- }
278- else {
279- aRequestObserver . onStopRequest ( null , this , Ci . nsIMsgCloudFileProvider . authErr ) ;
280- }
281- } . bind ( this ) ;
282- this . _checkFolderExists ( folderExists ) ;
275+ if ( exists ) {
276+ aRequestObserver . onStopRequest ( null , this , Cr . NS_OK ) ;
277+ }
278+ else {
279+ aRequestObserver . onStopRequest ( null , this , Ci . nsIMsgCloudFileProvider . authErr ) ;
280+ }
281+ } . bind ( this ) ;
282+ this . _checkFolderExists ( folderExists ) ;
283283 } . bind ( this ) ;
284284
285285 let failureCb = function ( ) {
@@ -306,7 +306,7 @@ Nextcloud.prototype = {
306306 return this . _maxFileSize ;
307307 } ,
308308 get remainingFileSpace ( ) {
309- return this . _totalStorage > 0 : this . _totalStorage - this . _fileSpaceUsed : - 1 ;
309+ return this . _totalStorage > 0 ? this . _totalStorage - this . _fileSpaceUsed : - 1 ;
310310 } ,
311311 get fileSpaceUsed ( ) {
312312 return this . _fileSpaceUsed ;
@@ -413,7 +413,8 @@ Nextcloud.prototype = {
413413 req . open ( "GET" , this . _serverUrl + ":" + this . _serverPort + kAuthPath + args , true ) ;
414414 req . setRequestHeader ( "Content-Type" , "application/x-www-form-urlencoded" ) ;
415415 req . setRequestHeader ( "OCS-APIREQUEST" , "true" ) ;
416- req . setRequestHeader ( "Authorization" , "Basic " + btoa ( this . _userName + ':' + this . _password ) ) ;
416+ req . setRequestHeader ( "Authorization" ,
417+ "Basic " + btoa ( this . _userName + ':' + this . _password ) ) ;
417418
418419 req . onerror = function ( ) {
419420 this . log . info ( "logon failure" ) ;
@@ -496,7 +497,7 @@ Nextcloud.prototype = {
496497 * ending states of the upload.
497498 * @private
498499 */
499- _finishUpload : function nsNc__finishUpload ( aFile , aCallback ) {
500+ _finishUpload : function nsNc_finishUpload ( aFile , aCallback ) {
500501 let exceedsQuota = Ci . nsIMsgCloudFileProvider . uploadWouldExceedQuota ;
501502 if ( ( this . _totalStorage > 0 ) && ( aFile . fileSize > this . remainingFileSpace ) ) {
502503 return aCallback . onStopRequest ( null , null , exceedsQuota ) ;
@@ -523,7 +524,7 @@ Nextcloud.prototype = {
523524 * @param failureCallback the function called if information retrieval fails
524525 * @private
525526 */
526- _getUserInfo : function nsNc__getUserInfo ( successCallback , failureCallback ) {
527+ _getUserInfo : function nsNc_getUserInfo ( successCallback , failureCallback ) {
527528 if ( ! successCallback ) {
528529 successCallback = function ( ) {
529530 this . requestObserver
@@ -589,49 +590,52 @@ Nextcloud.prototype = {
589590 * @returns {NodeList|number }
590591 * @private
591592 */
592- _getQuota : function nsNc__getUserQuota ( req , davVariable ) {
593+ _getQuota : function nsNc_getUserQuota ( req , davVariable ) {
593594 let quota = req . documentElement . getElementsByTagNameNS ( "DAV:" , davVariable ) ;
594595 return quota && quota . length && Number ( quota [ 0 ] . textContent ) || - 1 ;
595596 } ,
596597
597598 /**
598- * A private function that checks that the folder entered in the
599- * settings screen exists on the server.
600- *
601- * @param callback callback function called with true or false as an argument
602- */
603- _checkFolderExists : function nsOwncloud_checkFolderExists ( callback ) {
604- if ( this . _storageFolder !== '/' ) {
605- let body = '<propfind xmlns="DAV:">' +
606- '<prop>' +
607- '<resourcetype />' +
608- '</prop>' +
609- '</propfind>' ;
610-
611- let req = Cc [ "@mozilla.org/xmlextras/xmlhttprequest;1" ]
612- . createInstance ( Ci . nsIXMLHttpRequest ) ;
613-
614- req . open ( "PROPFIND" , this . _serverUrl + kWebDavPath + ( "/" + this . _storageFolder + "/" ) . replace ( / \/ + / g, '/' ) , true , this . _userName , this . _password ) ;
615- req . onerror = function ( ) {
616- this . log . info ( "failure checking folder" ) ;
617- callback ( false ) ;
618- } . bind ( this ) ;
619-
620- req . onload = function ( ) {
621- if ( req . status === 207 ) {
622- return callback ( true ) ;
623- }
624- else {
625- return callback ( false ) ;
626- }
627- } . bind ( this ) ;
628-
629- req . send ( body ) ;
630- }
631- else {
632- return callback ( true ) ;
633- }
634- } ,
599+ * A private function which makes sure that the folder entered in the
600+ * settings screen exists on the server.
601+ *
602+ * @param callback callback function called with true or false as an argument
603+ * @private
604+ */
605+ _checkFolderExists : function nsNc_checkFolderExists ( callback ) {
606+ if ( this . _storageFolder !== '/' ) {
607+ let body = '<propfind xmlns="DAV:">' +
608+ '<prop>' +
609+ '<resourcetype />' +
610+ '</prop>' +
611+ '</propfind>' ;
612+
613+ let req = Cc [ "@mozilla.org/xmlextras/xmlhttprequest;1" ]
614+ . createInstance ( Ci . nsIXMLHttpRequest ) ;
615+
616+ req . open ( "PROPFIND" , this . _serverUrl + kWebDavPath +
617+ ( "/" + this . _storageFolder + "/" ) . replace ( / \/ + / g, '/' ) , true , this . _userName ,
618+ this . _password ) ;
619+ req . onerror = function ( ) {
620+ this . log . info ( "Failed to check if folder exists" ) ;
621+ callback ( false ) ;
622+ } . bind ( this ) ;
623+
624+ req . onload = function ( ) {
625+ if ( req . status === 207 ) {
626+ return callback ( true ) ;
627+ }
628+ else {
629+ return callback ( false ) ;
630+ }
631+ } . bind ( this ) ;
632+
633+ req . send ( body ) ;
634+ }
635+ else {
636+ return callback ( true ) ;
637+ }
638+ } ,
635639
636640 /**
637641 * A private function that first ensures that the user is logged in, and then
0 commit comments