From 0f3efaf5c6fbe27d71d0cd95dd6e7fc701b0a150 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Thu, 23 Jan 2014 19:31:01 +0000 Subject: [PATCH] Bug 962516 - DataStore add() returns an error if the key is duplicated, r=ehsan --- dom/datastore/DataStore.jsm | 2 +- dom/datastore/tests/file_duplicate.html | 75 ++++++++++++++ dom/datastore/tests/mochitest.ini | 2 + dom/datastore/tests/test_duplicate.html | 128 ++++++++++++++++++++++++ 4 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 dom/datastore/tests/file_duplicate.html create mode 100644 dom/datastore/tests/test_duplicate.html diff --git a/dom/datastore/DataStore.jsm b/dom/datastore/DataStore.jsm index 115642ee56ad..a4418d3f8570 100644 --- a/dom/datastore/DataStore.jsm +++ b/dom/datastore/DataStore.jsm @@ -36,7 +36,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "cpmm", /* Helper functions */ function createDOMError(aWindow, aEvent) { - return new aWindow.DOMError(aEvent.target.error.name); + return new aWindow.DOMError(aEvent); } function throwInvalidArg(aWindow) { diff --git a/dom/datastore/tests/file_duplicate.html b/dom/datastore/tests/file_duplicate.html new file mode 100644 index 000000000000..3a45c2535b99 --- /dev/null +++ b/dom/datastore/tests/file_duplicate.html @@ -0,0 +1,75 @@ + + + + + Test for DataStore - duplicate keys + + +
+ + + diff --git a/dom/datastore/tests/mochitest.ini b/dom/datastore/tests/mochitest.ini index abc78f3862f0..cf65f24ce777 100644 --- a/dom/datastore/tests/mochitest.ini +++ b/dom/datastore/tests/mochitest.ini @@ -13,6 +13,7 @@ support-files = file_bug924104.html file_certifiedApp.html file_keys.html + file_duplicate.html [test_app_install.html] [test_readonly.html] @@ -24,3 +25,4 @@ support-files = [test_bug924104.html] [test_certifiedApp.html] [test_keys.html] +[test_duplicate.html] diff --git a/dom/datastore/tests/test_duplicate.html b/dom/datastore/tests/test_duplicate.html new file mode 100644 index 000000000000..1f14f9a74b95 --- /dev/null +++ b/dom/datastore/tests/test_duplicate.html @@ -0,0 +1,128 @@ + + + + + Test for DataStore - duplicate keys + + + + +
+ + +