Bug 220712

Summary: Object.assign should throw for property creation on non-extensible `target`
Product: WebKit Reporter: Alexey Shvayka <ashvayka>
Component: JavaScriptCoreAssignee: Alexey Shvayka <ashvayka>
Status: RESOLVED FIXED    
Severity: Trivial CC: ews-watchlist, keith_miller, mark.lam, msaboff, ross.kirsling, saam, tzagallo, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch ross.kirsling: review+

Description Alexey Shvayka 2021-01-18 09:31:28 PST
Object.assign should always throw if `target` is non-extensible
Comment 1 Alexey Shvayka 2021-01-18 09:34:53 PST
Created attachment 417838 [details]
Patch
Comment 2 Ross Kirsling 2021-01-18 13:50:37 PST
Comment on attachment 417838 [details]
Patch

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

r=me with comments

> Source/JavaScriptCore/ChangeLog:3
> +        Object.assign should always throw if `target` is non-extensible

Seems like "always" is a bit too strong if we don't throw when updating a property, right?

> Source/JavaScriptCore/ChangeLog:12
> +        Aligns JSC with the spec [1], V8, and SpiderMonkey.

Should we add a test262 test too?
Comment 3 Radar WebKit Bug Importer 2021-01-21 18:10:29 PST
<rdar://problem/73478307>
Comment 4 Alexey Shvayka 2021-02-05 06:26:48 PST
Committed r272411: <https://trac.webkit.org/changeset/272411>
Comment 5 Alexey Shvayka 2021-02-05 06:27:32 PST
(In reply to Ross Kirsling from comment #2)

Thank you for review, Ross!

> Seems like "always" is a bit too strong if we don't throw when updating a
> property, right?

Absolutely, I've renamed the bug.

> Should we add a test262 test too?

Extensive tests are coming in https://github.com/tc39/test262/pull/2945.