Skip to content

A problem in Object.defineProperty #1319

@Georgezxh

Description

@Georgezxh

Description

Build version: 1.7.14
OS version: ubuntu20.04

The following code showed that rhino didn't change the length of array and even didn't trigger the get() method in defineProperty, while other js engines(like V8 in Google,Spidermokey in firefox) did.

Testcase

var array = new Array(5)
var proto = {};

Object.setPrototypeOf(array,proto);
Object.defineProperty(
  proto, 1, {
    get() {
      array.length = 1;
      return 1;
    },
});
var a=[];
var res=a.concat(array);
print(array.length);

Output

5

Expected behavior

1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ecma IncompatibilityIssues about Rhino being incompatible with the EcmaScript specbugIssues considered a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions