2023-01-02 16:00:42 -05:00
|
|
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
2021-02-05 03:48:32 +05:30
|
|
|
"use strict";
|
2021-07-06 14:38:12 +02:00
|
|
|
|
|
|
|
// @ts-check
|
|
|
|
/// <reference path="../../core/internal.d.ts" />
|
|
|
|
|
2020-10-20 05:05:42 +01:00
|
|
|
((window) => {
|
2022-10-24 16:14:17 +02:00
|
|
|
const { EventTarget } = window.__bootstrap.eventTarget;
|
2021-07-06 14:38:12 +02:00
|
|
|
const {
|
|
|
|
Symbol,
|
|
|
|
SymbolToStringTag,
|
|
|
|
TypeError,
|
|
|
|
} = window.__bootstrap.primordials;
|
2020-10-20 05:05:42 +01:00
|
|
|
|
2020-12-11 02:45:45 +07:00
|
|
|
const illegalConstructorKey = Symbol("illegalConstructorKey");
|
2020-10-20 05:05:42 +01:00
|
|
|
|
|
|
|
class Window extends EventTarget {
|
2020-11-14 14:10:23 +02:00
|
|
|
constructor(key = null) {
|
2020-10-20 05:05:42 +01:00
|
|
|
if (key !== illegalConstructorKey) {
|
|
|
|
throw new TypeError("Illegal constructor.");
|
|
|
|
}
|
2020-11-03 16:19:29 +01:00
|
|
|
super();
|
2020-10-20 05:05:42 +01:00
|
|
|
}
|
|
|
|
|
2021-07-06 14:38:12 +02:00
|
|
|
get [SymbolToStringTag]() {
|
2020-10-20 05:05:42 +01:00
|
|
|
return "Window";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class WorkerGlobalScope extends EventTarget {
|
2020-11-14 14:10:23 +02:00
|
|
|
constructor(key = null) {
|
2020-10-20 05:05:42 +01:00
|
|
|
if (key != illegalConstructorKey) {
|
|
|
|
throw new TypeError("Illegal constructor.");
|
|
|
|
}
|
2020-11-03 16:19:29 +01:00
|
|
|
super();
|
2020-10-20 05:05:42 +01:00
|
|
|
}
|
|
|
|
|
2021-07-06 14:38:12 +02:00
|
|
|
get [SymbolToStringTag]() {
|
2020-10-20 05:05:42 +01:00
|
|
|
return "WorkerGlobalScope";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class DedicatedWorkerGlobalScope extends WorkerGlobalScope {
|
2020-11-14 14:10:23 +02:00
|
|
|
constructor(key = null) {
|
2020-10-20 05:05:42 +01:00
|
|
|
if (key != illegalConstructorKey) {
|
|
|
|
throw new TypeError("Illegal constructor.");
|
|
|
|
}
|
2020-11-03 16:19:29 +01:00
|
|
|
super();
|
2020-10-20 05:05:42 +01:00
|
|
|
}
|
|
|
|
|
2021-07-06 14:38:12 +02:00
|
|
|
get [SymbolToStringTag]() {
|
2020-10-20 05:05:42 +01:00
|
|
|
return "DedicatedWorkerGlobalScope";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
window.__bootstrap.globalInterfaces = {
|
|
|
|
DedicatedWorkerGlobalScope,
|
|
|
|
Window,
|
|
|
|
WorkerGlobalScope,
|
|
|
|
dedicatedWorkerGlobalScopeConstructorDescriptor: {
|
|
|
|
configurable: true,
|
|
|
|
enumerable: false,
|
|
|
|
value: DedicatedWorkerGlobalScope,
|
|
|
|
writable: true,
|
|
|
|
},
|
|
|
|
windowConstructorDescriptor: {
|
|
|
|
configurable: true,
|
|
|
|
enumerable: false,
|
|
|
|
value: Window,
|
|
|
|
writable: true,
|
|
|
|
},
|
|
|
|
workerGlobalScopeConstructorDescriptor: {
|
|
|
|
configurable: true,
|
|
|
|
enumerable: false,
|
|
|
|
value: WorkerGlobalScope,
|
|
|
|
writable: true,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
})(this);
|