Closed Bug 429128 Opened 17 years ago Closed 17 years ago

Relative URI resolution broken in some cases

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9

People

(Reporter: Biesinger, Assigned: Biesinger)

References

Details

(Keywords: regression)

Attachments

(2 files, 3 obsolete files)

js> base = ios.newURI("http://www.example.com/#", null, null) [xpconnect wrapped nsIURI] js> base.nsIURL.query = "param=value" param=value js> base.spec http://www.example.com/?param=value# js> ios.newURI("#ref", null, base).spec http://www.example.com/?#ref Note that the query parameters are gone. They should not be. This was working correctly in Firefox 2.
Flags: blocking1.9?
Well actually this seems to be broken also in Firefox 2, but form submission doesn't seem to hit the bug there (it does on trunk)
(bug 392567 changed form submission to expose this bug)
Oh man, that seems pretty serious. I think we should fix this at least in the form-submission case, if not in general.
Attached patch patchSplinter Review
Unfortunately I can't test this until Friday at the earliest because I don't have a build environment here.
Michal can you jump in an verify this patch?
(In reply to comment #5) > Michal can you jump in an verify this patch? Yes, I'll post result in few minutes.
I can confirm that the patch works. Output when patch is applied: js> var ios = Components.classes["@mozilla.org/network/io-service;1"]. getService(Components.interfaces.nsIIOService); js> var base = ios.newURI("http://www.example.com/#", null, null); js> base.nsIURL.query = "param=value" param=value js> base.spec http://www.example.com/?param=value# js> ios.newURI("#ref", null, base).spec http://www.example.com/?param=value#ref
Comment on attachment 315772 [details] [diff] [review] patch Did a tryserver build; this does fix the issue on the website I was seeing it on.
Attachment #315772 - Flags: superreview?(bzbarsky)
Attachment #315772 - Flags: review?(bzbarsky)
Attached file unit test (obsolete) —
for putting into netwerk/test/unit
Comment on attachment 315781 [details] unit test (note to self: fix the BUGID in this file)
For what it's worth, I have a slightly more extensive unit test for this, one which caught another bug in nsStandardURL, as far as I can tell. I'll post what I have.
Attached patch More test (obsolete) — Splinter Review
The nsStandardURL change was needed because otherwise this case: ["http://example.com#bar", "http://example.com/?foo#bar"], failed the equals() check, because the first URI had an mBasename segment with pos == 0, len == -1, while the second one had pos == 10, len == 0. I think those two segments should test true... If that's wrong, we should disble this one line, and fix the url parser to not produce a len == -1 basename, I guess.
Attachment #315796 - Flags: superreview?(cbiesinger)
Attachment #315796 - Flags: review?(cbiesinger)
Comment on attachment 315772 [details] [diff] [review] patch This looks good. See my test?
Attachment #315772 - Flags: superreview?(bzbarsky)
Attachment #315772 - Flags: superreview+
Attachment #315772 - Flags: review?(bzbarsky)
Attachment #315772 - Flags: review+
(In reply to comment #12) > ["http://example.com#bar", "http://example.com/?foo#bar"], I think it would be better to ensure that the mBasename fields are identical when the URIs have the same spec.
This seems pretty serious. +'ing.
Flags: blocking1.9? → blocking1.9+
So... that would involve changing the urlparser bits or something. Not quite sure what. I'm certainly not in a position to do that safely at this point in a release (just don't have the time to learn the code). So let's say we comment out that one line of test and file a followup bug on it, and I guess not make that nsStandardURL change?
Attached patch Add a couple more tests (obsolete) — Splinter Review
Attachment #315796 - Attachment is obsolete: true
Attachment #315903 - Flags: superreview?(cbiesinger)
Attachment #315903 - Flags: review?(cbiesinger)
Attachment #315796 - Flags: superreview?(cbiesinger)
Attachment #315796 - Flags: review?(cbiesinger)
Comment on attachment 315903 [details] [diff] [review] Add a couple more tests sounds good
Attachment #315903 - Flags: superreview?(cbiesinger)
Attachment #315903 - Flags: superreview+
Attachment #315903 - Flags: review?(cbiesinger)
Attachment #315903 - Flags: review+
Comment on attachment 315903 [details] [diff] [review] Add a couple more tests a=beltzner, but you don't need approvals for tests.
Attachment #315903 - Flags: approval1.9? → approval1.9+
Comment on attachment 315772 [details] [diff] [review] patch a=beltzner, oh, sure, have approval for the patch, as well :)
Attachment #315772 - Flags: approval1.9? → approval1.9+
Attached patch Final testSplinter Review
I filed bug 429347 on the "com#bar" thing.
Attachment #315781 - Attachment is obsolete: true
Attachment #315903 - Attachment is obsolete: true
Checking in netwerk/base/src/nsStandardURL.cpp; /cvsroot/mozilla/netwerk/base/src/nsStandardURL.cpp,v <-- nsStandardURL.cpp new revision: 1.110; previous revision: 1.109 done Checking in netwerk/test/unit/test_standardurl.js; /cvsroot/mozilla/netwerk/test/unit/test_standardurl.js,v <-- test_standardurl.js new revision: 1.2; previous revision: 1.1 done
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9
Flags: in-testsuite+
Presumably, although I haven't tried too hard to untangle it, this was also bug 426332.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: