# HG changeset patch # Parent 1ab6b9a0939bc91f43752c8e6c3ab98b9e153060 # User Andrea Marchesini Bug 924125 - DataStore API is always returning empty objects diff --git a/dom/datastore/DataStore.jsm b/dom/datastore/DataStore.jsm --- a/dom/datastore/DataStore.jsm +++ b/dom/datastore/DataStore.jsm @@ -142,19 +142,21 @@ this.DataStore.prototype = { // Creation of the results array. let results = new Array(aIds.length); // We're going to create this amount of requests. let pendingIds = aIds.length; let indexPos = 0; + let self = this; + function getInternalSuccess(aEvent, aPos) { debug("GetInternal success. Record: " + aEvent.target.result); - results[aPos] = aEvent.target.result; + results[aPos] = ObjectWrapper.wrap(aEvent.target.result, self._window); if (!--pendingIds) { aCallback(results); return; } if (indexPos < aIds.length) { // Just MAX_REQUESTS requests at the same time. let count = 0; diff --git a/dom/datastore/tests/file_bug924104.html b/dom/datastore/tests/file_bug924104.html new file mode 100644 --- /dev/null +++ b/dom/datastore/tests/file_bug924104.html @@ -0,0 +1,77 @@ + + + + + Test for bug 924104 + + +
+ + + diff --git a/dom/datastore/tests/mochitest.ini b/dom/datastore/tests/mochitest.ini --- a/dom/datastore/tests/mochitest.ini +++ b/dom/datastore/tests/mochitest.ini @@ -6,17 +6,19 @@ support-files = file_revision.html file_changes.html file_changes2.html file_app.sjs file_app.template.webapp file_app2.template.webapp file_arrays.html file_sync.html + file_bug924104.html [test_app_install.html] [test_readonly.html] [test_basic.html] [test_revision.html] [test_changes.html] [test_arrays.html] [test_oop.html] [test_sync.html] +[test_bug924104.html] diff --git a/dom/datastore/tests/test_basic.html b/dom/datastore/tests/test_bug924104.html copy from dom/datastore/tests/test_basic.html copy to dom/datastore/tests/test_bug924104.html --- a/dom/datastore/tests/test_basic.html +++ b/dom/datastore/tests/test_bug924104.html @@ -1,21 +1,21 @@ - Test for DataStore - basic operation on a readonly db + Test bug 924104