Title: [253493] trunk
Revision
253493
Author
[email protected]
Date
2019-12-13 12:38:13 -0800 (Fri, 13 Dec 2019)

Log Message

REGRESSION: (r251677) imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-3.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=205164
<rdar://problem/57879042>

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline WPT tests now that they are passing.

* web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-3-expected.txt:
* web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-expected.txt:

Source/WebCore:

Submitting a form should cancel any pending navigation scheduled by a previous submission of this form:
- https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-algorithm (step 22.3)

No new tests, rebaselined existing tests.

* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::submit):
* html/HTMLFormElement.h:
* loader/FormSubmission.h:
(WebCore::FormSubmission::cancel):
(WebCore::FormSubmission::wasCancelled const):
* loader/NavigationScheduler.cpp:

LayoutTests:

Unskip test that should no longer be flaky.

* platform/mac/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (253492 => 253493)


--- trunk/LayoutTests/ChangeLog	2019-12-13 19:37:53 UTC (rev 253492)
+++ trunk/LayoutTests/ChangeLog	2019-12-13 20:38:13 UTC (rev 253493)
@@ -1,3 +1,15 @@
+2019-12-13  Chris Dumez  <[email protected]>
+
+        REGRESSION: (r251677) imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-3.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=205164
+        <rdar://problem/57879042>
+
+        Reviewed by Alex Christensen.
+
+        Unskip test that should no longer be flaky.
+
+        * platform/mac/TestExpectations:
+
 2019-12-13  Per Arne Vollan  <[email protected]>
 
         [iOS] Deny mach lookup access to "*.apple-extension-service" in the WebContent process

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (253492 => 253493)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-12-13 19:37:53 UTC (rev 253492)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-12-13 20:38:13 UTC (rev 253493)
@@ -1,5 +1,18 @@
 2019-12-13  Chris Dumez  <[email protected]>
 
+        REGRESSION: (r251677) imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-3.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=205164
+        <rdar://problem/57879042>
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline WPT tests now that they are passing.
+
+        * web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-3-expected.txt:
+        * web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-expected.txt:
+
+2019-12-13  Chris Dumez  <[email protected]>
+
         Behavior of [[GetOwnProperty]] for cross-origin windows is not spec-compliant
         https://bugs.webkit.org/show_bug.cgi?id=205184
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-3-expected.txt (253492 => 253493)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-3-expected.txt	2019-12-13 19:37:53 UTC (rev 253492)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-3-expected.txt	2019-12-13 20:38:13 UTC (rev 253493)
@@ -4,5 +4,5 @@
 
 submit
 
-FAIL <button> should have the same double-submit protection as <input type=submit> assert_unreached: Frame1 should not get navigated by this test. Reached unreachable code
+PASS <button> should have the same double-submit protection as <input type=submit> 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-expected.txt (253492 => 253493)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-expected.txt	2019-12-13 19:37:53 UTC (rev 253492)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-expected.txt	2019-12-13 20:38:13 UTC (rev 253493)
@@ -4,5 +4,5 @@
 
 
 
-FAIL default submit action should supersede onclick submit() assert_unreached: Frame1 should not get navigated by this test. Reached unreachable code
+PASS default submit action should supersede onclick submit() 
 

Modified: trunk/LayoutTests/platform/mac/TestExpectations (253492 => 253493)


--- trunk/LayoutTests/platform/mac/TestExpectations	2019-12-13 19:37:53 UTC (rev 253492)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2019-12-13 20:38:13 UTC (rev 253493)
@@ -1961,4 +1961,3 @@
 webkit.org/b/204820 [ Catalina+ ] fast/text/emoji-gender-8.html [ ImageOnlyFailure ]
 webkit.org/b/204820 [ Catalina+ ] fast/text/emoji-gender-9.html [ ImageOnlyFailure ]
 
-webkit.org/b/205164 imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-3.html [ Pass Failure ]
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (253492 => 253493)


--- trunk/Source/WebCore/ChangeLog	2019-12-13 19:37:53 UTC (rev 253492)
+++ trunk/Source/WebCore/ChangeLog	2019-12-13 20:38:13 UTC (rev 253493)
@@ -1,3 +1,24 @@
+2019-12-13  Chris Dumez  <[email protected]>
+
+        REGRESSION: (r251677) imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-3.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=205164
+        <rdar://problem/57879042>
+
+        Reviewed by Alex Christensen.
+
+        Submitting a form should cancel any pending navigation scheduled by a previous submission of this form:
+        - https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-algorithm (step 22.3)
+
+        No new tests, rebaselined existing tests.
+
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::submit):
+        * html/HTMLFormElement.h:
+        * loader/FormSubmission.h:
+        (WebCore::FormSubmission::cancel):
+        (WebCore::FormSubmission::wasCancelled const):
+        * loader/NavigationScheduler.cpp:
+
 2019-12-13  John Wilander  <[email protected]>
 
         IsLoggedIn: Abstract data type for IsLoggedIn state

Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (253492 => 253493)


