WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
126200
Handle (numeric) indexed access of DOMStringMap
https://bugs.webkit.org/show_bug.cgi?id=126200
Summary
Handle (numeric) indexed access of DOMStringMap
Ryosuke Niwa
Reported
2013-12-23 19:15:28 PST
Consider merging
https://chromium.googlesource.com/chromium/blink/+/54785059007176b07b03810a3f98eb7afa4739b9
As the set of supported property names over DOMStringMap reflects the attributes of an Element prefixed with 'data-', these naturally also include numeric indexes. To allow such index values to be used over DOMStringMap, extend its IDL definition with indexed accessors. Also address an infelicity in comparing attribute names to property names if the property name uses a "-" but isn't followed by an ASCII uppercase letter (e.g. "a-1".) Extended test coverage to check for these variations also.
Attachments
Add attachment
proposed patch, testcase, etc.
Ahmad Saleem
Comment 1
2022-08-19 23:59:40 PDT
Not changed:
https://github.com/WebKit/WebKit/blob/8afe31a018b11741abdf9b4d5bb973d7c1d9ff05/Source/WebCore/dom/DatasetDOMStringMap.cpp#L87
IDL across all browsers:
https://github.com/chromium/chromium/blob/main/third_party/blink/renderer/core/dom/dom_string_map.idl
https://hg.mozilla.org/mozilla-central/file/tip/dom/webidl/DOMStringMap.webidl
https://github.com/WebKit/WebKit/blob/8afe31a018b11741abdf9b4d5bb973d7c1d9ff05/Source/WebCore/dom/DOMStringMap.idl
___ DOMStringMap seems to point to DatasetDOMStringMap:
https://github.com/WebKit/WebKit/blob/8afe31a018b11741abdf9b4d5bb973d7c1d9ff05/Source/WebCore/dom/DOMStringMap.h
but I cannot find link of Chromium change to this:
https://github.com/WebKit/WebKit/blob/8afe31a018b11741abdf9b4d5bb973d7c1d9ff05/Source/WebCore/dom/DatasetDOMStringMap.h
___ I will leave this for others to comment whether this change is needed any more or not. Thanks!
Ryosuke Niwa
Comment 2
2022-08-20 01:23:00 PDT
We handle numeric index getter just fine.
Alexey Proskuryakov
Comment 3
2022-08-20 09:34:56 PDT
We do, however the Blink patch in question fixes more that that, and many subtests are still failing in WebKit. Would you mind checking if your fix in
bug 123890
covers all of these? FAIL testGet('data-r-7', 'r-7') should be true. Was false. FAIL testGet('data-r-7-k', 'r-7K') should be true. Was false. ... FAIL testSet('-foo', 'dummy') should throw SyntaxError: Failed to set the '-foo' property on 'DOMStringMap': '-foo' is not a valid property name.. Threw exception SyntaxError: The string did not match the expected pattern.. ... FAIL testSet('foo豈', 'dummy') should throw InvalidCharacterError: The string contains invalid characters.. Was false. ... FAIL testDelete('data-r-2', 'r-2') should be true. Was false. FAIL testDelete('data--r-2-', 'R-2-') should be true. Was false. FAIL testDelete('data--r-2r', 'R-2r') should be true. Was false. FAIL testDelete('data--r-2-----r', 'R-2----R') should be true. Was false.
Ryosuke Niwa
Comment 4
2022-08-20 15:15:34 PDT
Yeah, I'm adding those test cases.
Alexey Proskuryakov
Comment 5
2022-08-21 13:04:23 PDT
We are still failing this subtest after the fix: FAIL testSet('foo豈', 'dummy') should throw InvalidCharacterError: The string contains invalid characters.. Was false.
Ryosuke Niwa
Comment 6
2022-08-21 13:07:58 PDT
(In reply to Alexey Proskuryakov from
comment #5
)
> We are still failing this subtest after the fix: > > FAIL testSet('foo豈', 'dummy') should throw InvalidCharacterError: The string > contains invalid characters.. Was false.
That test case is bogus. No browser throws exception in that scenario.
Alexey Proskuryakov
Comment 7
2022-08-21 13:40:33 PDT
I see the exception in Chrome 104.0.5112.101 (FAIL because their error message has changed since): FAIL testSet('foo豈', 'dummy') should throw InvalidCharacterError: The string contains invalid characters.. Threw exception InvalidCharacterError: Failed to set a named property on 'DOMStringMap': 'data-foo豈' is not a valid attribute name..
Alexey Proskuryakov
Comment 8
2022-08-21 13:41:19 PDT
(and in Firefox too)
Ryosuke Niwa
Comment 9
2022-08-21 16:00:34 PDT
(In reply to Alexey Proskuryakov from
comment #7
)
> I see the exception in Chrome 104.0.5112.101 (FAIL because their error > message has changed since): > > FAIL testSet('foo豈', 'dummy') should throw InvalidCharacterError: The string > contains invalid characters.. Threw exception InvalidCharacterError: Failed > to set a named property on 'DOMStringMap': 'data-foo豈' is not a valid > attribute name..
Huh, I guess I got confused while testing. Will address that in a separate bug.
Ryosuke Niwa
Comment 10
2022-08-21 16:05:11 PDT
Tracking in
https://bugs.webkit.org/show_bug.cgi?id=244174
Ryosuke Niwa
Comment 11
2022-08-21 16:35:27 PDT
(In reply to Ryosuke Niwa from
comment #9
)
> (In reply to Alexey Proskuryakov from
comment #7
) > > I see the exception in Chrome 104.0.5112.101 (FAIL because their error > > message has changed since): > > > > FAIL testSet('foo豈', 'dummy') should throw InvalidCharacterError: The string > > contains invalid characters.. Threw exception InvalidCharacterError: Failed > > to set a named property on 'DOMStringMap': 'data-foo豈' is not a valid > > attribute name.. > > Huh, I guess I got confused while testing. Will address that in a separate > bug.
Hm... actually, I don't get why other browsers are throwing in this case. U+F900 is clearly allowed in NameStartChar:
https://www.w3.org/TR/xml/#NT-Name
Ryosuke Niwa
Comment 12
2022-08-21 16:52:38 PDT
This is Blink's implementation:
https://github.com/chromium/chromium/blob/main/third_party/blink/renderer/core/dom/document.cc#L444
I think what happened here is that WebKit implements the latest specification:
https://commits.webkit.org/246206@main
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