Skip to content

Commit

Permalink
Form submission reentrancy protection for 'submit' and 'invalid' event
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D53696

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1551758
gecko-commit: 1f77dd98df61bb0b6c5ce53befbb98635fe4eed8
gecko-integration-branch: autoland
gecko-reviewers: smaug
  • Loading branch information
johndai1984 authored and moz-wptsync-bot committed Nov 23, 2019
1 parent 4c5a9dc commit 3f26c95
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@
assert_equals(counter, 2);
}, 'If constructing entry list flag of form is true, then return');

test(() => {
let form = populateForm('<input><input type=submit>');
let submitter1 = form.querySelector('input[type=submit]');
let valid = form.elements[0];
let counter = 0;
valid.oninvalid = () => {
++counter;
};
form.onsubmit = () => {
valid.required = true;
submitter1.dispatchEvent(new MouseEvent("click"));
};
submitter1.dispatchEvent(new MouseEvent("click"));
assert_equals(counter, 0);
}, "If firing submission events flag of form is true, then return");

test(() => {
let form = populateForm('<input required><input type=submit><button type=submit></button>');
Expand Down

0 comments on commit 3f26c95

Please sign in to comment.