Skip to content

Commit 7f5ab3c

Browse files
jeffryang24sandersn
authored andcommitted
Update Navigator type (#700)
* chore: add system state and capabilities whatwg spec * feat(idl): add generated widl and commentmap file * chore(baselines): add generated type * chore: update baseline * refactor(baseline): add removed ms-interfaces * refactor(idlSources): sort idlsource * refactor(addedTypes): add missing interfaces and MS-specific interfaces * refactor(overridingTypes): override navigator interface * refactor(overridingTypes): add missing ms-specific properties in Navigator interface * chore: update baselines * refactor(addedTypes): remove redundant interfaces * chore: update baselines #2 * refactor(addedTypes): remove MSLaunchUriCallback interface * refactor(knownTypes): add MSLaunchUriCallback inside Window field * chore: update baselines #3 (with node 12) * refactor(overridingTypes): restore NavigatorBeacon, activeVRDisplays, and getVRDisplays * chore: update baselines #4
1 parent a20c418 commit 7f5ab3c

8 files changed

+198
-30
lines changed

baselines/dom.generated.d.ts

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10631,9 +10631,21 @@ declare var MessagePort: {
1063110631

1063210632
/** Provides contains information about a MIME type associated with a particular plugin. NavigatorPlugins.mimeTypes returns an array of this object. */
1063310633
interface MimeType {
10634+
/**
10635+
* Returns the MIME type's description.
10636+
*/
1063410637
readonly description: string;
10638+
/**
10639+
* Returns the Plugin object that implements this MIME type.
10640+
*/
1063510641
readonly enabledPlugin: Plugin;
10642+
/**
10643+
* Returns the MIME type's typical file extensions, in a comma-separated list.
10644+
*/
1063610645
readonly suffixes: string;
10646+
/**
10647+
* Returns the MIME type.
10648+
*/
1063710649
readonly type: string;
1063810650
}
1063910651

@@ -10645,9 +10657,9 @@ declare var MimeType: {
1064510657
/** Returns an array of MimeType instances, each of which contains information about a supported browser plugins. This object is returned by NavigatorPlugins.mimeTypes. */
1064610658
interface MimeTypeArray {
1064710659
readonly length: number;
10648-
item(index: number): Plugin;
10649-
namedItem(type: string): Plugin;
10650-
[index: number]: Plugin;
10660+
item(index: number): MimeType | null;
10661+
namedItem(name: string): MimeType | null;
10662+
[index: number]: MimeType;
1065110663
}
1065210664

1065310665
declare var MimeTypeArray: {
@@ -10805,30 +10817,23 @@ declare var NavigationPreloadManager: {
1080510817
};
1080610818

1080710819
/** The state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities. */
10808-
interface Navigator extends NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, MSNavigatorDoNotTrack, MSFileSaver, NavigatorBeacon, NavigatorConcurrentHardware, NavigatorUserMedia, NavigatorLanguage, NavigatorStorage, NavigatorAutomationInformation {
10820+
interface Navigator extends NavigatorID, NavigatorLanguage, NavigatorOnLine, NavigatorContentUtils, NavigatorCookies, NavigatorPlugins, NavigatorConcurrentHardware, NavigatorStorage, NavigatorAutomationInformation, MSFileSaver, MSNavigatorDoNotTrack, NavigatorBeacon {
1080910821
readonly activeVRDisplays: ReadonlyArray<VRDisplay>;
10810-
readonly authentication: WebAuthentication;
1081110822
readonly clipboard: Clipboard;
10812-
readonly cookieEnabled: boolean;
1081310823
readonly credentials: CredentialsContainer;
1081410824
readonly doNotTrack: string | null;
10815-
gamepadInputEmulation: GamepadInputEmulationType;
1081610825
readonly geolocation: Geolocation;
1081710826
readonly maxTouchPoints: number;
1081810827
readonly mediaDevices: MediaDevices;
10819-
readonly mimeTypes: MimeTypeArray;
1082010828
readonly msManipulationViewsEnabled: boolean;
1082110829
readonly msMaxTouchPoints: number;
1082210830
readonly msPointerEnabled: boolean;
1082310831
readonly permissions: Permissions;
10824-
readonly plugins: PluginArray;
1082510832
readonly pointerEnabled: boolean;
1082610833
readonly serviceWorker: ServiceWorkerContainer;
10827-
readonly webdriver: boolean;
1082810834
getGamepads(): (Gamepad | null)[];
1082910835
getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
1083010836
getVRDisplays(): Promise<VRDisplay[]>;
10831-
javaEnabled(): boolean;
1083210837
msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;
1083310838
requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): Promise<MediaKeySystemAccess>;
1083410839
vibrate(pattern: number | number[]): boolean;
@@ -10852,18 +10857,26 @@ interface NavigatorConcurrentHardware {
1085210857
}
1085310858

1085410859
interface NavigatorContentUtils {
10860+
registerProtocolHandler(scheme: string, url: string, title: string): void;
10861+
unregisterProtocolHandler(scheme: string, url: string): void;
10862+
}
10863+
10864+
interface NavigatorCookies {
10865+
readonly cookieEnabled: boolean;
1085510866
}
1085610867

1085710868
interface NavigatorID {
1085810869
readonly appCodeName: string;
1085910870
readonly appName: string;
1086010871
readonly appVersion: string;
10872+
readonly oscpu: string;
1086110873
readonly platform: string;
1086210874
readonly product: string;
1086310875
readonly productSub: string;
1086410876
readonly userAgent: string;
1086510877
readonly vendor: string;
1086610878
readonly vendorSub: string;
10879+
taintEnabled(): boolean;
1086710880
}
1086810881

1086910882
interface NavigatorLanguage {
@@ -10875,17 +10888,14 @@ interface NavigatorOnLine {
1087510888
readonly onLine: boolean;
1087610889
}
1087710890

10878-
interface NavigatorStorage {
10879-
readonly storage: StorageManager;
10880-
}
10881-
10882-
interface NavigatorStorageUtils {
10891+
interface NavigatorPlugins {
10892+
readonly mimeTypes: MimeTypeArray;
10893+
readonly plugins: PluginArray;
10894+
javaEnabled(): boolean;
1088310895
}
1088410896

10885-
interface NavigatorUserMedia {
10886-
readonly mediaDevices: MediaDevices;
10887-
getDisplayMedia(constraints: MediaStreamConstraints): Promise<MediaStream>;
10888-
getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
10897+
interface NavigatorStorage {
10898+
readonly storage: StorageManager;
1088910899
}
1089010900

1089110901
/** Node is an interface from which a number of DOM API object types inherit. It allows those types to be treated similarly; for example, inheriting the same set of methods, or being tested in the same way. */
@@ -11839,13 +11849,27 @@ declare var Permissions: {
1183911849

1184011850
/** Provides information about a browser plugin. */
1184111851
interface Plugin {
11852+
/**
11853+
* Returns the plugin's description.
11854+
*/
1184211855
readonly description: string;
11856+
/**
11857+
* Returns the plugin library's filename, if applicable on the current platform.
11858+
*/
1184311859
readonly filename: string;
11860+
/**
11861+
* Returns the number of MIME types, represented by MimeType objects, supported by the plugin.
11862+
*/
1184411863
readonly length: number;
11864+
/**
11865+
* Returns the plugin's name.
11866+
*/
1184511867
readonly name: string;
11846-
readonly version: string;
11847-
item(index: number): MimeType;
11848-
namedItem(type: string): MimeType;
11868+
/**
11869+
* Returns the specified MimeType object.
11870+
*/
11871+
item(index: number): MimeType | null;
11872+
namedItem(name: string): MimeType | null;
1184911873
[index: number]: MimeType;
1185011874
}
1185111875

@@ -11857,8 +11881,8 @@ declare var Plugin: {
1185711881
/** Used to store a list of Plugin objects describing the available plugins; it's returned by the window.navigator.plugins property. The PluginArray is not a JavaScript array, but has the length property and supports accessing individual items using bracket notation (plugins[2]), as well as via item(index) and namedItem("name") methods. */
1185811882
interface PluginArray {
1185911883
readonly length: number;
11860-
item(index: number): Plugin;
11861-
namedItem(name: string): Plugin;
11884+
item(index: number): Plugin | null;
11885+
namedItem(name: string): Plugin | null;
1186211886
refresh(reload?: boolean): void;
1186311887
[index: number]: Plugin;
1186411888
}
@@ -19986,7 +20010,6 @@ type FillMode = "none" | "forwards" | "backwards" | "both" | "auto";
1998620010
type FullscreenNavigationUI = "auto" | "show" | "hide";
1998720011
type GamepadHand = "" | "left" | "right";
1998820012
type GamepadHapticActuatorType = "vibration";
19989-
type GamepadInputEmulationType = "mouse" | "keyboard" | "gamepad";
1999020013
type GamepadMappingType = "" | "standard";
1999120014
type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique";
1999220015
type IDBRequestReadyState = "pending" | "done";

baselines/dom.iterable.generated.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ interface MediaList {
134134
}
135135

136136
interface MimeTypeArray {
137-
[Symbol.iterator](): IterableIterator<Plugin>;
137+
[Symbol.iterator](): IterableIterator<MimeType>;
138138
}
139139

140140
interface NamedNodeMap {

baselines/webworker.generated.d.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,10 +2312,7 @@ interface NavigatorID {
23122312
readonly appVersion: string;
23132313
readonly platform: string;
23142314
readonly product: string;
2315-
readonly productSub: string;
23162315
readonly userAgent: string;
2317-
readonly vendor: string;
2318-
readonly vendorSub: string;
23192316
}
23202317

23212318
interface NavigatorOnLine {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"navigator": "Returns the string \"Mozilla\".",
3+
"plugin-name": "Returns the plugin's name.",
4+
"plugin-description": "Returns the plugin's description.",
5+
"plugin-filename": "Returns the plugin library's filename, if applicable on the current platform.",
6+
"plugin-length": "Returns the number of MIME types, represented by MimeType objects, supported by the plugin.",
7+
"plugin-item": "Returns the specified MimeType object.",
8+
"mimetype-type": "Returns the MIME type.",
9+
"mimetype-description": "Returns the MIME type's description.",
10+
"mimetype-suffixes": "Returns the MIME type's typical file extensions, in a comma-separated list.",
11+
"mimetype-enabledplugin": "Returns the Plugin object that implements this MIME type."
12+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
[Exposed=Window]
2+
interface Navigator {
3+
// objects implementing this interface also implement the interfaces given below
4+
};
5+
Navigator includes NavigatorID;
6+
Navigator includes NavigatorLanguage;
7+
Navigator includes NavigatorOnLine;
8+
Navigator includes NavigatorContentUtils;
9+
Navigator includes NavigatorCookies;
10+
Navigator includes NavigatorPlugins;
11+
Navigator includes NavigatorConcurrentHardware;
12+
13+
interface mixin NavigatorID {
14+
readonly attribute DOMString appCodeName; // constant "Mozilla"
15+
readonly attribute DOMString appName; // constant "Netscape"
16+
readonly attribute DOMString appVersion;
17+
readonly attribute DOMString platform;
18+
readonly attribute DOMString product; // constant "Gecko"
19+
[Exposed=Window] readonly attribute DOMString productSub;
20+
readonly attribute DOMString userAgent;
21+
[Exposed=Window] readonly attribute DOMString vendor;
22+
[Exposed=Window] readonly attribute DOMString vendorSub; // constant ""
23+
};
24+
25+
partial interface mixin NavigatorID {
26+
[Exposed=Window] boolean taintEnabled(); // constant false
27+
[Exposed=Window] readonly attribute DOMString oscpu;
28+
};
29+
30+
interface mixin NavigatorLanguage {
31+
readonly attribute DOMString language;
32+
readonly attribute FrozenArray<DOMString> languages;
33+
};
34+
35+
interface mixin NavigatorContentUtils {
36+
void registerProtocolHandler(DOMString scheme, USVString url, DOMString title);
37+
void unregisterProtocolHandler(DOMString scheme, USVString url);
38+
};
39+
40+
interface mixin NavigatorCookies {
41+
readonly attribute boolean cookieEnabled;
42+
};
43+
44+
interface mixin NavigatorPlugins {
45+
[SameObject] readonly attribute PluginArray plugins;
46+
[SameObject] readonly attribute MimeTypeArray mimeTypes;
47+
boolean javaEnabled();
48+
};
49+
50+
[Exposed=Window,
51+
LegacyUnenumerableNamedProperties]
52+
interface PluginArray {
53+
void refresh(optional boolean reload = false);
54+
readonly attribute unsigned long length;
55+
getter Plugin? item(unsigned long index);
56+
getter Plugin? namedItem(DOMString name);
57+
};
58+
59+
[Exposed=Window,
60+
LegacyUnenumerableNamedProperties]
61+
interface MimeTypeArray {
62+
readonly attribute unsigned long length;
63+
getter MimeType? item(unsigned long index);
64+
getter MimeType? namedItem(DOMString name);
65+
};
66+
67+
[Exposed=Window,
68+
LegacyUnenumerableNamedProperties]
69+
interface Plugin {
70+
readonly attribute DOMString name;
71+
readonly attribute DOMString description;
72+
readonly attribute DOMString filename;
73+
readonly attribute unsigned long length;
74+
getter MimeType? item(unsigned long index);
75+
getter MimeType? namedItem(DOMString name);
76+
};
77+
78+
[Exposed=Window]
79+
interface MimeType {
80+
readonly attribute DOMString type;
81+
readonly attribute DOMString description;
82+
readonly attribute DOMString suffixes; // comma-separated
83+
readonly attribute Plugin enabledPlugin;
84+
};

inputfiles/idlSources.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@
226226
"url": "https://html.spec.whatwg.org/multipage/history.html",
227227
"title": "HTML - Session history and navigation"
228228
},
229+
{
230+
"url": "https://html.spec.whatwg.org/multipage/system-state.html",
231+
"title": "HTML - System state and capabilities"
232+
},
229233
{
230234
"url": "https://html.spec.whatwg.org/multipage/tables.html",
231235
"title": "HTML - Tabular data"

inputfiles/knownTypes.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"KeyUsage",
4545
"Keyframe",
4646
"MidiPermissionDescriptor",
47+
"MSLaunchUriCallback",
4748
"MutationRecordType",
4849
"NamedCurve",
4950
"Pbkdf2Params",

inputfiles/overridingTypes.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2740,6 +2740,53 @@
27402740
}
27412741
}
27422742
}
2743+
},
2744+
"Navigator": {
2745+
"implements": [
2746+
"MSFileSaver",
2747+
"MSNavigatorDoNotTrack",
2748+
"NavigatorBeacon"
2749+
],
2750+
"methods": {
2751+
"method": {
2752+
"getVRDisplays": {
2753+
"name": "getVRDisplays",
2754+
"override-signatures": [
2755+
"getVRDisplays(): Promise<VRDisplay[]>"
2756+
]
2757+
},
2758+
"msLaunchUri": {
2759+
"name": "msLaunchUri",
2760+
"override-signatures": [
2761+
"msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void"
2762+
]
2763+
}
2764+
}
2765+
},
2766+
"properties": {
2767+
"property": {
2768+
"activeVRDisplays": {
2769+
"name": "activeVRDisplays",
2770+
"override-type": "ReadonlyArray<VRDisplay>",
2771+
"read-only": 1
2772+
},
2773+
"msManipulationViewsEnabled": {
2774+
"name": "msManipulationViewsEnabled",
2775+
"override-type": "boolean",
2776+
"read-only": 1
2777+
},
2778+
"msMaxTouchPoints": {
2779+
"name": "msMaxTouchPoints",
2780+
"override-type": "number",
2781+
"read-only": 1
2782+
},
2783+
"msPointerEnabled": {
2784+
"name": "msPointerEnabled",
2785+
"override-type": "boolean",
2786+
"read-only": 1
2787+
}
2788+
}
2789+
}
27432790
}
27442791
}
27452792
},

0 commit comments

Comments
 (0)