diff --git a/content/bookmarks.js b/content/bookmarks.js index f4cb31a5..fa09915f 100644 --- a/content/bookmarks.js +++ b/content/bookmarks.js @@ -331,7 +331,7 @@ liberator.Bookmarks = function () //{{{ { try { - var uri = PlacesUIUtils.createFixedURI(url); + var uri = liberator.util.createURI(url); if (!force) { for (let bmark in cache) diff --git a/content/io.js b/content/io.js index 3db6db1d..819d75f5 100644 --- a/content/io.js +++ b/content/io.js @@ -760,6 +760,7 @@ lookup: liberator.echomsg("sourcing \"" + filename + "\"", 2); let str = ioManager.readFile(file); + let uri = liberator.util.createURI(file.path); // handle pure javascript files specially if (/\.js$/.test(filename)) @@ -768,7 +769,7 @@ lookup: .getService(Components.interfaces.mozIJSSubScriptLoader); try { - loader.loadSubScript("file://" + file.path, liberator) + loader.loadSubScript(uri.spec, liberator) } catch (e) { @@ -778,7 +779,7 @@ lookup: } else if (/\.css$/.test(filename)) { - liberator.storage.styles.registerSheet("file://" + file.path, !silent, true); + liberator.storage.styles.registerSheet(uri.spec, !silent, true); } else { diff --git a/content/util.js b/content/util.js index 60f7ea77..f6393f21 100644 --- a/content/util.js +++ b/content/util.js @@ -107,6 +107,13 @@ liberator.util = { //{{{ liberator.echo("Yanked " + str, liberator.commandline.FORCE_SINGLELINE); }, + createURI: function (str) + { + const fixup = Components.classes["@mozilla.org/docshell/urifixup;1"] + .getService(Components.interfaces.nsIURIFixup); + return fixup.createFixupURI(str, fixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP); + }, + escapeHTML: function (str) { // XXX: the following code is _much_ slower than a simple .replace()