<?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>33733</bug_id>
          
          <creation_ts>2010-01-15 13:15:54 -0800</creation_ts>
          <short_desc>ValidityState object should be the same on each access (JS object getting GC&apos;d incorrectly)</short_desc>
          <delta_ts>2022-06-11 15:34:14 -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>Forms</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alexey Proskuryakov">ap</reporter>
          <assigned_to name="Ryosuke Niwa">rniwa</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>akeerthi</cc>
    
    <cc>cdumez</cc>
    
    <cc>darin</cc>
    
    <cc>ggaren</cc>
    
    <cc>michelangelo</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>181346</commentid>
    <comment_count>0</comment_count>
      <attachid>46707</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2010-01-15 13:15:54 -0800</bug_when>
    <thetext>Created attachment 46707
test case

Per HTML5, &quot;The validity attribute must return a ValidityState object that represents the validity states of the element. This object is live, and the same object must be returned each time the element&apos;s validity attribute is retrieved.&quot;

This means that a form element must prevent garbage collection of associated ValidityState wrapper, not just of its underlying DOM object.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>181552</commentid>
    <comment_count>1</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-01-16 13:31:28 -0800</bug_when>
    <thetext>Geoff Garen pointed out our usual technique for this sort of thing.

JSHTMLFormControlElement can mark JSValidityState. See JSSharedWorker::markChildren in JSSharedWorkerCustom.cpp.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1874835</commentid>
    <comment_count>2</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-06-08 15:36:39 -0700</bug_when>
    <thetext>I am unable to reproduce this bug in Safari 15.5 on macOS 12.4 since now test case shows &quot;PASS&quot;. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1874836</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-06-08 15:37:35 -0700</bug_when>
    <thetext>It also matches other browsers - Chrome Canary 104 and Firefox Nightly 103. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1875045</commentid>
    <comment_count>4</comment_count>
      <attachid>460139</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2022-06-09 10:55:12 -0700</bug_when>
    <thetext>Created attachment 460139
test case

Sadly, this is not fixed yet, it&apos;s just that our garbage collection became less precise than it used to be. This still reproduces when I adjust the test to be more forceful with GC.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1875082</commentid>
    <comment_count>5</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2022-06-09 13:11:28 -0700</bug_when>
    <thetext>A relevant term of art here is &quot;expando properties&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1875360</commentid>
    <comment_count>6</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-06-10 20:41:51 -0700</bug_when>
    <thetext>We should make JSValidityState report its owner element as an opaque root, and make it reachable from the opaque root.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1875363</commentid>
    <comment_count>7</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-06-10 20:48:25 -0700</bug_when>
    <thetext>More precisely, add the following extended attributes to IDL:
    GenerateIsReachable=ImplOwnerNodeRoot,
    GenerateAddOpaqueRoot=opaqueRootConcurrently
And then expose two member functions:
    void* opaqueRootConcurrently() const;
    Node* ownerNode() const;
both of which simply returns asHTMLElement().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1875392</commentid>
    <comment_count>8</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2022-06-11 09:41:06 -0700</bug_when>
    <thetext>That sounds right for how to fix. As for how to test we should have a test for the expando properties on this object in WPT, which already has some other expando property preservation tests.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1875399</commentid>
    <comment_count>9</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-06-11 13:09:24 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/1460</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1875403</commentid>
    <comment_count>10</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-06-11 15:33:34 -0700</bug_when>
    <thetext>Committed r295475 (251480@main): &lt;https://commits.webkit.org/251480@main&gt;

Reviewed commits have been landed. Closing PR #1460 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1875404</commentid>
    <comment_count>11</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-06-11 15:34:14 -0700</bug_when>
    <thetext>&lt;rdar://problem/94897805&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>46707</attachid>
            <date>2010-01-15 13:15:54 -0800</date>
            <delta_ts>2022-06-09 10:55:12 -0700</delta_ts>
            <desc>test case</desc>
            <filename>validity-object.html</filename>
            <type>text/html</type>
            <size>496</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">PGJvZHk+CjxzZWxlY3QgaWQ9c2VsPjwvc2VsZWN0Pgo8c2NyaXB0PgpmdW5jdGlvbiBnYygpCnsK
ICAgIGlmICh3aW5kb3cuR0NDb250cm9sbGVyKQogICAgICAgIHJldHVybiBHQ0NvbnRyb2xsZXIu
Y29sbGVjdCgpOwoKICAgIGZvciAodmFyIGkgPSAwOyBpIDwgMTAwMDA7IGkrKykgeyAvLyA+IGZv
cmNlIGdhcmJhZ2UgY29sbGVjdGlvbiAoRkYgcmVxdWlyZXMgYWJvdXQgOUsgYWxsb2NhdGlvbnMg
YmVmb3JlIGEgY29sbGVjdCkKICAgICAgICB2YXIgcyA9IG5ldyBTdHJpbmcoIiIpOwogICAgfQp9
Cgpkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgic2VsIikudmFsaWRpdHkuZm9vID0gIlBBU1MiOwoK
c2V0VGltZW91dChmdW5jdGlvbigpIHsKICAgIGdjKCk7CiAgICBkb2N1bWVudC53cml0ZSgiU2hv
dWxkIHNheSBQQVNTOiAiICsgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoInNlbCIpLnZhbGlkaXR5
LmZvbyArICI8cD4iKTsKfSwgMCk7Cjwvc2NyaXB0Pgo8L2JvZHk+Cg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>460139</attachid>
            <date>2022-06-09 10:55:12 -0700</date>
            <delta_ts>2022-06-09 10:55:12 -0700</delta_ts>
            <desc>test case</desc>
            <filename>validity-object.html</filename>
            <type>text/html</type>
            <size>565</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">PGJvZHk+CjxzZWxlY3QgaWQ9c2VsPjwvc2VsZWN0Pgo8c2NyaXB0PgpmdW5jdGlvbiBnYygpCnsK
ICAgIGlmICh3aW5kb3cuR0NDb250cm9sbGVyKQogICAgICAgIHJldHVybiBHQ0NvbnRyb2xsZXIu
Y29sbGVjdCgpOwoKICAgIGZvciAodmFyIGkgPSAwOyBpIDwgMTAwMDAwMDsgaSsrKSB7IC8vID4g
Zm9yY2UgZ2FyYmFnZSBjb2xsZWN0aW9uIChGRiByZXF1aXJlcyBhYm91dCA5SyBhbGxvY2F0aW9u
cyBiZWZvcmUgYSBjb2xsZWN0KQogICAgICAgIHZhciBzID0gbmV3IFN0cmluZygiIik7CiAgICB9
Cn0KCmRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJzZWwiKS52YWxpZGl0eS5mb28gPSAiUEFTUyI7
CiAgICBnYygpOwoKc2V0VGltZW91dChmdW5jdGlvbigpIHsKICAgIGdjKCk7CiAgICBzZXRUaW1l
b3V0KGZ1bmN0aW9uKCkgewogICAgICAgIGdjKCk7CiAgICAgICAgZG9jdW1lbnQud3JpdGUoIlNo
b3VsZCBzYXkgUEFTUzogIiArIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJzZWwiKS52YWxpZGl0
eS5mb28gKyAiPHA+Iik7CiAgICB9LCAwKTsKfSwgMCk7Cjwvc2NyaXB0Pgo8L2JvZHk+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>