Bug 92069 - IndexedDB: IDBTransaction::abort() should throw DOMException if "finished"
Summary: IndexedDB: IDBTransaction::abort() should throw DOMException if "finished"
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-23 23:56 PDT by Xingnan Wang
Modified: 2012-07-25 19:31 PDT (History)
8 users (show)

See Also:


Attachments
Patch (5.58 KB, patch)
2012-07-24 00:02 PDT, Xingnan Wang
no flags Details | Formatted Diff | Diff
Patch (5.69 KB, patch)
2012-07-24 00:40 PDT, Xingnan Wang
no flags Details | Formatted Diff | Diff
Patch (6.69 KB, patch)
2012-07-24 22:56 PDT, Xingnan Wang
no flags Details | Formatted Diff | Diff
Patch (6.69 KB, patch)
2012-07-24 22:59 PDT, Xingnan Wang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Xingnan Wang 2012-07-24 00:02:36 PDT
Created attachment 153971 [details]
Patch
Comment 2 Kentaro Hara 2012-07-24 00:23:43 PDT
Comment on attachment 153971 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=153971&action=review

> Source/WebCore/ChangeLog:7
> +

Please add the spec link to this ChangeLog.

> Source/WebCore/ChangeLog:8
> +        Update storage/indexeddb/resources/transaction-abort.js to cover this case.

In WebKit convention, we write this line like this:

    Test: storage/indexeddb/transaction-abort.html

> Source/WebCore/Modules/indexeddb/IDBTransaction.cpp:196
> +void IDBTransaction::abort(ExceptionCode& ec)

We do not want two abort() methods if possible. How about just changing the current 'void abort()' to 'void abort(ExceptionCode& ec)'?
Comment 3 Xingnan Wang 2012-07-24 00:34:34 PDT
Comment on attachment 153971 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=153971&action=review

Hi Kentaro,
    Thanks for your so quick response.

>> Source/WebCore/ChangeLog:7
>> +
> 
> Please add the spec link to this ChangeLog.

All right.

>> Source/WebCore/ChangeLog:8
>> +        Update storage/indexeddb/resources/transaction-abort.js to cover this case.
> 
> In WebKit convention, we write this line like this:
> 
>     Test: storage/indexeddb/transaction-abort.html

Got it.

>> Source/WebCore/Modules/indexeddb/IDBTransaction.cpp:196
>> +void IDBTransaction::abort(ExceptionCode& ec)
> 
> We do not want two abort() methods if possible. How about just changing the current 'void abort()' to 'void abort(ExceptionCode& ec)'?

abort() also needs to be called internally without throw exception, so I add another abort(ExceptionCode& ec) for external calling. If I just change abort() to abort(ExceptionCode& ec), all the points of call abort() need to be modified.
Comment 4 Xingnan Wang 2012-07-24 00:40:28 PDT
Created attachment 153978 [details]
Patch
Comment 5 Kentaro Hara 2012-07-24 00:44:28 PDT
(In reply to comment #3)
> abort() also needs to be called internally without throw exception, so I add another abort(ExceptionCode& ec) for external calling. If I just change abort() to abort(ExceptionCode& ec), all the points of call abort() need to be modified.

Makes sense.

The patch LGTM. If jsbell@ says OK, I'm happy to r+ it.
Comment 6 Xingnan Wang 2012-07-24 00:51:48 PDT
(In reply to comment #5)
> (In reply to comment #3)
> > abort() also needs to be called internally without throw exception, so I add another abort(ExceptionCode& ec) for external calling. If I just change abort() to abort(ExceptionCode& ec), all the points of call abort() need to be modified.
> 
> Makes sense.
> 
> The patch LGTM. If jsbell@ says OK, I'm happy to r+ it.

Thank you.
Comment 7 Joshua Bell 2012-07-24 08:01:25 PDT
Comment on attachment 153978 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=153978&action=review

Another nice catch. LGTM with one minor tweak.

> Source/WebCore/Modules/indexeddb/IDBTransaction.h:82
> +    bool abort();

Can you move this out of the "Implement the IDBTransaction IDL" set of methods, down with "setActive" and other non-IDL methods?
Comment 8 Joshua Bell 2012-07-24 08:06:53 PDT
(In reply to comment #3)
> > We do not want two abort() methods if possible. How about just changing the current 'void abort()' to 'void abort(ExceptionCode& ec)'?
> 
> abort() also needs to be called internally without throw exception, so I add another abort(ExceptionCode& ec) for external calling. If I just change abort() to abort(ExceptionCode& ec), all the points of call abort() need to be modified.

We could name the new IDL method implementation something else (e.g. abortMethod ? I can't think of anything good right now) and add an IDL attribute like we do for methods where there's a C++ keyword collision, e.g. for IDBCursor.continue:

 [ImplementedAs=continueFunction] void continue( ... ) raises ( ... );

I'd also be fine with renaming the "internal" abort something else. (We have a foo/fooInternal naming convention, but that's usually for private static impls of callbacks.)
Comment 9 Alec Flett 2012-07-24 09:33:18 PDT
I vote for a single abort() - change all the internal callers to use it, and ignore the result:

ExceptionCode unused;
transaction->abort(unused)
Comment 10 Joshua Bell 2012-07-24 09:37:20 PDT
(In reply to comment #9)
> I vote for a single abort() - change all the internal callers to use it, and ignore the result:
> 
> ExceptionCode unused;
> transaction->abort(unused)

That sounds good to me as well, possibly with a comment in the abort() code that it is idempotent for internal callers if they ignore the exception code.
Comment 11 Xingnan Wang 2012-07-24 22:56:16 PDT
Created attachment 154260 [details]
Patch
Comment 12 Xingnan Wang 2012-07-24 22:59:25 PDT
Created attachment 154262 [details]
Patch
Comment 13 Kentaro Hara 2012-07-24 23:00:42 PDT
Comment on attachment 154262 [details]
Patch

Looks OK
Comment 14 WebKit Review Bot 2012-07-25 19:30:55 PDT
Comment on attachment 154262 [details]
Patch

Clearing flags on attachment: 154262

Committed r123698: <http://trac.webkit.org/changeset/123698>
Comment 15 WebKit Review Bot 2012-07-25 19:31:00 PDT
All reviewed patches have been landed.  Closing bug.