xulapp/chrome/content/lib/shortcuts.js in gabrielg-xultestrunner-0.1.1 vs xulapp/chrome/content/lib/shortcuts.js in gabrielg-xultestrunner-0.1.2

- old
+ new

@@ -10,6 +10,15 @@ throw({name: "LoadError", message: "Failed to load " + fileURI + ": " + e.message}); } }; print = dump; -puts = function(str) { print(str + "\n"); }; +puts = function(str) { print(str + "\n"); }; + +// Much love to http://ejohn.org/blog/__file__-in-javascript/ +this.__defineGetter__("__FILE__", function() { + var stack = (new Error).stack; + // FIXME - Great. All this is a dance around the fact line #289 of mozJSSubScriptLoader.cpp in mozilla 1.9.1 + // thinks that the best way to delimit script files is with a fucking ASCII arrow YOU FUCKS + var fileURI = stack.split("\n")[2].split("@")[1].split(" -> ").slice(-1)[0].split(/:[0-9]/)[0]; + return fileURI; +}); \ No newline at end of file