User:GijsKruitbosch/JS Debugging/DocumentFromException
Jump to navigation
Jump to search
Main aim
Be able to determine the document an error came off from within chrome js/extension/etc.
Plan A
- Make nsIConsoleMessage implement nsIException
- Make nsIException have useful stuff in its data field that can be used to determine the document that the message came off.
Note: what? (as in, exactly)
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