dom/webidl/Navigator.webidl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 4 * You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 5 *
michael@0 6 * The origin of this IDL file is
michael@0 7 * http://www.whatwg.org/specs/web-apps/current-work/#the-navigator-object
michael@0 8 * http://www.w3.org/TR/tracking-dnt/
michael@0 9 * http://www.w3.org/TR/geolocation-API/#geolocation_interface
michael@0 10 * http://www.w3.org/TR/battery-status/#navigatorbattery-interface
michael@0 11 * http://www.w3.org/TR/vibration/#vibration-interface
michael@0 12 * http://www.w3.org/2012/sysapps/runtime/#extension-to-the-navigator-interface-1
michael@0 13 * https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
michael@0 14 * http://www.w3.org/TR/beacon/#sec-beacon-method
michael@0 15 *
michael@0 16 * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
michael@0 17 * Opera Software ASA. You are granted a license to use, reproduce
michael@0 18 * and create derivative works of this document.
michael@0 19 */
michael@0 20
michael@0 21 // http://www.whatwg.org/specs/web-apps/current-work/#the-navigator-object
michael@0 22 [HeaderFile="Navigator.h", NeedNewResolve]
michael@0 23 interface Navigator {
michael@0 24 // objects implementing this interface also implement the interfaces given below
michael@0 25 };
michael@0 26 Navigator implements NavigatorID;
michael@0 27 Navigator implements NavigatorLanguage;
michael@0 28 Navigator implements NavigatorOnLine;
michael@0 29 Navigator implements NavigatorContentUtils;
michael@0 30 Navigator implements NavigatorStorageUtils;
michael@0 31
michael@0 32 [NoInterfaceObject]
michael@0 33 interface NavigatorID {
michael@0 34 // WebKit/Blink/Trident/Presto support this (hardcoded "Mozilla").
michael@0 35 [Constant]
michael@0 36 readonly attribute DOMString appCodeName; // constant "Mozilla"
michael@0 37 [Constant]
michael@0 38 readonly attribute DOMString appName;
michael@0 39 [Constant]
michael@0 40 readonly attribute DOMString appVersion;
michael@0 41 [Constant]
michael@0 42 readonly attribute DOMString platform;
michael@0 43 [Constant]
michael@0 44 readonly attribute DOMString userAgent;
michael@0 45 [Constant]
michael@0 46 readonly attribute DOMString product; // constant "Gecko"
michael@0 47
michael@0 48 // Everyone but WebKit/Blink supports this. See bug 679971.
michael@0 49 boolean taintEnabled(); // constant false
michael@0 50 };
michael@0 51
michael@0 52 [NoInterfaceObject]
michael@0 53 interface NavigatorLanguage {
michael@0 54 readonly attribute DOMString? language;
michael@0 55 };
michael@0 56
michael@0 57 [NoInterfaceObject]
michael@0 58 interface NavigatorOnLine {
michael@0 59 readonly attribute boolean onLine;
michael@0 60 };
michael@0 61
michael@0 62 [NoInterfaceObject]
michael@0 63 interface NavigatorContentUtils {
michael@0 64 // content handler registration
michael@0 65 [Throws]
michael@0 66 void registerProtocolHandler(DOMString scheme, DOMString url, DOMString title);
michael@0 67 [Throws]
michael@0 68 void registerContentHandler(DOMString mimeType, DOMString url, DOMString title);
michael@0 69 // NOT IMPLEMENTED
michael@0 70 //DOMString isProtocolHandlerRegistered(DOMString scheme, DOMString url);
michael@0 71 //DOMString isContentHandlerRegistered(DOMString mimeType, DOMString url);
michael@0 72 //void unregisterProtocolHandler(DOMString scheme, DOMString url);
michael@0 73 //void unregisterContentHandler(DOMString mimeType, DOMString url);
michael@0 74 };
michael@0 75
michael@0 76 [NoInterfaceObject]
michael@0 77 interface NavigatorStorageUtils {
michael@0 78 // NOT IMPLEMENTED
michael@0 79 //void yieldForStorageUpdates();
michael@0 80 };
michael@0 81
michael@0 82 // Things that definitely need to be in the spec and and are not for some
michael@0 83 // reason. See https://www.w3.org/Bugs/Public/show_bug.cgi?id=22406
michael@0 84 partial interface Navigator {
michael@0 85 [Throws]
michael@0 86 readonly attribute MimeTypeArray mimeTypes;
michael@0 87 [Throws]
michael@0 88 readonly attribute PluginArray plugins;
michael@0 89 };
michael@0 90
michael@0 91 // http://www.w3.org/TR/tracking-dnt/ sort of
michael@0 92 partial interface Navigator {
michael@0 93 readonly attribute DOMString doNotTrack;
michael@0 94 };
michael@0 95
michael@0 96 // http://www.w3.org/TR/geolocation-API/#geolocation_interface
michael@0 97 [NoInterfaceObject]
michael@0 98 interface NavigatorGeolocation {
michael@0 99 [Throws, Pref="geo.enabled"]
michael@0 100 readonly attribute Geolocation geolocation;
michael@0 101 };
michael@0 102 Navigator implements NavigatorGeolocation;
michael@0 103
michael@0 104 // http://www.w3.org/TR/battery-status/#navigatorbattery-interface
michael@0 105 [NoInterfaceObject]
michael@0 106 interface NavigatorBattery {
michael@0 107 // XXXbz Per spec this should be non-nullable, but we return null in
michael@0 108 // torn-down windows. See bug 884925.
michael@0 109 [Throws, Func="Navigator::HasBatterySupport"]
michael@0 110 readonly attribute BatteryManager? battery;
michael@0 111 };
michael@0 112 Navigator implements NavigatorBattery;
michael@0 113
michael@0 114 // https://wiki.mozilla.org/WebAPI/DataStore
michael@0 115 [NoInterfaceObject]
michael@0 116 interface NavigatorDataStore {
michael@0 117 [Throws, NewObject, Func="Navigator::HasDataStoreSupport"]
michael@0 118 Promise getDataStores(DOMString name);
michael@0 119 };
michael@0 120 Navigator implements NavigatorDataStore;
michael@0 121
michael@0 122 // http://www.w3.org/TR/vibration/#vibration-interface
michael@0 123 partial interface Navigator {
michael@0 124 // We don't support sequences in unions yet
michael@0 125 //boolean vibrate ((unsigned long or sequence<unsigned long>) pattern);
michael@0 126 boolean vibrate(unsigned long duration);
michael@0 127 boolean vibrate(sequence<unsigned long> pattern);
michael@0 128 };
michael@0 129
michael@0 130 // http://www.w3.org/TR/pointerevents/#extensions-to-the-navigator-interface
michael@0 131 partial interface Navigator {
michael@0 132 [Pref="dom.w3c_pointer_events.enabled"]
michael@0 133 readonly attribute long maxTouchPoints;
michael@0 134 };
michael@0 135
michael@0 136 // Mozilla-specific extensions
michael@0 137
michael@0 138 callback interface MozIdleObserver {
michael@0 139 // Time is in seconds and is read only when idle observers are added
michael@0 140 // and removed.
michael@0 141 readonly attribute unsigned long time;
michael@0 142 void onidle();
michael@0 143 void onactive();
michael@0 144 };
michael@0 145
michael@0 146 // nsIDOMNavigator
michael@0 147 partial interface Navigator {
michael@0 148 [Throws]
michael@0 149 readonly attribute DOMString oscpu;
michael@0 150 // WebKit/Blink support this; Trident/Presto do not.
michael@0 151 readonly attribute DOMString vendor;
michael@0 152 // WebKit/Blink supports this (hardcoded ""); Trident/Presto do not.
michael@0 153 readonly attribute DOMString vendorSub;
michael@0 154 // WebKit/Blink supports this (hardcoded "20030107"); Trident/Presto don't
michael@0 155 readonly attribute DOMString productSub;
michael@0 156 // WebKit/Blink/Trident/Presto support this.
michael@0 157 readonly attribute boolean cookieEnabled;
michael@0 158 [Throws]
michael@0 159 readonly attribute DOMString buildID;
michael@0 160 [Throws, Func="Navigator::HasPowerSupport"]
michael@0 161 readonly attribute MozPowerManager mozPower;
michael@0 162
michael@0 163 // WebKit/Blink/Trident/Presto support this.
michael@0 164 [Throws]
michael@0 165 boolean javaEnabled();
michael@0 166
michael@0 167 /**
michael@0 168 * Navigator requests to add an idle observer to the existing window.
michael@0 169 */
michael@0 170 [Throws, Func="Navigator::HasIdleSupport"]
michael@0 171 void addIdleObserver(MozIdleObserver aIdleObserver);
michael@0 172
michael@0 173 /**
michael@0 174 * Navigator requests to remove an idle observer from the existing window.
michael@0 175 */
michael@0 176 [Throws, Func="Navigator::HasIdleSupport"]
michael@0 177 void removeIdleObserver(MozIdleObserver aIdleObserver);
michael@0 178
michael@0 179 /**
michael@0 180 * Request a wake lock for a resource.
michael@0 181 *
michael@0 182 * A page holds a wake lock to request that a resource not be turned
michael@0 183 * off (or otherwise made unavailable).
michael@0 184 *
michael@0 185 * The topic is the name of a resource that might be made unavailable for
michael@0 186 * various reasons. For example, on a mobile device the power manager might
michael@0 187 * decide to turn off the screen after a period of idle time to save power.
michael@0 188 *
michael@0 189 * The resource manager checks the lock state of a topic before turning off
michael@0 190 * the associated resource. For example, a page could hold a lock on the
michael@0 191 * "screen" topic to prevent the screensaver from appearing or the screen
michael@0 192 * from turning off.
michael@0 193 *
michael@0 194 * The resource manager defines what each topic means and sets policy. For
michael@0 195 * example, the resource manager might decide to ignore 'screen' wake locks
michael@0 196 * held by pages which are not visible.
michael@0 197 *
michael@0 198 * One topic can be locked multiple times; it is considered released only when
michael@0 199 * all locks on the topic have been released.
michael@0 200 *
michael@0 201 * The returned MozWakeLock object is a token of the lock. You can
michael@0 202 * unlock the lock via the object's |unlock| method. The lock is released
michael@0 203 * automatically when its associated window is unloaded.
michael@0 204 *
michael@0 205 * @param aTopic resource name
michael@0 206 */
michael@0 207 [Throws, Pref="dom.wakelock.enabled", Func="Navigator::HasWakeLockSupport"]
michael@0 208 MozWakeLock requestWakeLock(DOMString aTopic);
michael@0 209 };
michael@0 210
michael@0 211 // nsIDOMNavigatorDeviceStorage
michael@0 212 partial interface Navigator {
michael@0 213 [Throws, Pref="device.storage.enabled"]
michael@0 214 DeviceStorage? getDeviceStorage(DOMString type);
michael@0 215 [Throws, Pref="device.storage.enabled"]
michael@0 216 sequence<DeviceStorage> getDeviceStorages(DOMString type);
michael@0 217 };
michael@0 218
michael@0 219 // nsIDOMNavigatorDesktopNotification
michael@0 220 partial interface Navigator {
michael@0 221 [Throws, Func="Navigator::HasDesktopNotificationSupport"]
michael@0 222 readonly attribute DesktopNotificationCenter mozNotification;
michael@0 223 };
michael@0 224
michael@0 225 // nsIDOMClientInformation
michael@0 226 partial interface Navigator {
michael@0 227 [Throws]
michael@0 228 boolean mozIsLocallyAvailable(DOMString uri, boolean whenOffline);
michael@0 229 };
michael@0 230
michael@0 231 // nsIDOMMozNavigatorMobileMessage
michael@0 232 interface MozMobileMessageManager;
michael@0 233 partial interface Navigator {
michael@0 234 [Func="Navigator::HasMobileMessageSupport"]
michael@0 235 readonly attribute MozMobileMessageManager? mozMobileMessage;
michael@0 236 };
michael@0 237
michael@0 238 // NetworkInformation
michael@0 239 partial interface Navigator {
michael@0 240 [Throws, Pref="dom.netinfo.enabled"]
michael@0 241 readonly attribute NetworkInformation connection;
michael@0 242 };
michael@0 243
michael@0 244 // nsIDOMNavigatorCamera
michael@0 245 partial interface Navigator {
michael@0 246 [Throws, Func="Navigator::HasCameraSupport"]
michael@0 247 readonly attribute CameraManager mozCameras;
michael@0 248 };
michael@0 249
michael@0 250 // nsIDOMNavigatorSystemMessages and sort of maybe
michael@0 251 // http://www.w3.org/2012/sysapps/runtime/#extension-to-the-navigator-interface-1
michael@0 252 callback systemMessageCallback = void (optional object message);
michael@0 253 partial interface Navigator {
michael@0 254 [Throws, Pref="dom.sysmsg.enabled"]
michael@0 255 void mozSetMessageHandler (DOMString type, systemMessageCallback? callback);
michael@0 256 [Throws, Pref="dom.sysmsg.enabled"]
michael@0 257 boolean mozHasPendingMessage (DOMString type);
michael@0 258 };
michael@0 259
michael@0 260 #ifdef MOZ_B2G_RIL
michael@0 261 partial interface Navigator {
michael@0 262 [Throws, Func="Navigator::HasMobileConnectionSupport"]
michael@0 263 readonly attribute MozMobileConnectionArray mozMobileConnections;
michael@0 264 };
michael@0 265
michael@0 266 partial interface Navigator {
michael@0 267 [Throws, Func="Navigator::HasCellBroadcastSupport"]
michael@0 268 readonly attribute MozCellBroadcast mozCellBroadcast;
michael@0 269 };
michael@0 270
michael@0 271 partial interface Navigator {
michael@0 272 [Throws, Func="Navigator::HasVoicemailSupport"]
michael@0 273 readonly attribute MozVoicemail mozVoicemail;
michael@0 274 };
michael@0 275
michael@0 276 partial interface Navigator {
michael@0 277 [Throws, Func="Navigator::HasIccManagerSupport"]
michael@0 278 readonly attribute MozIccManager? mozIccManager;
michael@0 279 };
michael@0 280 #endif // MOZ_B2G_RIL
michael@0 281
michael@0 282 partial interface Navigator {
michael@0 283 [Throws, Func="Navigator::HasTelephonySupport"]
michael@0 284 readonly attribute Telephony? mozTelephony;
michael@0 285 };
michael@0 286
michael@0 287 #ifdef MOZ_GAMEPAD
michael@0 288 // https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
michael@0 289 partial interface Navigator {
michael@0 290 [Throws, Pref="dom.gamepad.enabled"]
michael@0 291 sequence<Gamepad?> getGamepads();
michael@0 292 };
michael@0 293 #endif // MOZ_GAMEPAD
michael@0 294
michael@0 295 #ifdef MOZ_B2G_BT
michael@0 296 partial interface Navigator {
michael@0 297 [Throws, Func="Navigator::HasBluetoothSupport"]
michael@0 298 readonly attribute BluetoothManager mozBluetooth;
michael@0 299 };
michael@0 300 #endif // MOZ_B2G_BT
michael@0 301
michael@0 302 #ifdef MOZ_B2G_FM
michael@0 303 partial interface Navigator {
michael@0 304 [Throws, Func="Navigator::HasFMRadioSupport"]
michael@0 305 readonly attribute FMRadio mozFMRadio;
michael@0 306 };
michael@0 307 #endif // MOZ_B2G_FM
michael@0 308
michael@0 309 #ifdef MOZ_TIME_MANAGER
michael@0 310 // nsIDOMMozNavigatorTime
michael@0 311 partial interface Navigator {
michael@0 312 [Throws, Func="Navigator::HasTimeSupport"]
michael@0 313 readonly attribute MozTimeManager mozTime;
michael@0 314 };
michael@0 315 #endif // MOZ_TIME_MANAGER
michael@0 316
michael@0 317 #ifdef MOZ_AUDIO_CHANNEL_MANAGER
michael@0 318 // nsIMozNavigatorAudioChannelManager
michael@0 319 partial interface Navigator {
michael@0 320 [Throws]
michael@0 321 readonly attribute AudioChannelManager mozAudioChannelManager;
michael@0 322 };
michael@0 323 #endif // MOZ_AUDIO_CHANNEL_MANAGER
michael@0 324
michael@0 325 #ifdef MOZ_MEDIA_NAVIGATOR
michael@0 326 callback NavigatorUserMediaSuccessCallback = void (MediaStream stream);
michael@0 327 callback NavigatorUserMediaErrorCallback = void (DOMString error);
michael@0 328
michael@0 329 partial interface Navigator {
michael@0 330 [Throws, Func="Navigator::HasUserMediaSupport"]
michael@0 331 void mozGetUserMedia(MediaStreamConstraints constraints,
michael@0 332 NavigatorUserMediaSuccessCallback successCallback,
michael@0 333 NavigatorUserMediaErrorCallback errorCallback);
michael@0 334 };
michael@0 335
michael@0 336 // nsINavigatorUserMedia
michael@0 337 callback MozGetUserMediaDevicesSuccessCallback = void (nsIVariant? devices);
michael@0 338 partial interface Navigator {
michael@0 339 [Throws, ChromeOnly]
michael@0 340 void mozGetUserMediaDevices(MediaStreamConstraints constraints,
michael@0 341 MozGetUserMediaDevicesSuccessCallback onsuccess,
michael@0 342 NavigatorUserMediaErrorCallback onerror,
michael@0 343 // The originating innerWindowID is needed to
michael@0 344 // avoid calling the callbacks if the window has
michael@0 345 // navigated away. It is optional only as legacy.
michael@0 346 optional unsigned long long innerWindowID = 0);
michael@0 347 };
michael@0 348 #endif // MOZ_MEDIA_NAVIGATOR
michael@0 349
michael@0 350 partial interface Navigator {
michael@0 351 [Throws, Pref="beacon.enabled"]
michael@0 352 boolean sendBeacon(DOMString url,
michael@0 353 optional (ArrayBufferView or Blob or DOMString or FormData)? data = null);
michael@0 354 };

mercurial