<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>126200</bug_id>
          
          <creation_ts>2013-12-23 19:15:28 -0800</creation_ts>
          <short_desc>Handle (numeric) indexed access of DOMStringMap</short_desc>
          <delta_ts>2022-08-21 16:52:38 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=123890</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BlinkMergeCandidate</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ryosuke Niwa">rniwa</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>benjamin</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cdumez</cc>
    
    <cc>kling</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>962691</commentid>
    <comment_count>0</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-12-23 19:15:28 -0800</bug_when>
    <thetext>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 &apos;data-&apos;, 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 &quot;-&quot; but isn&apos;t followed by an ASCII
uppercase letter (e.g. &quot;a-1&quot;.)

Extended test coverage to check for these variations also.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892611</commentid>
    <comment_count>1</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-08-19 23:59:40 -0700</bug_when>
    <thetext>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!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892624</commentid>
    <comment_count>2</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-08-20 01:23:00 -0700</bug_when>
    <thetext>We handle numeric index getter just fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892655</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2022-08-20 09:34:56 -0700</bug_when>
    <thetext>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(&apos;data-r-7&apos;, &apos;r-7&apos;) should be true. Was false.
FAIL testGet(&apos;data-r-7-k&apos;, &apos;r-7K&apos;) should be true. Was false.
...
FAIL testSet(&apos;-foo&apos;, &apos;dummy&apos;) should throw SyntaxError: Failed to set the &apos;-foo&apos; property on &apos;DOMStringMap&apos;: &apos;-foo&apos; is not a valid property name.. Threw exception SyntaxError: The string did not match the expected pattern..
...
FAIL testSet(&apos;foo豈&apos;, &apos;dummy&apos;) should throw InvalidCharacterError: The string contains invalid characters.. Was false.
...
FAIL testDelete(&apos;data-r-2&apos;, &apos;r-2&apos;) should be true. Was false.
FAIL testDelete(&apos;data--r-2-&apos;, &apos;R-2-&apos;) should be true. Was false.
FAIL testDelete(&apos;data--r-2r&apos;, &apos;R-2r&apos;) should be true. Was false.
FAIL testDelete(&apos;data--r-2-----r&apos;, &apos;R-2----R&apos;) should be true. Was false.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892708</commentid>
    <comment_count>4</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-08-20 15:15:34 -0700</bug_when>
    <thetext>Yeah, I&apos;m adding those test cases.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892815</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2022-08-21 13:04:23 -0700</bug_when>
    <thetext>We are still failing this subtest after the fix:

FAIL testSet(&apos;foo豈&apos;, &apos;dummy&apos;) should throw InvalidCharacterError: The string contains invalid characters.. Was false.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892817</commentid>
    <comment_count>6</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-08-21 13:07:58 -0700</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #5)
&gt; We are still failing this subtest after the fix:
&gt; 
&gt; FAIL testSet(&apos;foo豈&apos;, &apos;dummy&apos;) should throw InvalidCharacterError: The string
&gt; contains invalid characters.. Was false.

That test case is bogus. No browser throws exception in that scenario.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892827</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2022-08-21 13:40:33 -0700</bug_when>
    <thetext>I see the exception in Chrome 104.0.5112.101 (FAIL because their error message has changed since):

FAIL testSet(&apos;foo豈&apos;, &apos;dummy&apos;) should throw InvalidCharacterError: The string contains invalid characters.. Threw exception InvalidCharacterError: Failed to set a named property on &apos;DOMStringMap&apos;: &apos;data-foo豈&apos; is not a valid attribute name..</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892828</commentid>
    <comment_count>8</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2022-08-21 13:41:19 -0700</bug_when>
    <thetext>(and in Firefox too)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892836</commentid>
    <comment_count>9</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-08-21 16:00:34 -0700</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #7)
&gt; I see the exception in Chrome 104.0.5112.101 (FAIL because their error
&gt; message has changed since):
&gt; 
&gt; FAIL testSet(&apos;foo豈&apos;, &apos;dummy&apos;) should throw InvalidCharacterError: The string
&gt; contains invalid characters.. Threw exception InvalidCharacterError: Failed
&gt; to set a named property on &apos;DOMStringMap&apos;: &apos;data-foo豈&apos; is not a valid
&gt; attribute name..

Huh, I guess I got confused while testing. Will address that in a separate bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892838</commentid>
    <comment_count>10</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-08-21 16:05:11 -0700</bug_when>
    <thetext>Tracking in https://bugs.webkit.org/show_bug.cgi?id=244174</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892841</commentid>
    <comment_count>11</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-08-21 16:35:27 -0700</bug_when>
    <thetext>(In reply to Ryosuke Niwa from comment #9)
&gt; (In reply to Alexey Proskuryakov from comment #7)
&gt; &gt; I see the exception in Chrome 104.0.5112.101 (FAIL because their error
&gt; &gt; message has changed since):
&gt; &gt; 
&gt; &gt; FAIL testSet(&apos;foo豈&apos;, &apos;dummy&apos;) should throw InvalidCharacterError: The string
&gt; &gt; contains invalid characters.. Threw exception InvalidCharacterError: Failed
&gt; &gt; to set a named property on &apos;DOMStringMap&apos;: &apos;data-foo豈&apos; is not a valid
&gt; &gt; attribute name..
&gt; 
&gt; Huh, I guess I got confused while testing. Will address that in a separate
&gt; bug.

Hm... actually, I don&apos;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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892843</commentid>
    <comment_count>12</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-08-21 16:52:38 -0700</bug_when>
    <thetext>This is Blink&apos;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</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>