<?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>13062</bug_id>
          
          <creation_ts>2007-03-13 18:13:47 -0700</creation_ts>
          <short_desc>Implement contentWindow for iframes</short_desc>
          <delta_ts>2007-03-13 22:58:00 -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>523.x (Safari 3)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Brian Bober">netdragon</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>jhaygood</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>18836</commentid>
    <comment_count>0</comment_count>
    <who name="Brian Bober">netdragon</who>
    <bug_when>2007-03-13 18:13:47 -0700</bug_when>
    <thetext>There is no way to access contentWindow for iframes. That means when attempting to do sites with dynamically loading content inside of iframes, the main page has no way to access variables within the child frame&apos;s window, and has to instead have all variables stored on the main window (the parent of the frames). This causes a problem when some content inside the frames are 3rd party (such as floating rich media content).

What should work:
document.getElementById(&quot;iframename&quot;).contentWindow.myVar

The only way to access an iframe instead:
document.getElementById(&quot;iframename&quot;).contentDocument

I attempted playing around with contentDocument.defaultView to no avail.

This issue will lead to millions in lost potential revenue for publishing sites who use Ajax. If you want more details on why, I&apos;d be happy to explain if you email me, but it&apos;s probably off-topic to discuss here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18837</commentid>
    <comment_count>1</comment_count>
      <attachid>13621</attachid>
    <who name="Brian Bober">netdragon</who>
    <bug_when>2007-03-13 18:17:20 -0700</bug_when>
    <thetext>Created attachment 13621
Frame src for testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18839</commentid>
    <comment_count>2</comment_count>
      <attachid>13622</attachid>
    <who name="Brian Bober">netdragon</who>
    <bug_when>2007-03-13 18:26:34 -0700</bug_when>
    <thetext>Created attachment 13622
Here is the testcase. It will work on every major browser but Safari

Every major browser supports contentWindow except Safari (and older versions of Opera). A usage case where this is needed is for a particular major publisher&apos;s &quot;ajax&quot; dynamic serving mechanism (where one way to implement it is through iframes), to support rich media expandable content.

Other examples of discussion about this deficiency is here: http://xkr.us/articles/dom/iframe-document/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18843</commentid>
    <comment_count>3</comment_count>
      <attachid>13624</attachid>
    <who name="Brian Bober">netdragon</who>
    <bug_when>2007-03-13 18:41:33 -0700</bug_when>
    <thetext>Created attachment 13624
Here is the testcase. It will work on every major browser but Safari

Previous testcase had a bug. Note that because the iframe is on the same domain, there&apos;s no security restrictions. Some publishers utilize that capability for dynamic load functionality when loading 3rd party content through 3rd party scripts. The difficulty comes in when the iframes need to share variables with the main page.

An example case of when this is needed: A publisher, we&apos;ll call MajorPublisherA requested we support their implementation of Ajax ad serving. Their method works by refreshing the src of the serving iframe (iframe A). MajorPublisherA wants us, the rich media vendor, to support all major browsers. As a standard practice, expandable advertisements break out of the ad serving iframe and may create their own container on the main page, hovering over the serving frame, so they can change size on user interaction. However, when the src of the serving frame changes, the next ad will show up, but a remnant of the previous ad will still be there. In a situation like this, we have a &quot;hook&quot; variable on the window of the serving frame, and when we detect that we cannot access that &quot;hook&quot; variable anymore, we know our ad&apos;s code has been rotated out, and clean up our expandable advertisement. However, on Safari, as it stands right now, without the contentWindow, we can&apos;t detect that the initial serving iframe&apos;s src has been changed, and can&apos;t therefore clean up the advertisement. I believe I&apos;ve found a solution so that Safari users will get the same user experience on MajorPublisherA, but it required a massive workaround for something that should be simple, since it&apos;s supported on all other browsers.

Another thing all other browsers support is that you can compare window elements inside iframes to the contentWindow of another element to see if they match, even with domain security restrictions. You can&apos;t do anything else, but you can compare the two variables. Please make sure when this is implemented, it&apos;s implemented in a way that allows the capability of comparing contentWindow and window elements across domains.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18844</commentid>
    <comment_count>4</comment_count>
      <attachid>13624</attachid>
    <who name="Brian Bober">netdragon</who>
    <bug_when>2007-03-13 18:46:21 -0700</bug_when>
    <thetext>Comment on attachment 13624
Here is the testcase. It will work on every major browser but Safari

This testcase wasn&apos;t adequate in reproducing the issue. I&apos;ll create a better one in the future.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18845</commentid>
    <comment_count>5</comment_count>
    <who name="Brian Bober">netdragon</who>
    <bug_when>2007-03-13 19:04:58 -0700</bug_when>
    <thetext>Now everything&apos;s working fine. So weird, but oh well... -&gt; INVALID unless I can make it happen again reproducibly.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>13621</attachid>
            <date>2007-03-13 18:17:20 -0700</date>
            <delta_ts>2007-03-13 18:46:53 -0700</delta_ts>
            <desc>Frame src for testcase</desc>
            <filename>inframe.html</filename>
            <type>text/html</type>
            <size>161</size>
            <attacher name="Brian Bober">netdragon</attacher>
            
              <data encoding="base64">PGh0bWw+DQo8Ym9keT4NCjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0IiBsYW5ndWFnZT0i
