1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-04 12:35:46 +01:00
--HG--
branch : testing
This commit is contained in:
Kris Maglione
2010-08-26 15:18:49 -04:00
11 changed files with 58 additions and 48 deletions

10
common/content/statusline.js Normal file → Executable file
View File

@@ -63,7 +63,15 @@ const StatusLine = Module("statusline", {
function losslessDecodeURI(url) {
// 1. decodeURI decodes %25 to %, which creates unintended
// encoding sequences.
url = url.split("%25").map(decodeURI).join("%25");
url = url.split("%25").map(function (url) {
// Non-UTF-8 complient URLs cause "malformed URI sequence" errors.
try {
return decodeURI(url);
}
catch (e) {
return url;
}
}).join("%25");
// 2. Re-encode whitespace so that it doesn't get eaten away
// by the location bar (bug 410726).
url = url.replace(/[\r\n\t]/g, encodeURIComponent);