Bug 159604 - [JSC] Array.from() and Array.of() try to build objects even if "this" is not a constructor
Summary: [JSC] Array.from() and Array.of() try to build objects even if "this" is not ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Benjamin Poulain
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-09 12:19 PDT by Benjamin Poulain
Modified: 2016-07-11 17:58 PDT (History)
5 users (show)

See Also:


Attachments
Patch (10.34 KB, patch)
2016-07-09 12:21 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch for landing (10.34 KB, patch)
2016-07-11 17:29 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poulain 2016-07-09 12:19:47 PDT
[JSC] Array.from() and Array.of() try to build objects even if "this" is not a constructor
Comment 1 Benjamin Poulain 2016-07-09 12:21:20 PDT
Created attachment 283265 [details]
Patch
Comment 2 Yusuke Suzuki 2016-07-09 23:42:47 PDT
Comment on attachment 283265 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=283265&action=review

r=me

> Source/JavaScriptCore/ChangeLog:5
> +

Nice. And PromiseConstructor.js's FIXME should be also fixed in the other patch.

> Source/JavaScriptCore/builtins/ArrayConstructor.js:64
> +        var result = @isConstructor(thisObj) ? @Object(new thisObj()) : [];

Is this @Object() necessary? I think [[Construct]] is guaranteed that it always returns an object.

> Source/JavaScriptCore/builtins/ArrayConstructor.js:90
> +    var result = @isConstructor(thisObj) ? @Object(new thisObj(arrayLikeLength)) : new @Array(arrayLikeLength);

Ditto.
Comment 3 Benjamin Poulain 2016-07-11 17:29:24 PDT
Created attachment 283369 [details]
Patch for landing
Comment 4 WebKit Commit Bot 2016-07-11 17:58:19 PDT
Comment on attachment 283369 [details]
Patch for landing

Clearing flags on attachment: 283369

Committed r203101: <http://trac.webkit.org/changeset/203101>
Comment 5 WebKit Commit Bot 2016-07-11 17:58:23 PDT
All reviewed patches have been landed.  Closing bug.