dom/webidl/Navigator.webidl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/webidl/Navigator.webidl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,354 @@
     1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.7 + * You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 + *
     1.9 + * The origin of this IDL file is
    1.10 + * http://www.whatwg.org/specs/web-apps/current-work/#the-navigator-object
    1.11 + * http://www.w3.org/TR/tracking-dnt/
    1.12 + * http://www.w3.org/TR/geolocation-API/#geolocation_interface
    1.13 + * http://www.w3.org/TR/battery-status/#navigatorbattery-interface
    1.14 + * http://www.w3.org/TR/vibration/#vibration-interface
    1.15 + * http://www.w3.org/2012/sysapps/runtime/#extension-to-the-navigator-interface-1
    1.16 + * https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
    1.17 + * http://www.w3.org/TR/beacon/#sec-beacon-method
    1.18 + *
    1.19 + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
    1.20 + * Opera Software ASA. You are granted a license to use, reproduce
    1.21 + * and create derivative works of this document.
    1.22 + */
    1.23 +
    1.24 +// http://www.whatwg.org/specs/web-apps/current-work/#the-navigator-object
    1.25 +[HeaderFile="Navigator.h", NeedNewResolve]
    1.26 +interface Navigator {
    1.27 +  // objects implementing this interface also implement the interfaces given below
    1.28 +};
    1.29 +Navigator implements NavigatorID;
    1.30 +Navigator implements NavigatorLanguage;
    1.31 +Navigator implements NavigatorOnLine;
    1.32 +Navigator implements NavigatorContentUtils;
    1.33 +Navigator implements NavigatorStorageUtils;
    1.34 +
    1.35 +[NoInterfaceObject]
    1.36 +interface NavigatorID {
    1.37 +  // WebKit/Blink/Trident/Presto support this (hardcoded "Mozilla").
    1.38 +  [Constant]
    1.39 +  readonly attribute DOMString appCodeName; // constant "Mozilla"
    1.40 +  [Constant]
    1.41 +  readonly attribute DOMString appName;
    1.42 +  [Constant]
    1.43 +  readonly attribute DOMString appVersion;
    1.44 +  [Constant]
    1.45 +  readonly attribute DOMString platform;
    1.46 +  [Constant]
    1.47 +  readonly attribute DOMString userAgent;
    1.48 +  [Constant]
    1.49 +  readonly attribute DOMString product; // constant "Gecko"
    1.50 +
    1.51 +  // Everyone but WebKit/Blink supports this.  See bug 679971.
    1.52 +  boolean taintEnabled(); // constant false
    1.53 +};
    1.54 +
    1.55 +[NoInterfaceObject]
    1.56 +interface NavigatorLanguage {
    1.57 +  readonly attribute DOMString? language;
    1.58 +};
    1.59 +
    1.60 +[NoInterfaceObject]
    1.61 +interface NavigatorOnLine {
    1.62 +  readonly attribute boolean onLine;
    1.63 +};
    1.64 +
    1.65 +[NoInterfaceObject]
    1.66 +interface NavigatorContentUtils {
    1.67 +  // content handler registration
    1.68 +  [Throws]
    1.69 +  void registerProtocolHandler(DOMString scheme, DOMString url, DOMString title);
    1.70 +  [Throws]
    1.71 +  void registerContentHandler(DOMString mimeType, DOMString url, DOMString title);
    1.72 +  // NOT IMPLEMENTED
    1.73 +  //DOMString isProtocolHandlerRegistered(DOMString scheme, DOMString url);
    1.74 +  //DOMString isContentHandlerRegistered(DOMString mimeType, DOMString url);
    1.75 +  //void unregisterProtocolHandler(DOMString scheme, DOMString url);
    1.76 +  //void unregisterContentHandler(DOMString mimeType, DOMString url);
    1.77 +};
    1.78 +
    1.79 +[NoInterfaceObject]
    1.80 +interface NavigatorStorageUtils {
    1.81 +  // NOT IMPLEMENTED
    1.82 +  //void yieldForStorageUpdates();
    1.83 +};
    1.84 +
    1.85 +// Things that definitely need to be in the spec and and are not for some
    1.86 +// reason.  See https://www.w3.org/Bugs/Public/show_bug.cgi?id=22406
    1.87 +partial interface Navigator {
    1.88 +  [Throws]
    1.89 +  readonly attribute MimeTypeArray mimeTypes;
    1.90 +  [Throws]
    1.91 +  readonly attribute PluginArray plugins;
    1.92 +};
    1.93 +
    1.94 +// http://www.w3.org/TR/tracking-dnt/ sort of
    1.95 +partial interface Navigator {
    1.96 +  readonly attribute DOMString doNotTrack;
    1.97 +};
    1.98 +
    1.99 +// http://www.w3.org/TR/geolocation-API/#geolocation_interface
   1.100 +[NoInterfaceObject]
   1.101 +interface NavigatorGeolocation {
   1.102 +  [Throws, Pref="geo.enabled"]
   1.103 +  readonly attribute Geolocation geolocation;
   1.104 +};
   1.105 +Navigator implements NavigatorGeolocation;
   1.106 +
   1.107 +// http://www.w3.org/TR/battery-status/#navigatorbattery-interface
   1.108 +[NoInterfaceObject]
   1.109 +interface NavigatorBattery {
   1.110 +    // XXXbz Per spec this should be non-nullable, but we return null in
   1.111 +    // torn-down windows.  See bug 884925.
   1.112 +    [Throws, Func="Navigator::HasBatterySupport"]
   1.113 +    readonly attribute BatteryManager? battery;
   1.114 +};
   1.115 +Navigator implements NavigatorBattery;
   1.116 +
   1.117 +// https://wiki.mozilla.org/WebAPI/DataStore
   1.118 +[NoInterfaceObject]
   1.119 +interface NavigatorDataStore {
   1.120 +    [Throws, NewObject, Func="Navigator::HasDataStoreSupport"]
   1.121 +    Promise getDataStores(DOMString name);
   1.122 +};
   1.123 +Navigator implements NavigatorDataStore;
   1.124 +
   1.125 +// http://www.w3.org/TR/vibration/#vibration-interface
   1.126 +partial interface Navigator {
   1.127 +    // We don't support sequences in unions yet
   1.128 +    //boolean vibrate ((unsigned long or sequence<unsigned long>) pattern);
   1.129 +    boolean vibrate(unsigned long duration);
   1.130 +    boolean vibrate(sequence<unsigned long> pattern);
   1.131 +};
   1.132 +
   1.133 +// http://www.w3.org/TR/pointerevents/#extensions-to-the-navigator-interface
   1.134 +partial interface Navigator {
   1.135 +    [Pref="dom.w3c_pointer_events.enabled"]
   1.136 +    readonly attribute long maxTouchPoints;
   1.137 +};
   1.138 +
   1.139 +// Mozilla-specific extensions
   1.140 +
   1.141 +callback interface MozIdleObserver {
   1.142 +  // Time is in seconds and is read only when idle observers are added
   1.143 +  // and removed.
   1.144 +  readonly attribute unsigned long time;
   1.145 +  void onidle();
   1.146 +  void onactive();
   1.147 +};
   1.148 +
   1.149 +// nsIDOMNavigator
   1.150 +partial interface Navigator {
   1.151 +  [Throws]
   1.152 +  readonly attribute DOMString oscpu;
   1.153 +  // WebKit/Blink support this; Trident/Presto do not.
   1.154 +  readonly attribute DOMString vendor;
   1.155 +  // WebKit/Blink supports this (hardcoded ""); Trident/Presto do not.
   1.156 +  readonly attribute DOMString vendorSub;
   1.157 +  // WebKit/Blink supports this (hardcoded "20030107"); Trident/Presto don't
   1.158 +  readonly attribute DOMString productSub;
   1.159 +  // WebKit/Blink/Trident/Presto support this.
   1.160 +  readonly attribute boolean cookieEnabled;
   1.161 +  [Throws]
   1.162 +  readonly attribute DOMString buildID;
   1.163 +  [Throws, Func="Navigator::HasPowerSupport"]
   1.164 +  readonly attribute MozPowerManager mozPower;
   1.165 +
   1.166 +  // WebKit/Blink/Trident/Presto support this.
   1.167 +  [Throws]
   1.168 +  boolean javaEnabled();
   1.169 +
   1.170 +  /**
   1.171 +   * Navigator requests to add an idle observer to the existing window.
   1.172 +   */
   1.173 +  [Throws, Func="Navigator::HasIdleSupport"]
   1.174 +  void addIdleObserver(MozIdleObserver aIdleObserver);
   1.175 +
   1.176 +  /**
   1.177 +   * Navigator requests to remove an idle observer from the existing window.
   1.178 +   */
   1.179 +  [Throws, Func="Navigator::HasIdleSupport"]
   1.180 +  void removeIdleObserver(MozIdleObserver aIdleObserver);
   1.181 +
   1.182 +  /**
   1.183 +   * Request a wake lock for a resource.
   1.184 +   *
   1.185 +   * A page holds a wake lock to request that a resource not be turned
   1.186 +   * off (or otherwise made unavailable).
   1.187 +   *
   1.188 +   * The topic is the name of a resource that might be made unavailable for
   1.189 +   * various reasons. For example, on a mobile device the power manager might
   1.190 +   * decide to turn off the screen after a period of idle time to save power.
   1.191 +   *
   1.192 +   * The resource manager checks the lock state of a topic before turning off
   1.193 +   * the associated resource. For example, a page could hold a lock on the
   1.194 +   * "screen" topic to prevent the screensaver from appearing or the screen
   1.195 +   * from turning off.
   1.196 +   *
   1.197 +   * The resource manager defines what each topic means and sets policy.  For
   1.198 +   * example, the resource manager might decide to ignore 'screen' wake locks
   1.199 +   * held by pages which are not visible.
   1.200 +   *
   1.201 +   * One topic can be locked multiple times; it is considered released only when
   1.202 +   * all locks on the topic have been released.
   1.203 +   *
   1.204 +   * The returned MozWakeLock object is a token of the lock.  You can
   1.205 +   * unlock the lock via the object's |unlock| method.  The lock is released
   1.206 +   * automatically when its associated window is unloaded.
   1.207 +   *
   1.208 +   * @param aTopic resource name
   1.209 +   */
   1.210 +  [Throws, Pref="dom.wakelock.enabled", Func="Navigator::HasWakeLockSupport"]
   1.211 +  MozWakeLock requestWakeLock(DOMString aTopic);
   1.212 +};
   1.213 +
   1.214 +// nsIDOMNavigatorDeviceStorage
   1.215 +partial interface Navigator {
   1.216 +  [Throws, Pref="device.storage.enabled"]
   1.217 +  DeviceStorage? getDeviceStorage(DOMString type);
   1.218 +  [Throws, Pref="device.storage.enabled"]
   1.219 +  sequence<DeviceStorage> getDeviceStorages(DOMString type);
   1.220 +};
   1.221 +
   1.222 +// nsIDOMNavigatorDesktopNotification
   1.223 +partial interface Navigator {
   1.224 +  [Throws, Func="Navigator::HasDesktopNotificationSupport"]
   1.225 +  readonly attribute DesktopNotificationCenter mozNotification;
   1.226 +};
   1.227 +
   1.228 +// nsIDOMClientInformation
   1.229 +partial interface Navigator {
   1.230 +  [Throws]
   1.231 +  boolean mozIsLocallyAvailable(DOMString uri, boolean whenOffline);
   1.232 +};
   1.233 +
   1.234 +// nsIDOMMozNavigatorMobileMessage
   1.235 +interface MozMobileMessageManager;
   1.236 +partial interface Navigator {
   1.237 +  [Func="Navigator::HasMobileMessageSupport"]
   1.238 +  readonly attribute MozMobileMessageManager? mozMobileMessage;
   1.239 +};
   1.240 +
   1.241 +// NetworkInformation
   1.242 +partial interface Navigator {
   1.243 +  [Throws, Pref="dom.netinfo.enabled"]
   1.244 +  readonly attribute NetworkInformation connection;
   1.245 +};
   1.246 +
   1.247 +// nsIDOMNavigatorCamera
   1.248 +partial interface Navigator {
   1.249 +  [Throws, Func="Navigator::HasCameraSupport"]
   1.250 +  readonly attribute CameraManager mozCameras;
   1.251 +};
   1.252 +
   1.253 +// nsIDOMNavigatorSystemMessages and sort of maybe
   1.254 +// http://www.w3.org/2012/sysapps/runtime/#extension-to-the-navigator-interface-1
   1.255 +callback systemMessageCallback = void (optional object message);
   1.256 +partial interface Navigator {
   1.257 +  [Throws, Pref="dom.sysmsg.enabled"]
   1.258 +  void    mozSetMessageHandler (DOMString type, systemMessageCallback? callback);
   1.259 +  [Throws, Pref="dom.sysmsg.enabled"]
   1.260 +  boolean mozHasPendingMessage (DOMString type);
   1.261 +};
   1.262 +
   1.263 +#ifdef MOZ_B2G_RIL
   1.264 +partial interface Navigator {
   1.265 +  [Throws, Func="Navigator::HasMobileConnectionSupport"]
   1.266 +  readonly attribute MozMobileConnectionArray mozMobileConnections;
   1.267 +};
   1.268 +
   1.269 +partial interface Navigator {
   1.270 +  [Throws, Func="Navigator::HasCellBroadcastSupport"]
   1.271 +  readonly attribute MozCellBroadcast mozCellBroadcast;
   1.272 +};
   1.273 +
   1.274 +partial interface Navigator {
   1.275 +  [Throws, Func="Navigator::HasVoicemailSupport"]
   1.276 +  readonly attribute MozVoicemail mozVoicemail;
   1.277 +};
   1.278 +
   1.279 +partial interface Navigator {
   1.280 +  [Throws, Func="Navigator::HasIccManagerSupport"]
   1.281 +  readonly attribute MozIccManager? mozIccManager;
   1.282 +};
   1.283 +#endif // MOZ_B2G_RIL
   1.284 +
   1.285 +partial interface Navigator {
   1.286 +  [Throws, Func="Navigator::HasTelephonySupport"]
   1.287 +  readonly attribute Telephony? mozTelephony;
   1.288 +};
   1.289 +
   1.290 +#ifdef MOZ_GAMEPAD
   1.291 +// https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
   1.292 +partial interface Navigator {
   1.293 +  [Throws, Pref="dom.gamepad.enabled"]
   1.294 +  sequence<Gamepad?> getGamepads();
   1.295 +};
   1.296 +#endif // MOZ_GAMEPAD
   1.297 +
   1.298 +#ifdef MOZ_B2G_BT
   1.299 +partial interface Navigator {
   1.300 +  [Throws, Func="Navigator::HasBluetoothSupport"]
   1.301 +  readonly attribute BluetoothManager mozBluetooth;
   1.302 +};
   1.303 +#endif // MOZ_B2G_BT
   1.304 +
   1.305 +#ifdef MOZ_B2G_FM
   1.306 +partial interface Navigator {
   1.307 +  [Throws, Func="Navigator::HasFMRadioSupport"]
   1.308 +  readonly attribute FMRadio mozFMRadio;
   1.309 +};
   1.310 +#endif // MOZ_B2G_FM
   1.311 +
   1.312 +#ifdef MOZ_TIME_MANAGER
   1.313 +// nsIDOMMozNavigatorTime
   1.314 +partial interface Navigator {
   1.315 +  [Throws, Func="Navigator::HasTimeSupport"]
   1.316 +  readonly attribute MozTimeManager mozTime;
   1.317 +};
   1.318 +#endif // MOZ_TIME_MANAGER
   1.319 +
   1.320 +#ifdef MOZ_AUDIO_CHANNEL_MANAGER
   1.321 +// nsIMozNavigatorAudioChannelManager
   1.322 +partial interface Navigator {
   1.323 +  [Throws]
   1.324 +  readonly attribute AudioChannelManager mozAudioChannelManager;
   1.325 +};
   1.326 +#endif // MOZ_AUDIO_CHANNEL_MANAGER
   1.327 +
   1.328 +#ifdef MOZ_MEDIA_NAVIGATOR
   1.329 +callback NavigatorUserMediaSuccessCallback = void (MediaStream stream);
   1.330 +callback NavigatorUserMediaErrorCallback = void (DOMString error);
   1.331 +
   1.332 +partial interface Navigator {
   1.333 +  [Throws, Func="Navigator::HasUserMediaSupport"]
   1.334 +  void mozGetUserMedia(MediaStreamConstraints constraints,
   1.335 +                       NavigatorUserMediaSuccessCallback successCallback,
   1.336 +                       NavigatorUserMediaErrorCallback errorCallback);
   1.337 +};
   1.338 +
   1.339 +// nsINavigatorUserMedia
   1.340 +callback MozGetUserMediaDevicesSuccessCallback = void (nsIVariant? devices);
   1.341 +partial interface Navigator {
   1.342 +  [Throws, ChromeOnly]
   1.343 +  void mozGetUserMediaDevices(MediaStreamConstraints constraints,
   1.344 +                              MozGetUserMediaDevicesSuccessCallback onsuccess,
   1.345 +                              NavigatorUserMediaErrorCallback onerror,
   1.346 +                              // The originating innerWindowID is needed to
   1.347 +                              // avoid calling the callbacks if the window has
   1.348 +                              // navigated away. It is optional only as legacy.
   1.349 +                              optional unsigned long long innerWindowID = 0);
   1.350 +};
   1.351 +#endif // MOZ_MEDIA_NAVIGATOR
   1.352 +
   1.353 +partial interface Navigator {
   1.354 +  [Throws, Pref="beacon.enabled"]
   1.355 +  boolean sendBeacon(DOMString url,
   1.356 +                     optional (ArrayBufferView or Blob or DOMString or FormData)? data = null);
   1.357 +};

mercurial