Bug 58365 - IndexedDB createIndex should fail if name arg is null
Summary: IndexedDB createIndex should fail if name arg is null
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-12 12:46 PDT by Mark Pilgrim (Google)
Modified: 2011-04-28 14:22 PDT (History)
6 users (show)

See Also:


Attachments
test case (1.71 KB, text/html)
2011-04-12 12:46 PDT, Mark Pilgrim (Google)
no flags Details
Patch (6.72 KB, patch)
2011-04-27 18:52 PDT, Mark Pilgrim (Google)
no flags Details | Formatted Diff | Diff
Throw NON_TRANSIENT_ERR instead (6.73 KB, patch)
2011-04-27 20:16 PDT, Mark Pilgrim (Google)
no flags Details | Formatted Diff | Diff
Patch for landing (5.47 KB, patch)
2011-04-28 11:21 PDT, Tony Chang
no flags Details | Formatted Diff | Diff
Patch for landing (7.78 KB, patch)
2011-04-28 11:26 PDT, Tony Chang
no flags Details | Formatted Diff | Diff
Patch for landing (7.01 KB, patch)
2011-04-28 11:43 PDT, Tony Chang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Pilgrim (Google) 2011-04-12 12:46:01 PDT
Created attachment 89248 [details]
test case

According to http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#widl-IDBObjectStore-createIndex , the name argument of createIndex must not be null, and objectStore.createIndex(null, null) must throw a CONSTRAINT_ERR. WebKit does not throw an exception. Layout test attached.
Comment 1 Mark Pilgrim (Google) 2011-04-27 18:47:55 PDT
Root problem was in the IDL file, we need to ensure that a null DOMString is treated as null (otherwise it gets serialized as the 4-character string "null"). After that, a basic isNull() check works as expected in ::createIndex().
Comment 2 Mark Pilgrim (Google) 2011-04-27 18:52:23 PDT
Created attachment 91404 [details]
Patch
Comment 3 David Grogan 2011-04-27 19:25:08 PDT
Comment on attachment 91404 [details]
Patch

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

r+

> Source/WebCore/storage/IDBObjectStore.idl:31
> +        readonly attribute [ConvertNullStringTo=Null] DOMString name;

I wonder why this was left off initially.  It seems to be ok though.
Comment 4 Mark Pilgrim (Google) 2011-04-27 20:16:41 PDT
Created attachment 91415 [details]
Throw NON_TRANSIENT_ERR instead

Updated patch similar to bug 58465 -- Firefox throws NON_TRANSIENT_ERR, not CONSTRAINT_ERR, when name arg is null.
Comment 5 David Grogan 2011-04-27 20:18:43 PDT
Comment on attachment 91415 [details]
Throw NON_TRANSIENT_ERR instead

r+
Comment 6 WebKit Commit Bot 2011-04-28 10:02:52 PDT
Comment on attachment 91415 [details]
Throw NON_TRANSIENT_ERR instead

Rejecting attachment 91415 [details] from commit-queue.

Failed to run "['./Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=cr-jail-8', 'apply-..." exit_code: 2

Last 500 characters of output:
eate-index-null-name.html
patch unexpectedly ends in middle of line
patch: **** malformed patch at line 69:  

fatal: pathspec 'LayoutTests/storage/indexeddb/mozilla/create-index-null-name.html' did not match any files
Failed to git add LayoutTests/storage/indexeddb/mozilla/create-index-null-name.html. at /mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply line 438.

Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', u'--reviewer', u'Tony Chang', u'--force']" exit_code: 2

Full output: http://queues.webkit.org/results/8519429
Comment 7 Mark Pilgrim (Google) 2011-04-28 11:01:27 PDT
What just happened?
Comment 8 Tony Chang 2011-04-28 11:14:06 PDT
Comment on attachment 91415 [details]
Throw NON_TRANSIENT_ERR instead

Looks like the patch failed to apply, although I'm not sure why (it says it's malformed, but it looks fine to me).

Let's try again.
Comment 9 WebKit Commit Bot 2011-04-28 11:15:17 PDT
Comment on attachment 91415 [details]
Throw NON_TRANSIENT_ERR instead

Rejecting attachment 91415 [details] from commit-queue.

Failed to run "['./Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=cr-jail-8', 'apply-..." exit_code: 2

Last 500 characters of output:
eate-index-null-name.html
patch unexpectedly ends in middle of line
patch: **** malformed patch at line 69:  

fatal: pathspec 'LayoutTests/storage/indexeddb/mozilla/create-index-null-name.html' did not match any files
Failed to git add LayoutTests/storage/indexeddb/mozilla/create-index-null-name.html. at /mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply line 438.

Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', u'--reviewer', u'Tony Chang', u'--force']" exit_code: 2

Full output: http://queues.webkit.org/results/8514702
Comment 10 Tony Chang 2011-04-28 11:21:37 PDT
Created attachment 91521 [details]
Patch for landing
Comment 11 Tony Chang 2011-04-28 11:22:24 PDT
Turns out the diff was missing an newline at the end of the file.  This confused patch and prevented the diff from being applied.

I've uploaded a fixed diff for landing.
Comment 12 Tony Chang 2011-04-28 11:25:03 PDT
Comment on attachment 91521 [details]
Patch for landing

Crap, forgot to add the .html file.
Comment 13 Tony Chang 2011-04-28 11:26:26 PDT
Created attachment 91523 [details]
Patch for landing
Comment 14 Mark Pilgrim (Google) 2011-04-28 11:27:47 PDT
No idea how that happened. Thanks, Tony.
Comment 15 Tony Chang 2011-04-28 11:28:02 PDT
Comment on attachment 91523 [details]
Patch for landing

hmm, the expected file is wrong.
Comment 16 Mark Pilgrim (Google) 2011-04-28 11:29:40 PDT
OK, let me start over. I'll upload a new patch ASAP.
Comment 17 Tony Chang 2011-04-28 11:32:42 PDT
(In reply to comment #16)
> OK, let me start over. I'll upload a new patch ASAP.

Sorry, I just uploaded an incorrect expected file (I ran patch twice so the new file was duplicated).  If you have a fixed diff, feel free to upload.
Comment 18 Mark Pilgrim (Google) 2011-04-28 11:37:11 PDT
No, I have nothing yet. I was finishing up another bug's patch. If you'd like to fix it, please do.
Comment 19 Tony Chang 2011-04-28 11:43:24 PDT
Created attachment 91529 [details]
Patch for landing
Comment 20 WebKit Commit Bot 2011-04-28 14:11:12 PDT
The commit-queue encountered the following flaky tests while processing attachment 91529 [details]:

animations/suspend-resume-animation.html bug 48161 (authors: cmarrin@apple.com and simon.fraser@apple.com)
The commit-queue is continuing to process your patch.
Comment 21 WebKit Commit Bot 2011-04-28 14:12:56 PDT
Comment on attachment 91529 [details]
Patch for landing

Clearing flags on attachment: 91529

Committed r85238: <http://trac.webkit.org/changeset/85238>
Comment 22 WebKit Commit Bot 2011-04-28 14:13:02 PDT
All reviewed patches have been landed.  Closing bug.
Comment 23 WebKit Commit Bot 2011-04-28 14:22:01 PDT
The commit-queue encountered the following flaky tests while processing attachment 91529 [details]:

animations/suspend-resume-animation.html bug 48161 (authors: cmarrin@apple.com and simon.fraser@apple.com)
The commit-queue is continuing to process your patch.