Skip to content

Commit 1389855

Browse files
committed
Use globalThis for .window/.self
1 parent 10a86a2 commit 1389855

File tree

4 files changed

+24
-44
lines changed

4 files changed

+24
-44
lines changed

baselines/dom.generated.d.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18328,11 +18328,6 @@ interface WindowEventMap extends GlobalEventHandlersEventMap, WindowEventHandler
1832818328

1832918329
/** A window containing a DOM document; the document property points to the DOM document loaded in that window. */
1833018330
interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64, AnimationFrameProvider, WindowOrWorkerGlobalScope, WindowEventHandlers {
18331-
Blob: typeof Blob;
18332-
TextDecoder: typeof TextDecoder;
18333-
TextEncoder: typeof TextEncoder;
18334-
URL: typeof URL;
18335-
URLSearchParams: typeof URLSearchParams;
1833618331
readonly applicationCache: ApplicationCache;
1833718332
readonly caches: CacheStorage;
1833818333
readonly clientInformation: Navigator;
@@ -18412,14 +18407,14 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
1841218407
readonly scrollX: number;
1841318408
readonly scrollY: number;
1841418409
readonly scrollbars: BarProp;
18415-
readonly self: Window;
18410+
readonly self: Window & typeof globalThis;
1841618411
readonly speechSynthesis: SpeechSynthesis;
1841718412
status: string;
1841818413
readonly statusbar: BarProp;
1841918414
readonly styleMedia: StyleMedia;
1842018415
readonly toolbar: BarProp;
1842118416
readonly top: Window;
18422-
readonly window: Window;
18417+
readonly window: Window & typeof globalThis;
1842318418
alert(message?: any): void;
1842418419
blur(): void;
1842518420
/** @deprecated */
@@ -19322,11 +19317,6 @@ declare var Image: {
1932219317
declare var Option: {
1932319318
new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement;
1932419319
};
19325-
declare var Blob: typeof Blob;
19326-
declare var TextDecoder: typeof TextDecoder;
19327-
declare var TextEncoder: typeof TextEncoder;
19328-
declare var URL: typeof URL;
19329-
declare var URLSearchParams: typeof URLSearchParams;
1933019320
declare var applicationCache: ApplicationCache;
1933119321
declare var caches: CacheStorage;
1933219322
declare var clientInformation: Navigator;
@@ -19406,14 +19396,14 @@ declare var screenY: number;
1940619396
declare var scrollX: number;
1940719397
declare var scrollY: number;
1940819398
declare var scrollbars: BarProp;
19409-
declare var self: Window;
19399+
declare var self: Window & typeof globalThis;
1941019400
declare var speechSynthesis: SpeechSynthesis;
1941119401
declare var status: string;
1941219402
declare var statusbar: BarProp;
1941319403
declare var styleMedia: StyleMedia;
1941419404
declare var toolbar: BarProp;
1941519405
declare var top: Window;
19416-
declare var window: Window;
19406+
declare var window: Window & typeof globalThis;
1941719407
declare function alert(message?: any): void;
1941819408
declare function blur(): void;
1941919409
/** @deprecated */

baselines/webworker.generated.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5338,7 +5338,7 @@ interface WorkerGlobalScope extends EventTarget, WorkerUtils, WindowConsole, Win
53385338
readonly location: WorkerLocation;
53395339
onerror: ((this: WorkerGlobalScope, ev: ErrorEvent) => any) | null;
53405340
readonly performance: Performance;
5341-
readonly self: WorkerGlobalScope;
5341+
readonly self: WorkerGlobalScope & typeof globalThis;
53425342
msWriteProfilerMark(profilerMarkName: string): void;
53435343
addEventListener<K extends keyof WorkerGlobalScopeEventMap>(type: K, listener: (this: WorkerGlobalScope, ev: WorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
53445344
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -5727,7 +5727,7 @@ declare var isSecureContext: boolean;
57275727
declare var location: WorkerLocation;
57285728
declare var onerror: ((this: DedicatedWorkerGlobalScope, ev: ErrorEvent) => any) | null;
57295729
declare var performance: Performance;
5730-
declare var self: WorkerGlobalScope;
5730+
declare var self: WorkerGlobalScope & typeof globalThis;
57315731
declare function msWriteProfilerMark(profilerMarkName: string): void;
57325732
/**
57335733
* Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

inputfiles/addedTypes.json

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -532,34 +532,9 @@
532532
"name": "Window",
533533
"properties": {
534534
"property": {
535-
"URL": {
536-
"exposeGlobally": false,
537-
"name": "URL",
538-
"override-type": "typeof URL"
539-
},
540-
"URLSearchParams": {
541-
"exposeGlobally": false,
542-
"name": "URLSearchParams",
543-
"override-type": "typeof URLSearchParams"
544-
},
545-
"Blob": {
546-
"exposeGlobally": false,
547-
"name": "Blob",
548-
"override-type": "typeof Blob"
549-
},
550535
"customElements": {
551536
"name": "customElements",
552-
"override-type": "CustomElementRegistry"
553-
},
554-
"TextEncoder": {
555-
"exposeGlobally": true,
556-
"name": "TextEncoder",
557-
"override-type": "typeof TextEncoder"
558-
},
559-
"TextDecoder": {
560-
"exposeGlobally": true,
561-
"name": "TextDecoder",
562-
"override-type": "typeof TextDecoder"
537+
"type": "CustomElementRegistry"
563538
}
564539
}
565540
},

inputfiles/overridingTypes.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,9 @@
439439
"override-type": "Event | undefined",
440440
"deprecated": 1
441441
},
442+
"location": {
443+
"read-only": 0
444+
},
442445
"orientation": {
443446
"name": "orientation",
444447
"override-type": "string | number"
@@ -448,8 +451,11 @@
448451
"override-type": "any",
449452
"read-only": 0
450453
},
451-
"location": {
452-
"read-only": 0
454+
"self": {
455+
"override-type": "Window & typeof globalThis"
456+
},
457+
"window": {
458+
"override-type": "Window & typeof globalThis"
453459
}
454460
}
455461
},
@@ -2727,6 +2733,15 @@
27272733
}
27282734
}
27292735
}
2736+
},
2737+
"WorkerGlobalScope": {
2738+
"properties": {
2739+
"property": {
2740+
"self": {
2741+
"override-type": "WorkerGlobalScope & typeof globalThis"
2742+
}
2743+
}
2744+
}
27302745
}
27312746
}
27322747
},

0 commit comments

Comments
 (0)