<?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>155060</bug_id>
          
          <creation_ts>2016-03-04 20:07:18 -0800</creation_ts>
          <short_desc>Second call to super() should fail</short_desc>
          <delta_ts>2016-04-11 00:02:21 -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>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>151113</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ryosuke Niwa">rniwa</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ggaren</cc>
    
    <cc>gskachkov</cc>
    
    <cc>keith_miller</cc>
    
    <cc>saam</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1171141</commentid>
    <comment_count>0</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2016-03-04 20:07:18 -0800</bug_when>
    <thetext>class A { }
class B extends A { constructor() { super(); console.log(&apos;hi&apos;); super(); } }

should fail immediately after &apos;hi&apos; since &quot;this&quot; is already created.

Specifically, step 10 in SuperCall:
http://www.ecma-international.org/ecma-262/6.0/#sec-super-keyword-runtime-semantics-evaluation

10. Return thisER.BindThisValue(result).

should throw a ReferenceError because of step 3:
http://www.ecma-international.org/ecma-262/6.0/#sec-bindthisvalue

3. If envRec.[[thisBindingStatus]] is &quot;initialized&quot;, throw a ReferenceError exception.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1171165</commentid>
    <comment_count>1</comment_count>
    <who name="GSkachkov">gskachkov</who>
    <bug_when>2016-03-04 23:16:10 -0800</bug_when>
    <thetext>We have very close issue to this https://bugs.webkit.org/show_bug.cgi?id=151113 that rely on discussion https://esdiscuss.org/topic/duplicate-super-call-behaviour
test example:
class Foo {
  constructor() {
    console.log(&quot;foo&quot;);
  }
}

class Bar extends Foo {
  constructor() {
    super();
    console.log(&quot;bar&quot;);
    super();
  }
}

new Bar;

If we will strictly follow specs we will have:
foo
bar 
foo
ReferenceError: This can not be initialized twice.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1182607</commentid>
    <comment_count>2</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2016-04-10 23:59:01 -0700</bug_when>
    <thetext>Does your patch for the bug 151113 also fix this bug?  Or do we still need to keep this bug around?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1182608</commentid>
    <comment_count>3</comment_count>
    <who name="GSkachkov">gskachkov</who>
    <bug_when>2016-04-11 00:01:47 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; Does your patch for the bug 151113 also fix this bug?  Or do we still need
&gt; to keep this bug around?

Yes, I think it is the same issue, so path for 151113 fix this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1182609</commentid>
    <comment_count>4</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2016-04-11 00:02:21 -0700</bug_when>
    <thetext>Let&apos;s dupe this bug in that case.

*** This bug has been marked as a duplicate of bug 151113 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>