Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Unified Diff: LayoutTests/fast/forms/form-submission-cancelable.html

Issue 177683004: Don't delay submit in onsubmit event handler (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to latest master Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/forms/form-submission-cancelable-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/forms/form-submission-cancelable.html
diff --git a/LayoutTests/fast/forms/form-submission-cancelable.html b/LayoutTests/fast/forms/form-submission-cancelable.html
new file mode 100644
index 0000000000000000000000000000000000000000..3518456fac7285bf4fd5b7e3bb3d00d98984b553
--- /dev/null
+++ b/LayoutTests/fast/forms/form-submission-cancelable.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+<form method="GET" target="target">
+ <input name="query" value="AAA" />
+ <input type="submit" id="submitButton"/>
+</form>
+<form method="GET" target="target1">
+ <input name="query1" value="AAA" />
+ <input type="submit" id="submitButton1"/>
+</form>
+<iframe id="target" ></iframe>
+<iframe id="target1" ></iframe>
+<script>
+description('Test that form submit within onsubmit event handlers are not delayed and sends the form data when invoked');
+var count = 2;
+document.forms[0].onsubmit = function (event) {
+ document.forms[0].submit();
+ document.forms[0].children.query.value = 'BBB';
+ return false;
+}
+
+document.forms[1].onsubmit = function (event) {
+ document.forms[1].submit();
+ document.forms[1].children.query1.value = 'BBB';
+ return true;
+}
+
+document.getElementById('target').onload = function(event) {
+ shouldBeEqualToString('event.target.contentWindow.location.search', '?query=AAA');
+ if (--count == 0)
+ finishJSTest();
+}
+
+document.getElementById('target1').onload = function(event) {
+ shouldBeEqualToString('event.target.contentWindow.location.search', '?query1=BBB');
+ if (--count == 0)
+ finishJSTest();
+}
+
+window.onload = function() {
+ document.getElementById('submitButton1').click();
+ document.getElementById('submitButton').click();
tkent 2014/03/17 06:39:20 Form submission and load events are asynchronous.
+}
+
+if (window.testRunner)
+ window.jsTestIsAsync = true;
+</script>
+</body>
+</html>
+
+
+
+
« no previous file with comments | « no previous file | LayoutTests/fast/forms/form-submission-cancelable-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698