--- trunk/Source/WebCore/html/HTMLFormElement.cpp	2019-12-13 19:37:53 UTC (rev 253492)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp	2019-12-13 20:38:13 UTC (rev 253493)
@@ -358,7 +358,11 @@
     auto protectedThis = makeRef(*this); // Form submission can execute arbitary _javascript_.
 
     auto shouldLockHistory = processingUserGesture ? LockHistory::No : LockHistory::Yes;
-    frame->loader().submitForm(FormSubmission::create(*this, m_attributes, event, shouldLockHistory, formSubmissionTrigger));
+    auto formSubmission = FormSubmission::create(*this, m_attributes, event, shouldLockHistory, formSubmissionTrigger);
+    if (m_plannedFormSubmission)
+        m_plannedFormSubmission->cancel();
+    m_plannedFormSubmission = makeWeakPtr(formSubmission.get());
+    frame->loader().submitForm(WTFMove(formSubmission));
 
     if (needButtonActivation && firstSuccessfulSubmitButton)
         firstSuccessfulSubmitButton->setActivatedSubmit(false);

Modified: trunk/Source/WebCore/html/HTMLFormElement.h (253492 => 253493)


--- trunk/Source/WebCore/html/HTMLFormElement.h	2019-12-13 19:37:53 UTC (rev 253492)
+++ trunk/Source/WebCore/html/HTMLFormElement.h	2019-12-13 20:38:13 UTC (rev 253493)
@@ -181,6 +181,7 @@
     Vector<FormAssociatedElement*> m_associatedElements;
     Vector<WeakPtr<HTMLImageElement>> m_imageElements;
     WeakHashSet<HTMLFormControlElement> m_invalidAssociatedFormControls;
+    WeakPtr<FormSubmission> m_plannedFormSubmission;
 
     bool m_wasUserSubmitted { false };
     bool m_isSubmittingOrPreparingForSubmission { false };

Modified: trunk/Source/WebCore/loader/FormSubmission.h (253492 => 253493)


--- trunk/Source/WebCore/loader/FormSubmission.h	2019-12-13 19:37:53 UTC (rev 253492)
+++ trunk/Source/WebCore/loader/FormSubmission.h	2019-12-13 20:38:13 UTC (rev 253493)
@@ -33,6 +33,7 @@
 #include "FormState.h"
 #include "FrameLoaderTypes.h"
 #include <wtf/URL.h>
+#include <wtf/WeakPtr.h>
 
 namespace WebCore {
 
@@ -40,9 +41,9 @@
 class FormData;
 class FrameLoadRequest;
 
-class FormSubmission : public RefCounted<FormSubmission> {
+class FormSubmission : public RefCounted<FormSubmission>, public CanMakeWeakPtr<FormSubmission> {
 public:
-    enum class Method { Get, Post };
+    enum class Method : bool { Get, Post };
 
     class Attributes {
     public:
@@ -96,11 +97,15 @@
     void setReferrer(const String& referrer) { m_referrer = referrer; }
     void setOrigin(const String& origin) { m_origin = origin; }
 
+    void cancel() { m_wasCancelled = true; }
+    bool wasCancelled() const { return m_wasCancelled; }
+
 private:
     FormSubmission(Method, const URL& action, const String& target, const String& contentType, Ref<FormState>&&, Ref<FormData>&&, const String& boundary, LockHistory, Event*);
 
     // FIXME: Hold an instance of Attributes instead of individual members.
     Method m_method;
+    bool m_wasCancelled { false };
     URL m_action;
     String m_target;
     String m_contentType;

Modified: trunk/Source/WebCore/loader/NavigationScheduler.cpp (253492 => 253493)


--- trunk/Source/WebCore/loader/NavigationScheduler.cpp	2019-12-13 19:37:53 UTC (rev 253492)
+++ trunk/Source/WebCore/loader/NavigationScheduler.cpp	2019-12-13 20:38:13 UTC (rev 253493)
@@ -277,6 +277,9 @@
 
     void fire(Frame& frame) override
     {
+        if (m_submission->wasCancelled())
+            return;
+
         UserGestureIndicator gestureIndicator(userGestureToForward());
 
         // The submitForm function will find a target frame before using the redirection timer.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to