Bookmarklet Regression - Space gets replaced with %20
Categories
(Core :: Networking, defect, P3)
Tracking
()
People
(Reporter: kissaki, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-triaged])
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0
Steps to reproduce:
I am adding a Bookmarklet Bookmark in the Bookmarks Toolbar through the context menu Add/Edit Bookmark.
I add javascript:code as URL.
javascript:console.log(document.querySelectorAll('#community_table tr:has(button .me-1)'))
Actual results:
Firefox replaces spaces with %20 even within string code/text/selector string
javascript:console.log(document.querySelectorAll('#community_table%20tr:has(button%20.me-1)'))
breaking the selector
Expected results:
URL is taken over as is,
like it worked before,
so existing Bookmarklets can be edited and new ones added.
I tried using tab instead of space as a workaround, but a tab gets dropped/removed completely.
Comment 2•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::Bookmarks & History' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 3•2 years ago
|
||
Would you kindly provide the test case that you are using to reproduce this issue?
I tried reproducing it here on this page, and was able to identify a difference on when it happens:
javascript:document.querySelectorAll('.comment table:has(tbody .change-name)')
Is saved and works correctly, as entered.
However, when including an id selector
javascript:document.querySelectorAll('#main-inner .comment table:has(tbody .change-name)')
it gets replaced by
javascript:document.querySelectorAll('#main-inner%20.comment%20table:has(tbody%20.change-name)')
The original report included javascript:console.log(document.querySelectorAll('#community_table tr:has(button .me-1)')), which has this behavior for me.
What else do you want as a test case?
When I add a bookmark with that URL it gets replaced. That already is a test case.
Comment 6•2 years ago
|
||
I've managed to replicate the reported issue in both Nightly 125.0a1 and Firefox 123.0.1 versions on Windows 10 x64.
Setting as NEW and currently awaiting the developer's input on this matter.
If this is not the correct component, please feel free to change it to a more fitting one.
Comment 7•2 years ago
|
||
This is possibly a problem in the URL parser, as
(new URL("javascript:console.log(document.querySelectorAll('#community_table tr:has(button .me-1)'))")).href
returns
"javascript:console.log(document.querySelectorAll('#community_table%20tr:has(button%20.me-1)'))"
Taking the # out means that the spaces don't get replaced.
It has been this way since at least FF 90, so nothing has changed recently.
Comment 8•2 years ago
|
||
FWIW, Chrome also has the same behavior as Firefox.
Description
•