Skip to content

Object: separate internal property descriptors from user conversion objects #813

Description

@chrisbbreuer

Parent: #465. Follow-up to #811's descriptor conversion/caller audit.

Engine-internal Property Descriptor records must not be reinterpreted as user
objects by ToPropertyDescriptor. Several helpers currently construct an object
with own value/writable/enumerable/configurable fields, then call
builtins.defineOneResult, which observes inherited get/set fields. That adds
user-code execution to CreateDataProperty / internal descriptor application.

Confirmed on 0ad2b5d and the local #811 candidate; Node returns true, zig-js
returns ERR 123:

(function () {
  var calls = 0;
  Object.defineProperty(Object.prototype, 'get', {
    get() { calls++; throw 123; }, configurable: true
  });
  try {
    var result = JSON.parse('{"a":1}', function (k, v) { return v; });
    return result.a === 1 && calls === 0;
  } finally { delete Object.prototype.get; }
})()

Audit internal callers including createDataIndexOrThrow, internalizeStore,
array result publication, ordinary receiver DefineOwnProperty paths, and
setterIgnoringProto. Public Object/Reflect.defineProperty must still perform
ToPropertyDescriptor exactly once; internal records must go directly to the
descriptor-application path, including through nested Proxy forwarding.

Use a clear internal record/API boundary, not prototype mutation, pinning,
suppression, or exception recovery. Add inherited-field ordering/abrupt controls,
both execution tiers, actual-moving witnesses where callbacks remain required,
allocation-failure restoration, and affected test262/TSan checks.

Local reproduction and baseline/candidate logs:
/Users/chris/.cache/zig-js-reflection.iP8bKP/followup-internal-descriptor-read.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions