Object.assign throws strict mode error for readonly properties in non strict mode.

RESOLVED INVALID

Status

()

Core
JavaScript: Standard Library
RESOLVED INVALID
3 years ago
3 years ago

People

(Reporter: John-David Dalton, Unassigned)

Tracking

40 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36

Steps to reproduce:

When not in strict mode:

var o = { 'a': 1 };
Object.freeze(o);
Object.assign(o, { 'a': 2 });
// TypeError: "a" is read-only


Actual results:

Throws a TypeError: "a" is read-only


Expected results:

Silent fail to assign.
(Reporter)

Comment 1

3 years ago
This happens in Nightly but not stable 37.
(Reporter)

Updated

3 years ago
Summary: Object.assign → Object.assign throws strict mode error for readonly properties in non strict mode.
Component: Untriaged → JavaScript: Standard Library
Product: Firefox → Core
Nightly is correct, see 19.1.2.1 Step 5.c.iii.3. It calls Set with the "Throw" parameter set to true.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → INVALID
(Reporter)

Comment 3

3 years ago
Ah ok thanks!
You need to log in before you can comment on or make changes to this bug.