Closed Bug 567938 Opened 14 years ago Closed 14 years ago

form.submit() broken if called from <input type='submit'>'s onclick handler

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- alpha5+

People

(Reporter: nirvn.asia, Assigned: mounir)

References

Details

(Keywords: regression)

Attachments

(2 files, 2 obsolete files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a5pre) Gecko/20100524 Minefield/3.7a5pre Build Identifier: The latest minefield fails to submit a form when triggered by the javascript submit() function. Reproducible: Always Steps to Reproduce: 1. Open the attached test case 2. Click on the "Submit Query" button Actual Results: Nothing happens. Expected Results: The form should be submitted and page reloaded. Regression range is within the last 5 days. I'm surprised this isn't tested in current test suit. :)
Attached file test case
Assignee: general → nobody
Status: UNCONFIRMED → NEW
blocking2.0: --- → alpha5+
Component: JavaScript Engine → HTML: Form Submission
Ever confirmed: true
QA Contact: general → form-submission
Ok, I'm looking at that.
Assignee: nobody → mounir.lamouri
Status: NEW → ASSIGNED
This is working with <button type='submit'> with <input> and if i call the function from onmousedown or onmouseup. In other words, that's not a failure with |form.submit()| but with |form.submit()| called from the onclick handler of a <input type='submit'>. I'm still investigating. And thank you for your report Mathieu :)
Summary: form.submit() broken in latest Minefield → form.submit() broken if called from <input type='submit'>'s onclick handler
Found it, that's a dup of bug 567927
Attached patch Patch v1 (obsolete) — Splinter Review
This should fix a regression (with a test).
Attachment #447323 - Flags: review?(bzbarsky)
s/a/the/
OS: Windows 7 → All
Hardware: x86 → All
Version: unspecified → Trunk
Comment on attachment 447323 [details] [diff] [review] Patch v1 r=me, with a few caveats: 1) Can you also add tests for the other cases fixed by the oldType change? Separate bug ok. 2) That test will randomly fail if the about:blank load completes before the <script> has had a chance to execute. What you want to do is to run your test off the main page onload event (using addLoadEvent), and only set up the iframe's load handler there.
Attachment #447323 - Flags: review?(bzbarsky) → review+
Attached patch Patch v2 (obsolete) — Splinter Review
Thank you very much for your help on the tests Boris.
Attachment #447323 - Attachment is obsolete: true
Attachment #447335 - Flags: review?(bzbarsky)
Boris, do you think you can review this patch soon ? Otherwise, could you move the review to someone else ? (jst, smaug or sicking maybe) I suppose this regression must be quite annoying for Minefield users...
Comment on attachment 447335 [details] [diff] [review] Patch v2 >+++ b/content/html/content/test/test_bug567938-1.html >+ // Cleaning-up. >+ for (var tmpChild = form.firstChild; tmpChild; tmpChild = form.firstChild) { >+ form.removeChild(tmpChild); >+ } form.textContent = ""; And for the other tests too. >+ is(frames['submit_frame'].location.href, >+ "http://mochi.test:8888/tests/content/html/content/test/foo", >+ "The form should have been submitted"); If this is true for submit it will also be true for image, no? So the real test for image is that onload fires? This seems to apply to the other tests too. >+++ b/content/html/content/test/test_bug567938-2.html >+ element.onclick = function() { form.submit(); element.type='input'; }; s/input/text/ ? r=bzbarsky
Attachment #447335 - Flags: review?(bzbarsky) → review+
Attached patch Patch v2.1Splinter Review
r=bz
Attachment #447335 - Attachment is obsolete: true
Keywords: checkin-needed
Any chance we can get this applied to trunk? I'm getting uncomfortable switching to Chromium every time I need to submit info in our database ;)
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Flags: in-testsuite+
Thanks
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: