WeaveSvc_wipeServer: async + async/yield -> sync. Fix up chrome uses of wipeServer, resetClient, wipeRemote, wipeClient.
authorEdward Lee <edilee@mozilla.com>
Fri, 05 Jun 2009 22:21:27 -0700
changeset 45533 5fd6fe1fd76b1821ecc94b8ab10d2fdb66aa63be
parent 45532 48d3eb25f43facfb9cfecb5483dcd2bfda1d762d
child 45534 9d87f626e88dbcfe265b0cd248d9bcb2f66169cc
push id14033
push useredward.lee@engineering.uiuc.edu
push dateWed, 23 Jun 2010 22:21:35 +0000
treeherdermozilla-central@227db4ad8cdf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
WeaveSvc_wipeServer: async + async/yield -> sync. Fix up chrome uses of wipeServer, resetClient, wipeRemote, wipeClient.
services/sync/modules/service.js
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -969,39 +969,35 @@ WeaveSvc.prototype = {
     }
   },
 
   _freshStart: function WeaveSvc__freshStart() {
     let self = yield;
     this.resetClient();
     this._log.info("Reset client data from freshStart.");
     this._log.info("Client metadata wiped, deleting server data");
-    yield this.wipeServer(self.cb);
+    this.wipeServer();
 
     this._log.debug("Uploading new metadata record");
     meta = new WBORecord(this.clusterURL + this.username + "/meta/global");
     this._log.debug("Setting meta payload storage version to " + WEAVE_VERSION);
     meta.payload.storageVersion = WEAVE_VERSION;
     meta.payload.syncID = Clients.syncID;
     let res = new Resource(meta.uri);
     res.put(meta.serialize());
   },
 
   /**
    * Wipe all user data from the server.
    *
-   * @param onComplete
-   *        Callback when this method completes
    * @param engines [optional]
    *        Array of engine names to wipe. If not given, all engines are used.
    */
-  wipeServer: function WeaveSvc_wipeServer(onComplete, engines) {
-    let fn = function WeaveSvc__wipeServer() {
-      let self = yield;
-
+  wipeServer: function WeaveSvc_wipeServer(engines)
+    this._catch(this._notify("wipe-server", "", function() {
       // Grab all the collections for the user
       let userURL = this.clusterURL + this.username + "/";
       let res = new Resource(userURL);
       res.get();
 
       // Get the array of collections and delete each one
       let allCollections = JSON.parse(res.data);
       for each (let name in allCollections) {
@@ -1011,19 +1007,17 @@ WeaveSvc.prototype = {
             continue;
 
           new Resource(userURL + name).delete();
         }
         catch(ex) {
           this._log.debug("Exception on wipe of '" + name + "': " + Utils.exceptionStr(ex));
         }
       }
-    };
-    this._catchAll(this._notifyAsync("wipe-server", "", fn)).async(this, onComplete);
-  },
+    }))(),
 
   /**
    * Wipe all local user data.
    *
    * @param engines [optional]
    *        Array of engine names to wipe. If not given, all engines are used.
    */
   wipeClient: function WeaveSvc_wipeClient(engines)