<?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>185243</bug_id>
          
          <creation_ts>2018-05-03 01:50:32 -0700</creation_ts>
          <short_desc>iframe.contentWindow.document not accessible only on WebKit.</short_desc>
          <delta_ts>2018-05-03 13:29:42 -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>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>11388</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=11388</see_also>
          <bug_file_loc>https://html.spec.whatwg.org/multipage/window-object.html#named-access-on-the-window-object</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="Emilio Cobos Álvarez (:emilio)">emilio</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>ajuma</cc>
    
    <cc>cdumez</cc>
    
    <cc>danyao</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1420060</commentid>
    <comment_count>0</comment_count>
      <attachid>339399</attachid>
    <who name="Emilio Cobos Álvarez (:emilio)">emilio</who>
    <bug_when>2018-05-03 01:50:32 -0700</bug_when>
    <thetext>Created attachment 339399
test.html

See the testcase incoming, which does something useful in every other browser.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1420115</commentid>
    <comment_count>1</comment_count>
    <who name="Danyao Wang">danyao</who>
    <bug_when>2018-05-03 07:39:25 -0700</bug_when>
    <thetext>The problem doesn&apos;t seem to be with iframe.contentWindow.document. If I just add &quot;var frm = document.getElementById(&apos;frm&apos;);&quot; at the beginning, WebKit behaves identically to Chrome.

I don&apos;t think it&apos;s standard to be able to reference HTML element by ID as named variables in JavaScript. I could be wrong.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1420146</commentid>
    <comment_count>2</comment_count>
    <who name="Ali Juma">ajuma</who>
    <bug_when>2018-05-03 09:10:19 -0700</bug_when>
    <thetext>(In reply to Danyao Wang from comment #1)
&gt; The problem doesn&apos;t seem to be with iframe.contentWindow.document. If I just
&gt; add &quot;var frm = document.getElementById(&apos;frm&apos;);&quot; at the beginning, WebKit
&gt; behaves identically to Chrome.
&gt; 
&gt; I don&apos;t think it&apos;s standard to be able to reference HTML element by ID as
&gt; named variables in JavaScript. I could be wrong.

See bug 183087; the id becomes a global variable unless it gets shadowed by another explicitly declared global variable. So if adding &quot;var frm = document.getElementById(&apos;frm&apos;);&quot; changes behavior in this example, that sounds like a bug, since frm should already be referring to that element.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1420157</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2018-05-03 09:27:57 -0700</bug_when>
    <thetext>I believe the issue is that WebKit wrongly uses the iframe&apos;s id as the iframe&apos;s window name. Because of the ordering of Window&apos;s named property getter, we return the iframe&apos;s window that matches &apos;frm&apos; instead of the iframe with id &apos;frm&apos;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1420181</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2018-05-03 09:53:08 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #3)
&gt; I believe the issue is that WebKit wrongly uses the iframe&apos;s id as the
&gt; iframe&apos;s window name. Because of the ordering of Window&apos;s named property
&gt; getter, we return the iframe&apos;s window that matches &apos;frm&apos; instead of the
&gt; iframe with id &apos;frm&apos;.

Ironically, looks like I fixed this in Blink a long time ago :)
https://bugs.chromium.org/p/chromium/issues/detail?id=347169</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1420212</commentid>
    <comment_count>5</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2018-05-03 10:37:07 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 11388 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1420217</commentid>
    <comment_count>6</comment_count>
    <who name="Emilio Cobos Álvarez (:emilio)">emilio</who>
    <bug_when>2018-05-03 10:45:19 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #4)
&gt; (In reply to Chris Dumez from comment #3)
&gt; &gt; I believe the issue is that WebKit wrongly uses the iframe&apos;s id as the
&gt; &gt; iframe&apos;s window name. Because of the ordering of Window&apos;s named property
&gt; &gt; getter, we return the iframe&apos;s window that matches &apos;frm&apos; instead of the
&gt; &gt; iframe with id &apos;frm&apos;.
&gt; 
&gt; Ironically, looks like I fixed this in Blink a long time ago :)
&gt; https://bugs.chromium.org/p/chromium/issues/detail?id=347169

Lol.

Ok, thanks a lot, now I can report the CSS bug I really wanted to report :-)</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>339399</attachid>
            <date>2018-05-03 01:50:32 -0700</date>
            <delta_ts>2018-05-03 01:50:32 -0700</delta_ts>
            <desc>test.html</desc>
            <filename>test.html</filename>
            <type>text/html</type>
            <size>669</size>
            <attacher name="Emilio Cobos Álvarez (:emilio)">emilio</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxpZnJhbWUgaWQ9ImZybSIgc3R5bGU9IndpZHRoOiAxMDBweDsgaGVp
Z3RoOiAxMDBweCI+PC9pZnJhbWU+Cjxicj4KPHNjcmlwdD4KICB2YXIgZnJtRG9jID0gZnJtLmNv
bnRlbnRXaW5kb3cuZG9jdW1lbnQ7CiAgZnJtRG9jLm9wZW4oKTsKICBmcm1Eb2Mud3JpdGUoJzxi
b2R5PklycmVsZXZhbnQ8L2JvZHk+Jyk7CiAgZnJtRG9jLmNsb3NlKCk7CgogIGRvY3VtZW50LmJv
ZHkub2Zmc2V0VG9wOwoKICBpZiAoZnJtLmNvbnRlbnRXaW5kb3cubWF0Y2hNZWRpYSgnKG1heC13
aWR0aDogMTUwcHgpJykubWF0Y2hlcykKICAgIGRvY3VtZW50LndyaXRlKCJQQVNTPGJyPiIpOwog
IGVsc2UKICAgIGRvY3VtZW50LndyaXRlKCJGQUlMIC0gTWVkaWEgZGlkbid0IG1hdGNoPGJyPiIp
CgogIGZybS5zdHlsZS53aWR0aCA9ICIyMDBweCI7CgogIC8vIFVuY29tbWVudCB0byBwYXNzOgog
IC8vIGZybURvYy5kb2N1bWVudEVsZW1lbnQub2Zmc2V0VG9wOwoKICBpZiAoZnJtLmNvbnRlbnRX
aW5kb3cubWF0Y2hNZWRpYSgnKG1heC13aWR0aDogMTUwcHgpJykubWF0Y2hlcykKICAgIGRvY3Vt
ZW50LndyaXRlKCJGQUlMIC0gTWVkaWEgaW5jb3JyZWN0bHkgbWF0Y2hlZDxicj4iKQogIGVsc2UK
ICAgIGRvY3VtZW50LndyaXRlKCJQQVNTPGJyPiIpOwo8L3NjcmlwdD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>