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
+
+
+
+
+
+
+
+