From 7cb2187148d33101004ea3097a9324215deb28e0 Mon Sep 17 00:00:00 2001 From: "TAMURA, Kent" Date: Thu, 13 Jun 2019 10:23:31 +0000 Subject: [PATCH] Bug 1557370 [wpt PR 16811] - html: Add a testcase for submit event reentrancy protection, a=testonly Automatic update from web-platform-tests html: Add a testcase for submit event reentrancy protection (#16811) Specification change: https://github.com/whatwg/html/pull/4621 -- wp5At-commits: 7ffd31b4eb23f0d99d5333ae2056b8c6896f463b wpt-pr: 16811 --- .../form-submission-algorithm.html | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/testing/web-platform/tests/html/semantics/forms/form-submission-0/form-submission-algorithm.html b/testing/web-platform/tests/html/semantics/forms/form-submission-0/form-submission-algorithm.html index bf9f9ce330a3a..8f61cbc18c951 100644 --- a/testing/web-platform/tests/html/semantics/forms/form-submission-0/form-submission-algorithm.html +++ b/testing/web-platform/tests/html/semantics/forms/form-submission-0/form-submission-algorithm.html @@ -18,8 +18,39 @@ assert_equals(counter, 2); }, 'If constructing entry list flag of form is true, then return'); -let test10 = async_test('Cannot navigate (after constructing the entry list)'); -test10.step(() => { + +test(() => { + let form = populateForm(''); + let submitter1 = form.querySelector('input[type=submit]'); + let submitter2 = form.querySelector('button[type=submit]'); + let invalid = form.querySelector('[required]'); + let counter = 0; + invalid.oninvalid = () => { + ++counter; + // Needs to click different one because click() has reentrancy protection. + submitter2.click(); + }; + submitter1.click(); + assert_equals(counter, 1); +}, "If form's firing submission events is true, then return; 'invalid' event"); + +async_test(t => { + let form = populateForm('