SmF2YXNjcmlwdCI+DQo8IS0tDQoJZG9jdW1lbnQud3JpdGVsbigiZnJhbWUiKTsNCgl2YXIgbXlW
YXIgPSAiSGVsbG8iOw0KLS0+DQo8L3NjcmlwdD4NCjwvYm9keT4NCjwvaHRtbD4=
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>13622</attachid>
            <date>2007-03-13 18:26:34 -0700</date>
            <delta_ts>2007-03-13 18:41:33 -0700</delta_ts>
            <desc>Here is the testcase. It will work on every major browser but Safari</desc>
            <filename>testcase.html</filename>
            <type>text/html</type>
            <size>631</size>
            <attacher name="Brian Bober">netdragon</attacher>
            
              <data encoding="base64">PGh0bWw+DQo8Ym9keT4NCjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0IiBsYW5ndWFnZT0i
SmF2YXNjcmlwdCI+DQo8IS0tDQpmdW5jdGlvbiBkaXNwbGF5VmFyKCkNCnsNCglkb2N1bWVudC5n
ZXRFbGVtZW50QnlJZCgiZGlzcGxheURpdiIpLmlubmVySFRNTCA9IGRvY3VtZW50LmdldEVsZW1l
bnRCeUlkKCJ0ZXN0RnJhbWUiKS5jb250ZW50V2luZG93Lm15VmFyOy8qIEkga25vdyBpbm5lckhU
TUwgaXMgImV2aWwiLCBidXQgdGhpcyBpcyBqdXN0IGEgdGVzdGNhc2UgKi8NCn0NCi0tPg0KPC9z
Y3JpcHQ+DQpPdXRwdXQgZ29lcyBoZXJlOiA8ZGl2IHN0eWxlPSJ3aWR0aDogODAwcHg7IGhlaWdo
dDogNTBweDsgYm9yZGVyOiAxcHggc29saWQgcmVkOyI+PC9kaXY+DQo8YnI+DQo8aW5wdXQgdHlw
ZT0iYnV0dG9uIiBvbmNsaWNrPSJkaXNwbGF5VmFyKCkiIHZhbHVlPSJjbGljayBoZXJlIHRvIHNo
b3cgaWZyYW1lLmNvbnRlbnRXaW5kb3cubXlWYXIiPjxicj4NCjxpZnJhbWUgc3JjPSJodHRwOi8v
YnVncy53ZWJraXQub3JnL2F0dGFjaG1lbnQuY2dpP2lkPTEzNjIxIiBpZD0idGVzdEZyYW1lIiBi
b3JkZXI9IjEiIHdpZHRoPSI4MDAiIGhlaWdodD0iNTAiPjwvaWZyYW1lPg0KPC9ib2R5Pg0KPC9o
dG1sPg==
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>13624</attachid>
            <date>2007-03-13 18:41:33 -0700</date>
            <delta_ts>2007-03-13 18:46:21 -0700</delta_ts>
            <desc>Here is the testcase. It will work on every major browser but Safari</desc>
            <filename>testcase.html</filename>
            <type>text/html</type>
            <size>647</size>
            <attacher name="Brian Bober">netdragon</attacher>
            
              <data encoding="base64">PGh0bWw+DQo8Ym9keT4NCjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0IiBsYW5ndWFnZT0i
SmF2YXNjcmlwdCI+DQo8IS0tDQpmdW5jdGlvbiBkaXNwbGF5VmFyKCkNCnsNCglkb2N1bWVudC5n
ZXRFbGVtZW50QnlJZCgiZGlzcGxheURpdiIpLmlubmVySFRNTCA9IGRvY3VtZW50LmdldEVsZW1l
bnRCeUlkKCJ0ZXN0RnJhbWUiKS5jb250ZW50V2luZG93Lm15VmFyOy8qIEkga25vdyBpbm5lckhU
TUwgaXMgImV2aWwiLCBidXQgdGhpcyBpcyBqdXN0IGEgdGVzdGNhc2UgKi8NCn0NCi0tPg0KPC9z
Y3JpcHQ+DQpPdXRwdXQgZ29lcyBoZXJlOiA8ZGl2IGlkPSJkaXNwbGF5RGl2IiBzdHlsZT0id2lk
dGg6IDgwMHB4OyBoZWlnaHQ6IDUwcHg7IGJvcmRlcjogMXB4IHNvbGlkIHJlZDsiPjwvZGl2Pg0K
PGJyPg0KPGlucHV0IHR5cGU9ImJ1dHRvbiIgb25jbGljaz0iZGlzcGxheVZhcigpIiB2YWx1ZT0i
Y2xpY2sgaGVyZSB0byBzaG93IGlmcmFtZS5jb250ZW50V2luZG93Lm15VmFyIj48YnI+DQo8aWZy
YW1lIHNyYz0iaHR0cDovL2J1Z3Mud2Via2l0Lm9yZy9hdHRhY2htZW50LmNnaT9pZD0xMzYyMSIg
aWQ9InRlc3RGcmFtZSIgYm9yZGVyPSIxIiB3aWR0aD0iODAwIiBoZWlnaHQ9IjUwIj48L2lmcmFt
ZT4NCjwvYm9keT4NCjwvaHRtbD4=
</data>

          </attachment>
      

    </bug>

</bugzilla>