Bug 21842

Summary: custom constructors (like HTMLOptionElement) are not called during "new HTMLOptionElement"
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: ap, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Bug Depends on: 21846    
Bug Blocks: 21886    

Eric Seidel (no email)
Reported 2008-10-23 16:21:26 PDT
custom constructors (like HTMLOptionElement) are not called during "new HTMLOptionElement" Why? JSValuePtr jsDOMWindowHTMLOptionElementConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) { if (!static_cast<JSDOMWindow*>(asObject(slot.slotBase()))->allowsAccessFrom(exec)) return jsUndefined(); return JSHTMLOptionElement::getConstructor(exec); } we call JSHTMLOptionElement::getConstructor(exec), but JSHTMLOptionElement has no custom implementation of getConstructor, because the idl doesn't have GenerateConstructor defined. Seems we need a CustomConstructor= idl flag. I expect this is a regression, since otherwise I don't know why we'd have this dead code in WebCore. I'm not even really sure I understand what crazy behavior the custom JSHTMLOptionElementConstructor is supposed to provide. Tentatively marking this as a Regression. Feel free to remove the flag if you have more info to suggest it's not.
Attachments
Eric Seidel (no email)
Comment 1 2008-10-23 18:25:49 PDT
This doesn't actually depend on bug 21846, but it's related at least. :)
Sam Weinig
Comment 2 2008-10-23 19:02:31 PDT
I don't think that new HTMLOptionElement has ever worked. The syntax is new Option(), and that behavior is implemented in JSDOMWindowBase in jsDOMWindowBaseOption() which uses the custom JSHTMLOptionElementConstructor class. We should see if mozilla supports the new HTMLOptionElement syntax and move forward accordingly.
Alexey Proskuryakov
Comment 3 2008-10-25 04:24:07 PDT
As Sam said, these "constructors" can not be used for constructing objects, they are only good for extending prototypes. Someone else may be able to better explain this in legalese, but the bug as filed is not valid.
Eric Seidel (no email)
Comment 4 2008-10-25 08:19:23 PDT
Ok. There is a valid bug here. But I will file a new one. document.createElement("option").constructor == "[object HTMLElementConstructor"; That seems wrong to me. Since that's the only HTMLElement "subclass" for which that is true. That is due to the fact that HTMLOptionElement has a custom constructor which is not wired up correctly.
Note You need to log in before you can comment on or make changes to this bug.