proxy-super-return-define-property-trap.js 613 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
// Copyright 2022 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Flags: --no-lazy-feedback-allocation
Proxy.prototype = Object.prototype;

let logs = [];

class Z extends Proxy {
  constructor() {
    super({}, {
      set() {
        logs.push("set");
        return true;
      },
      defineProperty() {
        logs.push("defineProperty");
        return true;
      }
    })
  }
  a = 1;
}

new Z();
assertEquals(["defineProperty"], logs);

logs = [];
new Z();
assertEquals(["defineProperty"], logs);