mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
add window.self read-only property (#4131)
This commit is contained in:
parent
5946808f66
commit
0e37184ca8
3 changed files with 15 additions and 0 deletions
|
@ -9,14 +9,26 @@ test(function windowExists(): void {
|
||||||
assert(window != null);
|
assert(window != null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test(function selfExists(): void {
|
||||||
|
assert(self != null);
|
||||||
|
});
|
||||||
|
|
||||||
test(function windowWindowExists(): void {
|
test(function windowWindowExists(): void {
|
||||||
assert(window.window === window);
|
assert(window.window === window);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test(function windowSelfExists(): void {
|
||||||
|
assert(window.self === window);
|
||||||
|
});
|
||||||
|
|
||||||
test(function globalThisEqualsWindow(): void {
|
test(function globalThisEqualsWindow(): void {
|
||||||
assert(globalThis === window);
|
assert(globalThis === window);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test(function globalThisEqualsSelf(): void {
|
||||||
|
assert(globalThis === self);
|
||||||
|
});
|
||||||
|
|
||||||
test(function DenoNamespaceExists(): void {
|
test(function DenoNamespaceExists(): void {
|
||||||
assert(Deno != null);
|
assert(Deno != null);
|
||||||
});
|
});
|
||||||
|
|
2
cli/js/lib.deno.window.d.ts
vendored
2
cli/js/lib.deno.window.d.ts
vendored
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
declare interface Window extends WindowOrWorkerGlobalScope {
|
declare interface Window extends WindowOrWorkerGlobalScope {
|
||||||
window: Window & WindowOrWorkerGlobalScope & typeof globalThis;
|
window: Window & WindowOrWorkerGlobalScope & typeof globalThis;
|
||||||
|
self: Window & WindowOrWorkerGlobalScope & typeof globalThis;
|
||||||
onload: Function | undefined;
|
onload: Function | undefined;
|
||||||
onunload: Function | undefined;
|
onunload: Function | undefined;
|
||||||
crypto: Crypto;
|
crypto: Crypto;
|
||||||
|
@ -16,6 +17,7 @@ declare interface Window extends WindowOrWorkerGlobalScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare const window: Window & WindowOrWorkerGlobalScope & typeof globalThis;
|
declare const window: Window & WindowOrWorkerGlobalScope & typeof globalThis;
|
||||||
|
declare const self: Window & WindowOrWorkerGlobalScope & typeof globalThis;
|
||||||
declare const onload: Function | undefined;
|
declare const onload: Function | undefined;
|
||||||
declare const onunload: Function | undefined;
|
declare const onunload: Function | undefined;
|
||||||
declare const crypto: Crypto;
|
declare const crypto: Crypto;
|
||||||
|
|
|
@ -32,6 +32,7 @@ Deno[Deno.symbols.internal] = internalObject;
|
||||||
|
|
||||||
export const mainRuntimeGlobalProperties = {
|
export const mainRuntimeGlobalProperties = {
|
||||||
window: readOnly(globalThis),
|
window: readOnly(globalThis),
|
||||||
|
self: readOnly(globalThis),
|
||||||
Deno: readOnly(Deno),
|
Deno: readOnly(Deno),
|
||||||
|
|
||||||
crypto: readOnly(csprng),
|
crypto: readOnly(csprng),
|
||||||
|
|
Loading…
Add table
Reference in a new issue