[Webkit-unassigned] [Bug 112320] New: [V8] String return value of IndexGetter should be equals to that of item() in case of index out of range

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 13 22:11:23 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=112320

           Summary: [V8] String return value of IndexGetter should be
                    equals to that of item() in case of index out of range
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: WebCore JavaScript
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: kojih at chromium.org
                CC: haraken at chromium.org, nbarth at chromium.org


There are 4 IDLs with attribute [IndexedGetter] and return type of its item method is [TreatReturnedNullStringAs=Null] DOMString, 
but its implementation returns undefined instead of null in case of index out of range.

According to the spec, XXX[i] should be equals to XXX.item(i).
http://trac.webkit.org/wiki/WebKitIDL#IndexedGetter

Also from code generator view point, code generator will become cleaner than current implementation that handles the case specially.

Changing behavior may cause problem to existing web but I think this case(index out of range) might be trivial.
How do you think about it?


** Detail **

Behavior of index getter and item() on Chrome(26.0.1410.28 beta), FireFox(19.0.2) and Opera(12.14).

[MediaList]
var styleElement  = document.createElement('style');
styleElement.setAttribute('media', 'screen, print');
document.documentElement.appendChild(styleElement)
var mediaList = document.styleSheets[document.styleSheets.length - 1].media;
mediaList[-1]                       // Chrome: undefined   FireFox: Exception     Opera: undefined
mediaList[100000]                   // Chrome: undefined   FireFox: undefined     Opera: null
mediaList.item(-1)                  // Chrome: null        FireFox: null          Opera: null
mediaList.item(100000)              // Chrome: null        FireFox: null          Opera: null

(According to the spec, mediaList[-1] and mediaList[100000] should be null)

[DOMStringList]
LayoutTests/storage/indexeddb/database-basics.html
db.objectStoreNames[-1]             // Chrome: undefined   FireFox: undefined  Opera: Not supported
db.objectStoreNames[1000000]        // Chrome: undefined   FireFox: undefined  Opera: Not supported
db.objectStoreNames.item(-1)        // Chrome: null        FireFox: null       Opera: Not supported
db.objectStoreNames.item(1000000)   // Chrome: null        FireFox: null       Opera: Not supported

(Same as above)

[DOMSettableTokenList]
element = document.createElement('output');
element.htmlFor[100000]             // Chrome: undefined    FireFox: undefined  Opera: No htmlFor
element.htmlFor[-1]                 // Chrome: undefined    FireFox: undefined  Opera: No htmlFor
element.htmlFor.item(100000)        // Chrome: null         FireFox: null       Opera: No htmlFor
element.htmlFor.item(-1)            // Chrome: null         FireFox: null       Opera: No htmlFor

[DOMTokenList]
element = document.createElement('span');
element.classList[100000]           // Chrome: undefined    FireFox: undefined  Opera: undefined
element.classList[-1]               // Chrome: undefined    FireFox: undefined  Opera: undefined
element.classList.item(100000)      // Chrome: null         FireFox: null       Opera: null
element.classList.item(-1)          // Chrome: null         FireFox: null       Opera: null

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list