Closed Bug 392567 Opened 18 years ago Closed 18 years ago

Impossible to submit forms to JAR URLs

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha8

People

(Reporter: jwkbugzilla, Assigned: jwkbugzilla)

References

Details

Attachments

(4 files, 3 obsolete files)

Attached file JAR file for testcase
If I try to submit a GET form to a JAR URL the browser simply requests the form's action URI instead of attaching query parameters to it. Reason seems to be that nsFormSubmission uses nsIURI::SetPath that is not implemented by nsJARURI.
Attachment #277073 - Attachment is obsolete: true
Attachment #277073 - Attachment is obsolete: false
Attached file Testcase
Open this testcase, enter something into the text field and submit the form. The browser will open jar:https://bugzilla.mozilla.org/attachment.cgi?id=277073!/index.html instead of the expected jar:https://bugzilla.mozilla.org/attachment.cgi?id=277073!/index.html?test=some_text. This example also shows that simply implementing SetPath in nsJARURI will not help, this URL already contains one query string and form submission should not change it. Instead, form submission should use GetFilePath and SetFilePath methods (if nsIURL is implemented).
Component: Networking: JAR → HTML: Form Submission
QA Contact: networking.jar → form-submission
Attached patch Proposed patch (obsolete) — Splinter Review
Actually, it is better to use nsIURL::SetQuery().
Assignee: nobody → trev.moz
Status: NEW → ASSIGNED
Attachment #277077 - Flags: review?(bzbarsky)
Comment on attachment 277077 [details] [diff] [review] Proposed patch This is wrong, because if there is an existing query it doesn't remove it. I expect an automated regression test for this in the next patch version. Why not just do a single SetQuery call when this is an nsIURL and do this rigmarole otherwise? That said, I was sure we'd tried that once and it broke something, so if you go that route test well! And perhaps jar URIs should implement SetPath? Not sure what form it would take, though, since there are two paths involved.
Attachment #277077 - Flags: review?(bzbarsky) → review-
Attached patch Patch v2 (obsolete) — Splinter Review
Attaching new patch - now using nsIURL::SetQuery() whenever possible without even trying all the tricks meant for nsIURI. Also added a testcase and checked all existing mochitest testcases (no issues found). Will attach -w patch to make reviewing easier.
Attachment #277077 - Attachment is obsolete: true
Attachment #277372 - Flags: review?(bzbarsky)
Attached patch Patch v2 with -w (obsolete) — Splinter Review
> checked all existing mochitest testcases We don't really have any form submission tests yet.... In any case, the bug I was thinking of was bug 185169, so you should be OK here, I think. But please keep an eye on incoming bugs for a few weeks and watch out for form submission issues.
Comment on attachment 277373 [details] [diff] [review] Patch v2 with -w >Index: content/html/content/src/nsFormSubmission.cpp > nsCAutoString path; >+ > rv = aURI->GetPath(path); Why add that blank line? >Index: content/html/content/test/test_bug392567.html >+ is(frame.location.href, expected, "Submitting to " + tests[currentTest][0] + ", expecting to see URL " + expected + " - seeing " + frame.location.href); If this fails, |is| will report what it saw and what was expected. So I'd make the message just: "Submitting to " + tests[currentTest][0] r=bzbarsky with those nits picked.
Attachment #277372 - Flags: review?(bzbarsky) → review+
Attached patch Patch v3Splinter Review
Attachment #277372 - Attachment is obsolete: true
Attachment #277373 - Attachment is obsolete: true
Attachment #277508 - Flags: superreview?
Attachment #277508 - Flags: review+
Attachment #277508 - Flags: superreview? → superreview?(jonas)
Attached patch Patch v3 with -wSplinter Review
Attachment #277508 - Flags: superreview?(jonas) → superreview+
Keywords: checkin-needed
Comment on attachment 277508 [details] [diff] [review] Patch v3 Requesting approval for 1.9: This fixes a bug that prevents using jar: urls like regular http: or file: URLs. In my case this was necessary to distribute lots of help files in one single archive, something that I think is required rather often.
Attachment #277508 - Flags: approval1.9?
Doesn't seem to be anything checkin-needed yet, if you're still waiting on approval.
Keywords: checkin-needed
Blocks: tomtom
Keywords: checkin-needed
Checking in content/html/content/src/nsFormSubmission.cpp; /cvsroot/mozilla/content/html/content/src/nsFormSubmission.cpp,v <-- nsFormSubmission.cpp new revision: 1.60; previous revision: 1.59 done Checking in content/html/content/test/Makefile.in; /cvsroot/mozilla/content/html/content/test/Makefile.in,v <-- Makefile.in new revision: 1.28; previous revision: 1.27 done RCS file: /cvsroot/mozilla/content/html/content/test/test_bug392567.html,v done Checking in content/html/content/test/test_bug392567.html; /cvsroot/mozilla/content/html/content/test/test_bug392567.html,v <-- test_bug392567.html initial revision: 1.1 done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Flags: in-testsuite+
Target Milestone: --- → mozilla1.9 M8
Depends on: 458781
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: