Bug 1946787 - Avoid creating redundant GradientCache::OnMaxEntriesBreached tasks...
[gecko.git] / dom / webidl / Navigator.webidl
blobfcbd0cf4104675ef714f63b3cd62e404f79834a2
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/.
5  *
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
21  *
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.
25  */
27 interface URI;
29 // https://html.spec.whatwg.org/#the-navigator-object
30 [HeaderFile="Navigator.h",
31  Exposed=Window]
32 interface Navigator {
33   // objects implementing this interface also implement the interfaces given below
35 Navigator includes NavigatorID;
36 Navigator includes NavigatorLanguage;
37 Navigator includes NavigatorOnLine;
38 Navigator includes NavigatorContentUtils;
39 Navigator includes NavigatorStorageUtils;
40 Navigator includes NavigatorConcurrentHardware;
41 Navigator includes NavigatorStorage;
42 Navigator includes NavigatorAutomationInformation;
43 Navigator includes NavigatorGPU;
44 Navigator includes GlobalPrivacyControl;
46 interface mixin NavigatorID {
47   // WebKit/Blink/Trident/Presto support this (hardcoded "Mozilla").
48   [Constant, Cached, Throws]
49   readonly attribute DOMString appCodeName; // constant "Mozilla"
50   [Constant, Cached]
51   readonly attribute DOMString appName; // constant "Netscape"
52   [Constant, Cached, Throws, NeedsCallerType]
53   readonly attribute DOMString appVersion;
54   [Pure, Cached, Throws, NeedsCallerType]
55   readonly attribute DOMString platform;
56   [Pure, Cached, Throws, NeedsCallerType]
57   readonly attribute DOMString userAgent;
58   [Constant, Cached]
59   readonly attribute DOMString product; // constant "Gecko"
61   // Everyone but WebKit/Blink supports this.  See bug 679971.
62   [Exposed=Window]
63   boolean taintEnabled(); // constant false
66 interface mixin NavigatorLanguage {
68   // These two attributes are cached because this interface is also implemented
69   // by Workernavigator and this way we don't have to go back to the
70   // main-thread from the worker thread anytime we need to retrieve them. They
71   // are updated when pref intl.accept_languages is changed.
73   [Pure, Cached]
74   readonly attribute DOMString? language;
75   [Pure, Cached, Frozen]
76   readonly attribute sequence<DOMString> languages;
79 interface mixin NavigatorOnLine {
80   readonly attribute boolean onLine;
83 interface mixin NavigatorContentUtils {
84   // content handler registration
85   [Throws, ChromeOnly]
86   undefined checkProtocolHandlerAllowed(DOMString scheme, URI handlerURI, URI documentURI);
87   [Throws, SecureContext]
88   undefined registerProtocolHandler(DOMString scheme, DOMString url);
89   // NOT IMPLEMENTED
90   //undefined unregisterProtocolHandler(DOMString scheme, DOMString url);
93 [SecureContext]
94 interface mixin NavigatorStorage {
95   readonly attribute StorageManager storage;
98 interface mixin NavigatorStorageUtils {
99   // NOT IMPLEMENTED
100   //undefined yieldForStorageUpdates();
103 // https://w3c.github.io/permissions/#webidl-2112232240
104 partial interface Navigator {
105   [Throws, SameObject]
106   readonly attribute Permissions permissions;
109 partial interface Navigator {
110   [Throws, SameObject]
111   readonly attribute MimeTypeArray mimeTypes;
112   [Throws, SameObject]
113   readonly attribute PluginArray plugins;
114   readonly attribute boolean pdfViewerEnabled;
117 // http://www.w3.org/TR/tracking-dnt/ sort of
118 partial interface Navigator {
119   readonly attribute DOMString doNotTrack;
122 // https://globalprivacycontrol.github.io/gpc-spec/
123 interface mixin GlobalPrivacyControl {
124   [Pref="privacy.globalprivacycontrol.functionality.enabled"]
125   readonly attribute boolean globalPrivacyControl;
128 // http://www.w3.org/TR/geolocation-API/#geolocation_interface
129 interface mixin NavigatorGeolocation {
130   [Throws, Pref="geo.enabled"]
131   readonly attribute Geolocation geolocation;
133 Navigator includes NavigatorGeolocation;
135 // http://www.w3.org/TR/battery-status/#navigatorbattery-interface
136 partial interface Navigator {
137   // ChromeOnly to prevent web content from fingerprinting users' batteries.
138   [Throws, ChromeOnly, Pref="dom.battery.enabled"]
139   Promise<BatteryManager> getBattery();
142 // http://www.w3.org/TR/vibration/#vibration-interface
143 partial interface Navigator {
144     // We don't support sequences in unions yet
145     //boolean vibrate ((unsigned long or sequence<unsigned long>) pattern);
146     [Pref="dom.vibrator.enabled"]
147     boolean vibrate(unsigned long duration);
148     [Pref="dom.vibrator.enabled"]
149     boolean vibrate(sequence<unsigned long> pattern);
152 // http://www.w3.org/TR/pointerevents/#extensions-to-the-navigator-interface
153 partial interface Navigator {
154     [NeedsCallerType]
155     readonly attribute long maxTouchPoints;
158 // https://wicg.github.io/media-capabilities/#idl-index
159 [Exposed=Window]
160 partial interface Navigator {
161   [SameObject]
162   readonly attribute MediaCapabilities mediaCapabilities;
165 // Mozilla-specific extensions
167 // Chrome-only interface for Vibration API permission handling.
168 partial interface Navigator {
169     /* Set permission state to device vibration.
170      * @param permitted permission state (true for allowing vibration)
171      * @param persistent make the permission session-persistent
172      */
173     [ChromeOnly]
174     undefined setVibrationPermission(boolean permitted,
175                                      optional boolean persistent = true);
178 partial interface Navigator {
179   [Throws, Constant, Cached, NeedsCallerType]
180   readonly attribute DOMString oscpu;
181   // WebKit/Blink support this; Trident/Presto do not.
182   readonly attribute DOMString vendor;
183   // WebKit/Blink supports this (hardcoded ""); Trident/Presto do not.
184   readonly attribute DOMString vendorSub;
185   // WebKit/Blink supports this (hardcoded "20030107"); Trident/Presto don't
186   readonly attribute DOMString productSub;
187   // WebKit/Blink/Trident/Presto support this.
188   readonly attribute boolean cookieEnabled;
189   [Throws, Constant, Cached, NeedsCallerType]
190   readonly attribute DOMString buildID;
192   // WebKit/Blink/Trident/Presto support this.
193   [Affects=Nothing, DependsOn=Nothing]
194   boolean javaEnabled();
197 // Addon manager bits
198 partial interface Navigator {
199   [Throws, Func="mozilla::AddonManagerWebAPI::IsAPIEnabled"]
200   readonly attribute AddonManager mozAddonManager;
203 // NetworkInformation
204 partial interface Navigator {
205   [Throws, Pref="dom.netinfo.enabled"]
206   readonly attribute NetworkInformation connection;
209 // https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
210 partial interface Navigator {
211   [Throws, Pref="dom.gamepad.enabled"]
212   sequence<Gamepad?> getGamepads();
214 partial interface Navigator {
215   [Throws, Pref="dom.gamepad.test.enabled"]
216   GamepadServiceTest requestGamepadServiceTest();
219 // Chrome-only interface for acquiring all gamepads. Normally, a gamepad can
220 // only become visible if it gets interacted by the user. This function bypasses
221 // this restriction; it allow requesting all gamepad info without user
222 // interacting with the gamepads.
223 partial interface Navigator {
224   [Throws, ChromeOnly]
225   Promise<sequence<Gamepad>> requestAllGamepads();
228 // https://immersive-web.github.io/webvr/spec/1.1/#interface-navigator
229 partial interface Navigator {
230   [NewObject, SecureContext, Pref="dom.vr.enabled"]
231   Promise<sequence<VRDisplay>> getVRDisplays();
232   // TODO: Use FrozenArray once available. (Bug 1236777)
233   [SecureContext, Frozen, Cached, Pure, Pref="dom.vr.enabled"]
234   readonly attribute sequence<VRDisplay> activeVRDisplays;
235   [ChromeOnly, Pref="dom.vr.enabled"]
236   readonly attribute boolean isWebVRContentDetected;
237   [ChromeOnly, Pref="dom.vr.enabled"]
238   readonly attribute boolean isWebVRContentPresenting;
239   [ChromeOnly, Pref="dom.vr.enabled"]
240   undefined requestVRPresentation(VRDisplay display);
242 partial interface Navigator {
243   [Throws, Pref="dom.vr.puppet.enabled"]
244   VRServiceTest requestVRServiceTest();
247 // https://immersive-web.github.io/webxr/#dom-navigator-xr
248 partial interface Navigator {
249   [SecureContext, SameObject, Throws, Pref="dom.vr.webxr.enabled"]
250   readonly attribute XRSystem xr;
253 // http://webaudio.github.io/web-midi-api/#requestmidiaccess
254 partial interface Navigator {
255   [NewObject, Func="Navigator::HasMidiSupport"]
256   Promise<MIDIAccess> requestMIDIAccess(optional MIDIOptions options = {});
259 callback NavigatorUserMediaSuccessCallback = undefined (MediaStream stream);
260 callback NavigatorUserMediaErrorCallback = undefined (MediaStreamError error);
262 partial interface Navigator {
263   [Throws, Func="Navigator::HasUserMediaSupport"]
264   readonly attribute MediaDevices mediaDevices;
266   // Deprecated. Use mediaDevices.getUserMedia instead.
267   [Deprecated="NavigatorGetUserMedia", Throws,
268    Func="Navigator::HasUserMediaSupport",
269    NeedsCallerType,
270    UseCounter]
271   undefined mozGetUserMedia(MediaStreamConstraints constraints,
272                             NavigatorUserMediaSuccessCallback successCallback,
273                             NavigatorUserMediaErrorCallback errorCallback);
276 // Service Workers/Navigation Controllers
277 // https://w3c.github.io/ServiceWorker/#navigator-serviceworker
278 partial interface Navigator {
279   [Func="ServiceWorkersEnabled", SameObject, BinaryName="serviceWorkerJS"]
280   readonly attribute ServiceWorkerContainer serviceWorker;
283 partial interface Navigator {
284   [Throws, Pref="beacon.enabled"]
285   boolean sendBeacon(DOMString url,
286                      optional BodyInit? data = null);
289 partial interface Navigator {
290   [NewObject, Func="mozilla::dom::TCPSocket::ShouldTCPSocketExist"]
291   readonly attribute LegacyMozTCPSocket mozTCPSocket;
294 partial interface Navigator {
295   [NewObject]
296   Promise<MediaKeySystemAccess>
297   requestMediaKeySystemAccess(DOMString keySystem,
298                               sequence<MediaKeySystemConfiguration> supportedConfigurations);
301 interface mixin NavigatorConcurrentHardware {
302   readonly attribute unsigned long long hardwareConcurrency;
305 // https://w3c.github.io/webappsec-credential-management/#framework-credential-management
306 partial interface Navigator {
307   [Pref="security.webauth.webauthn", SecureContext, SameObject]
308   readonly attribute CredentialsContainer credentials;
311 // https://w3c.github.io/webdriver/webdriver-spec.html#interface
312 interface mixin NavigatorAutomationInformation {
313   [Constant, Cached]
314   readonly attribute boolean webdriver;
317 // https://www.w3.org/TR/clipboard-apis/#navigator-interface
318 partial interface Navigator {
319   [SecureContext, SameObject]
320   readonly attribute Clipboard clipboard;
323 // Used for testing of origin trials.
324 partial interface Navigator {
325   [Trial="TestTrial"]
326   readonly attribute boolean testTrialGatedAttribute;
329 // https://wicg.github.io/web-share/#navigator-interface
330 partial interface Navigator {
331   [SecureContext, NewObject, Func="Navigator::HasShareSupport"]
332   Promise<undefined> share(optional ShareData data = {});
333   [SecureContext, Func="Navigator::HasShareSupport"]
334   boolean canShare(optional ShareData data = {});
336 // https://wicg.github.io/web-share/#sharedata-dictionary
337 dictionary ShareData {
338   USVString title;
339   USVString text;
340   USVString url;
341   // Note: we don't actually support files yet
342   // we have it here for the .canShare() checks.
343   sequence<File> files;
346 // https://w3c.github.io/mediasession/#idl-index
347 [Exposed=Window]
348 partial interface Navigator {
349   [SameObject]
350   readonly attribute MediaSession mediaSession;
353 // https://w3c.github.io/web-locks/#navigator-mixins
354 [SecureContext]
355 interface mixin NavigatorLocks {
356   readonly attribute LockManager locks;
358 Navigator includes NavigatorLocks;
360 // https://w3c.github.io/autoplay/#autoplay-policy
361 enum AutoplayPolicy {
362   "allowed",
363   "allowed-muted",
364   "disallowed"
367 enum AutoplayPolicyMediaType {
368   "mediaelement",
369   "audiocontext"
372 // https://w3c.github.io/autoplay/#autoplay-detection-methods
373 partial interface Navigator {
374   [Pref="dom.media.autoplay-policy-detection.enabled"]
375   AutoplayPolicy getAutoplayPolicy(AutoplayPolicyMediaType type);
377   [Pref="dom.media.autoplay-policy-detection.enabled"]
378   AutoplayPolicy getAutoplayPolicy(HTMLMediaElement element);
380   [Pref="dom.media.autoplay-policy-detection.enabled"]
381   AutoplayPolicy getAutoplayPolicy(AudioContext context);
384 // https://html.spec.whatwg.org/multipage/interaction.html#the-useractivation-interface
385 partial interface Navigator {
386   [SameObject] readonly attribute UserActivation userActivation;
389 // https://w3c.github.io/screen-wake-lock/#extensions-to-the-navigator-interface
390 [SecureContext]
391 partial interface Navigator {
392   [SameObject, Pref="dom.screenwakelock.enabled"]
393   readonly attribute WakeLock wakeLock;
396 [SecureContext]
397 partial interface Navigator {
398   [SameObject, Trial="PrivateAttributionV2"]
399   readonly attribute PrivateAttribution privateAttribution;