v8/test/mjsunit/regress/regress-crbug-1259950.js
Igor Sheludko 0ba885943a [ic] Make DefineOwnIC throw if the private symbol already exists
Drive-by:
* don't create proto handlers for DefineOwnIC and StoreOwnIC,
* make sure that none of the DefineOwnIC and StoreOwnIC handlers are
  leaked into StoreIC's megamorphic stub cache.

Bug: v8:9888, chromium:1259950
Change-Id: I9db538e6ed14bc578aa80df037ffebd9e8c3c649
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3250641
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77632}
2021-11-01 21:07:43 +00:00

26 lines
555 B
JavaScript

// Copyright 2021 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.
function test(obj) {
class Base {
constructor() {
return obj;
}
}
class C extends Base {
#x = 1;
}
let c = new C();
c = new C();
}
assertThrows(
() => test(globalThis),
TypeError, "Cannot initialize #x twice on the same object");
assertThrows(
() => test(Object.create(null)),
TypeError, "Cannot initialize #x twice on the same object");