Closed
Bug 81115
Opened 24 years ago
Closed 24 years ago
event.target is bogus
Categories
(Core :: DOM: Events, defect)
Core
DOM: Events
Tracking
()
VERIFIED
FIXED
People
(Reporter: alex.dent, Assigned: joki)
Details
(Keywords: regression)
Attachments
(2 files)
655 bytes,
text/html
|
Details | |
23.07 KB,
patch
|
Details | Diff | Splinter Review |
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Macintosh; U; PPC; en-US; rv:0.9+) Gecko/
BuildID: 2001051508
try the attached testcase. the div gets a click event and a custom variable
gumbo is set in the divs object. this variable does NOT exist in the event
target, but it does exist in event.target.nextSibling.previousSibling, which
should be the same as event.target! this shows that some evil hack is going on
in the background that creates a new, bogus node as the event.target, with most,
but not all, properties copied over from the original node.
this needs to be fixed asap, as it creates a lot of problems even in mozillas
own scripts.
Reproducible: Always
![]() |
||
Comment 2•24 years ago
|
||
seeing this on linux too...
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Mac System 9.x → All
Hardware: Macintosh → All
forgot to mention that not only event.target is bogus, but it is also the same
as 'this' in the event handler, ie. this.gumbo is also undefined in the test
case above.
Summary: event.target ist bogus → event.target is bogus
Assignee | ||
Comment 4•24 years ago
|
||
From a quick look it seems we may be making different XPCDOM wrappers for the
content object depending on whether we see it as an nsIDOMNode or an
nsIDOMEventTarget. This would cause some identity problems.
Comment 5•24 years ago
|
||
Adding myself to CC because this *might* be causing the problems with context
menus for bookmarks sidebar and personnal toolbar not working.
Comment 6•24 years ago
|
||
Testcase is working well in Mozilla 0.9
Regression?
Comment 7•24 years ago
|
||
Right on, joki! When I read your comment it occured to me that this is probably
a problem with the nsIContent/nsIDOMEvent(Target/Listener) aggregation we do for
XML/HTML elements and some other nodes as well, and I was right, that whole
aggregation/tearoff scheme violates the one [XP]COM rule that can not be broken
in a situation like this, namely the identity rule. Whatever really happens
behind the scene when something like this is done doesn't really matter as long
as QI'ing any one of these tearoff objects (nsEventListenerManager in this case)
to the nsISuppotys interface *always* results the *same* pointer, this was not
happening. Here's a patch that fixes this, and other problems as well (at least
bug 80929).
Index: content/events/src/nsEventListenerManager.cpp
===================================================================
RCS file: /cvsroot/mozilla/content/events/src/nsEventListenerManager.cpp,v
retrieving revision 1.99
diff -u -r1.99 nsEventListenerManager.cpp
--- nsEventListenerManager.cpp 2001/05/11 00:43:25 1.99
+++ nsEventListenerManager.cpp 2001/05/16 06:58:53
@@ -184,13 +184,13 @@
AddRef();
return NS_OK;
}
+ if (mTarget) {
+ return mTarget->QueryInterface(aIID, aInstancePtr);
+ }
if (aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = (void*)(nsISupports*)(nsIEventListenerManager*)this;
AddRef();
return NS_OK;
- }
- if (mTarget) {
- return mTarget->QueryInterface(aIID, aInstancePtr);
}
return NS_NOINTERFACE;
}
Tom, I don't know how scary this is from the event listener manager point of
view, but it does fix the problem and doesn't introduce any obvious problems
that I've noticed in testing this for only a few minutes. Whaddaya think?
Updated•24 years ago
|
Severity: blocker → critical
Keywords: mozilla0.9.1,
regression
Assignee | ||
Comment 9•24 years ago
|
||
Yeah, I can see it being a bit scary, or maybe just weird in that
nsEventListenerManager doesn't really do nsISupports at all anymore, but given
our aggregation scheme it seems like the correct choice.
Comment 10•24 years ago
|
||
Vidur, sr=?
Assignee | ||
Comment 11•24 years ago
|
||
For the sake of process,
r=joki
Comment 12•24 years ago
|
||
Seeing this too hope this is fixed for 0.9.1 because it breaks a lot of menus.
Comment 13•24 years ago
|
||
Scary. nsGenericElement is the only user of the nsEventListenerManager, right?
Joki, can you confirm? If so, then we can assume in the implementation that it
is a tear-off and Johnny's patch is correct. Assuming enough testing has been
done, sr=vidur.
Comment 14•24 years ago
|
||
Comment 15•24 years ago
|
||
The patch I just attached has been checked in, that patch creates a new tearoff
class that's used for implementing nsIDOMEventReceiver and nsIDOMEventTarget on
nsGenericElement and nsGenericDOMDataNode. This fixes this immediate problem and
also makes QI'ing a nsGenericElement not create the event listener manager and
holding on to it for the rest of the elements lifetime.
Fixed!
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 16•24 years ago
|
||
after 3 days a new mac build is finally availiable and the bug is fixed just
fine so far.
but probably related is bug 82092
Comment 17•24 years ago
|
||
Verifying fixed on build 2001-05-22-06-trunk windows 98
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•