Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use globalThis for .window/.self #715

Merged
merged 1 commit into from
Jul 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18478,11 +18478,6 @@ interface WindowEventMap extends GlobalEventHandlersEventMap, WindowEventHandler

/** A window containing a DOM document; the document property points to the DOM document loaded in that window. */
interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64, AnimationFrameProvider, WindowOrWorkerGlobalScope, WindowEventHandlers {
Blob: typeof Blob;
TextDecoder: typeof TextDecoder;
TextEncoder: typeof TextEncoder;
URL: typeof URL;
URLSearchParams: typeof URLSearchParams;
readonly applicationCache: ApplicationCache;
readonly caches: CacheStorage;
readonly clientInformation: Navigator;
Expand Down Expand Up @@ -18562,14 +18557,14 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
readonly scrollX: number;
readonly scrollY: number;
readonly scrollbars: BarProp;
readonly self: Window;
readonly self: Window & typeof globalThis;
readonly speechSynthesis: SpeechSynthesis;
status: string;
readonly statusbar: BarProp;
readonly styleMedia: StyleMedia;
readonly toolbar: BarProp;
readonly top: Window;
readonly window: Window;
readonly window: Window & typeof globalThis;
alert(message?: any): void;
blur(): void;
/** @deprecated */
Expand Down Expand Up @@ -19472,11 +19467,6 @@ declare var Image: {
declare var Option: {
new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement;
};
declare var Blob: typeof Blob;
declare var TextDecoder: typeof TextDecoder;
declare var TextEncoder: typeof TextEncoder;
declare var URL: typeof URL;
declare var URLSearchParams: typeof URLSearchParams;
declare var applicationCache: ApplicationCache;
declare var caches: CacheStorage;
declare var clientInformation: Navigator;
Expand Down Expand Up @@ -19556,14 +19546,14 @@ declare var screenY: number;
declare var scrollX: number;
declare var scrollY: number;
declare var scrollbars: BarProp;
declare var self: Window;
declare var self: Window & typeof globalThis;
declare var speechSynthesis: SpeechSynthesis;
declare var status: string;
declare var statusbar: BarProp;
declare var styleMedia: StyleMedia;
declare var toolbar: BarProp;
declare var top: Window;
declare var window: Window;
declare var window: Window & typeof globalThis;
declare function alert(message?: any): void;
declare function blur(): void;
/** @deprecated */
Expand Down
4 changes: 2 additions & 2 deletions baselines/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5361,7 +5361,7 @@ interface WorkerGlobalScope extends EventTarget, WorkerUtils, WindowConsole, Win
readonly location: WorkerLocation;
onerror: ((this: WorkerGlobalScope, ev: ErrorEvent) => any) | null;
readonly performance: Performance;
readonly self: WorkerGlobalScope;
readonly self: WorkerGlobalScope & typeof globalThis;
msWriteProfilerMark(profilerMarkName: string): void;
addEventListener<K extends keyof WorkerGlobalScopeEventMap>(type: K, listener: (this: WorkerGlobalScope, ev: WorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
Expand Down Expand Up @@ -5750,7 +5750,7 @@ declare var isSecureContext: boolean;
declare var location: WorkerLocation;
declare var onerror: ((this: DedicatedWorkerGlobalScope, ev: ErrorEvent) => any) | null;
declare var performance: Performance;
declare var self: WorkerGlobalScope;
declare var self: WorkerGlobalScope & typeof globalThis;
declare function msWriteProfilerMark(profilerMarkName: string): void;
/**
* 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.
Expand Down
27 changes: 1 addition & 26 deletions inputfiles/addedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -532,34 +532,9 @@
"name": "Window",
"properties": {
"property": {
"URL": {
"exposeGlobally": false,
"name": "URL",
"override-type": "typeof URL"
},
"URLSearchParams": {
"exposeGlobally": false,
"name": "URLSearchParams",
"override-type": "typeof URLSearchParams"
},
"Blob": {
"exposeGlobally": false,
"name": "Blob",
"override-type": "typeof Blob"
},
"customElements": {
"name": "customElements",
"override-type": "CustomElementRegistry"
},
"TextEncoder": {
"exposeGlobally": true,
"name": "TextEncoder",
"override-type": "typeof TextEncoder"
},
"TextDecoder": {
"exposeGlobally": true,
"name": "TextDecoder",
"override-type": "typeof TextDecoder"
"type": "CustomElementRegistry"
}
}
},
Expand Down
19 changes: 17 additions & 2 deletions inputfiles/overridingTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@
"override-type": "Event | undefined",
"deprecated": 1
},
"location": {
"read-only": 0
},
"orientation": {
"name": "orientation",
"override-type": "string | number"
Expand All @@ -448,8 +451,11 @@
"override-type": "any",
"read-only": 0
},
"location": {
"read-only": 0
"self": {
"override-type": "Window & typeof globalThis"
},
"window": {
"override-type": "Window & typeof globalThis"
}
}
},
Expand Down Expand Up @@ -2787,6 +2793,15 @@
}
}
}
},
"WorkerGlobalScope": {
"properties": {
"property": {
"self": {
"override-type": "WorkerGlobalScope & typeof globalThis"
}
}
}
}
}
},
Expand Down