<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[166793] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/166793">166793</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-04-04 11:07:44 -0700 (Fri, 04 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION (<a href="http://trac.webkit.org/projects/webkit/changeset/166615">r166615</a>): Pressing return doesn’t submit search term at bing.com
https://bugs.webkit.org/show_bug.cgi?id=131212
&lt;rdar://problem/16521788&gt;

Reviewed by Dan Bernstein.

Source/WebCore: 

Test: fast/forms/submit-while-you-submit.html

Turns out that m_shouldSubmit can actually be modified in a code path where we can't
directly return the result. I'm not sure if the current behavior is entirely correct
(we have open bugs about submitting forms multiple times), but let's restore it to
pre-<a href="http://trac.webkit.org/projects/webkit/changeset/166615">r166615</a> state.

* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::HTMLFormElement):
(WebCore::HTMLFormElement::prepareForSubmission):
(WebCore::HTMLFormElement::submit):
* html/HTMLFormElement.h:

LayoutTests: 

* fast/forms/submit-while-you-submit-expected.txt: Added.
* fast/forms/submit-while-you-submit.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLFormElementcpp">trunk/Source/WebCore/html/HTMLFormElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLFormElementh">trunk/Source/WebCore/html/HTMLFormElement.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastformssubmitwhileyousubmitexpectedtxt">trunk/LayoutTests/fast/forms/submit-while-you-submit-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformssubmitwhileyousubmithtml">trunk/LayoutTests/fast/forms/submit-while-you-submit.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (166792 => 166793)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-04-04 17:56:23 UTC (rev 166792)
+++ trunk/LayoutTests/ChangeLog        2014-04-04 18:07:44 UTC (rev 166793)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-04-04  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        REGRESSION (r166615): Pressing return doesn’t submit search term at bing.com
+        https://bugs.webkit.org/show_bug.cgi?id=131212
+        &lt;rdar://problem/16521788&gt;
+
+        Reviewed by Dan Bernstein.
+
+        * fast/forms/submit-while-you-submit-expected.txt: Added.
+        * fast/forms/submit-while-you-submit.html: Added.
+
</ins><span class="cx"> 2014-04-04  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed test fix. Rebaseline Mountain Lion scrolling tests
</span></span></pre></div>
<a id="trunkLayoutTestsfastformssubmitwhileyousubmitexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/submit-while-you-submit-expected.txt (0 => 166793)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/submit-while-you-submit-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/submit-while-you-submit-expected.txt        2014-04-04 18:07:44 UTC (rev 166793)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test that calling submit() during submit event handling works.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Form was submitted
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/forms/submit-while-you-submit-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfastformssubmitwhileyousubmithtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/submit-while-you-submit.html (0 => 166793)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/submit-while-you-submit.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/submit-while-you-submit.html        2014-04-04 18:07:44 UTC (rev 166793)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;form action=&quot;javascript:testPassed('Form was submitted'); finishJSTest()&quot; onsubmit=&quot;onSubmit()&quot;&gt;
+&lt;input type=&quot;submit&quot; id=&quot;submitButton&quot;&gt;
+&lt;/form&gt;
+&lt;script&gt;
+
+description(&quot;Test that calling submit() during submit event handling works.&quot;);
+jsTestIsAsync = true;
+
+function onSubmit()
+{
+    document.forms[0].submit();
+    event.preventDefault();
+}
+
+function simulateClick(id)
+{
+    var rect = document.getElementById(id).getBoundingClientRect();
+    eventSender.mouseMoveTo(rect.left + rect.width / 2, rect.top + rect.height / 2);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+
+if (window.eventSender)
+    simulateClick(&quot;submitButton&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/forms/submit-while-you-submit.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (166792 => 166793)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-04 17:56:23 UTC (rev 166792)
+++ trunk/Source/WebCore/ChangeLog        2014-04-04 18:07:44 UTC (rev 166793)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-04-04  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        REGRESSION (r166615): Pressing return doesn’t submit search term at bing.com
+        https://bugs.webkit.org/show_bug.cgi?id=131212
+        &lt;rdar://problem/16521788&gt;
+
+        Reviewed by Dan Bernstein.
+
+        Test: fast/forms/submit-while-you-submit.html
+
+        Turns out that m_shouldSubmit can actually be modified in a code path where we can't
+        directly return the result. I'm not sure if the current behavior is entirely correct
+        (we have open bugs about submitting forms multiple times), but let's restore it to
+        pre-r166615 state.
+
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::HTMLFormElement):
+        (WebCore::HTMLFormElement::prepareForSubmission):
+        (WebCore::HTMLFormElement::submit):
+        * html/HTMLFormElement.h:
+
</ins><span class="cx"> 2014-04-04  Martin Hock  &lt;mhock@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Mac] Change operation queue width to NSOperationQueueDefaultMaxConcurrentOperationCount.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLFormElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (166792 => 166793)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLFormElement.cpp        2014-04-04 17:56:23 UTC (rev 166792)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp        2014-04-04 18:07:44 UTC (rev 166793)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx">     , m_associatedElementsAfterIndex(0)
</span><span class="cx">     , m_wasUserSubmitted(false)
</span><span class="cx">     , m_isSubmittingOrPreparingForSubmission(false)
</span><ins>+    , m_shouldSubmit(false)
</ins><span class="cx">     , m_isInResetFunction(false)
</span><span class="cx">     , m_wasDemoted(false)
</span><span class="cx"> {
</span><span class="lines">@@ -266,7 +267,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_isSubmittingOrPreparingForSubmission = true;
</span><del>-    bool shouldSubmit = false;
</del><ins>+    m_shouldSubmit = false;
</ins><span class="cx"> 
</span><span class="cx">     // Interactive validation must be done before dispatching the submit event.
</span><span class="cx">     if (!validateInteractively(event)) {
</span><span class="lines">@@ -279,12 +280,13 @@
</span><span class="cx">     RefPtr&lt;FormState&gt; formState = FormState::create(this, controlNamesAndValues, &amp;document(), NotSubmittedByJavaScript);
</span><span class="cx">     frame-&gt;loader().client().dispatchWillSendSubmitEvent(formState.release());
</span><span class="cx"> 
</span><ins>+    // Event handling can result in m_shouldSubmit becoming true, regardless of dispatchEvent() return value.
</ins><span class="cx">     if (dispatchEvent(Event::create(eventNames().submitEvent, true, true)))
</span><del>-        shouldSubmit = true;
</del><ins>+        m_shouldSubmit = true;
</ins><span class="cx"> 
</span><span class="cx">     m_isSubmittingOrPreparingForSubmission = false;
</span><span class="cx"> 
</span><del>-    if (shouldSubmit)
</del><ins>+    if (m_shouldSubmit)
</ins><span class="cx">         submit(event, true, true, NotSubmittedByJavaScript);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -322,8 +324,10 @@
</span><span class="cx">     if (!view || !frame)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (m_isSubmittingOrPreparingForSubmission)
</del><ins>+    if (m_isSubmittingOrPreparingForSubmission) {
+        m_shouldSubmit = true;
</ins><span class="cx">         return;
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     m_isSubmittingOrPreparingForSubmission = true;
</span><span class="cx">     m_wasUserSubmitted = processingUserGesture;
</span><span class="lines">@@ -353,6 +357,7 @@
</span><span class="cx">     if (needButtonActivation &amp;&amp; firstSuccessfulSubmitButton)
</span><span class="cx">         firstSuccessfulSubmitButton-&gt;setActivatedSubmit(false);
</span><span class="cx"> 
</span><ins>+    m_shouldSubmit = false;
</ins><span class="cx">     m_isSubmittingOrPreparingForSubmission = false;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLFormElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLFormElement.h (166792 => 166793)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLFormElement.h        2014-04-04 17:56:23 UTC (rev 166792)
+++ trunk/Source/WebCore/html/HTMLFormElement.h        2014-04-04 18:07:44 UTC (rev 166793)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">     void registerImgElement(HTMLImageElement*);
</span><span class="cx">     void removeImgElement(HTMLImageElement*);
</span><span class="cx"> 
</span><del>-    void prepareForSubmission(Event*); // FIXME: This function doesn't only prepare, it sometimes calls sumbit() itself.
</del><ins>+    void prepareForSubmission(Event*); // FIXME: This function doesn't only prepare, it sometimes calls submit() itself.
</ins><span class="cx">     void submit();
</span><span class="cx">     void submitFromJavaScript();
</span><span class="cx">     void reset();
</span><span class="lines">@@ -172,6 +172,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool m_wasUserSubmitted;
</span><span class="cx">     bool m_isSubmittingOrPreparingForSubmission;
</span><ins>+    bool m_shouldSubmit;
</ins><span class="cx"> 
</span><span class="cx">     bool m_isInResetFunction;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>