Add 'at' to Array.prototype[@@unscopables]

Bug: v8:10961
Change-Id: I3746dca570de005d203a2648dcffedd81122f215
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2553157
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Gus Caplan <snek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71377}
This commit is contained in:
Gus Caplan 2020-11-23 12:01:34 -06:00 committed by Commit Bot
parent c229abea6d
commit 20b417503a
2 changed files with 8 additions and 0 deletions

View File

@ -4406,6 +4406,12 @@ void Genesis::InitializeGlobal_harmony_relative_indexing_methods() {
SimpleInstallFunction(isolate(), array_prototype, "at", SimpleInstallFunction(isolate(), array_prototype, "at",
Builtins::kArrayPrototypeAt, 1, true); Builtins::kArrayPrototypeAt, 1, true);
Handle<JSObject> unscopables = Handle<JSObject>::cast(
JSReceiver::GetProperty(isolate(), array_prototype,
factory()->unscopables_symbol())
.ToHandleChecked());
InstallTrueValuedProperty(isolate(), unscopables, "at");
} }
{ {

View File

@ -45,3 +45,5 @@ assertThrows(() => {
a.at(0); a.at(0);
}, TypeError); }, TypeError);
} }
assertEquals(Array.prototype[Symbol.unscopables].at, true);