1// META: global=window,dedicatedworker,shadowrealm
2"use strict";
3// https://webidl.spec.whatwg.org/#es-namespaces
4// https://console.spec.whatwg.org/#console-namespace
5
6test(() => {
7  assert_true(self.hasOwnProperty("console"));
8}, "console exists on the global object");
9
10test(() => {
11  const propDesc = Object.getOwnPropertyDescriptor(self, "console");
12  assert_equals(propDesc.writable, true, "must be writable");
13  assert_equals(propDesc.enumerable, false, "must not be enumerable");
14  assert_equals(propDesc.configurable, true, "must be configurable");
15  assert_equals(propDesc.value, console, "must have the right value");
16}, "console has the right property descriptors");
17
18test(() => {
19  assert_false("Console" in self);
20}, "Console (uppercase, as if it were an interface) must not exist");
21
22test(() => {
23  const prototype1 = Object.getPrototypeOf(console);
24  const prototype2 = Object.getPrototypeOf(prototype1);
25
26  assert_equals(Object.getOwnPropertyNames(prototype1).length, 0, "The [[Prototype]] must have no properties");
27  assert_equals(prototype2, Object.prototype, "The [[Prototype]]'s [[Prototype]] must be %ObjectPrototype%");
28}, "The prototype chain must be correct");
29