Bug 152108 - ES6 Class syntax. Invoking method of parent class in constructor before super() lead to crash
Summary: ES6 Class syntax. Invoking method of parent class in constructor before super...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords:
Depends on:
Blocks: 140491
  Show dependency treegraph
 
Reported: 2015-12-09 23:37 PST by GSkachkov
Modified: 2016-03-26 00:08 PDT (History)
6 users (show)

See Also:


Attachments
dump_error (75.06 KB, application/octet-stream)
2015-12-09 23:42 PST, GSkachkov
no flags Details
[PATCH] Proposed Fix (4.57 KB, patch)
2016-03-25 22:58 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description GSkachkov 2015-12-09 23:37:19 PST
Invoking method of parent class in constructor before super() lead to crash. See example:
<script>
   class A {
      getValue() {
         return 'test-value';
      }
   }

  class B extends A {
     constructor () {
        let _value  = super.getValue();
        super();
        this.value = _value;
     }
  }

  let b = new B();
  console.log(b.value);
</script>
Comment 1 GSkachkov 2015-12-09 23:42:13 PST
Created attachment 267075 [details]
dump_error

Error dump, that I received on r193804
Comment 2 Joseph Pecoraro 2016-03-25 22:58:41 PDT
(In reply to comment #0)
> Invoking method of parent class in constructor before super() lead to crash.
>
>   class B extends A {
>      constructor () {
>         let _value  = super.getValue();
>         super();
>         this.value = _value;
>      }
>   }

I think this was supposed to be an arrow function:

    let _value = () => { super.getValue() };
    _value();
    super();

At least Based on the FIXME in the LayoutTests/js test.

However, it looks like this has been fixed! Lets enable the test to ensure we get a bit extra coverage and remove the FIXMEs in LayoutTests.
Comment 3 Joseph Pecoraro 2016-03-25 22:58:56 PDT
Created attachment 274980 [details]
[PATCH] Proposed Fix
Comment 4 WebKit Commit Bot 2016-03-26 00:08:22 PDT
Comment on attachment 274980 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 274980

Committed r198714: <http://trac.webkit.org/changeset/198714>
Comment 5 WebKit Commit Bot 2016-03-26 00:08:25 PDT
All reviewed patches have been landed.  Closing bug.