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

Replace horrible chrome-data URLs with somewhat more comprehensible dactyl://style/ URLs.

This commit is contained in:
Kris Maglione
2011-02-02 11:14:10 -05:00
parent 5576a5f5e6
commit c9bdbe3391
3 changed files with 45 additions and 23 deletions

View File

@@ -37,6 +37,9 @@ function makeChannel(url, orig) {
if (typeof url === "function")
return let ([type, data] = url()) StringChannel(data, type, orig);
if (isArray(url))
return let ([type, data] = url) StringChannel(data, type, orig);
let uri = ioService.newURI(url, null, null);
return (new XMLChannel(uri)).channel;
}
@@ -114,6 +117,7 @@ function Dactyl() {
this.OVERLAY_MAP = {};
this.pages = {};
this.providers = {};
Cu.import("resource://dactyl/bootstrap.jsm");
if (!JSMLoader.initialized)
@@ -162,6 +166,9 @@ Dactyl.prototype = {
if (/^help/.test(uri.host) && !("all" in this.FILE_MAP))
return redirect(uri.spec, uri, 1);
if (uri.host in this.providers)
return makeChannel(this.providers[uri.host](uri), uri);
let path = decodeURIComponent(uri.path.replace(/^\/|#.*/g, ""));
switch(uri.host) {
case "content":
@@ -182,7 +189,9 @@ Dactyl.prototype = {
return makeChannel(["resource://dactyl-local-locale", config.locale, path].join("/"), uri);
}
}
catch (e) {}
catch (e) {
util.reportError(e);
}
return fakeChannel(uri);
},