<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>21842</bug_id>
          
          <creation_ts>2008-10-23 16:21:26 -0700</creation_ts>
          <short_desc>custom constructors (like HTMLOptionElement) are not called during &quot;new HTMLOptionElement&quot;</short_desc>
          <delta_ts>2008-10-25 08:19:23 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>21846</dependson>
          <blocked>21886</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Eric Seidel (no email)">eric</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>96446</commentid>
    <comment_count>0</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-10-23 16:21:26 -0700</bug_when>
    <thetext>custom constructors (like HTMLOptionElement) are not called during &quot;new HTMLOptionElement&quot;

Why?

JSValuePtr jsDOMWindowHTMLOptionElementConstructor(ExecState* exec, const Identifier&amp;, const PropertySlot&amp; slot)
{
    if (!static_cast&lt;JSDOMWindow*&gt;(asObject(slot.slotBase()))-&gt;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&apos;t have GenerateConstructor defined.

Seems we need a CustomConstructor= idl flag.

I expect this is a regression, since otherwise I don&apos;t know why we&apos;d have this dead code in WebCore.  I&apos;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&apos;s not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96468</commentid>
    <comment_count>1</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-10-23 18:25:49 -0700</bug_when>
    <thetext>This doesn&apos;t actually depend on bug 21846, but it&apos;s related at least. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96473</commentid>
    <comment_count>2</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2008-10-23 19:02:31 -0700</bug_when>
    <thetext>I don&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96669</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-10-25 04:24:07 -0700</bug_when>
    <thetext>As Sam said, these &quot;constructors&quot; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96671</commentid>
    <comment_count>4</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-10-25 08:19:23 -0700</bug_when>
    <thetext>Ok.  There is a valid bug here.  But I will file a new one.

document.createElement(&quot;option&quot;).constructor == &quot;[object HTMLElementConstructor&quot;;

That seems wrong to me.  Since that&apos;s the only HTMLElement &quot;subclass&quot; for which that is true.  That is due to the fact that HTMLOptionElement has a custom constructor which is not wired up correctly.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>