<?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>144283</bug_id>
          
          <creation_ts>2015-04-27 15:26:20 -0700</creation_ts>
          <short_desc>ES6 classes: super() should throw when extending null</short_desc>
          <delta_ts>2015-04-28 09:58:04 -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>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</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>
          
          <blocked>140491</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Erik Arvidsson">arv</reporter>
          <assigned_to name="Ryosuke Niwa">rniwa</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1089228</commentid>
    <comment_count>0</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2015-04-27 15:26:20 -0700</bug_when>
    <thetext>http://trac.webkit.org/browser/trunk/LayoutTests/js/script-tests/class-syntax-super.js#L59

shouldThrow(&apos;new (class extends null { constructor() { super(); return undefined } })&apos;, &apos;&quot;TypeError: undefined is not an object (evaluating \&apos;super()\&apos;)&quot;&apos;);


and

http://trac.webkit.org/browser/trunk/LayoutTests/js/script-tests/class-syntax-super.js#L64

shouldThrow(&apos;new (class extends null { constructor() { super() } })&apos;, &apos;&quot;TypeError: undefined is not an object (evaluating \&apos;super()\&apos;)&quot;&apos;);


The reason super() throws is because Function.prototype is not constructable. Your test seems to be testing the return value. It should never get there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1089250</commentid>
    <comment_count>1</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2015-04-27 16:07:33 -0700</bug_when>
    <thetext>Oh, this is because of the way I&apos;m retriecving Function.prototype. It is in fact throwing up before calling super() so our behavior is corect.

Thanks for filing all these bugs :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1089259</commentid>
    <comment_count>2</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2015-04-27 16:28:00 -0700</bug_when>
    <thetext>It is not clear to me that you are throwing at the right spot:

http://people.mozilla.org/~jorendorff/es6-draft.html#sec-super-keyword-runtime-semantics-evaluation

You should throw in step 7/8 in SuperCall : super Arguments

In this case there is no undefined value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1089289</commentid>
    <comment_count>3</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2015-04-27 17:20:44 -0700</bug_when>
    <thetext>Yes, that&apos;s what&apos;s happening (throw in step 7 of 8) You&apos;re right that the error message isn&apos;t exactly descriptive/informative but I don&apos;t feel like I need to improve it since it&apos;s such an edge case.

Or do you feel that web devs will end up hitting this error often?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1089505</commentid>
    <comment_count>4</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2015-04-28 07:42:35 -0700</bug_when>
    <thetext>&gt; Or do you feel that web devs will end up hitting this error often?

I don&apos;t think this is a common case but the current message is pretty confusing. I assume it is hard coded so you can easily change it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1089573</commentid>
    <comment_count>5</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2015-04-28 09:58:04 -0700</bug_when>
    <thetext>No, the problem is that I&apos;m relying on accessing undefined to throw an exception in this case right now, and I&apos;d need to add a runtime branch if I wanted to throw a nicer error message here.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>