Skip to content

Implementation dependent [[Prototype]] of Global Object. #2593

Open
@jhnaldo

Description

@jhnaldo

I think that the following tests violate the semantics of implementation dependent [[Prototype]] of Global Object.

According to the definition of Global Object, the [[Prototype]] internal slot of the global object is fully implementation-dependent. There is any restriction for it. Thus, we should not assume that [[Prototype]] of the global object is related to Object.prototype. However, the above tests use this assumption.

For example, see the first test /test/built-ins/Object/defineProperty/15.2.3.6-4-625gs.js:

Object.defineProperty(Object.prototype,
  "prop",
  {
    value: 1001,
    writable: false,
    enumerable: false,
    configurable: false
  }
);
var prop = 1002;

if (!(this.hasOwnProperty("prop") && prop === 1002)) {
  throw "this.prop should take precedence over Object.prototype.prop";
}

In this case, this points to the global object and this test tries to access this.hasOwnProperty. If the [[Prototype]] of the global object is a chain including Object.prototype, this.hasOwnProperty points to Object.prototype.hasOwnProperty but we should not assume that [[Prototype]] of the global object is a chain including Object.prototype.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions