<?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>6958</bug_id>
          
          <creation_ts>2006-01-30 23:20:32 -0800</creation_ts>
          <short_desc>form submit in onload handler causes an infinite loop</short_desc>
          <delta_ts>2011-07-29 12:41:21 -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>Forms</component>
          <version>420+</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>7080</dependson>
          <blocked>39021</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Joost de Valk (AlthA)">joost</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>BugZilla</cc>
    
    <cc>darin</cc>
    
    <cc>ddkilzer</cc>
    
    <cc>ian</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>30722</commentid>
    <comment_count>0</comment_count>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2006-01-30 23:20:32 -0800</bug_when>
    <thetext>Testcase forthcoming but this is the code:

&lt;body onload=&quot;document.getElementById(&apos;form&apos;).submit()&quot;&gt;

&lt;form id=&quot;form&quot;&gt;&lt;/form&gt;

&lt;/body&gt;

This will cause an infinite loop, hanging safari.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30723</commentid>
    <comment_count>1</comment_count>
      <attachid>6139</attachid>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2006-01-30 23:21:22 -0800</bug_when>
    <thetext>Created attachment 6139
Testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30810</commentid>
    <comment_count>2</comment_count>
    <who name="Dave Hyatt">hyatt</who>
    <bug_when>2006-01-31 14:57:45 -0800</bug_when>
    <thetext>I think this may be related to the infinite loop bug with setting window.location.href = &quot;#somelinkonpage&quot; in onload.  Try a test case that does that too.  I bet they are the same underlying issue.  There was some Ajax bug about Really Simple History not working that is related to this too.

IMO fixing these bugs is really really important (P1), since it&apos;s an infinite loop.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30902</commentid>
    <comment_count>3</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2006-01-31 21:50:33 -0800</bug_when>
    <thetext>Is it really starting an infinite loop, or is the Redirection Timer just started and never stopped during this action?

See also Bug 6309.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>31412</commentid>
    <comment_count>4</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2006-02-05 00:48:03 -0800</bug_when>
    <thetext>This is really an infinite loop.

I think the reason for this is that it submits the form right away, whereas for a location change, we schedule it and it gets done next time around the event loop. I think form submission should be changed to work the same way as other location changes, sharing the &quot;redirection timer&quot; with the rest.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>31422</commentid>
    <comment_count>5</comment_count>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2006-02-05 01:21:29 -0800</bug_when>
    <thetext>As commented by darin, form submission should time differently. The infinite loop part of this can be found in bug 7080, this bug is now just here to track how we handle form submission.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62063</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2007-11-23 01:49:58 -0800</bug_when>
    <thetext>Hmm, this seems to have fixed itself between r19809 and r19818 - I don&apos;t see any check-ins in this period that look related to this issue (most of them were on branches).

I guess we need to land an automated test for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>442414</commentid>
    <comment_count>7</comment_count>
    <who name="Kevin H McCullough">BugZilla</who>
    <bug_when>2011-07-26 11:50:20 -0700</bug_when>
    <thetext>I can reproduce on r91704</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>442657</commentid>
    <comment_count>8</comment_count>
      <attachid>102083</attachid>
    <who name="Kevin H McCullough">BugZilla</who>
    <bug_when>2011-07-26 17:46:30 -0700</bug_when>
    <thetext>Created attachment 102083
Test case for body onload handler that submits a form that loads itself</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>442658</commentid>
    <comment_count>9</comment_count>
      <attachid>102084</attachid>
    <who name="Kevin H McCullough">BugZilla</who>
    <bug_when>2011-07-26 17:47:04 -0700</bug_when>
    <thetext>Created attachment 102084
Test case for body onload handler that submits a URL fragment</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>442668</commentid>
    <comment_count>10</comment_count>
    <who name="Kevin H McCullough">BugZilla</who>
    <bug_when>2011-07-26 17:58:17 -0700</bug_when>
    <thetext>I uploaded two tests.  One for testing if the unload handler submits to a URL fragment and one if it just submits to the current page.  For the URL fragment there is no infinite loop, but for the other test WebKit does loop infinitely.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>442669</commentid>
    <comment_count>11</comment_count>
    <who name="Kevin H McCullough">BugZilla</who>
    <bug_when>2011-07-26 18:02:46 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; This is really an infinite loop.
&gt; 
&gt; I think the reason for this is that it submits the form right away, whereas for a location change, we schedule it and it gets done next time around the event loop. I think form submission should be changed to work the same way as other location changes, sharing the &quot;redirection timer&quot; with the rest.

NavigationScheduler::scheduleFormSubmission()

calls

schedule(adoptPtr(new ScheduledFormSubmission()))

Does this mean the submission is using the &quot;redirection timer&quot;?  It seems like the infinite loop is because on each new load the body&apos;s onload handler is called.  However, you are not stuck in this loop, I can click on another link and navigate away from the looping page.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>443057</commentid>
    <comment_count>12</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-07-27 12:07:33 -0700</bug_when>
    <thetext>(In reply to comment #11)
&gt; However, you are not stuck in this loop, I can click on another link and navigate away from the looping page.

That’s right. An infinite reload loop, not a browser or engine hang.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>443079</commentid>
    <comment_count>13</comment_count>
    <who name="Kevin H McCullough">BugZilla</who>
    <bug_when>2011-07-27 12:23:16 -0700</bug_when>
    <thetext>(In reply to comment #12)
&gt; (In reply to comment #11)
&gt; &gt; However, you are not stuck in this loop, I can click on another link and navigate away from the looping page.
&gt; 
&gt; That’s right. An infinite reload loop, not a browser or engine hang.

So what ought to be the fix?  The browser is doing what the website is telling it to do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>443080</commentid>
    <comment_count>14</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-07-27 12:23:56 -0700</bug_when>
    <thetext>Do other web browsers do the same thing?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>443100</commentid>
    <comment_count>15</comment_count>
    <who name="Kevin H McCullough">BugZilla</who>
    <bug_when>2011-07-27 12:39:15 -0700</bug_when>
    <thetext>(In reply to comment #14)
&gt; Do other web browsers do the same thing?

FF (OS X) infinite reloads.  It doesn&apos;t look like it because the UI isn&apos;t updating, but in FireBug it&apos;s very obvious.
Chrome (OS X) infinite reloads

Unfortunately I haven&apos;t put Win on this machine yet.  But I&apos;ve been meaning to do that, so maybe now is the time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>443167</commentid>
    <comment_count>16</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-07-27 14:54:41 -0700</bug_when>
    <thetext>The original bug was a true infinite loop. But now it’s just an infinite reload loop.

Kevin, you are the one who said you could still reproduce the bug, but you’re just reproducing a reload loop, not a true infinite loop. I think Alexey had it right in comment #6. This is fixed and we need a regression test.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>443240</commentid>
    <comment_count>17</comment_count>
    <who name="Kevin H McCullough">BugZilla</who>
    <bug_when>2011-07-27 17:52:01 -0700</bug_when>
    <thetext>(In reply to comment #16)
&gt; The original bug was a true infinite loop. But now it’s just an infinite reload loop.
&gt; 
&gt; Kevin, you are the one who said you could still reproduce the bug, but you’re just reproducing a reload loop, not a true infinite loop. I think Alexey had it right in comment #6. This is fixed and we need a regression test.

Agreed.  I get the same behavior as I described above on current FF, Chrome, Safari, and IE (on Win 7).

I&apos;ll make a layout test.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>444043</commentid>
    <comment_count>18</comment_count>
      <attachid>102380</attachid>
    <who name="Kevin H McCullough">BugZilla</who>
    <bug_when>2011-07-29 12:41:21 -0700</bug_when>
    <thetext>Created attachment 102380
New Test case proposal.

This test case tries to test for the &quot;infinite loop&quot; scenario while not reloading forever in the success case.  However, as the infinite loop code has not caused the error for so long, I cannot reproduce the old bad-behavior, and so am unable to be certain if this test would catch it.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>6139</attachid>
            <date>2006-01-30 23:21:22 -0800</date>
            <delta_ts>2006-01-30 23:21:22 -0800</delta_ts>
            <desc>Testcase</desc>
            <filename>6958-infinite-loop.html</filename>
            <type>text/html</type>
            <size>90</size>
            <attacher name="Joost de Valk (AlthA)">joost</attacher>
            
              <data encoding="base64">PGJvZHkgb25sb2FkPSJkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnZm9ybScpLnN1Ym1pdCgpIj4K
Cjxmb3JtIGlkPSJmb3JtIj48L2Zvcm0+Cgo8L2JvZHk+
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>102083</attachid>
            <date>2011-07-26 17:46:30 -0700</date>
            <delta_ts>2011-07-29 12:41:21 -0700</delta_ts>
            <desc>Test case for body onload handler that submits a form that loads itself</desc>
            <filename>form-submit-fragment-in-onload-handler.html</filename>
            <type>text/html</type>
            <size>597</size>
            <attacher name="Kevin H McCullough">BugZilla</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgo8c2NyaXB0PgogICAgZnVuY3Rpb24gcnVuVGVzdHMoKSB7CiAgICAgICAg
aWYgKHdpbmRvdy5sYXlvdXRUZXN0Q29udHJvbGxlcikgewogICAgICAgICAgICBsYXlvdXRUZXN0
Q29udHJvbGxlci5kdW1wQXNUZXh0KCk7CiAgICAgICAgICAgIGxheW91dFRlc3RDb250cm9sbGVy
LndhaXRVbnRpbERvbmUoKTsKICAgICAgICB9CiAgICB9CgogICAgPC9zY3JpcHQ+CjwvaGVhZD4K
PCEtLSA8Ym9keSBvbmxvYWQ9InJ1blRlc3RzKCk7Ij4gLS0+Cjxib2R5IG9ubG9hZD0iZG9jdW1l
bnQuZ2V0RWxlbWVudEJ5SWQoJ2Zvcm0nKS5zdWJtaXQoKSI+CiAgICA8cD5UaGlzIHRlc3RzIHRo
YXQgc3VibWl0dGluZyBhIGZvcm0gaW4gdGhlIG9ubG9hZCBoYW5kbGVyIHRvIGFuIFVSTCBmcmFn
bWVudCBkb2VzIG5vdCByZXN1bHQgaW4gYW4gaW5maW5pdGUgbG9vcDwvcD4KICAgIDxmb3JtIGlk
PSJmb3JtIiBhY3Rpb249IiNzb21lbGlua29ucGFnZSI+PC9mb3JtPgogICAgPGRpdiBpZD0iY29u
c29sZSI+PC9kaXY+CiAgICA8YSBuYW1lPSJzb21lbGlua29ucGFnZSI+WW91J3JlIGF0IHRoZSBi
b3R0b20hPC9hPgo8L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>102084</attachid>
            <date>2011-07-26 17:47:04 -0700</date>
            <delta_ts>2011-07-29 12:41:21 -0700</delta_ts>
            <desc>Test case for body onload handler that submits a URL fragment</desc>
            <filename>form-submit-in-onload-handler.html</filename>
            <type>text/html</type>
            <size>498</size>
            <attacher name="Kevin H McCullough">BugZilla</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgo8c2NyaXB0PgogICAgZnVuY3Rpb24gcnVuVGVzdHMoKSB7CiAgICAgICAg
aWYgKHdpbmRvdy5sYXlvdXRUZXN0Q29udHJvbGxlcikgewogICAgICAgICAgICBsYXlvdXRUZXN0
Q29udHJvbGxlci5kdW1wQXNUZXh0KCk7CiAgICAgICAgICAgIGxheW91dFRlc3RDb250cm9sbGVy
LndhaXRVbnRpbERvbmUoKTsKICAgICAgICB9CiAgICB9CgogICAgPC9zY3JpcHQ+CjwvaGVhZD4K
PCEtLSA8Ym9keSBvbmxvYWQ9InJ1blRlc3RzKCk7Ij4gLS0+Cjxib2R5IG9ubG9hZD0iZG9jdW1l
bnQuZ2V0RWxlbWVudEJ5SWQoJ2Zvcm0nKS5zdWJtaXQoKSI+CiAgICA8cD5UaGlzIHRlc3RzIHRo
YXQgc3VibWl0dGluZyBhIGZvcm0gaW4gdGhlIG9ubG9hZCBoYW5kbGVyIGRvZXMgbm90IHJlc3Vs
dCBpbiBhbiBpbmZpbml0ZSBsb29wPC9wPgogICAgPGZvcm0gaWQ9ImZvcm0iPjwvZm9ybT4KICAg
IDxkaXYgaWQ9ImNvbnNvbGUiPjwvZGl2Pgo8L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>102380</attachid>
            <date>2011-07-29 12:41:21 -0700</date>
            <delta_ts>2011-07-29 12:41:21 -0700</delta_ts>
            <desc>New Test case proposal.</desc>
            <filename>form-submit-in-onload-handler.html</filename>
            <type>text/html</type>
            <size>1319</size>
            <attacher name="Kevin H McCullough">BugZilla</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgo8c2NyaXB0PgogICAgZnVuY3Rpb24gcnVuVGVzdHMoKSB7CiAgICAgICAg
aWYgKHdpbmRvdy5sYXlvdXRUZXN0Q29udHJvbGxlcikgewogICAgICAgICAgICBsYXlvdXRUZXN0
Q29udHJvbGxlci5kdW1wQXNUZXh0KCk7CiAgICAgICAgICAgIGxheW91dFRlc3RDb250cm9sbGVy
LndhaXRVbnRpbERvbmUoKTsKICAgICAgICB9CgogICAgICAgIGluY3JlbWVudENvb2tpZUFuZFN1
Ym1pdEFnYWluKCk7CiAgICB9CgoKICAgIGZ1bmN0aW9uIGluY3JlbWVudENvb2tpZUFuZFN1Ym1p
dEFnYWluKCkgewogICAgICAgIHZhciBjb29raWUgPSBkb2N1bWVudC5jb29raWU7CiAgICAgICAg
Y29va2llID0gY29va2llLnNwbGl0KCI7Iik7CgogICAgICAgIHZhciBjb3VudGVyID0gMDsKICAg
ICAgICB2YXIgcGFpcjsKICAgICAgICBmb3IodmFyIGkgPSAwOyBpIDwgY29va2llLmxlbmd0aDsg
KytpKSB7CiAgICAgICAgICAgIHBhaXIgPSBjb29raWVbaV0uc3BsaXQoIj0iKTsKICAgICAgICAg
ICAgaWYgKHBhaXJbMF0gPT0gInBhZ2VDb3VudCIpCiAgICAgICAgICAgICAgICBjb3VudGVyID0g
cGFyc2VJbnQocGFpclsxXSk7CiAgICAgICAgfQogICAgICAgICsrY291bnRlcjsKCiAgICAgICAg
aWYgKGNvdW50ZXIgPCAzKQogICAgICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnZm9y
bScpLnN1Ym1pdCgpOwoKICAgICAgICB2YXIgZXhwRGF0ZSA9IG5ldyBEYXRlKCk7CiAgICAgICAg
ZXhwRGF0ZS5zZXRUaW1lKGV4cERhdGUuZ2V0VGltZSgpICsgNTAwMCk7ICAvLyBleHByaWVzIGlu
IDUgc2Vjb25kcwoKICAgICAgICB2YXIgbmV3Q29va2llID0gInBhZ2VDb3VudD0iICsgY291bnRl
cjsKICAgICAgICBuZXdDb29raWUgKz0gIjsgZXhwaXJlcz0iICsgZXhwRGF0ZS50b0dNVFN0cmlu
ZygpOwogICAgICAgIHdpbmRvdy5kb2N1bWVudC5jb29raWUgPSBuZXdDb29raWU7CgogICAgICAg
IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJjb25zb2xlIikuaW5uZXJIVE1MID0gIkxvb3BlZCAi
ICsgY291bnRlciArICIgdGltZXMuIjsKICAgIH0KICAgIDwvc2NyaXB0Pgo8L2hlYWQ+Cgo8IS0t
IDxib2R5IG9ubG9hZD0icnVuVGVzdHMoKTsiPiAtLT4KPGJvZHkgb25sb2FkPSJydW5UZXN0cygp
Ij4KICAgIDxwPlRoaXMgdGVzdHMgdGhhdCBzdWJtaXR0aW5nIGEgZm9ybSBpbiB0aGUgb25sb2Fk
IGhhbmRsZXIgZG9lcyBub3QgcmVzdWx0IGluIGFuIGluZmluaXRlIGxvb3A8L3A+CiAgICA8Zm9y
bSBpZD0iZm9ybSI+PC9mb3JtPgogICAgPGRpdiBpZD0iY29uc29sZSI+PC9kaXY+CjwvYm9keT4K
PC9odG1sPgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>