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 * http://www.whatwg.org/specs/web-apps/current-work/#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 * 21 * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and 22 * Opera Software ASA. You are granted a license to use, reproduce 23 * and create derivative works of this document. 24 */ 25 26// http://www.whatwg.org/specs/web-apps/current-work/#the-navigator-object 27[HeaderFile="Navigator.h"] 28interface Navigator { 29 // objects implementing this interface also implement the interfaces given below 30}; 31Navigator includes NavigatorID; 32Navigator includes NavigatorLanguage; 33Navigator includes NavigatorOnLine; 34Navigator includes NavigatorContentUtils; 35Navigator includes NavigatorStorageUtils; 36Navigator includes NavigatorConcurrentHardware; 37Navigator includes NavigatorStorage; 38Navigator includes NavigatorAutomationInformation; 39 40[Exposed=(Window,Worker)] 41interface mixin NavigatorID { 42 // WebKit/Blink/Trident/Presto support this (hardcoded "Mozilla"). 43 [Constant, Cached, Throws] 44 readonly attribute DOMString appCodeName; // constant "Mozilla" 45 [Constant, Cached, NeedsCallerType] 46 readonly attribute DOMString appName; 47 [Constant, Cached, Throws, NeedsCallerType] 48 readonly attribute DOMString appVersion; 49 [Constant, Cached, Throws, NeedsCallerType] 50 readonly attribute DOMString platform; 51 [Pure, Cached, Throws, NeedsCallerType] 52 readonly attribute DOMString userAgent; 53 [Constant, Cached] 54 readonly attribute DOMString product; // constant "Gecko" 55 56 // Everyone but WebKit/Blink supports this. See bug 679971. 57 [Exposed=Window] 58 boolean taintEnabled(); // constant false 59}; 60 61[Exposed=(Window,Worker)] 62interface mixin NavigatorLanguage { 63 64 // These two attributes are cached because this interface is also implemented 65 // by Workernavigator and this way we don't have to go back to the 66 // main-thread from the worker thread anytime we need to retrieve them. They 67 // are updated when pref intl.accept_languages is changed. 68 69 [Pure, Cached] 70 readonly attribute DOMString? language; 71 [Pure, Cached, Frozen] 72 readonly attribute sequence<DOMString> languages; 73}; 74 75[Exposed=(Window,Worker)] 76interface mixin NavigatorOnLine { 77 readonly attribute boolean onLine; 78}; 79 80interface mixin NavigatorContentUtils { 81 // content handler registration 82 [Throws, Func="nsGlobalWindowInner::RegisterProtocolHandlerAllowedForContext"] 83 void registerProtocolHandler(DOMString scheme, DOMString url, DOMString title); 84 [Pref="dom.registerContentHandler.enabled", Throws] 85 void registerContentHandler(DOMString mimeType, DOMString url, DOMString title); 86 // NOT IMPLEMENTED 87 //DOMString isProtocolHandlerRegistered(DOMString scheme, DOMString url); 88 //DOMString isContentHandlerRegistered(DOMString mimeType, DOMString url); 89 //void unregisterProtocolHandler(DOMString scheme, DOMString url); 90 //void unregisterContentHandler(DOMString mimeType, DOMString url); 91}; 92 93[SecureContext, Exposed=(Window,Worker)] 94interface mixin NavigatorStorage { 95 [Func="mozilla::dom::DOMPrefs::StorageManagerEnabled"] 96 readonly attribute StorageManager storage; 97}; 98 99interface mixin NavigatorStorageUtils { 100 // NOT IMPLEMENTED 101 //void yieldForStorageUpdates(); 102}; 103 104partial interface Navigator { 105 [Throws] 106 readonly attribute Permissions permissions; 107}; 108 109// Things that definitely need to be in the spec and and are not for some 110// reason. See https://www.w3.org/Bugs/Public/show_bug.cgi?id=22406 111partial interface Navigator { 112 [Throws] 113 readonly attribute MimeTypeArray mimeTypes; 114 [Throws] 115 readonly attribute PluginArray plugins; 116}; 117 118// http://www.w3.org/TR/tracking-dnt/ sort of 119partial interface Navigator { 120 readonly attribute DOMString doNotTrack; 121}; 122 123// http://www.w3.org/TR/geolocation-API/#geolocation_interface 124interface mixin NavigatorGeolocation { 125 [Throws, Pref="geo.enabled"] 126 readonly attribute Geolocation geolocation; 127}; 128Navigator includes NavigatorGeolocation; 129 130// http://www.w3.org/TR/battery-status/#navigatorbattery-interface 131partial interface Navigator { 132 // ChromeOnly to prevent web content from fingerprinting users' batteries. 133 [Throws, ChromeOnly, Pref="dom.battery.enabled"] 134 Promise<BatteryManager> getBattery(); 135}; 136 137// http://www.w3.org/TR/vibration/#vibration-interface 138partial interface Navigator { 139 // We don't support sequences in unions yet 140 //boolean vibrate ((unsigned long or sequence<unsigned long>) pattern); 141 boolean vibrate(unsigned long duration); 142 boolean vibrate(sequence<unsigned long> pattern); 143}; 144 145// http://www.w3.org/TR/pointerevents/#extensions-to-the-navigator-interface 146partial interface Navigator { 147 [Pref="dom.w3c_pointer_events.enabled"] 148 readonly attribute long maxTouchPoints; 149}; 150 151// https://wicg.github.io/media-capabilities/#idl-index 152[Exposed=Window] 153partial interface Navigator { 154 [SameObject, Func="mozilla::dom::MediaCapabilities::Enabled"] 155 readonly attribute MediaCapabilities mediaCapabilities; 156}; 157 158// NetworkInformation 159partial interface Navigator { 160 [Throws, Pref="dom.netinfo.enabled"] 161 readonly attribute NetworkInformation connection; 162}; 163 164// https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension 165partial interface Navigator { 166 [Throws, Pref="dom.gamepad.enabled"] 167 sequence<Gamepad?> getGamepads(); 168}; 169partial interface Navigator { 170 [Pref="dom.gamepad.test.enabled"] 171 GamepadServiceTest requestGamepadServiceTest(); 172}; 173 174partial interface Navigator { 175 [Throws, Pref="dom.vr.enabled"] 176 Promise<sequence<VRDisplay>> getVRDisplays(); 177 // TODO: Use FrozenArray once available. (Bug 1236777) 178 [Frozen, Cached, Pure, Pref="dom.vr.enabled"] 179 readonly attribute sequence<VRDisplay> activeVRDisplays; 180 [ChromeOnly, Pref="dom.vr.enabled"] 181 readonly attribute boolean isWebVRContentDetected; 182 [ChromeOnly, Pref="dom.vr.enabled"] 183 readonly attribute boolean isWebVRContentPresenting; 184 [ChromeOnly, Pref="dom.vr.enabled"] 185 void requestVRPresentation(VRDisplay display); 186}; 187partial interface Navigator { 188 [Pref="dom.vr.test.enabled"] 189 VRServiceTest requestVRServiceTest(); 190}; 191 192// http://webaudio.github.io/web-midi-api/#requestmidiaccess 193partial interface Navigator { 194 [Throws, Pref="dom.webmidi.enabled"] 195 Promise<MIDIAccess> requestMIDIAccess(optional MIDIOptions options); 196}; 197 198callback NavigatorUserMediaSuccessCallback = void (MediaStream stream); 199callback NavigatorUserMediaErrorCallback = void (MediaStreamError error); 200 201partial interface Navigator { 202 [Throws, Func="Navigator::HasUserMediaSupport"] 203 readonly attribute MediaDevices mediaDevices; 204}; 205 206// Service Workers/Navigation Controllers 207partial interface Navigator { 208 [Func="ServiceWorkerContainer::IsEnabled", SameObject] 209 readonly attribute ServiceWorkerContainer serviceWorker; 210}; 211 212partial interface Navigator { 213 [Throws, Pref="beacon.enabled"] 214 boolean sendBeacon(DOMString url, 215 optional BodyInit? data = null); 216}; 217 218partial interface Navigator { 219 [Throws, Pref="dom.presentation.enabled", SameObject] 220 readonly attribute Presentation? presentation; 221}; 222 223partial interface Navigator { 224 [NewObject] 225 Promise<MediaKeySystemAccess> 226 requestMediaKeySystemAccess(DOMString keySystem, 227 sequence<MediaKeySystemConfiguration> supportedConfigurations); 228}; 229 230[Exposed=(Window,Worker)] 231interface mixin NavigatorConcurrentHardware { 232 readonly attribute unsigned long long hardwareConcurrency; 233}; 234 235// https://w3c.github.io/webappsec-credential-management/#framework-credential-management 236partial interface Navigator { 237 [Pref="security.webauth.webauthn", SecureContext, SameObject] 238 readonly attribute CredentialsContainer credentials; 239}; 240 241// https://w3c.github.io/webdriver/webdriver-spec.html#interface 242[NoInterfaceObject] 243interface NavigatorAutomationInformation { 244 [Pref="dom.webdriver.enabled"] 245 readonly attribute boolean webdriver; 246}; 247