Bug 942104 - Avoid exposing Bluetooth interface to all web pages, r=bz
☠☠ backed out by 84bba7b978f7 ☠ ☠
authorEric Chou <echou@mozilla.com>
Thu, 22 May 2014 14:09:33 +0800
changeset 203625 74dd14f065b697822005600ac2d51b8411596fb5
parent 203624 3d4aedbd3784847b91e2ce04aa1e0f836b7d420a
child 203626 c0f93e0fb095a25761db23f2c8d7356cadb20347
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs942104
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 942104 - Avoid exposing Bluetooth interface to all web pages, r=bz Current Bluetooth related webidl implementation would make interfaces such as BluetoothAdapter exposed to all web pages, and obviously we don't want to see that.
dom/bindings/Bindings.conf
dom/bluetooth/moz.build
dom/webidl/BluetoothAdapter.webidl
dom/webidl/BluetoothDevice.webidl
dom/webidl/BluetoothDeviceEvent.webidl
dom/webidl/BluetoothManager.webidl
dom/webidl/BluetoothStatusChangedEvent.webidl
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -154,27 +154,24 @@ DOMInterfaces = {
 
 'BatteryManager': {
     'nativeType': 'mozilla::dom::battery::BatteryManager',
     'headerFile': 'BatteryManager.h'
 },
 
 'BluetoothAdapter': {
     'nativeType': 'mozilla::dom::bluetooth::BluetoothAdapter',
-    'headerFile': 'BluetoothAdapter.h'
 },
 
 'BluetoothDevice': {
     'nativeType': 'mozilla::dom::bluetooth::BluetoothDevice',
-    'headerFile': 'BluetoothDevice.h'
 },
 
 'BluetoothManager': {
     'nativeType': 'mozilla::dom::bluetooth::BluetoothManager',
-    'headerFile': 'BluetoothManager.h'
 },
 
 'CameraCapabilities': {
     'nativeType': 'mozilla::dom::CameraCapabilities',
     'headerFile': 'DOMCameraCapabilities.h'
 },
 
 'CameraControl': {
--- a/dom/bluetooth/moz.build
+++ b/dom/bluetooth/moz.build
@@ -86,17 +86,20 @@ if CONFIG['MOZ_B2G_BT']:
         'ipc',
     ]
 
 EXPORTS.mozilla.dom.bluetooth.ipc += [
     'ipc/BluetoothMessageUtils.h',
 ]
 
 EXPORTS.mozilla.dom.bluetooth += [
+    'BluetoothAdapter.h',
     'BluetoothCommon.h',
+    'BluetoothDevice.h',
+    'BluetoothManager.h',
 ]
 
 IPDL_SOURCES += [
     'ipc/BluetoothTypes.ipdlh',
     'ipc/PBluetooth.ipdl',
     'ipc/PBluetoothRequest.ipdl',
 ]
 
--- a/dom/webidl/BluetoothAdapter.webidl
+++ b/dom/webidl/BluetoothAdapter.webidl
@@ -27,16 +27,17 @@ dictionary MediaPlayStatus
   // current track length (ms)
   long long   duration = -1;
   // playing time (ms)
   long long   position = -1;
   // one of 'STOPPED'/'PLAYING'/'PAUSED'/'FWD_SEEK'/'REV_SEEK'/'ERROR'
   DOMString   playStatus = "";
 };
 
+[Func="Navigator::HasBluetoothSupport"]
 interface BluetoothAdapter : EventTarget {
   readonly attribute DOMString      address;
   readonly attribute unsigned long  class;
   readonly attribute boolean        discovering;
   readonly attribute DOMString      name;
   readonly attribute boolean        discoverable;
   readonly attribute unsigned long  discoverableTimeout; // in seconds
 
--- a/dom/webidl/BluetoothDevice.webidl
+++ b/dom/webidl/BluetoothDevice.webidl
@@ -1,14 +1,15 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+[Func="Navigator::HasBluetoothSupport"]
 interface BluetoothDevice : EventTarget {
   readonly attribute DOMString      address;
   readonly attribute DOMString      name;
   readonly attribute DOMString      icon;
   readonly attribute boolean        connected;
   readonly attribute boolean        paired;
   readonly attribute unsigned long  class;
 
--- a/dom/webidl/BluetoothDeviceEvent.webidl
+++ b/dom/webidl/BluetoothDeviceEvent.webidl
@@ -1,15 +1,16 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-[Constructor(DOMString type, optional BluetoothDeviceEventInit eventInitDict)]
+[Constructor(DOMString type, optional BluetoothDeviceEventInit eventInitDict),
+ Func="Navigator::HasBluetoothSupport"]
 interface BluetoothDeviceEvent : Event
 {
   readonly attribute BluetoothDevice? device;
 };
 
 dictionary BluetoothDeviceEventInit : EventInit
 {
   BluetoothDevice? device = null;
--- a/dom/webidl/BluetoothManager.webidl
+++ b/dom/webidl/BluetoothManager.webidl
@@ -1,13 +1,14 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+[Func="Navigator::HasBluetoothSupport"]
 interface BluetoothManager : EventTarget {
   [Throws]
   readonly attribute boolean      enabled;
 
            attribute EventHandler onenabled;
            attribute EventHandler ondisabled;
            attribute EventHandler onadapteradded;
 
--- a/dom/webidl/BluetoothStatusChangedEvent.webidl
+++ b/dom/webidl/BluetoothStatusChangedEvent.webidl
@@ -1,15 +1,17 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-[Constructor(DOMString type, optional BluetoothStatusChangedEventInit eventInitDict)]
+[Constructor(DOMString type,
+             optional BluetoothStatusChangedEventInit eventInitDict),
+ Func="Navigator::HasBluetoothSupport"]
 interface BluetoothStatusChangedEvent : Event
 {
   readonly attribute DOMString address;
   readonly attribute boolean status;
 };
 
 dictionary BluetoothStatusChangedEventInit : EventInit
 {