Do not drop trailing spaces from non-trailing opaque paths data: URL
Categories
(Core :: Networking, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox129 | --- | fixed |
People
(Reporter: valentin, Assigned: sekim)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-triaged])
Attachments
(1 file)
Reporter | ||
Comment 1•2 years ago
|
||
<a>: Setting <data:space ?query#fragment>.search = '' Do not drop trailing spaces from non-trailing opaque paths
FAIL message: assert_equals: expected "data:space #fragment" but got "data:space#fragment"
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 2•1 year ago
•
|
||
{
"comment": "Do not drop trailing spaces from non-trailing opaque",
"href": "data:space ?query#fragment",
"new_value": "",
"expected": {
"href": "data:space #fragment",
"search": ""
}
}
Adding this under search
in setters_tests.json
(rust-url) somehow passes, could you elaborate more on the test it is failing? Thanks
Reporter | ||
Comment 3•1 year ago
•
|
||
rust-url isn't being used for data URLs.
We use simpleURI for that https://searchfox.org/mozilla-central/source/netwerk/protocol/data/nsDataHandler.cpp
And I think the weird thing was that it only happens for <a> elements, not for the URL object.
So this works:
u = new URL("data:space ?query#fragment")
u.search = ""
u.href // "data:space #fragment"
but this doesn't:
x = document.createElement("a");
x.href = "data:space ?query#fragment";
x.search = "";
x.href // "data:space#fragment"
It's unclear why these two behave differently.
Reporter | ||
Comment 4•1 year ago
|
||
Maybe because we call SetHrefAttribute after changing the query - and that somehow ends up stripping the space?
Reporter | ||
Comment 5•1 year ago
|
||
The difference is
u = new URL("data:space ?q")
u.href // "data:space ?q"
u = new URL("data:space #q")
u.href // "data:space#q"
The second one is wrong. I think nsSimpleURI is to blame.
u = Services.io.newURI("data:space #q"); (in the browser console, Ctrl-Shift-J)
u.spec
has the same issue.
Assignee | ||
Comment 6•1 year ago
|
||
Comment 8•1 year ago
|
||
bugherder |
Description
•