v8/test/mjsunit/regress/regress-crbug-1321899.js
Joyee Cheung bb98b38735 [ic] handle access check for private names
Previously the LookupIterator ignores private symbols
(including private names) for the access check. This patch
removes these exceptions so that they are always checked.

Drive-by: removes the unused should_throw parameter in
Runtime::DefineObjectOwnProperty()

Bug: chromium:1321899
Change-Id: I9677b1e377f01d966daa1603eee1ed9535ffab92
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3623419
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Joyee Cheung <joyee@igalia.com>
Cr-Commit-Position: refs/heads/main@{#80700}
2022-05-23 18:30:07 +00:00

64 lines
1.2 KiB
JavaScript

// 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.
class A {
constructor(arg) {
return arg;
}
}
class B extends A {
#b = 1; // ACCESS_CHECK -> DATA
constructor(arg) {
super(arg);
}
static setField(obj) {
obj.#b = 'b'; // KeyedStoreIC
}
static getField(obj) {
return obj.#b;
}
}
class C extends A {
#c; // DefineKeyedOwnIC: ACCESS_CHECK -> NOT_FOUND
constructor(arg) {
super(arg);
}
static setField(obj) {
obj.#c = 'c'; // KeyedStoreIC
}
static getField(obj) {
return obj.#c;
}
}
let d = 0;
class D extends A {
get #d() { return d; }
set #d(val) { d = val;}
constructor(arg) {
super(arg); // KeyedStoreIC for private brand
}
static setAccessor(obj) {
obj.#d = 'd'; // KeyedLoadIC for private brand
}
static getAccessor(obj) {
return obj.#d; // KeyedLoadIC for private brand
}
}
class E extends A {
#e() { return 0; }
constructor(arg) {
super(arg); // KeyedStoreIC for private brand
}
static setMethod(obj) {
obj.#e = 'e'; // KeyedLoadIC for private brand
}
static getMethod(obj) {
return obj.#e; // KeyedLoadIC for private brand
}
}