User:GijsKruitbosch/JS Debugging/DocumentFromException: Difference between revisions

(Oops, B wasn't finished yet)
Line 10: Line 10:


== Plan B ==
== Plan B ==
*In the debugger hook that Firebug has, the exception hook gets a JSContext, from there you can get the nsIScriptGlobalObject (, and from that you can get a nsIDOMWindowInternal, which has a frameElement from which you can derive a document etc. etc. ''Note: http://lxr.mozilla.org/seamonkey/source/content/base/src/nsContentUtils.cpp#1001''
*In the debugger hook that Firebug has, the exception hook gets a JSContext, from there you can get the nsIScriptGlobalObject (http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsJSUtils.cpp#206), and from that you can get a nsIDOMWindowInternal, which has a frameElement from which you can derive a document etc. etc. ''Note: http://lxr.mozilla.org/seamonkey/source/content/base/src/nsContentUtils.cpp#1001''
*Save this info in the internals of the debugger. Note: this would still require binary components...
*Save this info in the internals of the debugger. Note: this would still require binary components...
*Assume that whatever exception comes in through the error console listener will be the last one you stored in the debugger code, meaning you now get a clue of where your error came from.
*Assume that whatever exception comes in through the error console listener will be the last one you stored in the debugger code, meaning you now get a clue of where your error came from.


== Discussion ==
== Discussion ==
Confirmed users
293

edits