1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://html.spec.whatwg.org/#the-navigator-object
8 * http://www.w3.org/TR/tracking-dnt/
9 * http://www.w3.org/TR/geolocation-API/#geolocation_interface
10 * http://www.w3.org/TR/battery-status/#navigatorbattery-interface
11 * http://www.w3.org/TR/vibration/#vibration-interface
12 * http://www.w3.org/2012/sysapps/runtime/#extension-to-the-navigator-interface-1
13 * https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
14 * http://www.w3.org/TR/beacon/#sec-beacon-method
15 * https://html.spec.whatwg.org/#navigatorconcurrenthardware
16 * http://wicg.github.io/netinfo/#extensions-to-the-navigator-interface
17 * https://w3c.github.io/webappsec-credential-management/#framework-credential-management
18 * https://w3c.github.io/webdriver/webdriver-spec.html#interface
19 * https://wicg.github.io/media-capabilities/#idl-index
20 * https://w3c.github.io/mediasession/#idl-index
22 * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
23 * Opera Software ASA. You are granted a license to use, reproduce
24 * and create derivative works of this document.
29 // https://html.spec.whatwg.org/#the-navigator-object
30 [HeaderFile="Navigator.h",
32 InstrumentedProps=(canShare,
39 // objects implementing this interface also implement the interfaces given below
41 Navigator includes NavigatorID;
42 Navigator includes NavigatorLanguage;
43 Navigator includes NavigatorOnLine;
44 Navigator includes NavigatorContentUtils;
45 Navigator includes NavigatorStorageUtils;
46 Navigator includes NavigatorConcurrentHardware;
47 Navigator includes NavigatorStorage;
48 Navigator includes NavigatorAutomationInformation;
49 Navigator includes NavigatorGPU;
50 Navigator includes GlobalPrivacyControl;
52 interface mixin NavigatorID {
53 // WebKit/Blink/Trident/Presto support this (hardcoded "Mozilla").
54 [Constant, Cached, Throws]
55 readonly attribute DOMString appCodeName; // constant "Mozilla"
57 readonly attribute DOMString appName; // constant "Netscape"
58 [Constant, Cached, Throws, NeedsCallerType]
59 readonly attribute DOMString appVersion;
60 [Pure, Cached, Throws, NeedsCallerType]
61 readonly attribute DOMString platform;
62 [Pure, Cached, Throws, NeedsCallerType]
63 readonly attribute DOMString userAgent;
65 readonly attribute DOMString product; // constant "Gecko"
67 // Everyone but WebKit/Blink supports this. See bug 679971.
69 boolean taintEnabled(); // constant false
72 interface mixin NavigatorLanguage {
74 // These two attributes are cached because this interface is also implemented
75 // by Workernavigator and this way we don't have to go back to the
76 // main-thread from the worker thread anytime we need to retrieve them. They
77 // are updated when pref intl.accept_languages is changed.
80 readonly attribute DOMString? language;
81 [Pure, Cached, Frozen]
82 readonly attribute sequence<DOMString> languages;
85 interface mixin NavigatorOnLine {
86 readonly attribute boolean onLine;
89 interface mixin NavigatorContentUtils {
90 // content handler registration
92 undefined checkProtocolHandlerAllowed(DOMString scheme, URI handlerURI, URI documentURI);
93 [Throws, SecureContext]
94 undefined registerProtocolHandler(DOMString scheme, DOMString url);
96 //undefined unregisterProtocolHandler(DOMString scheme, DOMString url);
100 interface mixin NavigatorStorage {
101 readonly attribute StorageManager storage;
104 interface mixin NavigatorStorageUtils {
106 //undefined yieldForStorageUpdates();
109 partial interface Navigator {
111 readonly attribute Permissions permissions;
114 partial interface Navigator {
116 readonly attribute MimeTypeArray mimeTypes;
118 readonly attribute PluginArray plugins;
119 readonly attribute boolean pdfViewerEnabled;
122 // http://www.w3.org/TR/tracking-dnt/ sort of
123 partial interface Navigator {
124 readonly attribute DOMString doNotTrack;
127 // https://globalprivacycontrol.github.io/gpc-spec/
128 interface mixin GlobalPrivacyControl {
129 [Pref="privacy.globalprivacycontrol.functionality.enabled"]
130 readonly attribute boolean globalPrivacyControl;
133 // http://www.w3.org/TR/geolocation-API/#geolocation_interface
134 interface mixin NavigatorGeolocation {
135 [Throws, Pref="geo.enabled"]
136 readonly attribute Geolocation geolocation;
138 Navigator includes NavigatorGeolocation;
140 // http://www.w3.org/TR/battery-status/#navigatorbattery-interface
141 partial interface Navigator {
142 // ChromeOnly to prevent web content from fingerprinting users' batteries.
143 [Throws, ChromeOnly, Pref="dom.battery.enabled"]
144 Promise<BatteryManager> getBattery();
147 // http://www.w3.org/TR/vibration/#vibration-interface
148 partial interface Navigator {
149 // We don't support sequences in unions yet
150 //boolean vibrate ((unsigned long or sequence<unsigned long>) pattern);
151 [Pref="dom.vibrator.enabled"]
152 boolean vibrate(unsigned long duration);
153 [Pref="dom.vibrator.enabled"]
154 boolean vibrate(sequence<unsigned long> pattern);
157 // http://www.w3.org/TR/pointerevents/#extensions-to-the-navigator-interface
158 partial interface Navigator {
160 readonly attribute long maxTouchPoints;
163 // https://wicg.github.io/media-capabilities/#idl-index
165 partial interface Navigator {
167 readonly attribute MediaCapabilities mediaCapabilities;
170 // Mozilla-specific extensions
172 // Chrome-only interface for Vibration API permission handling.
173 partial interface Navigator {
174 /* Set permission state to device vibration.
175 * @param permitted permission state (true for allowing vibration)
176 * @param persistent make the permission session-persistent
179 undefined setVibrationPermission(boolean permitted,
180 optional boolean persistent = true);
183 partial interface Navigator {
184 [Throws, Constant, Cached, NeedsCallerType]
185 readonly attribute DOMString oscpu;
186 // WebKit/Blink support this; Trident/Presto do not.
187 readonly attribute DOMString vendor;
188 // WebKit/Blink supports this (hardcoded ""); Trident/Presto do not.
189 readonly attribute DOMString vendorSub;
190 // WebKit/Blink supports this (hardcoded "20030107"); Trident/Presto don't
191 readonly attribute DOMString productSub;
192 // WebKit/Blink/Trident/Presto support this.
193 readonly attribute boolean cookieEnabled;
194 [Throws, Constant, Cached, NeedsCallerType]
195 readonly attribute DOMString buildID;
197 // WebKit/Blink/Trident/Presto support this.
198 [Affects=Nothing, DependsOn=Nothing]
199 boolean javaEnabled();
202 // Addon manager bits
203 partial interface Navigator {
204 [Throws, Func="mozilla::AddonManagerWebAPI::IsAPIEnabled"]
205 readonly attribute AddonManager mozAddonManager;
208 // NetworkInformation
209 partial interface Navigator {
210 [Throws, Pref="dom.netinfo.enabled"]
211 readonly attribute NetworkInformation connection;
214 // https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
215 partial interface Navigator {
216 [Throws, Pref="dom.gamepad.enabled"]
217 sequence<Gamepad?> getGamepads();
219 partial interface Navigator {
220 [Throws, Pref="dom.gamepad.test.enabled"]
221 GamepadServiceTest requestGamepadServiceTest();
224 // Chrome-only interface for acquiring all gamepads. Normally, a gamepad can
225 // only become visible if it gets interacted by the user. This function bypasses
226 // this restriction; it allow requesting all gamepad info without user
227 // interacting with the gamepads.
228 partial interface Navigator {
230 Promise<sequence<Gamepad>> requestAllGamepads();
233 // https://immersive-web.github.io/webvr/spec/1.1/#interface-navigator
234 partial interface Navigator {
235 [NewObject, SecureContext, Pref="dom.vr.enabled"]
236 Promise<sequence<VRDisplay>> getVRDisplays();
237 // TODO: Use FrozenArray once available. (Bug 1236777)
238 [SecureContext, Frozen, Cached, Pure, Pref="dom.vr.enabled"]
239 readonly attribute sequence<VRDisplay> activeVRDisplays;
240 [ChromeOnly, Pref="dom.vr.enabled"]
241 readonly attribute boolean isWebVRContentDetected;
242 [ChromeOnly, Pref="dom.vr.enabled"]
243 readonly attribute boolean isWebVRContentPresenting;
244 [ChromeOnly, Pref="dom.vr.enabled"]
245 undefined requestVRPresentation(VRDisplay display);
247 partial interface Navigator {
248 [Throws, Pref="dom.vr.puppet.enabled"]
249 VRServiceTest requestVRServiceTest();
252 // https://immersive-web.github.io/webxr/#dom-navigator-xr
253 partial interface Navigator {
254 [SecureContext, SameObject, Throws, Pref="dom.vr.webxr.enabled"]
255 readonly attribute XRSystem xr;
258 // http://webaudio.github.io/web-midi-api/#requestmidiaccess
259 partial interface Navigator {
260 [NewObject, Func="Navigator::HasMidiSupport"]
261 Promise<MIDIAccess> requestMIDIAccess(optional MIDIOptions options = {});
264 callback NavigatorUserMediaSuccessCallback = undefined (MediaStream stream);
265 callback NavigatorUserMediaErrorCallback = undefined (MediaStreamError error);
267 partial interface Navigator {
268 [Throws, Func="Navigator::HasUserMediaSupport"]
269 readonly attribute MediaDevices mediaDevices;
271 // Deprecated. Use mediaDevices.getUserMedia instead.
272 [Deprecated="NavigatorGetUserMedia", Throws,
273 Func="Navigator::HasUserMediaSupport",
276 undefined mozGetUserMedia(MediaStreamConstraints constraints,
277 NavigatorUserMediaSuccessCallback successCallback,
278 NavigatorUserMediaErrorCallback errorCallback);
281 // Service Workers/Navigation Controllers
282 partial interface Navigator {
283 [Func="ServiceWorkersEnabled", SameObject, BinaryName="serviceWorkerJS"]
284 readonly attribute ServiceWorkerContainer serviceWorker;
287 partial interface Navigator {
288 [Throws, Pref="beacon.enabled"]
289 boolean sendBeacon(DOMString url,
290 optional BodyInit? data = null);
293 partial interface Navigator {
294 [NewObject, Func="mozilla::dom::TCPSocket::ShouldTCPSocketExist"]
295 readonly attribute LegacyMozTCPSocket mozTCPSocket;
298 partial interface Navigator {
300 Promise<MediaKeySystemAccess>
301 requestMediaKeySystemAccess(DOMString keySystem,
302 sequence<MediaKeySystemConfiguration> supportedConfigurations);
305 interface mixin NavigatorConcurrentHardware {
306 readonly attribute unsigned long long hardwareConcurrency;
309 // https://w3c.github.io/webappsec-credential-management/#framework-credential-management
310 partial interface Navigator {
311 [Pref="security.webauth.webauthn", SecureContext, SameObject]
312 readonly attribute CredentialsContainer credentials;
315 // https://w3c.github.io/webdriver/webdriver-spec.html#interface
316 interface mixin NavigatorAutomationInformation {
318 readonly attribute boolean webdriver;
321 // https://www.w3.org/TR/clipboard-apis/#navigator-interface
322 partial interface Navigator {
323 [SecureContext, SameObject]
324 readonly attribute Clipboard clipboard;
327 // Used for testing of origin trials.
328 partial interface Navigator {
330 readonly attribute boolean testTrialGatedAttribute;
333 // https://wicg.github.io/web-share/#navigator-interface
334 partial interface Navigator {
335 [SecureContext, NewObject, Func="Navigator::HasShareSupport"]
336 Promise<undefined> share(optional ShareData data = {});
337 [SecureContext, Func="Navigator::HasShareSupport"]
338 boolean canShare(optional ShareData data = {});
340 // https://wicg.github.io/web-share/#sharedata-dictionary
341 dictionary ShareData {
345 // Note: we don't actually support files yet
346 // we have it here for the .canShare() checks.
347 sequence<File> files;
350 // https://w3c.github.io/mediasession/#idl-index
352 partial interface Navigator {
354 readonly attribute MediaSession mediaSession;
357 // https://w3c.github.io/web-locks/#navigator-mixins
359 interface mixin NavigatorLocks {
360 readonly attribute LockManager locks;
362 Navigator includes NavigatorLocks;
364 // https://w3c.github.io/autoplay/#autoplay-policy
365 enum AutoplayPolicy {
371 enum AutoplayPolicyMediaType {
376 // https://w3c.github.io/autoplay/#autoplay-detection-methods
377 partial interface Navigator {
378 [Pref="dom.media.autoplay-policy-detection.enabled"]
379 AutoplayPolicy getAutoplayPolicy(AutoplayPolicyMediaType type);
381 [Pref="dom.media.autoplay-policy-detection.enabled"]
382 AutoplayPolicy getAutoplayPolicy(HTMLMediaElement element);
384 [Pref="dom.media.autoplay-policy-detection.enabled"]
385 AutoplayPolicy getAutoplayPolicy(AudioContext context);
388 // https://html.spec.whatwg.org/multipage/interaction.html#the-useractivation-interface
389 partial interface Navigator {
390 [SameObject] readonly attribute UserActivation userActivation;
393 // https://w3c.github.io/screen-wake-lock/#extensions-to-the-navigator-interface
395 partial interface Navigator {
396 [SameObject, Pref="dom.screenwakelock.enabled"]
397 readonly attribute WakeLock wakeLock;
401 partial interface Navigator {
402 [SameObject, Trial="PrivateAttribution"]
403 readonly attribute PrivateAttribution privateAttribution;