diff --git a/dom/datastore/DataStore.jsm b/dom/datastore/DataStore.jsm index 45884bf2f260..c3c665acb479 100644 --- a/dom/datastore/DataStore.jsm +++ b/dom/datastore/DataStore.jsm @@ -458,104 +458,6 @@ this.DataStore.prototype = { return this._revisionId; }, - getChanges: function(aRevisionId) { - debug("GetChanges: " + aRevisionId); - - if (aRevisionId === null || aRevisionId === undefined) { - return this._window.Promise.reject( - new this._window.DOMError("SyntaxError", "Invalid revisionId")); - } - - let self = this; - - // Promise - return new this._window.Promise(function(aResolve, aReject) { - debug("GetChanges promise started"); - self._db.revisionTxn( - 'readonly', - function(aTxn, aStore) { - debug("GetChanges transaction success"); - - let request = self._db.getInternalRevisionId( - aRevisionId, - aStore, - function(aInternalRevisionId) { - if (aInternalRevisionId == undefined) { - aResolve(undefined); - return; - } - - // This object is the return value of this promise. - // Initially we use maps, and then we convert them in array. - let changes = { - revisionId: '', - addedIds: {}, - updatedIds: {}, - removedIds: {} - }; - - let request = aStore.mozGetAll(IDBKeyRange.lowerBound(aInternalRevisionId, true)); - request.onsuccess = function(aEvent) { - for (let i = 0; i < aEvent.target.result.length; ++i) { - let data = aEvent.target.result[i]; - - switch (data.operation) { - case REVISION_ADDED: - changes.addedIds[data.objectId] = true; - break; - - case REVISION_UPDATED: - // We don't consider an update if this object has been added - // or if it has been already modified by a previous - // operation. - if (!(data.objectId in changes.addedIds) && - !(data.objectId in changes.updatedIds)) { - changes.updatedIds[data.objectId] = true; - } - break; - - case REVISION_REMOVED: - let id = data.objectId; - - // If the object has been added in this range of revisions - // we can ignore it and remove it from the list. - if (id in changes.addedIds) { - delete changes.addedIds[id]; - } else { - changes.removedIds[id] = true; - } - - if (id in changes.updatedIds) { - delete changes.updatedIds[id]; - } - break; - } - } - - // The last revisionId. - if (aEvent.target.result.length) { - changes.revisionId = aEvent.target.result[aEvent.target.result.length - 1].revisionId; - } - - // From maps to arrays. - changes.addedIds = Object.keys(changes.addedIds).map(function(aKey) { return parseInt(aKey, 10); }); - changes.updatedIds = Object.keys(changes.updatedIds).map(function(aKey) { return parseInt(aKey, 10); }); - changes.removedIds = Object.keys(changes.removedIds).map(function(aKey) { return parseInt(aKey, 10); }); - - let wrappedObject = ObjectWrapper.wrap(changes, self._window); - aResolve(wrappedObject); - }; - } - ); - }, - function(aEvent) { - debug("GetChanges transaction failed"); - aReject(createDOMError(self._window, aEvent)); - } - ); - }); - }, - getLength: function() { let self = this; diff --git a/dom/datastore/tests/file_basic.html b/dom/datastore/tests/file_basic.html index addff1283c63..f6a8084429a7 100644 --- a/dom/datastore/tests/file_basic.html +++ b/dom/datastore/tests/file_basic.html @@ -39,7 +39,6 @@ ok("remove" in store, "store.remove exists"); ok("clear" in store, "store.clear exists"); ok("revisionId" in store, "store.revisionId exists"); - ok("getChanges" in store, "store.getChanges exists"); ok("getLength" in store, "store.getLength exists"); ok("sync" in store, "store.sync exists"); diff --git a/dom/datastore/tests/file_revision.html b/dom/datastore/tests/file_revision.html deleted file mode 100644 index 8781412145b7..000000000000 --- a/dom/datastore/tests/file_revision.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - Test for DataStore - basic operation on a readonly db - - -

- -
-  
-
- - - diff --git a/dom/datastore/tests/mochitest.ini b/dom/datastore/tests/mochitest.ini index cf3056acfce1..a13df2499244 100644 --- a/dom/datastore/tests/mochitest.ini +++ b/dom/datastore/tests/mochitest.ini @@ -3,7 +3,6 @@ support-files = file_app_install.html file_readonly.html file_basic.html - file_revision.html file_changes.html file_changes2.html file_app.sjs @@ -16,7 +15,6 @@ support-files = [test_app_install.html] [test_readonly.html] [test_basic.html] -[test_revision.html] [test_changes.html] [test_arrays.html] [test_oop.html] diff --git a/dom/datastore/tests/test_revision.html b/dom/datastore/tests/test_revision.html deleted file mode 100644 index 23846c8469b7..000000000000 --- a/dom/datastore/tests/test_revision.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Test for DataStore - basic operation on a readonly db - - - - -

- -
-  
-
- - - diff --git a/dom/webidl/DataStore.webidl b/dom/webidl/DataStore.webidl index 320bb0ddd503..f2372d9ed7c7 100644 --- a/dom/webidl/DataStore.webidl +++ b/dom/webidl/DataStore.webidl @@ -39,22 +39,12 @@ interface DataStore : EventTarget { attribute EventHandler onchange; - // Promise - Promise getChanges(DOMString revisionId); - // Promise Promise getLength(); DataStoreCursor sync(optional DOMString revisionId = ""); }; -dictionary DataStoreChanges { - DOMString revisionId; - sequence addedIds; - sequence updatedIds; - sequence removedIds; -}; - [Pref="dom.datastore.enabled", JSImplementation="@mozilla.org/dom/datastore-cursor;1"] interface DataStoreCursor {