Closed Bug 1545828 Opened 5 years ago Closed 3 years ago

breaking booklets after '#' in javascript

Categories

(Core :: Networking, defect, P3)

66 Branch
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: axet, Assigned: valentin)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36

Steps to reproduce:

Hello! Seems like firefox breaking javascript bookmark if script contains '#' it start to encode javascript spaces with %20.

Try add following javascript as bookmark, and open again. Javascript will be broken.

Actual results:

javascript: (function() {
var e = document.querySelector('paper-dialog #button');
if (e != null && e.offsetParent != null) {
e.click();
console.log('click dialog');
}
})();

javascript: (function() { var e = document.querySelector('paper-dialog #button');%20%20%20%20%20%20%20%20%20if%20(e%20!=%20null%20&&%20e.offsetParent%20!=%20null)%20{%20%20%20%20%20%20%20%20%20%20%20%20%20e.click();%20%20%20%20%20%20%20%20%20%20%20%20%20console.log('click%20dialog');%20%20%20%20%20%20%20%20%20}%20})();

One workaround is to replace the # by %23 (the encoded value for the hash). Otherwise the URL parser thinks that the # is the anchor for the URL.

It does seem that we have different behaviour from Google Chrome, so moving this to Core, as I think it is likely the parser or encoder that is at issue.

Component: Bookmarks & History → Networking
Product: Firefox → Core

Valentin, could you take a look at this?.
Thanks

Flags: needinfo?(valentin.gosu)
Priority: -- → P2
Whiteboard: [necko-triaged]
Assignee: nobody → valentin.gosu
Severity: normal → S3
Flags: needinfo?(valentin.gosu)
Priority: P2 → P3

According to the reference parser we're doing the right thing here.

Blocks: url
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.