Closed Bug 1942030 Opened 1 year ago Closed 1 year ago

nsStandarURL.setHost("") is throws for URLTYPE_STANDARD

Categories

(Core :: Networking, defect, P2)

defect

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox136 --- fixed

People

(Reporter: valentin, Assigned: valentin)

References

Details

(Whiteboard: [necko-triaged][necko-priority-next])

Attachments

(1 external file)

This was regressed by bug 996055.

https://searchfox.org/mozilla-central/rev/b19c379ba7b6d4f25af090a66cec3facf8153ee3/netwerk/base/nsIStandardURL.idl#20-26

/**
 * blah:foo/bar    => blah://foo/bar
 * blah:/foo/bar   => blah:///foo/bar
 * blah://foo/bar  => blah://foo/bar
 * blah:///foo/bar => blah:///foo/bar
 */
const unsigned long URLTYPE_STANDARD        = 1;

URLTYPE_STANDARD is defined as "may or may not have a hostname".
As such, it's weird that we may parse a URL without a hostname, set the hostname to something, but not be able to clear it.

The fix is to update the condition to only throw for URLTYPE_AUTHORITY here and update the test expectation

Assignee: nobody → valentin.gosu
Status: NEW → ASSIGNED
Pushed by valentin.gosu@gmail.com: https://hg.mozilla.org/integration/autoland/rev/e95cc87f0db1 nsStandarURL.setHost("") throws for URLTYPE_STANDARD r=necko-reviewers,kershaw
Pushed by valentin.gosu@gmail.com: https://hg.mozilla.org/integration/autoland/rev/23fd0c10f9a7 nsStandarURL.setHost("") throws for URLTYPE_STANDARD r=necko-reviewers,kershaw
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: