diff --git a/common/modules/base.jsm b/common/modules/base.jsm index e0f0eaad..105639d4 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -150,19 +150,24 @@ this.lazyRequire("services", ["services"]); this.lazyRequire("storage", ["File"]); this.lazyRequire("util", ["FailedAssertion", "util"]); +literal.files = {}; +literal.locations = {}; function literal(/* comment */) { let { caller } = Components.stack; while (caller && caller.language != 2) caller = caller.caller; let file = caller.filename.replace(/.* -> /, ""); - let key = "literal:" + file + ":" + caller.line; + let key = "literal:" + file + ":" + caller.lineNumber; + if (Set.has(literal.locations, key)) + return literal.locations[key]; - let source = File.readURL(file); + let source = literal.files[file] || File.readURL(file); + literal.files[file] = source; let match = RegExp("(?:.*\\n){" + (caller.lineNumber - 1) + "}" + ".*literal\\(/\\*([^]*?)\\*/\\)").exec(source); - return match[1]; + return literal.locations[key] = match[1]; // Later... return cache.get(key, function () { diff --git a/common/modules/buffer.jsm b/common/modules/buffer.jsm index 97b37b25..9ae00643 100644 --- a/common/modules/buffer.jsm +++ b/common/modules/buffer.jsm @@ -644,9 +644,10 @@ var Buffer = Module("Buffer", { } let link = DOM("link[href][rev=canonical], \ - link[href][rel=shortlink]", doc); - if (link.length) - return hashify(link.attr("href")); + link[href][rel=shortlink]", doc) + .attr("href"); + if (link) + return hashify(link); return null; }, diff --git a/pentadactyl/install.rdf b/pentadactyl/install.rdf index d7060288..18c945b8 100644 --- a/pentadactyl/install.rdf +++ b/pentadactyl/install.rdf @@ -31,7 +31,7 @@