Bug 1535988, backout because bug 1537555, r=backout
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Fri, 22 Mar 2019 17:20:27 +0200
changeset 465813 e6e1347abf34dc5e579f334732678871d9dfd332
parent 465812 36720426160eee98a884c6fe939725b80c935af6
child 465814 2deb1c4df8fda42bdce78761b25eb90d44d14d05
push id35747
push usershindli@mozilla.com
push dateSat, 23 Mar 2019 09:48:05 +0000
treeherdermozilla-central@59e55930dc0f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1535988, 1537555
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1535988, backout because bug 1537555, r=backout
dom/html/HTMLFormElement.cpp
testing/web-platform/tests/html/semantics/forms/the-button-element/button-click-submits.html
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -401,18 +401,17 @@ void HTMLFormElement::UnbindFromTree(boo
   if (oldDocument) {
     oldDocument->RemovedForm();
   }
   ForgetCurrentSubmission();
 }
 
 void HTMLFormElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) {
   aVisitor.mWantsWillHandleEvent = true;
-  if (aVisitor.mEvent->IsTrusted() &&
-      aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
+  if (aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
     uint32_t msg = aVisitor.mEvent->mMessage;
     if (msg == eFormSubmit) {
       if (mGeneratingSubmit) {
         aVisitor.mCanHandle = false;
         return;
       }
       mGeneratingSubmit = true;
 
@@ -439,18 +438,17 @@ void HTMLFormElement::WillHandleEvent(Ev
        aVisitor.mEvent->mMessage == eFormReset) &&
       aVisitor.mEvent->mFlags.mInBubblingPhase &&
       aVisitor.mEvent->mOriginalTarget != static_cast<nsIContent*>(this)) {
     aVisitor.mEvent->StopPropagation();
   }
 }
 
 nsresult HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
-  if (aVisitor.mEvent->IsTrusted() &&
-      aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
+  if (aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
     EventMessage msg = aVisitor.mEvent->mMessage;
     if (msg == eFormSubmit) {
       // let the form know not to defer subsequent submissions
       mDeferSubmission = false;
     }
 
     if (aVisitor.mEventStatus == nsEventStatus_eIgnore) {
       switch (msg) {
--- a/testing/web-platform/tests/html/semantics/forms/the-button-element/button-click-submits.html
+++ b/testing/web-platform/tests/html/semantics/forms/the-button-element/button-click-submits.html
@@ -202,25 +202,9 @@ async_test(t => {
     t.step_timeout(() => t.done(), 500);
   }));
 
   const e = new MouseEvent("click", { bubbles: false });
   span.dispatchEvent(e);
 
 }, "clicking the child of a button by dispatching a non-bubbling event should not trigger submit");
 
-async_test(t => {
-  const form = document.createElement("form");
-  const button = document.createElement("button");
-  button.type = "button";
-  button.onclick =
-    function(e) {
-      form.dispatchEvent(new Event("submit"), { bubbles: true});
-    };
-  form.appendChild(button);
-  document.body.appendChild(form);
-
-  button.click();
-
-  t.step_timeout(() => t.done(), 500);
-}, "dispatching submit event should not trigger a submit");
-
 </script>