Bug 938406 - DataStoreService.jsm must emit 'datastore-first-revision-created' also when the first revision already exists., r=ehsan
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 05 Dec 2013 21:07:13 +0000
changeset 173777 53a630e3ed5e6181a55b63ff15ff7573db018d44
parent 173776 53f77d87a3ab7b98688702be79e27aeda1069ef1
child 173778 fbc0b4c30fd0fb53e5613e747ab5b9263170919a
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs938406
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 938406 - DataStoreService.jsm must emit 'datastore-first-revision-created' also when the first revision already exists., r=ehsan
dom/datastore/DataStoreService.js
--- a/dom/datastore/DataStoreService.js
+++ b/dom/datastore/DataStoreService.js
@@ -131,17 +131,20 @@ DataStoreService.prototype = {
     db.revisionTxn(
       'readwrite',
       function(aTxn, aRevisionStore) {
         debug("createFirstRevisionId - transaction success");
 
         let request = aRevisionStore.openCursor(null, 'prev');
         request.onsuccess = function(aEvent) {
           let cursor = aEvent.target.result;
-          if (!cursor) {
+          if (cursor) {
+            ppmm.broadcastAsyncMessage('datastore-first-revision-created',
+                                       { name: aName, owner: aOwner });
+          } else {
             // If the revision doesn't exist, let's create the first one.
             db.addRevision(aRevisionStore, 0, REVISION_VOID, function() {
               debug("First revision created.");
               if (aName in self.stores && aAppId in self.stores[aName]) {
                 self.stores[aName][aAppId].enabled = true;
                 ppmm.broadcastAsyncMessage('datastore-first-revision-created',
                                            { name: aName, owner: aOwner });
               }