<?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>111023</bug_id>
          
          <creation_ts>2013-02-27 16:05:28 -0800</creation_ts>
          <short_desc>Threaded HTML parser causes flaky timeout for fast/loader/unload-hyperlink-targeted.html</short_desc>
          <delta_ts>2013-09-20 11:58:03 -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>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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>
          
          <blocked>106127</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Adam Barth">abarth</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>dpranke</cc>
    
    <cc>eric</cc>
    
    <cc>syoichi</cc>
    
    <cc>tonyg</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>843593</commentid>
    <comment_count>0</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2013-02-27 16:05:28 -0800</bug_when>
    <thetext>Reduction:

=== fast/loader/unload-hyperlink-targeted.html ===

&lt;script&gt;
if (window.testRunner) {
  testRunner.dumpAsText();
  testRunner.waitUntilDone();
}
&lt;/script&gt;
&lt;iframe src=&quot;resources/unload-hyperlink-targeted-subframe.html&quot;&gt;
&lt;/iframe&gt;

=== unload-hyperlink-targeted-subframe.html ===

&lt;script&gt;
addEventListener(&quot;unload&quot;, function() {
  top.location = &quot;pass-and-notify-done.html&quot;;
});

window.location = &quot;about:blank&quot;;
&lt;/script&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>843599</commentid>
    <comment_count>1</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2013-02-27 16:12:36 -0800</bug_when>
    <thetext>These tests are awesome.  We can stare at this in person tomorrow if you haven&apos;t solved it by then.

I&apos;m sure this is just a race.

Does scheduling a location change from in an unload handler cancel the previously scheduled change?

I assume the parser immediately gets detached/stopped?

http://trac.webkit.org/browser/trunk/LayoutTests/fast/loader/resources/pass-and-notify-done.html

The main resource won&apos;t be done loading until that&apos;s done loading, right?  And that &lt;script&gt; executes before it&apos;s done loading.

I wonder if:

test.html:
&lt;script&gt;
if (window.testRunner) {
  testRunner.dumpAsText();
  testRunner.waitUntilDone();
}
document.location = &quot;pass-and-notify-done.html&quot;
&lt;/script&gt;

is supposed to work or not. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>843608</commentid>
    <comment_count>2</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2013-02-27 16:24:02 -0800</bug_when>
    <thetext>&gt; I&apos;m sure this is just a race.

Yes.  The question is why the main thread parser always wins the race.

&gt; Does scheduling a location change from in an unload handler cancel the previously scheduled change?

I don&apos;t think so.  Once you get to unload, nothing can stop the navigation from happening.  It&apos;s already committed.

&gt; I assume the parser immediately gets detached/stopped?

Yes.  The parser will notice that there is a location change pending.

&gt; http://trac.webkit.org/browser/trunk/LayoutTests/fast/loader/resources/pass-and-notify-done.html
&gt; 
&gt; The main resource won&apos;t be done loading until that&apos;s done loading, right?

Correct.  Note, however, that the parser for the main frame is probably done already.

&gt; And that &lt;script&gt; executes before it&apos;s done loading.

Yes.

&gt; I wonder if:
&gt; 
&gt; test.html:
&gt; &lt;script&gt;
&gt; if (window.testRunner) {
&gt;   testRunner.dumpAsText();
&gt;   testRunner.waitUntilDone();
&gt; }
&gt; document.location = &quot;pass-and-notify-done.html&quot;
&gt; &lt;/script&gt;
&gt; 
&gt; is supposed to work or not. :)

Yes, that works.  I think we&apos;d call that a &quot;client-side redirect.&quot;  There is a bunch of special code to handle client-side redirects.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>843617</commentid>
    <comment_count>3</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2013-02-27 16:57:13 -0800</bug_when>
    <thetext>The difference between the passing and failing case appears to be the timing of the EOF processing.  If the EOF comes in before the top.location timer fires, then there&apos;s no timeout.  If the EOF takes longer and comes in after the top.location timer fires, then the test times out.

I need to study the test case more carefully to confirm.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>843851</commentid>
    <comment_count>4</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2013-02-28 01:04:45 -0800</bug_when>
    <thetext>fast/dom/Window/Location/set-location-after-close.html too</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>844507</commentid>
    <comment_count>5</comment_count>
    <who name="Dirk Pranke">dpranke</who>
    <bug_when>2013-02-28 14:56:31 -0800</bug_when>
    <thetext>(marking this as flaky ...)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>931500</commentid>
    <comment_count>6</comment_count>
    <who name="Dirk Pranke">dpranke</who>
    <bug_when>2013-09-20 11:58:03 -0700</bug_when>
    <thetext>Seems to be fine now. Closing.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>