Closed
Bug 369469
Opened 18 years ago
Closed 5 years ago
XBL creating properties as events are triggered (e.g. onxblfocus) is weird
Categories
(Core :: XBL, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: jruderman, Unassigned)
Details
(Keywords: testcase)
Attachments
(2 files)
BL adds attributes like "onxblfocus" and "onxblblur" to elements when those events are called. I think it should either always add these attributes or never add them. Things to notice about the testcase: * After a call to focus(), two new properties are added. * If the window does not have focus, only one new property is added. I noticed this because the script in bug 326633 has behavior that depends on the exact number of properties objects have. Because I was doing other things, the window sometimes had focus and sometimes did not, causing the script to behave chaotically. I think I can avoid the chaotic behavior by making the script skip attributes named onxbl*, but it would have been better if I didn't have to go through the pain of discovering that.
Reporter | ||
Updated•18 years ago
|
Attachment #254144 -
Attachment mime type: text/plain → application/xhtml+xml
Comment 1•18 years ago
|
||
So this is sort of on purpose http://lxr.mozilla.org/seamonkey/source/content/xbl/src/nsXBLPrototypeHandler.cpp#408
Reporter | ||
Comment 2•18 years ago
|
||
I figured that much ;) Is the purpose to cache the compiled handler? Maybe it could be stored somewhere other than in the node's attribute list, maybe even with the XBL binding.
There definitely are places we could store this info, but I'm not sure if it's worth it. If this is blocking testing we can definitely fix it, but otherwise it's pretty low priority for me.
Comment 4•18 years ago
|
||
Those aren't attributes; please don't scare me like that! In any case, this is how on* stuff behaves in HTML in general, so I'd probably wontfix this.
Summary: XBL creating attributes as events are triggered (e.g. onxblfocus) is weird → XBL creating properties as events are triggered (e.g. onxblfocus) is weird
Reporter | ||
Comment 5•18 years ago
|
||
You're right, normal HTML has similar weird behavior. Calling focus() on a textbox that has an onfocus attribute makes both an "onfocus" property and an "addEventListener" property appear in enumeration! If the window doesn't have focus, "addEventListener" still shows up but "onfocus" does not. Maybe I should just make my script stay the heck away from focus/blur ;)
Comment 6•18 years ago
|
||
Yeah. You can thank JS and its name resolution business for that, fwiw. ;) I don't think we can do much about it short of switching to a different JS engine or predefining all possible on* properties to null up front. I do think there's a bug on that last, btw.
Reporter | ||
Comment 7•18 years ago
|
||
What about the addEventListener part?
Reporter | ||
Comment 8•18 years ago
|
||
I won't whine too much if you wontfix it all; I'm probably the only one who cares at all about exactly what shows up in property enumeration. Most of the pain is a sunk cost for me and I can find workarounds.
Reporter | ||
Comment 9•18 years ago
|
||
Bug 159849? It's marked as fixed though.
Comment 10•18 years ago
|
||
The addEventListener part is odd. I would have thought XPConnect-exposed properties would be enumerable, and addEventListener _should_ be exposed via XPConnect (in addition to the classinfo glue that does: 6709 JSFunction *fnc = 6710 ::JS_DefineFunction(cx, obj, ::JS_GetStringBytes(str), 6711 AddEventListenerHelper, 3, JSPROP_ENUMERATE); to handle our extensions to it).
Comment 11•18 years ago
|
||
> Bug 159849? It's marked as fixed though.
Oh, right. In JS, enumerating props on foo and doing |"bar" in foo| and doing "foo.bar" are kinda distinct things that can give different answers... So for the on* props, we changed what foo.bar does, basically. But the property doesn't actually exist till someone tries to resolve it.
Reporter | ||
Comment 12•18 years ago
|
||
Should I file a separate bug on the addEventListener part?
Comment 13•18 years ago
|
||
I don't think it's worth it. I'm willing to bet $20 it's "correct" given how JS works and all that... I just happen not to know the exact codepath that leads to that result.
Reporter | ||
Comment 14•18 years ago
|
||
It's "correct" for addEventListener to not appear in property enumeration -- until it is used implicitly? :/
Comment 15•18 years ago
|
||
Again, just my guess. I could be wrong; jst or brendan would know for sure. Maybe.
Updated•15 years ago
|
Assignee: xbl → nobody
QA Contact: ian → xbl
Comment 16•5 years ago
|
||
XBL is now disabled in Firefox (Bug 1583314) and is in the process of being removed from Gecko (Bug 1566221), so closing bugs requesting changes to its implementation as wontfix.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•