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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>20493</bug_id>
          
          <creation_ts>2012-12-22 00:55:24 +0000</creation_ts>
          <short_desc>[Custom]: Need to define, not set the &quot;constructor&quot; property on element prototype.</short_desc>
          <delta_ts>2013-05-08 15:23:04 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - Component Model</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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>20653</dependson>
          <blocked>17103</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Boris Zbarsky">bzbarsky</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>erik.arvidsson</cc>
    
    <cc>wchen</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>80521</commentid>
    <comment_count>0</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2012-12-22 00:55:24 +0000</bug_when>
    <thetext>&gt;&quot;Set PROTOTYPE as the prototype property on CONSTRUCTOR
&gt;Set CONSTRUCTOR as the constructor property on PROTOTYPE.&quot;

Those should be defining properties, not setting them.  Furthermore, those properties should have some non-default property attributes (which you have to think about once you start defining properties).  In particular, the .constructor of the prototype should not be enumerable (because otherwise enumeration on all the elements involved would see it!), and the .prototype of the constructor should probably not be configurable, writable, or enumerable (which is how WebIDL .prototype and standard class .prototype work), though this part we could at least argue about.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81274</commentid>
    <comment_count>1</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-01-11 19:20:22 +0000</bug_when>
    <thetext>Since this is a function object, it will already have the &quot;prototype&quot; property per http://ecma-international.org/ecma-262/5.1/#sec-13.2

But you&apos;re right, I need to define the &quot;constructor&quot; property.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81276</commentid>
    <comment_count>2</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-01-11 19:34:06 +0000</bug_when>
    <thetext>&gt; Since this is a function object, it will already have the &quot;prototype&quot; property

The spec section you link to is what happens if you create a function from a string.  It&apos;s not applicable here, unless you explicitly invoke it in the components spec (in which case you have to define the inputs to that algorithm and whatnot.. but I suspect you do not in fact want to go there, since you want these to be [native code] functions).

You should really look into how WebIDL defines its constructor objects and ideally share that definition....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81282</commentid>
    <comment_count>3</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-01-11 20:51:27 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; &gt; Since this is a function object, it will already have the &quot;prototype&quot; property
&gt; 
&gt; The spec section you link to is what happens if you create a function from a
&gt; string.  It&apos;s not applicable here, unless you explicitly invoke it in the
&gt; components spec (in which case you have to define the inputs to that
&gt; algorithm and whatnot.. but I suspect you do not in fact want to go there,
&gt; since you want these to be [native code] functions).
&gt; 
&gt; You should really look into how WebIDL defines its constructor objects and
&gt; ideally share that definition....

(In reply to comment #2)
&gt; &gt; Since this is a function object, it will already have the &quot;prototype&quot; property
&gt; 
&gt; The spec section you link to is what happens if you create a function from a
&gt; string.  It&apos;s not applicable here, unless you explicitly invoke it in the
&gt; components spec (in which case you have to define the inputs to that
&gt; algorithm and whatnot.. but I suspect you do not in fact want to go there,
&gt; since you want these to be [native code] functions).

There&apos;s a not at the end that simply states:

&quot;A prototype property is automatically created for every function, to allow for the possibility that the function will be used as a constructor.&quot;

Or is this not enough?

&gt; 
&gt; You should really look into how WebIDL defines its constructor objects and
&gt; ideally share that definition....

Yup. And probably file bugs against WebIDL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81286</commentid>
    <comment_count>4</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-01-11 21:11:24 +0000</bug_when>
    <thetext>A note at the end of the algorithm that&apos;s not being used here?

Seriously, this just needs to be defined.  It doesn&apos;t come for free with the current state of ES.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81287</commentid>
    <comment_count>5</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-01-11 21:23:17 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; A note at the end of the algorithm that&apos;s not being used here?
&gt; 
&gt; Seriously, this just needs to be defined.  It doesn&apos;t come for free with the
&gt; current state of ES.

Sounds good, filing bug against WebIDL here: http://www.w3.org/TR/WebIDL/#dfn-function-object</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85884</commentid>
    <comment_count>6</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-04-10 20:52:42 +0000</bug_when>
    <thetext>I ended up letting WebIDL do the work: &quot;Let CONSTRUCTOR be the interface object whose interface prototype object is PROTOTYPE ...&quot;, which is defined pretty well in WebIDL.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>