Better file/line number reporting in stack traces in Rhino

This commit is contained in:
Tom Robinson committed 2009-01-21 01:35:52 -08:00
1 parent 62284c9218
commit 19a4140f7d
2 files changed
+9 -1

No files matched your search

+4
View File
@@ -151,7 +151,11 @@ function fragment_evaluate_code(aFragment)
try
{
#if RHINO
compiled = Packages.org.mozilla.javascript.Context.getCurrentContext().compileFunction(window, "function(){"+GET_CODE(aFragment)+"}", GET_FILE(aFragment).path, 0, null);
#else
compiled = new Function(GET_CODE(aFragment));
#endif
}
catch(anException)
{
+5 -1
View File
@@ -181,7 +181,11 @@ if (!this.load)
alert("Setting up 'load()'");
this.load = function(path)
{
return eval(readFile(path));
var contents = readFile(path);
if (typeof Packages !== "undefined")
return Packages.org.mozilla.javascript.Context.getCurrentContext().evaluateString(window, contents, path, 0, null);
else
return eval(contents);
}
}