WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
102514
Remove IDBDatabaseException
https://bugs.webkit.org/show_bug.cgi?id=102514
Summary
Remove IDBDatabaseException
Erik Arvidsson
Reported
2012-11-16 07:54:33 PST
We should be using DOMException instead
Attachments
Patch
(200.71 KB, patch)
2012-11-19 16:00 PST
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Patch
(189.54 KB, patch)
2012-11-19 17:24 PST
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Patch
(190.70 KB, patch)
2012-11-20 09:39 PST
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Patch
(193.18 KB, patch)
2012-11-20 12:02 PST
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Patch for landing
(193.80 KB, patch)
2012-11-21 10:48 PST
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Joshua Bell
Comment 1
2012-11-16 09:58:09 PST
arv@ - did you have any specific implementation thoughts here, or is this just a tracking bug?
Erik Arvidsson
Comment 2
2012-11-16 11:15:07 PST
My first thought was to just change to DOMException but it seems we should use DOMError for idb?
Joshua Bell
Comment 3
2012-11-16 11:23:06 PST
There are a couple places where DOMError is used (IDBRequest.error) for asynchronous error reporting, but most synchronous error handling in the spec does just have methods throw DOMExceptions. There are IDB-specific exception types, which in WebIDL/DOM4/spec parlance are e.g. "throw a DOMException of type ConstraintError". Right now we use IDBDatabaseException.CONSTRAINT_ERR like all of the legacy modules do, and there are various layers of indirection that map that to a DOMException with code = CONSTRAINT_ERR and name = "ConstraintError", but it would be nice to simplify that. To align with the spec: * we shouldn't be exposing the IDBDatabaseException interface * the codes should be 0 for IDB-specific exception types We'd like to do the above in the next couple of weeks - the big time sink will be updating tests.
Joshua Bell
Comment 4
2012-11-19 16:00:31 PST
Created
attachment 175067
[details]
Patch
Joshua Bell
Comment 5
2012-11-19 16:02:25 PST
alecflett@, dgrogan@ - general sanity check? abarth@ - could you take a look at the binding "InFile" changes around DOMException? NOTE: This can't land until some tests on the Chromium side have been disabled, as they use IDBDatabaseException from script.
Adam Barth
Comment 6
2012-11-19 16:06:46 PST
Comment on
attachment 175067
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=175067&action=review
> Source/WebCore/bindings/scripts/InFilesCompiler.pm:207 > + my $noInterface = $parsedItems{$itemName}{"noInterface"}; > + next if $noInterface;
This is the wrong layer at which to process this property. You should teach the exception specific backends about noInterface.
Joshua Bell
Comment 7
2012-11-19 16:22:33 PST
(In reply to
comment #6
)
> (From update of
attachment 175067
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=175067&action=review
> > > Source/WebCore/bindings/scripts/InFilesCompiler.pm:207 > > + my $noInterface = $parsedItems{$itemName}{"noInterface"}; > > + next if $noInterface; > > This is the wrong layer at which to process this property. You should teach the exception specific backends about noInterface.
Hrm. This is the code generating the binding code's ExceptionHeaders.h file which is essentially a list of lines such as #include "V8IDBDatabaseException.h"; with the rest of this change that file doesn't (and shouldn't) exist. Basically, I need to make IDBDatabaseException only "visible" to the files make_dom_exceptions.pl generates directly (ExceptionCodeDescription.h/.cpp). Several approaches occur to me: * make_dom_exceptions.pl's generateCode() filter out "noInterface" items before calling into the InFileCompiler's methods, by mutating $parsedItemsRef. * make this more abstract by implementing a variant of conditional without the requirement of being wrapped in USE(). Seems like overkill. * leave the IDBDatabaseException.idl around but simply not expose it via document/worker (leaving the clean-up for later) Does the first seem reasonable?
Adam Barth
Comment 8
2012-11-19 16:36:23 PST
Comment on
attachment 175067
[details]
Patch So, the problem is that there is an IDBDatabaseException.h but no IDBDatabaseException.idl... You probably need to restructure how make_dom_exceptions.pl works. It was written with the assumption that there is a one-to-one correspondence between the CPP and IDL worlds.
Adam Barth
Comment 9
2012-11-19 16:37:48 PST
Why does DOMExceptions.in need to list IDBDatabaseException at all if there isn't an IDL interface for it?
Adam Barth
Comment 10
2012-11-19 16:41:19 PST
Looks like the output of this in file is only used in V8ThrowException::setDOMException and the JSC bindings' setDOMException.
Joshua Bell
Comment 11
2012-11-19 16:42:39 PST
(In reply to
comment #9
)
> Why does DOMExceptions.in need to list IDBDatabaseException at all if there isn't an IDL interface for it?
When an ExceptionCode is being translated into a DOMException, to assign a name and description, a generated list of static methods are called with the code and can create the description or indicate it's not handled. See gen/webkit/ExceptionCodeDescription.cpp ExceptionCodeDescription::ExceptionCodeDescription Even though IDBDatabaseException is being removed as an IDL interface it still needs to participate in this description mechanism. (Ideally we'd replace ExceptionCode with a class that allows assigning a name/description directly.)
Erik Arvidsson
Comment 12
2012-11-19 16:52:02 PST
Maybe we should do
bug 102726
first? Then we can add the IDB exceptions to that and map the code to 0 for these?
Joshua Bell
Comment 13
2012-11-19 16:54:14 PST
(In reply to
comment #12
)
> Maybe we should do
bug 102726
first? Then we can add the IDB exceptions to that and map the code to 0 for these?
If we think that will happen soon I can remove the "tricky" bits of this patch, which I was thinking of doing anyway - leave the IDL in place even though it will disappear from script. The tests can still all be updated, which will help validate 102726.
Adam Barth
Comment 14
2012-11-19 16:55:43 PST
I'm not sure what the best thing to do here is. You're breaking a basic assumption that the InFileCompiler makes about how things work. It's likely that you'll want to significantly restructure things. Teaching the InFileCompiler.pm about noInterface seems a bit like papering over the structural part of this change.
Joshua Bell
Comment 15
2012-11-19 16:58:57 PST
(In reply to
comment #14
)
> Teaching the InFileCompiler.pm about noInterface seems a bit like papering over the structural part of this change.
I completely agree. See my suggestion above: "make_dom_exceptions.pl's generateCode() filter out "noInterface" items before calling into the InFileCompiler's methods, by mutating $parsedItemsRef." - that would remove any changes to InFileCompiler, all changes would be localized to make_dom_exceptions ... but arv's suggestion is the end-goal anyway. I'll upload a new patch soonish.
Joshua Bell
Comment 16
2012-11-19 17:24:03 PST
Created
attachment 175089
[details]
Patch
Joshua Bell
Comment 17
2012-11-19 17:25:29 PST
New patch just does the "easy" part and hides the interface from script, updates the codes, and all the tests. It leaves the cleanup for later. Still need to disable some Chromium tests before landing, though.
David Grogan
Comment 18
2012-11-19 17:34:01 PST
Comment on
attachment 175089
[details]
Patch lgtm Do all evalAndExpectException calls now have "0" as the second parameter? If so, evalAndExpectException is IDB-specific, we could remove that parameter.
Joshua Bell
Comment 19
2012-11-19 19:36:10 PST
(In reply to
comment #18
)
> (From update of
attachment 175089
[details]
) > lgtm > > Do all evalAndExpectException calls now have "0" as the second parameter? If so, evalAndExpectException is IDB-specific, we could remove that parameter.
Some places throw DOMExceptions with codes so they should be tested for. We could make the expectation of 0 "quiet" though.
Joshua Bell
Comment 20
2012-11-20 09:37:18 PST
(In reply to
comment #19
)
> > Do all evalAndExpectException calls now have "0" as the second parameter? If so, evalAndExpectException is IDB-specific, we could remove that parameter. > > Some places throw DOMExceptions with codes so they should be tested for.
Yeah, 147 places look for "0" now, 143 places look for a DOMException constant.
> We could make the expectation of 0 "quiet" though.
... but I'd suggest doing that later.
Joshua Bell
Comment 21
2012-11-20 09:39:36 PST
Created
attachment 175233
[details]
Patch
Joshua Bell
Comment 22
2012-11-20 09:50:44 PST
Should add tests for these to storage/indexeddb/removed.html: shouldBeFalse("'IDBDatabaseException' in self"); shouldBeFalse("'errorCode' in indexeddb.open('')");
Joshua Bell
Comment 23
2012-11-20 12:02:26 PST
Created
attachment 175258
[details]
Patch
Joshua Bell
Comment 24
2012-11-20 15:47:01 PST
Okay, Chromium side is out of the way, and this is reduced to just IDB code/test changes. r? anyone?
Adam Barth
Comment 25
2012-11-20 16:06:22 PST
Comment on
attachment 175258
[details]
Patch rs=me There's still some more clean up to do here to remove the IDBException interface from the codebase.
WebKit Review Bot
Comment 26
2012-11-21 10:21:56 PST
Comment on
attachment 175258
[details]
Patch Rejecting
attachment 175258
[details]
from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2 Last 500 characters of output: e-flag-expected.txt patching file LayoutTests/storage/indexeddb/transaction-basics-expected.txt patching file LayoutTests/storage/indexeddb/transaction-complete-workers-expected.txt patching file LayoutTests/storage/indexeddb/transaction-error-expected.txt patching file LayoutTests/storage/indexeddb/transaction-read-only-expected.txt Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', u'--force', u'--reviewer', u'Adam Barth']" exit_code: 1 cwd: /mnt/git/webkit-commit-queue Full output:
http://queues.webkit.org/results/14961026
Joshua Bell
Comment 27
2012-11-21 10:48:53 PST
Created
attachment 175481
[details]
Patch for landing
WebKit Review Bot
Comment 28
2012-11-21 12:14:23 PST
Comment on
attachment 175481
[details]
Patch for landing Clearing flags on attachment: 175481 Committed
r135424
: <
http://trac.webkit.org/changeset/135424
>
WebKit Review Bot
Comment 29
2012-11-21 12:14:29 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug