<?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>26520</bug_id>
          
          <creation_ts>2009-06-18 15:17:25 -0700</creation_ts>
          <short_desc>Accessing a DOM node from a parent window in a child iframe moves the prototype to the child iframe and resets it in the parent window</short_desc>
          <delta_ts>2010-03-01 18:25:27 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore JavaScript</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>http://paulsowden.com/etc/webkit/test-prototype.html</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Paul Sowden">paul</reporter>
          <assigned_to name="Alexey Proskuryakov">ap</assigned_to>
          <cc>abarth</cc>
    
    <cc>ap</cc>
    
    <cc>ggaren</cc>
    
    <cc>gianni</cc>
    
    <cc>kangax</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>126788</commentid>
    <comment_count>0</comment_count>
    <who name="Paul Sowden">paul</who>
    <bug_when>2009-06-18 15:17:25 -0700</bug_when>
    <thetext>In the test case we extend the prototype of HTMLInputElement to add a property &quot;foo&quot;.  In the child iframe I extend the prototype of HTMLInputElement to add a property &quot;bar&quot;.  In the child iframe we hook up an event listener to the parent window&apos;s body and access e.target.

When clicking the submit button we should expect to see &quot;foo&quot;, which is the property we added to the HTMLInputElement&apos;s prototype, but instead we see &quot;undefined&quot;.  Removing the line in the iframe which accesses e.target causes the alert to display &quot;foo&quot;, as expected.

It looks like when e.target is accessed in the child iframe it creates the HTMLElement DOM wrapper and this causes the prototypes from the parent window to be moved to the child iframe, then when we handle the onsubmit event in the parent window it lazyilly creates the HTMLElement DOM wrapper but with a blank prototype that now exists in the parent window.

The extended prototypes are getting incorrectly moved between the two window objects.

This looks like it could be related to bug 24795 but the testcase attached to that bug seems to work in the latest nightly so I suspect that it could actually be a different issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127846</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-06-24 00:44:36 -0700</bug_when>
    <thetext>Confirming as a difference with Firefox.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127871</commentid>
    <comment_count>2</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2009-06-24 01:48:11 -0700</bug_when>
    <thetext>This is a dup of another bug that I can&apos;t put my fingers on immediately.  This is also related to a recent thread on webkit-dev.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>194426</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2010-02-26 19:51:08 -0800</bug_when>
    <thetext>The bug URL is no longer valid. Could you please attach the test case to the bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>194438</commentid>
    <comment_count>4</comment_count>
      <attachid>49673</attachid>
    <who name="Paul Sowden">paul</who>
    <bug_when>2010-02-26 20:32:30 -0800</bug_when>
    <thetext>Created attachment 49673
Testcase for the main page (requires test-prototype-iframe.html as well)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>194439</commentid>
    <comment_count>5</comment_count>
      <attachid>49674</attachid>
    <who name="Paul Sowden">paul</who>
    <bug_when>2010-02-26 20:33:16 -0800</bug_when>
    <thetext>Created attachment 49674
Testcase for the iframe (is loaded by the first testcase page)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>194448</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2010-02-26 21:20:03 -0800</bug_when>
    <thetext>Thanks!

I can reproduce with Safari/WebKit 4.0.4, but this appears fixed with recent WebKit builds (I tried r55339).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>194464</commentid>
    <comment_count>7</comment_count>
    <who name="Paul Sowden">paul</who>
    <bug_when>2010-02-26 23:06:35 -0800</bug_when>
    <thetext>For reference, I&apos;m pretty sure this was fixed in r46444.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>194467</commentid>
    <comment_count>8</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2010-02-26 23:34:38 -0800</bug_when>
    <thetext>Maybe we need to land this test case then - r46444 didn&apos;t include tests. Re-opening for that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>194555</commentid>
    <comment_count>9</comment_count>
      <attachid>49692</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2010-02-27 21:29:45 -0800</bug_when>
    <thetext>Created attachment 49692
proposed patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>194894</commentid>
    <comment_count>10</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2010-03-01 18:25:27 -0800</bug_when>
    <thetext>Test committed &lt;http://trac.webkit.org/changeset/55396&gt;.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>49673</attachid>
            <date>2010-02-26 20:32:30 -0800</date>
            <delta_ts>2010-02-27 21:29:45 -0800</delta_ts>
            <desc>Testcase for the main page (requires test-prototype-iframe.html as well)</desc>
            <filename>test-prototype.html</filename>
            <type>text/html</type>
            <size>241</size>
            <attacher name="Paul Sowden">paul</attacher>
            
              <data encoding="base64">CjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4KCkhUTUxJbnB1dEVsZW1lbnQucHJvdG90
eXBlLmZvbyA9ICdmb28nOwoKPC9zY3JpcHQ+Cgo8aWZyYW1lIHNyYz0idGVzdC1wcm90b3R5cGUt
aWZyYW1lLmh0bWwiPjwvaWZyYW1lPgoKPGZvcm0gb25zdWJtaXQ9ImFsZXJ0KHRoaXMuZWxlbWVu
dHNbMF0uZm9vKTsgcmV0dXJuIGZhbHNlIj4KPGlucHV0IHR5cGU9InN1Ym1pdCIgbmFtZT0iZmRz
YSI+CjwvZm9ybT4KCg==
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>49674</attachid>
            <date>2010-02-26 20:33:16 -0800</date>
            <delta_ts>2010-02-27 21:29:45 -0800</delta_ts>
            <desc>Testcase for the iframe (is loaded by the first testcase page)</desc>
            <filename>test-prototype-iframe.html</filename>
            <type>text/html</type>
            <size>219</size>
            <attacher name="Paul Sowden">paul</attacher>
            
              <data encoding="base64">CjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4KCkhUTUxGb3JtRWxlbWVudC5wcm90b3R5
cGUuYmFyID0gJ2Jhcic7Cgp3aW5kb3cub25sb2FkID0gZnVuY3Rpb24gKGUpIHsKCXRvcC5kb2N1
bWVudC5ib2R5LmFkZEV2ZW50TGlzdGVuZXIoJ21vdXNlZG93bicsIGZ1bmN0aW9uIChlKSB7CgkJ
dmFyIHRhcmdldCA9IGUudGFyZ2V0OwoJfSwgdHJ1ZSk7Cn0KCjwvc2NyaXB0PgoK
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>49692</attachid>
            <date>2010-02-27 21:29:45 -0800</date>
            <delta_ts>2010-03-01 13:33:05 -0800</delta_ts>
            <desc>proposed patch</desc>
            <filename>AddPrototypeTest.txt</filename>
            <type>text/plain</type>
            <size>3620</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">SW5kZXg6IExheW91dFRlc3RzL0NoYW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bmVyKCdjbGljaycsIGZ1bmN0aW9uIChl
KSB7CisJCXZhciB0YXJnZXQgPSBlLnRhcmdldDsKKwl9LCB0cnVlKTsKKwl0b3AuZG9jdW1lbnQu
Z2V0RWxlbWVudHNCeVRhZ05hbWUoImlucHV0IilbMF0uY2xpY2soKTsKK30KKworPC9zY3JpcHQ+
CisKClByb3BlcnR5IGNoYW5nZXMgb246IExheW91dFRlc3RzL2Zhc3QvZG9tL3Jlc291cmNlcy9j
cm9zcy1mcmFtZS1ub2RlLXByb3RvdHlwZS1pZnJhbWUuaHRtbApfX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCkFkZGVkOiBz
dm46bWltZS10eXBlCiAgICsgdGV4dC9odG1sCgo=
</data>
<flag name="review"
          id="32632"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>