1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 05:57:58 +01:00

Switch back to the fixup service for sourcing files.

This commit is contained in:
Kris Maglione
2008-10-11 19:19:43 +00:00
parent e5b21557c6
commit bad771cddc
3 changed files with 11 additions and 3 deletions

View File

@@ -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)

View File

@@ -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
{

View File

@@ -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()