<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Resource load cancelled if detaching the first of multiple iframes all loading from the same URL"
   href="https://bugs.webkit.org/show_bug.cgi?id=157563">157563</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Resource load cancelled if detaching the first of multiple iframes all loading from the same URL
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Local Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frames
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hyongyoub.kim&#64;navercorp.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=278609" name="attach_278609" title="Test html pages and cgi perl scripts">attachment 278609</a> <a href="attachment.cgi?id=278609&amp;action=edit" title="Test html pages and cgi perl scripts">[details]</a></span>
Test html pages and cgi perl scripts

Multiple iframes are loading from the same URL. Before the main resource load completes, the first iframe that started the load gets detached from the page via javascript. The other iframes all see cancelled main resource.

test.zip contains two simple test cases. Need cgi/perl enabled webserver.
Case 1:
html/main.html

Case 2:
html/main2.html

Here is case 1 so you do not have to unzip the file.

&lt;html&gt;
&lt;body&gt;
&lt;div id=&quot;shadow&quot;&gt;
&lt;iframe src=&quot;/cgi-bin/slow-iframe&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;div id=&quot;empty&quot;&gt;&lt;/div&gt;
&lt;/body&gt;

&lt;script&gt;
function set2() {
  document.getElementById(&quot;shadow&quot;).innerHTML = &quot;&quot;;
}

function set1() {
  document.getElementById(&quot;empty&quot;).innerHTML = document.getElementById(&quot;shadow&quot;).innerHTML;
  setTimeout(set2, 1000);
}

setTimeout(set1, 1000);
&lt;/script&gt;
&lt;/html&gt;

The first iframe ('shadow') starts loading /cgi-bin/slow-iframe.
1 second later: set1 adds the second iframe, which also loads from /cgi-bin/slow-iframe.
2 seconds later: set2 detaches the first iframe from the page.
3 seconds later: slow-iframe finally returns the response.

IE/Firefox/Chrome all show slow-iframe's response in the second iframe. But safari and other WebKit ports show a blank because the load gets cancelled when we detach the first iframe from the page. When detached from the page, FrameLoader calls stopAllLoaders, which ends up cancelling the main resource load. The second iframe waiting for the load to complete sees a cancelled load.

Case 2 is similar but shows the problem with subresource not the main resource. In this case, the main resouce loads quickly so both iframes see the completed resource. But its subresource loads slowly. When the first iframe gets detached, the subresource load gets cancelled.

For case 2, IE/Firefox show the subresource in the second iframe. Safari/Chrome/WebKit ports show blank. Chrome is okay for case 1 because it is not caching main resources in MemoryCache...

This behavior feels like a bug because, without MemoryCache, we would not see cancelled loads. In case people feel like this sort of iframe usage is a far fetched scenario, many sites in China actually do employ some versions of it...</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>