Closed Bug 318678 Opened 15 years ago Closed 15 years ago
[FIX]events registered via div
Elem .onmouseover and div Elem .onclick do not trigger
Taking bug, but bz, feel free to have a look if you've got some cycles.
Assignee: nobody → jst
OS: Linux → All
Hardware: PC → All
this regressed between 2005-07-30-05 and 2005-07-31-10 (landing of 296639)
(regrression was for onclick specifically)
So I added some logging to nsEventListenerManager::RegisterScriptEventListener to see what's going on as follows: fprintf(stderr, "Registering listener for %s on %p\n", NS_ConvertUTF16toUTF8(type).get(), jsobj); Here's what I see for the div in question (by matching up pointer values): Created wrapped native [object HTMLDivElement @ 0xb2b67d18 (native @ 0xb2b67cf0)], flat JSObject is 0xb2b2ca88 Registering listener for onclick on 0xb2b2ca88 Registering listener for onclick on 0xb2b2ca88 and then much later (probably as I click around): Created wrapped native [object HTMLDivElement @ 0xb2b9a340 (native @ 0xb2b67cf0)], flat JSObject is 0xb2b6f450 Created wrapped native [object HTMLDivElement @ 0xb2b9baf0 (native @ 0xb2b67cf0)], flat JSObject is 0xb3d5b6c0 Created wrapped native [object HTMLDivElement @ 0xb3c16f20 (native @ 0xb2b67cf0)], flat JSObject is 0xb4dfa950 So for some reason we "lose" the original XPCWrappedNative that the event listener is set on... hence no listener firing. This is all for the onclick listener; the onmouseover listener is a bug in the site (but Daniel, please don't change the code until we can get to the bottom of this, ok?).
Fix -- have to use the correct old scope when reparenting wrappers...
I think we want this on the 1.8 branch... I sorta wish I'd followed up more on my questions about this code in bug 296639. :(
Assignee: jst → bzbarsky
Priority: -- → P1
Summary: events registered via divElem.onmouseover and divElem.onclick do not trigger → [FIX]events registered via divElem.onmouseover and divElem.onclick do not trigger
Target Milestone: --- → mozilla1.9alpha
Comment on attachment 204852 [details] [diff] [review] Fix r+sr=jst
Checked in to trunk.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment on attachment 204852 [details] [diff] [review] Fix I think we need this on the 1.8 branch as soon as we can manage... :(
Comment on attachment 204852 [details] [diff] [review] Fix Please land for 1.8.0 and 1.8 branches. Thanks!
Could someone please land this for me? If not, I'll do it in early January...
*** Committing to MOZILLA_1_8_BRANCH... Checking in content/base/public/nsContentUtils.h; new revision: 188.8.131.52; previous revision: 184.108.40.206 Checking in content/base/src/nsContentUtils.cpp; new revision: 220.127.116.11; previous revision: 18.104.22.168 *** Committing content/base/public/nsContentUtils.h on MOZILLA_1_8_0_BRANCH... new revision: 22.214.171.124.2.1; previous revision: 126.96.36.199 *** Committing content/base/src/nsContentUtils.cpp on MOZILLA_1_8_0_BRANCH... new revision: 188.8.131.52.2.1; previous revision: 184.108.40.206
You need to log in before you can comment on or make changes to this bug.