Object.defineProperty() on sealed standard objects throws NPE

UNCONFIRMED
Unassigned

Status

UNCONFIRMED
7 years ago
7 years ago

People

(Reporter: anba, Unassigned)

Tracking

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

7 years ago
Created attachment 596122 [details]
JUnit test case to show the NPE

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20100101 Firefox/10.0
Build ID: 20120129021758

Steps to reproduce:

Sealing the built-in objects with Context#initStandardObjects() by passing true as the second argument does not work with Object.defineProperty(). See the attached JUnit test case for an example using Boolean.prototype.

Note: "sealing" does not refer to Object.seal() in this case!


Actual results:

ScriptableObject#createSlot() throws a NullPointerException b/c ScriptableObject#slots is null


Expected results:

Most likely this should throw an instance of org.mozilla.javascript.EvaluatorException. Just like it's the case for setting any other property on Boolean.prototype if the standard objects are sealed, e.g. with a plain assignment "Boolean.prototype.x = 0".
(Reporter)

Comment 1

7 years ago
Created attachment 596125 [details]
JUnit test case to show the NPE
Attachment #596122 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.