mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-03 20:44:16 +01:00
Only explicitly demangle subscript URIs rather than doing it automatically in newURI. Closes issue #185.
This commit is contained in:
@@ -281,7 +281,7 @@ function deprecated(alternative, fn) {
|
||||
let obj = this.className ? this.className + "#" :
|
||||
this.constructor.className ? this.constructor.className + "#" :
|
||||
"";
|
||||
let filename = (frame.filename || "unknown").replace(/.* -> /, "");
|
||||
let filename = util.fixURI(frame.filename || "unknown");
|
||||
if (!set.add(deprecatedMethod.seen, filename))
|
||||
util.dactyl(fn).warn(
|
||||
util.urlPath(filename) + ":" + frame.lineNumber + ": " +
|
||||
|
||||
@@ -183,7 +183,7 @@ var BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver), {
|
||||
let bookmark = this.bookmarks[itemId];
|
||||
if (bookmark) {
|
||||
if (property == "tags")
|
||||
value = services.tagging.getTagsForURI(util.newURI(bookmark.url), {});
|
||||
value = services.tagging.getTagsForURI(bookmark.uri, {});
|
||||
if (property in bookmark) {
|
||||
bookmark[bookmark.members[property]] = value;
|
||||
storage.fireEvent(name, "change", { __proto__: bookmark, changed: property });
|
||||
|
||||
@@ -173,7 +173,7 @@ var IO = Module("io", {
|
||||
catch (e) {
|
||||
if (e.fileName)
|
||||
try {
|
||||
e.fileName = e.fileName.replace(/^(chrome|resource):.*? -> /, "");
|
||||
e.fileName = util.fixURI(e.fileName);
|
||||
if (e.fileName == uri.spec)
|
||||
e.fileName = filename;
|
||||
e.echoerr = <>{e.fileName}:{e.lineNumber}: {e}</>;
|
||||
@@ -328,7 +328,7 @@ var IO = Module("io", {
|
||||
*/
|
||||
isJarURL: function isJarURL(url) {
|
||||
try {
|
||||
let uri = util.newURI(url);
|
||||
let uri = util.newURI(util.fixURI(url));
|
||||
let channel = services.io.newChannelFromURI(uri);
|
||||
channel.cancel(Cr.NS_BINDING_ABORTED);
|
||||
if (channel instanceof Ci.nsIJARChannel)
|
||||
|
||||
@@ -243,7 +243,7 @@ var Overlay = Module("Overlay", {
|
||||
|
||||
defineModule.loadLog.push("Load" + (isString(prereq) ? " " + prereq + " dependency: " : ": ") + module.className);
|
||||
if (frame && frame.filename)
|
||||
defineModule.loadLog.push(" from: " + frame.filename.replace(/.* -> /, "") + ":" + frame.lineNumber);
|
||||
defineModule.loadLog.push(" from: " + util.fixURI(frame.filename) + ":" + frame.lineNumber);
|
||||
|
||||
delete modules[module.className];
|
||||
modules[module.className] = defineModule.time(module.className, "init", module);
|
||||
|
||||
@@ -374,7 +374,7 @@ var Template = Module("Template", {
|
||||
},
|
||||
|
||||
sourceLink: function (frame) {
|
||||
let url = (frame.filename || "unknown").replace(/.* -> /, "");
|
||||
let url = util.fixURI(frame.filename || "unknown");
|
||||
let path = util.urlPath(url);
|
||||
|
||||
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user