1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-24 08:02:28 +01:00

Only explicitly demangle subscript URIs rather than doing it automatically in newURI. Closes issue #185.

This commit is contained in:
Kris Maglione
2011-02-02 09:26:56 -05:00
parent 8507b4f232
commit 5576a5f5e6
6 changed files with 15 additions and 10 deletions

View File

@@ -526,7 +526,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
let match, re = /([^]*?)@([^@\n]*)(?:\n|$)/g;
while (match = re.exec(stack))
lines.push(match[1].replace(/\n/g, "\\n").substr(0, 80) + "@" +
match[2].replace(/.* -> /, ""));
util.fixURI(match[2]));
return lines;
},
@@ -712,7 +712,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
getFile: function getFile(uri) {
try {
if (isString(uri))
uri = util.newURI(uri);
uri = util.newURI(util.fixURI(uri));
if (uri instanceof Ci.nsIFileURL)
return File(uri.QueryInterface(Ci.nsIFileURL).file);
@@ -885,7 +885,13 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @returns {nsIURI}
*/
// FIXME: createURI needed too?
newURI: function (uri, charset, base) services.io.newURI(String.replace(uri, /.* -> /, ""), charset, base),
newURI: function (uri, charset, base) services.io.newURI(uri, charset, base),
/**
* Removes leading garbage prepended to URIs by the subscript
* loader.
*/
fixURI: function fixURI(url) String.replace(url, /.* -> /, ""),
/**
* Pretty print a JavaScript object. Use HTML markup to color certain items
@@ -1579,7 +1585,6 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
},
urlPath: function urlPath(url) {
url = (url || "unknown").replace(/.* -> /, "");
try {
return util.getFile(url).path;
}