Skip to content

Update Navigator type #700

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

Merged
merged 17 commits into from
Jun 20, 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
75 changes: 49 additions & 26 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10631,9 +10631,21 @@ declare var MessagePort: {

/** Provides contains information about a MIME type associated with a particular plugin. NavigatorPlugins.mimeTypes returns an array of this object. */
interface MimeType {
/**
* Returns the MIME type's description.
*/
readonly description: string;
/**
* Returns the Plugin object that implements this MIME type.
*/
readonly enabledPlugin: Plugin;
/**
* Returns the MIME type's typical file extensions, in a comma-separated list.
*/
readonly suffixes: string;
/**
* Returns the MIME type.
*/
readonly type: string;
}

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

declare var MimeTypeArray: {
Expand Down Expand Up @@ -10805,30 +10817,23 @@ declare var NavigationPreloadManager: {
};

/** The state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities. */
interface Navigator extends NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, MSNavigatorDoNotTrack, MSFileSaver, NavigatorBeacon, NavigatorConcurrentHardware, NavigatorUserMedia, NavigatorLanguage, NavigatorStorage, NavigatorAutomationInformation {
interface Navigator extends NavigatorID, NavigatorLanguage, NavigatorOnLine, NavigatorContentUtils, NavigatorCookies, NavigatorPlugins, NavigatorConcurrentHardware, NavigatorStorage, NavigatorAutomationInformation, MSFileSaver, MSNavigatorDoNotTrack, NavigatorBeacon {
readonly activeVRDisplays: ReadonlyArray<VRDisplay>;
readonly authentication: WebAuthentication;
readonly clipboard: Clipboard;
readonly cookieEnabled: boolean;
readonly credentials: CredentialsContainer;
readonly doNotTrack: string | null;
gamepadInputEmulation: GamepadInputEmulationType;
readonly geolocation: Geolocation;
readonly maxTouchPoints: number;
readonly mediaDevices: MediaDevices;
readonly mimeTypes: MimeTypeArray;
readonly msManipulationViewsEnabled: boolean;
readonly msMaxTouchPoints: number;
readonly msPointerEnabled: boolean;
readonly permissions: Permissions;
readonly plugins: PluginArray;
readonly pointerEnabled: boolean;
readonly serviceWorker: ServiceWorkerContainer;
readonly webdriver: boolean;
getGamepads(): (Gamepad | null)[];
getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
getVRDisplays(): Promise<VRDisplay[]>;
javaEnabled(): boolean;
msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;
requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): Promise<MediaKeySystemAccess>;
vibrate(pattern: number | number[]): boolean;
Expand All @@ -10852,18 +10857,26 @@ interface NavigatorConcurrentHardware {
}

interface NavigatorContentUtils {
registerProtocolHandler(scheme: string, url: string, title: string): void;
unregisterProtocolHandler(scheme: string, url: string): void;
}

interface NavigatorCookies {
readonly cookieEnabled: boolean;
}

interface NavigatorID {
readonly appCodeName: string;
readonly appName: string;
readonly appVersion: string;
readonly oscpu: string;
readonly platform: string;
readonly product: string;
readonly productSub: string;
readonly userAgent: string;
readonly vendor: string;
readonly vendorSub: string;
taintEnabled(): boolean;
}

interface NavigatorLanguage {
Expand All @@ -10875,17 +10888,14 @@ interface NavigatorOnLine {
readonly onLine: boolean;
}

interface NavigatorStorage {
readonly storage: StorageManager;
}

interface NavigatorStorageUtils {
interface NavigatorPlugins {
readonly mimeTypes: MimeTypeArray;
readonly plugins: PluginArray;
javaEnabled(): boolean;
}

interface NavigatorUserMedia {
readonly mediaDevices: MediaDevices;
getDisplayMedia(constraints: MediaStreamConstraints): Promise<MediaStream>;
getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
interface NavigatorStorage {
readonly storage: StorageManager;
}

/** 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. */
Expand Down Expand Up @@ -11839,13 +11849,27 @@ declare var Permissions: {

/** Provides information about a browser plugin. */
interface Plugin {
/**
* Returns the plugin's description.
*/
readonly description: string;
/**
* Returns the plugin library's filename, if applicable on the current platform.
*/
readonly filename: string;
/**
* Returns the number of MIME types, represented by MimeType objects, supported by the plugin.
*/
readonly length: number;
/**
* Returns the plugin's name.
*/
readonly name: string;
readonly version: string;
item(index: number): MimeType;
namedItem(type: string): MimeType;
/**
* Returns the specified MimeType object.
*/
item(index: number): MimeType | null;
namedItem(name: string): MimeType | null;
[index: number]: MimeType;
}

Expand All @@ -11857,8 +11881,8 @@ declare var Plugin: {
/** 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. */
interface PluginArray {
readonly length: number;
item(index: number): Plugin;
namedItem(name: string): Plugin;
item(index: number): Plugin | null;
namedItem(name: string): Plugin | null;
refresh(reload?: boolean): void;
[index: number]: Plugin;
}
Expand Down Expand Up @@ -19986,7 +20010,6 @@ type FillMode = "none" | "forwards" | "backwards" | "both" | "auto";
type FullscreenNavigationUI = "auto" | "show" | "hide";
type GamepadHand = "" | "left" | "right";
type GamepadHapticActuatorType = "vibration";
type GamepadInputEmulationType = "mouse" | "keyboard" | "gamepad";
type GamepadMappingType = "" | "standard";
type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique";
type IDBRequestReadyState = "pending" | "done";
Expand Down
2 changes: 1 addition & 1 deletion baselines/dom.iterable.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ interface MediaList {
}

interface MimeTypeArray {
[Symbol.iterator](): IterableIterator<Plugin>;
[Symbol.iterator](): IterableIterator<MimeType>;
}

interface NamedNodeMap {
Expand Down
3 changes: 0 additions & 3 deletions baselines/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2312,10 +2312,7 @@ interface NavigatorID {
readonly appVersion: string;
readonly platform: string;
readonly product: string;
readonly productSub: string;
readonly userAgent: string;
readonly vendor: string;
readonly vendorSub: string;
}

interface NavigatorOnLine {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"navigator": "Returns the string \"Mozilla\".",
"plugin-name": "Returns the plugin's name.",
"plugin-description": "Returns the plugin's description.",
"plugin-filename": "Returns the plugin library's filename, if applicable on the current platform.",
"plugin-length": "Returns the number of MIME types, represented by MimeType objects, supported by the plugin.",
"plugin-item": "Returns the specified MimeType object.",
"mimetype-type": "Returns the MIME type.",
"mimetype-description": "Returns the MIME type's description.",
"mimetype-suffixes": "Returns the MIME type's typical file extensions, in a comma-separated list.",
"mimetype-enabledplugin": "Returns the Plugin object that implements this MIME type."
}
84 changes: 84 additions & 0 deletions inputfiles/idl/HTML - System state and capabilities.widl
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[Exposed=Window]
interface Navigator {
// objects implementing this interface also implement the interfaces given below
};
Navigator includes NavigatorID;
Navigator includes NavigatorLanguage;
Navigator includes NavigatorOnLine;
Navigator includes NavigatorContentUtils;
Navigator includes NavigatorCookies;
Navigator includes NavigatorPlugins;
Navigator includes NavigatorConcurrentHardware;

interface mixin NavigatorID {
readonly attribute DOMString appCodeName; // constant "Mozilla"
readonly attribute DOMString appName; // constant "Netscape"
readonly attribute DOMString appVersion;
readonly attribute DOMString platform;
readonly attribute DOMString product; // constant "Gecko"
[Exposed=Window] readonly attribute DOMString productSub;
readonly attribute DOMString userAgent;
[Exposed=Window] readonly attribute DOMString vendor;
[Exposed=Window] readonly attribute DOMString vendorSub; // constant ""
};

partial interface mixin NavigatorID {
[Exposed=Window] boolean taintEnabled(); // constant false
[Exposed=Window] readonly attribute DOMString oscpu;
};

interface mixin NavigatorLanguage {
readonly attribute DOMString language;
readonly attribute FrozenArray<DOMString> languages;
};

interface mixin NavigatorContentUtils {
void registerProtocolHandler(DOMString scheme, USVString url, DOMString title);
void unregisterProtocolHandler(DOMString scheme, USVString url);
};

interface mixin NavigatorCookies {
readonly attribute boolean cookieEnabled;
};

interface mixin NavigatorPlugins {
[SameObject] readonly attribute PluginArray plugins;
[SameObject] readonly attribute MimeTypeArray mimeTypes;
boolean javaEnabled();
};

[Exposed=Window,
LegacyUnenumerableNamedProperties]
interface PluginArray {
void refresh(optional boolean reload = false);
readonly attribute unsigned long length;
getter Plugin? item(unsigned long index);
getter Plugin? namedItem(DOMString name);
};

[Exposed=Window,
LegacyUnenumerableNamedProperties]
interface MimeTypeArray {
readonly attribute unsigned long length;
getter MimeType? item(unsigned long index);
getter MimeType? namedItem(DOMString name);
};

[Exposed=Window,
LegacyUnenumerableNamedProperties]
interface Plugin {
readonly attribute DOMString name;
readonly attribute DOMString description;
readonly attribute DOMString filename;
readonly attribute unsigned long length;
getter MimeType? item(unsigned long index);
getter MimeType? namedItem(DOMString name);
};

[Exposed=Window]
interface MimeType {
readonly attribute DOMString type;
readonly attribute DOMString description;
readonly attribute DOMString suffixes; // comma-separated
readonly attribute Plugin enabledPlugin;
};
4 changes: 4 additions & 0 deletions inputfiles/idlSources.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@
"url": "https://html.spec.whatwg.org/multipage/history.html",
"title": "HTML - Session history and navigation"
},
{
"url": "https://html.spec.whatwg.org/multipage/system-state.html",
"title": "HTML - System state and capabilities"
},
{
"url": "https://html.spec.whatwg.org/multipage/tables.html",
"title": "HTML - Tabular data"
Expand Down
1 change: 1 addition & 0 deletions inputfiles/knownTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"KeyUsage",
"Keyframe",
"MidiPermissionDescriptor",
"MSLaunchUriCallback",
"MutationRecordType",
"NamedCurve",
"Pbkdf2Params",
Expand Down
47 changes: 47 additions & 0 deletions inputfiles/overridingTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2740,6 +2740,53 @@
}
}
}
},
"Navigator": {
"implements": [
"MSFileSaver",
"MSNavigatorDoNotTrack",
"NavigatorBeacon"
],
"methods": {
"method": {
"getVRDisplays": {
"name": "getVRDisplays",
"override-signatures": [
"getVRDisplays(): Promise<VRDisplay[]>"
]
},
"msLaunchUri": {
"name": "msLaunchUri",
"override-signatures": [
"msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void"
]
}
}
},
"properties": {
"property": {
"activeVRDisplays": {
"name": "activeVRDisplays",
"override-type": "ReadonlyArray<VRDisplay>",
"read-only": 1
},
"msManipulationViewsEnabled": {
"name": "msManipulationViewsEnabled",
"override-type": "boolean",
"read-only": 1
},
"msMaxTouchPoints": {
"name": "msMaxTouchPoints",
"override-type": "number",
"read-only": 1
},
"msPointerEnabled": {
"name": "msPointerEnabled",
"override-type": "boolean",
"read-only": 1
}
}
}
}
}
},
Expand Down