Closed Bug 265201 Opened 21 years ago Closed 4 years ago

Error when adding a new property to not extensible object should refer to the object.

Categories

(Core :: JavaScript Engine, defect, P5)

x86
Windows 2000
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: timeless, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: DUPEME)

R:\mozilla\js\src\WINNT5.1_DBG.OBJ>js -w -s js> var testc={}; seal(testc); testc.ase=true; 1: Error: testc.ase is read-only js> build();help() built on Jul 18 2004 at 17:51:08 JavaScript-C 1.5 pre-release 6a 2004-06-09 it seems to me that something that doesn't exist can't be readonly. instead of: 1: Error: testc.ase is read-only i'd expect something closer to this: js> Components.z=1 typein:3: uncaught exception: [Exception... "Cannot modify properties of a WrappedNative" nsresult: "0x80570034 (NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN)" location: "JS frame :: typein :: <TOP_LEVEL> :: line 3" data: no] simply: 1: Error: testc is read-only or 1: Error: Can't modify properties of a readonly object (testc).
-> default qa
QA Contact: pschwartau → general
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P5
I thought pschwartau reported this earlier, right after JS_SealObject went in. /be
Whiteboard: DUPEME
The seal api doesn't exists anymore, but when adding properties to not extensible object, we still get a rather obscure message. function () { 'use strict'; var o = {} Object.seal(o); o.a = 1; } Error message is: o.a is not extensible We should change this to 'o is not extensible, can't add new property' Changed title to reflect new content.
Summary: js.exe error for setting an undefined property of a sealed object should refer to the sealed object not the property → Error when adding a new property to not extensible object should refer to the object.
Now gives: >Exception: ({}) is not extensible
Assignee: general → nobody
Nowadays: "TypeError: can't define property "a": Object is not extensible"
are we going to put the disassemble or toString of the object into the error message? if not, the current message seems to be sufficient and we can close this.

Let's resolve this as WFM per comment #6.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.