It seems that using encodeURIComponent() instead of the custom function currently in use yields much better results.
Interestingly, it breaks the existing unit tests, likely because AddressBar.requestedUrl is of type URL, which when it is built converts back some encoded characters to their decoded form (such as "'" or "é").
It seems that using encodeURICompon ent() instead of the custom function currently in use yields much better results. requestedUrl is of type URL, which when it is built converts back some encoded characters to their decoded form (such as "'" or "é").
Interestingly, it breaks the existing unit tests, likely because AddressBar.