Bug 92988 - itemType[index] must be undefined for out-of-range index
Summary: itemType[index] must be undefined for out-of-range index
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 92986
  Show dependency treegraph
 
Reported: 2012-08-02 07:10 PDT by Arko Saha
Modified: 2012-08-07 00:00 PDT (History)
11 users (show)

See Also:


Attachments
Patch (17.19 KB, patch)
2012-08-03 04:39 PDT, Arko Saha
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from gce-cr-linux-04 (499.91 KB, application/zip)
2012-08-03 05:41 PDT, WebKit Review Bot
no flags Details
Patch for review (deleted)
2012-08-03 06:50 PDT, Arko Saha
no flags Details | Formatted Diff | Diff
Updated patch (24.68 KB, patch)
2012-08-03 08:34 PDT, Arko Saha
haraken: review+
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (24.71 KB, patch)
2012-08-06 21:54 PDT, Arko Saha
arko: commit-queue-
Details | Formatted Diff | Diff
Patch_for_landing_1 (21.60 KB, patch)
2012-08-06 22:27 PDT, Arko Saha
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arko Saha 2012-08-02 07:10:52 PDT
Fail- itemType[index] must be undefined for out-of-range index assert_equals: expected (undefined) undefined but got (object) null

Sample test:
test(function () {
    assert_equals( makeEl('div',{itemtype:' '}).itemType[0], window.undefined );
}, 'itemType[index] must be undefined for out-of-range index');


Expected result: itemTpye[0] should return undefined.
Actual: Returns null.

makeEl method creates an element <div> with empty itemtype(0 tokens).

According to the spec itemtpye attribute is a space-separated list. http://www.whatwg.org/specs/web-apps/current-work/#attr-itemtype
We have defined itemtype attribute as :
readonly attribute [Conditional=MICRODATA] DOMSettableTokenList itemType;

itemType[index] should return undefined for out-of-range index instead of null.

IndexedGetter spec: http://dev.w3.org/2006/webapi/WebIDL/#idl-indexed-properties

Same issue can also be observed with following attributes:
itemref,
itemprop
Comment 1 Arko Saha 2012-08-03 04:39:29 PDT
Created attachment 156326 [details]
Patch
Comment 2 WebKit Review Bot 2012-08-03 05:41:09 PDT
Comment on attachment 156326 [details]
Patch

Attachment 156326 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13425636

New failing tests:
storage/indexeddb/objectstore-basics-workers.html
storage/indexeddb/database-basics.html
storage/indexeddb/objectstore-basics.html
Comment 3 WebKit Review Bot 2012-08-03 05:41:13 PDT
Created attachment 156336 [details]
Archive of layout-test-results from gce-cr-linux-04

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: gce-cr-linux-04  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Comment 4 Arko Saha 2012-08-03 06:50:51 PDT
Created attachment 156358 [details]
Patch for review
Comment 5 Kentaro Hara 2012-08-03 07:08:14 PDT
Comment on attachment 156358 [details]
Patch for review

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

You change is conformed to the spec, but this will break backward compatibility of WebKit.

How are Firefox, Opera, IE behave? (Please add the explanation to ChangeLog.)

> Source/WebCore/ChangeLog:9
> +        Made changes in IndexedGetter property so that it returns undefined for out-of-range
> +        index.

Please add the spec link (http://www.w3.org/TR/WebIDL/#idl-indexed-properties) to ChangeLog.
Comment 6 Arko Saha 2012-08-03 08:34:41 PDT
Created attachment 156388 [details]
Updated patch
Comment 7 Arko Saha 2012-08-03 08:37:40 PDT
(In reply to comment #5)
> (From update of attachment 156358 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=156358&action=review
> 
> You change is conformed to the spec, but this will break backward compatibility of WebKit.
> 
> How are Firefox, Opera, IE behave? (Please add the explanation to ChangeLog.)

Firefox and Opera's behavior is consistent with the spec. Both returns undefined for out-of-range index.
Tested on:
Firefox: 11.0
Opera: 12.01

> > Source/WebCore/ChangeLog:9
> > +        Made changes in IndexedGetter property so that it returns undefined for out-of-range
> > +        index.
> 
> Please add the spec link (http://www.w3.org/TR/WebIDL/#idl-indexed-properties) to ChangeLog.

Done.
Comment 8 Kentaro Hara 2012-08-03 08:47:34 PDT
Comment on attachment 156388 [details]
Updated patch

Thank you very much for the clarification. Sounds reasonable to make this change.

But let's wait to cq+ it for one more day because someone might have concern about breaking the backward compatibility.
Comment 9 Alexey Proskuryakov 2012-08-03 10:33:12 PDT
> > How are Firefox, Opera, IE behave? (Please add the explanation to ChangeLog.)
> 
> Firefox and Opera's behavior is consistent with the spec. Both returns undefined for out-of-range index.
> Tested on:
> Firefox: 11.0
> Opera: 12.01

Did you provide an answer about IE?
Comment 10 Arko Saha 2012-08-04 08:43:10 PDT
(In reply to comment #9)
> Did you provide an answer about IE?

Observed the same behavior in IE. It returns undefined for out-of-range index.
Tested on IE9.
Comment 11 Ryosuke Niwa 2012-08-06 14:19:06 PDT
Has this patch been landed?
Comment 12 Arko Saha 2012-08-06 21:29:40 PDT
(In reply to comment #11)
> Has this patch been landed?

I haven't landed the patch as I was waiting to check if anyone has anymore concern. Looks like its ok to land the patch now.
Comment 13 Kentaro Hara 2012-08-06 21:30:15 PDT
Comment on attachment 156388 [details]
Updated patch

Yes
Comment 14 WebKit Review Bot 2012-08-06 21:32:27 PDT
Comment on attachment 156388 [details]
Updated patch

Rejecting attachment 156388 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 1

ERROR: /mnt/git/webkit-commit-queue/LayoutTests/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).

Full output: http://queues.webkit.org/results/13441921
Comment 15 Kentaro Hara 2012-08-06 21:33:54 PDT
Comment on attachment 156388 [details]
Updated patch

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

> LayoutTests/ChangeLog:5
> +

The "Reviewed by" line is needed here. Would you upload the patch again?
Comment 16 Arko Saha 2012-08-06 21:54:58 PDT
Created attachment 156859 [details]
Patch for landing
Comment 17 Arko Saha 2012-08-06 22:17:09 PDT
Comment on attachment 156859 [details]
Patch for landing

Patch for fast/dom/MicroData/domsettabletokenlist-attributes-out-of-range-index.html is incorrect.
Comment 18 Arko Saha 2012-08-06 22:27:53 PDT
Created attachment 156865 [details]
Patch_for_landing_1
Comment 19 WebKit Review Bot 2012-08-07 00:00:25 PDT
Comment on attachment 156865 [details]
Patch_for_landing_1

Clearing flags on attachment: 156865

Committed r124859: <http://trac.webkit.org/changeset/124859>
Comment 20 WebKit Review Bot 2012-08-07 00:00:31 PDT
All reviewed patches have been landed.  Closing bug.