b4b2dafc03
This is a reland of 4dac9872ae
Original change's description:
> Ship globalThis 🎉
>
> Proposal repository:
> https://github.com/tc39/proposal-global
>
> Intent to ship:
> https://groups.google.com/d/msg/v8-users/Vkoh0wXRwaM/Yt7MpzhkAgAJ
>
> Bug: v8:5537
> Change-Id: I60a6c5375165d89548db12fef454a64137d04c27
> Reviewed-on: https://chromium-review.googlesource.com/1195494
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> Commit-Queue: Mathias Bynens <mathias@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#55543}
TBR=adamk@chromium.org,machenbach@chromium.org,gsathya@chromium.org,mathias@chromium.org
No-Presubmit: true
Bug: v8:5537
Change-Id: I1e20d606bb027d7afca713ffde87e183b6f610bd
Reviewed-on: https://chromium-review.googlesource.com/1208633
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55732}
29 lines
853 B
JavaScript
29 lines
853 B
JavaScript
// Copyright 2018 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: --harmony-global
|
|
|
|
assertEquals(globalThis, this);
|
|
assertEquals(this.globalThis, this);
|
|
assertEquals(globalThis.globalThis, this);
|
|
assertEquals(globalThis.globalThis.globalThis, this);
|
|
assertEquals(globalThis.globalThis.globalThis.globalThis, this);
|
|
|
|
{
|
|
const realm = Realm.create();
|
|
assertEquals(Realm.global(realm), Realm.eval(realm, 'globalThis'));
|
|
assertNotEquals(Realm.global(realm), globalThis);
|
|
}
|
|
|
|
{
|
|
const descriptor = Object.getOwnPropertyDescriptor(
|
|
this,
|
|
'globalThis'
|
|
);
|
|
assertEquals(descriptor.value, this);
|
|
assertEquals(descriptor.writable, true);
|
|
assertEquals(descriptor.enumerable, false);
|
|
assertEquals(descriptor.configurable, true);
|
|
}
|