1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 21:18:00 +01:00

Add dactyl://data/ to replace chrome-data:.

This commit is contained in:
Kris Maglione
2011-03-07 18:01:17 -05:00
parent f002825d10
commit d336764b47

View File

@@ -165,6 +165,8 @@ Dactyl.prototype = {
var uri = Cc["@mozilla.org/network/standard-url;1"] var uri = Cc["@mozilla.org/network/standard-url;1"]
.createInstance(Ci.nsIStandardURL) .createInstance(Ci.nsIStandardURL)
.QueryInterface(Ci.nsIURI); .QueryInterface(Ci.nsIURI);
if (baseURI && baseURI.host === "data")
baseURI = null;
uri.init(uri.URLTYPE_STANDARD, this.defaultPort, spec, charset, baseURI); uri.init(uri.URLTYPE_STANDARD, this.defaultPort, spec, charset, baseURI);
return uri; return uri;
}, },
@@ -181,6 +183,19 @@ Dactyl.prototype = {
switch(uri.host) { switch(uri.host) {
case "content": case "content":
return makeChannel(this.pages[path] || "resource://dactyl-content/" + path, uri); return makeChannel(this.pages[path] || "resource://dactyl-content/" + path, uri);
case "data":
try {
var channel = ioService.newChannel(uri.path.replace(/^\/(.*)(?:#.*)?/, "data:$1"),
null, null);
}
catch (e) {
var error = e;
break;
}
channel.contentCharset = "UTF-8";
channel.owner = systemPrincipal;
channel.originalURI = uri;
return channel;
case "help": case "help":
return makeChannel(this.FILE_MAP[path], uri); return makeChannel(this.FILE_MAP[path], uri);
case "help-overlay": case "help-overlay":
@@ -201,6 +216,8 @@ Dactyl.prototype = {
catch (e) { catch (e) {
util.reportError(e); util.reportError(e);
} }
if (error)
throw error;
return fakeChannel(uri); return fakeChannel(uri);
}, },