Skip to content

Commit

Permalink
Use globalThis for .window/.self
Browse files Browse the repository at this point in the history
  • Loading branch information
saschanaz committed Jun 12, 2019
1 parent 10a86a2 commit 1389855
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 44 deletions.
18 changes: 4 additions & 14 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18328,11 +18328,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 @@ -18412,14 +18407,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 @@ -19322,11 +19317,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 @@ -19406,14 +19396,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 @@ -5338,7 +5338,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 @@ -5727,7 +5727,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 @@ -2727,6 +2733,15 @@
}
}
}
},
"WorkerGlobalScope": {
"properties": {
"property": {
"self": {
"override-type": "WorkerGlobalScope & typeof globalThis"
}
}
}
}
}
},
Expand Down

0 comments on commit 1389855

Please sign in to comment.