[Greasemonkey] [PATCH] Display the filename when a greasemonkey
script errors
Dominic Mitchell
dom at happygiraffe.net
Thu May 4 09:33:57 EDT 2006
I've had a couple of problems whilst going through greasemonkey hacks.
Just syntax errors, little stuff. The trouble is that now I've 12 or so
scripts installed, it's not always obvious which on caused the problem.
This small patch causes the filename which triggered the error to be
displayed in the console so you stand a fighting chance of fixing it.
Unfortunately, I can't seem to make it so that you can click on the
error and view the source, like normal. I tried wrapping
script.filename in getScriptFileURI(), but that just produced something
incomprehensible in the console and clicking on it caused nothing to
happen. Sorry.
-Dom
-------------- next part --------------
Index: chrome/chromeFiles/content/browser.js
===================================================================
RCS file: /cvs/greasemonkey/src/chrome/chromeFiles/content/browser.js,v
retrieving revision 1.5
diff -u -r1.5 browser.js
--- chrome/chromeFiles/content/browser.js 9 Jan 2006 10:07:55 -0000 1.5
+++ chrome/chromeFiles/content/browser.js 30 Apr 2006 23:15:53 -0000
@@ -179,6 +179,7 @@
try {
Components.utils.evalInSandbox(scriptStr, sandbox);
} catch (e) {
+ e.fileName = script.filename;
GM_logError(e);
}
}
More information about the Greasemonkey
mailing list