Closed Bug 607729 Opened 14 years ago Closed 14 years ago

IndexedDB: Allow IndexedDB events to propagate, and error events to hit window.error

Categories

(Core :: Storage: IndexedDB, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bent.mozilla, Assigned: bent.mozilla)

References

Details

Attachments

(1 file)

Attached patch Patch, v1Splinter Review
As per discussion, patch attached.
Attachment #486414 - Flags: review?(jonas)
Comment on attachment 486414 [details] [diff] [review]
Patch, v1

Make the event go to the transaction after the request.
Remove the new and existing event stuff from cursor/index/objectStore.
Remove onsuccess (function and member) from transaction/database.
Remove onblocked (function and member) from database. Blocked is fired at the request, no?

In MaybeDuplicate, don't copy the 'cancelable' flag. It should always be set to false. Cancelling the error event prevents rolling back when done on the request/transaction/database. However the error on the window is purely a error-reporting mechanism.

>diff --git a/dom/indexedDB/IDBEvents.cpp b/dom/indexedDB/IDBEvents.cpp
> IDBEvent::CreateGenericEvent(const nsAString& aType)
> {
>   nsRefPtr<nsDOMEvent> event(new nsDOMEvent(nsnull, nsnull));
>-  nsresult rv = event->InitEvent(aType, PR_FALSE, PR_FALSE);
>+  nsresult rv = event->InitEvent(aType, PR_TRUE, PR_TRUE);

Why TRUE/TRUE? I suspect this should remain FALSE/FALSE.


>@@ -213,18 +273,18 @@ IDBSuccessEvent::Create(IDBRequest* aReq
>-  nsresult rv = event->InitEvent(NS_LITERAL_STRING(SUCCESS_EVT_STR), PR_FALSE,
>-                                 PR_FALSE);
>+  nsresult rv = event->InitEvent(NS_LITERAL_STRING(SUCCESS_EVT_STR), PR_TRUE,
>+                                 PR_TRUE);

FALSE/FALSE here too.

>@@ -306,18 +366,18 @@ GetSuccessEvent::~GetSuccessEvent()
>-  nsresult rv = InitEvent(NS_LITERAL_STRING(SUCCESS_EVT_STR), PR_FALSE,
>-                          PR_FALSE);
>+  nsresult rv = InitEvent(NS_LITERAL_STRING(SUCCESS_EVT_STR), PR_TRUE,
>+                          PR_TRUE);

FALSE/FALSE

>@@ -520,17 +580,17 @@ IDBVersionChangeEvent::CreateInternal(ns
>-  nsresult rv = event->InitEvent(aType, PR_FALSE, PR_FALSE);
>+  nsresult rv = event->InitEvent(aType, PR_TRUE, PR_TRUE);

FALSE/FALSE


r=me with that fixed.
Attachment #486414 - Flags: review?(jonas) → review+
http://hg.mozilla.org/mozilla-central/rev/4211f1d517ed

The test was being a little flaky, I also landed these, hopefully they fix it:

http://hg.mozilla.org/mozilla-central/rev/bc78b38106e8
http://hg.mozilla.org/mozilla-central/rev/d7f4a4464ea1
http://hg.mozilla.org/mozilla-central/rev/9d15bba46bee
Status: ASSIGNED → RESOLVED
blocking2.0: betaN+ → ---
Closed: 14 years ago
Resolution: --- → FIXED
Depends on: 658637
Component: DOM → DOM: IndexedDB
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: