Closed Bug 962516 Opened 7 years ago Closed 7 years ago

datastore.add breaks if a record with an existing id is added

Categories

(Core :: DOM: Device Interfaces, defect)

x86
Gonk (Firefox OS)
defect
Not set
major

Tracking

()

RESOLVED FIXED
1.3 C3/1.4 S3(31jan)
blocking-b2g 1.3+
Tracking Status
firefox27 --- wontfix
firefox28 --- fixed
firefox29 --- fixed
b2g-v1.3 --- fixed
b2g-v1.4 --- fixed

People

(Reporter: jmcf, Assigned: baku)

References

Details

Attachments

(1 file)

This exception appears on the console, instead of reporting an error through the promise error function. 

E/GeckoConsole( 1817): [JavaScript Error: "aEvent.target is undefined" {file: "resource://gre/modules/DataStore.jsm" line: 39}]
Blocks: 950295
Attached patch add.patchSplinter Review
Attachment #8363641 - Flags: review?(ehsan)
Blocks: 916089
blocking-b2g: 1.3? → 1.3+
Comment on attachment 8363641 [details] [diff] [review]
add.patch

Review of attachment 8363641 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/datastore/DataStore.jsm
@@ -35,5 @@
>                                     "nsIMessageSender");
>  
>  /* Helper functions */
>  function createDOMError(aWindow, aEvent) {
> -  return new aWindow.DOMError(aEvent.target.error.name);

Oh, I see now that IndexedDBHelper.newTxn does this for us...  Sorry I didn't spot this in previous reviews.

::: dom/datastore/tests/file_duplicate.html
@@ +12,5 @@
> +  var gEvent;
> +  var gChangeId;
> +
> +  function is(a, b, msg) {
> +    alert((a === b ? 'OK' : 'KO') + ' ' + msg)

Nit: this can be:

function is(a, b, msg) {
  ok(a === b, msg);
}
Attachment #8363641 - Flags: review?(ehsan) → review+
You need to log in before you can comment on or make changes to this bug.