Bug 157283 - Indexing CSSStyleDeclaration object with out-of-range index should return undefined
Summary: Indexing CSSStyleDeclaration object with out-of-range index should return und...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: WebExposed
Depends on:
Blocks:
 
Reported: 2016-05-02 15:31 PDT by Chris Dumez
Modified: 2016-05-02 19:51 PDT (History)
5 users (show)

See Also:


Attachments
Patch (10.26 KB, patch)
2016-05-02 16:27 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-05-02 15:31:55 PDT
Indexed property getters returning a DOMString should not return undefined for out of bound access. Instead, it should behave like regular operations returning a DOMString or DOMString attribute getters. Namely, it should:
- Return null if the returned DOMString type is nullable
- Return the empty string otherwise

Firefox and Chrome seem to behave correctly but WebKit always returns undefined in this case.
Comment 1 Chris Dumez 2016-05-02 16:27:04 PDT
Created attachment 277943 [details]
Patch
Comment 2 Darin Adler 2016-05-02 18:03:05 PDT
Comment on attachment 277943 [details]
Patch

What is the compatibility risk to fixing this? How did you notice this?
Comment 3 Chris Dumez 2016-05-02 18:35:11 PDT
(In reply to comment #2)
> Comment on attachment 277943 [details]
> Patch
> 
> What is the compatibility risk to fixing this? How did you notice this?

I noticed it somewhat randomly when writing a layout test. I would assume the compatibility risk is very low as developers tend to not do out of range indexing, they usually access the length and iterate from 0 to length - 1. Also, Firefox behaves this way.
Comment 4 WebKit Commit Bot 2016-05-02 19:51:44 PDT
Comment on attachment 277943 [details]
Patch

Clearing flags on attachment: 277943

Committed r200358: <http://trac.webkit.org/changeset/200358>
Comment 5 WebKit Commit Bot 2016-05-02 19:51:51 PDT
All reviewed patches have been landed.  Closing bug.