Closed
Bug 242489
Opened 20 years ago
Closed 13 years ago
routeEvent should warn to JS console that it's not implemented
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: bzbarsky, Unassigned)
Details
Attachments
(1 file)
5.24 KB,
patch
|
Details | Diff | Splinter Review |
See discussion in bug 242429
Reporter | ||
Comment 1•20 years ago
|
||
This is implemented by nsHTMLDocument and nsGlobalWindow. The basic idea is to get the console service and log some (localized) warning message to it. Something similar to what the code at RectArea::ParseCoords does (with a "warning" flag).
Keywords: helpwanted
Whiteboard: [good first bug]
Comment 2•20 years ago
|
||
Wouldn't the patch in bug 82878 along with a queryable keyword be a better solution to this problem?
Reporter | ||
Comment 3•20 years ago
|
||
Myk, wrong bug?
Comment 4•20 years ago
|
||
Indeed. Sorry about that.
Reporter | ||
Comment 5•20 years ago
|
||
Note that at this point it would be better to use nsContentUtils::ReportToConsole instead of copying the RectArea code.
Comment 6•20 years ago
|
||
I see that both <http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsGlobalWindow.cpp#2970> and <http://lxr.mozilla.org/seamonkey/source/content/html/document/src/nsHTMLDocument.cpp#2828> have "implemented" routeEvent; must the nsContentUtils::ReportToConsole be implemented both places, or can I for example get a reference to nsGlobalWindow from nsHTMLDocument ?
Comment 7•20 years ago
|
||
I noticed that mScriptGlobalObject in nsHTMLDocument is a reference to the nsGlobalWindow (nsGlobalWindow.h implements nsIScriptGlobalObject) - thanks to Neil for confirming that. So I guess that means we can do (in nsHTMLDocument): nsCOMPtr<nsGlobalWindow> gW = do_QueryInterface(mScriptGlobalObject); gW->routeEvent(aEvt); Or ? But the QI above doesn't work.. Any pointers ?
Reporter | ||
Comment 8•20 years ago
|
||
You can't QI to a concrete class. You could QI to nsIDOMJSWindow, though, since that's where routeEvent is defined. Note that it's possible for a document to have no script global object, though. So it would make more sense for both method to call a static nsContentUtils method or something. Though using ReportToConsole() shouldn't take more than a line or two of code, so it may be OK to just put it in both places.
Comment 9•20 years ago
|
||
Work in progress Do I need to check for sourceURI or doc ? If they are null, I guess we should just report it with no source file ? Can I get the source location anywhere - I saw nsJSUtils::GetCallingLocation, for example, can I use that? Am I using the right report category ("content javascript") ? I believe the actual warning message needs some work as well :)
Assignee: general → bugmail
Status: NEW → ASSIGNED
Comment 10•20 years ago
|
||
bz: Any hints on how to get the linenumber, etc here ? I noticed also that the last patch has an unused nsresult.
Reporter | ||
Comment 11•20 years ago
|
||
You may try to get the current stack frame off nsIXPConnect and getting the line number from that... I'm not sure whether that will give you the start of the function, though. Chances are, there is no good way to get a line number here. I'm not sure what else you're having trouble getting; could you elaborate?
Comment 12•19 years ago
|
||
have you looked at DumpJSStack() (fanout is painful), i can't remember if it does what you want or not.
Comment 13•16 years ago
|
||
This bug seems to have been solved already. Please close.
Updated•15 years ago
|
QA Contact: ian → general
Updated•13 years ago
|
Assignee: vhaarr+bmo → nobody
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Keywords: helpwanted
OS: Linux → All
Hardware: x86 → All
Resolution: --- → WORKSFORME
Whiteboard: [good first bug]
Assignee | ||
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•