Merge m-c to b2g-inbound. a=merge
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 18 Jul 2014 10:26:13 -0400
changeset 216846 a6ad0f6af77e8699120aae9a1afe991070233010
parent 216845 552adee6dad953e6d9e7686b3f388518f2fd0b91 (current diff)
parent 216714 330ba968ed6153bce59d4aa3dc74d27f1b7d3001 (diff)
child 216847 f796f0862a62b473ac12ec6fe0e223f5eb0ec969
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone33.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
Merge m-c to b2g-inbound. a=merge
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -346,17 +346,17 @@ let AdbController = {
       if (this.DEBUG) {
         this.debug("updateState: Waiting for all vars to be initialized");
       }
       return;
     }
 
     // Check if we have a remote debugging session going on. If so, we won't
     // disable adb even if the screen is locked.
-    let isDebugging = USBRemoteDebugger.isDebugging;
+    let isDebugging = RemoteDebugger.isDebugging;
     if (this.DEBUG) {
       this.debug("isDebugging=" + isDebugging);
     }
 
     // If USB Mass Storage, USB tethering, or a debug session is active,
     // then we don't want to disable adb in an automatic fashion (i.e.
     // when the screen locks or due to timeout).
     let sysUsbConfig = libcutils.property_get("sys.usb.config");
@@ -427,88 +427,55 @@ let AdbController = {
 };
 
 SettingsListener.observe("lockscreen.locked", false,
                          AdbController.setLockscreenState.bind(AdbController));
 SettingsListener.observe("lockscreen.enabled", false,
                          AdbController.setLockscreenEnabled.bind(AdbController));
 #endif
 
-(function() {
-  // Track these separately here so we can determine the correct value for the
-  // pref "devtools.debugger.remote-enabled", which is true when either mode of
-  // using DevTools is enabled.
-  let devtoolsUSB = false;
-  let devtoolsWiFi = false;
-
-  // Keep the old setting to not break people that won't have updated
-  // gaia and gecko.
-  SettingsListener.observe('devtools.debugger.remote-enabled', false,
-                           function(value) {
-    devtoolsUSB = value;
-    Services.prefs.setBoolPref('devtools.debugger.remote-enabled',
-                               devtoolsUSB || devtoolsWiFi);
-    // This preference is consulted during startup
-    Services.prefs.savePrefFile(null);
-    try {
-      value ? USBRemoteDebugger.start() : USBRemoteDebugger.stop();
-    } catch(e) {
-      dump("Error while initializing USB devtools: "
-           + e + "\n" + e.stack + "\n");
-    }
+// Keep the old setting to not break people that won't have updated
+// gaia and gecko.
+SettingsListener.observe('devtools.debugger.remote-enabled', false, function(value) {
+  Services.prefs.setBoolPref('devtools.debugger.remote-enabled', value);
+  // This preference is consulted during startup
+  Services.prefs.savePrefFile(null);
+  try {
+    value ? RemoteDebugger.start() : RemoteDebugger.stop();
+  } catch(e) {
+    dump("Error while initializing devtools: " + e + "\n" + e.stack + "\n");
+  }
 
 #ifdef MOZ_WIDGET_GONK
-    AdbController.setRemoteDebuggerState(value);
+  AdbController.setRemoteDebuggerState(value);
 #endif
-  });
+});
 
-  SettingsListener.observe('debugger.remote-mode', false, function(value) {
-    if (['disabled', 'adb-only', 'adb-devtools'].indexOf(value) == -1) {
-      dump('Illegal value for debugger.remote-mode: ' + value + '\n');
-      return;
-    }
+SettingsListener.observe('debugger.remote-mode', false, function(value) {
+  if (['disabled', 'adb-only', 'adb-devtools'].indexOf(value) == -1) {
+    dump('Illegal value for debugger.remote-mode: ' + value + '\n');
+    return;
+  }
 
-    devtoolsUSB = value == 'adb-devtools';
-    Services.prefs.setBoolPref('devtools.debugger.remote-enabled',
-                               devtoolsUSB || devtoolsWiFi);
-    // This preference is consulted during startup
-    Services.prefs.savePrefFile(null);
+  Services.prefs.setBoolPref('devtools.debugger.remote-enabled',
+                             value == 'adb-devtools');
+  // This preference is consulted during startup
+  Services.prefs.savePrefFile(null);
 
-    try {
-      (value == 'adb-devtools') ? USBRemoteDebugger.start()
-                                : USBRemoteDebugger.stop();
-    } catch(e) {
-      dump("Error while initializing USB devtools: "
-           + e + "\n" + e.stack + "\n");
-    }
+  try {
+    (value == 'adb-devtools') ? RemoteDebugger.start()
+                              : RemoteDebugger.stop();
+  } catch(e) {
+    dump("Error while initializing devtools: " + e + "\n" + e.stack + "\n");
+  }
 
 #ifdef MOZ_WIDGET_GONK
-    AdbController.setRemoteDebuggerState(value != 'disabled');
+  AdbController.setRemoteDebuggerState(value != 'disabled');
 #endif
-  });
-
-  SettingsListener.observe('devtools.remote.wifi.enabled', false,
-                           function(value) {
-    devtoolsWiFi = value;
-    Services.prefs.setBoolPref('devtools.debugger.remote-enabled',
-                               devtoolsUSB || devtoolsWiFi);
-    // Allow remote debugging on non-local interfaces when WiFi debug is enabled
-    // TODO: Bug 1034411: Lock down to WiFi interface, instead of all interfaces
-    Services.prefs.setBoolPref('devtools.debugger.force-local', !value);
-    // This preference is consulted during startup
-    Services.prefs.savePrefFile(null);
-
-    try {
-      value ? WiFiRemoteDebugger.start() : WiFiRemoteDebugger.stop();
-    } catch(e) {
-      dump("Error while initializing WiFi devtools: "
-           + e + "\n" + e.stack + "\n");
-    }
-  });
-})();
+});
 
 // =================== Device Storage ====================
 SettingsListener.observe('device.storage.writable.name', 'sdcard', function(value) {
   if (Services.prefs.getPrefType('device.storage.writable.name') != Ci.nsIPrefBranch.PREF_STRING) {
     // We clear the pref because it used to be erroneously written as a bool
     // and we need to clear it before we can change it to have the correct type.
     Services.prefs.clearUserPref('device.storage.writable.name');
   }
@@ -685,19 +652,16 @@ let settingsToObserve = {
     prefName: 'layers.offmainthreadcomposition.log-animations',
     defaultValue: false
   },
   'debug.paint-flashing.enabled': {
     prefName: 'nglayout.debug.paint_flashing',
     defaultValue: false
   },
   'devtools.eventlooplag.threshold': 100,
-  'devtools.remote.wifi.visible': {
-    resetToPref: true
-  },
   'dom.mozApps.use_reviewer_certs': false,
   'layers.draw-borders': false,
   'layers.draw-tile-borders': false,
   'layers.dump': false,
   'layers.enable-tiles': true,
   'layers.simple-tiles': false,
   'privacy.donottrackheader.enabled': false,
   'ril.radio.disabled': false,
--- a/b2g/chrome/content/shell.js
+++ b/b2g/chrome/content/shell.js
@@ -51,26 +51,16 @@ XPCOMUtils.defineLazyServiceGetter(Servi
                                    '@mozilla.org/focus-manager;1',
                                    'nsIFocusManager');
 
 XPCOMUtils.defineLazyGetter(this, 'DebuggerServer', function() {
   Cu.import('resource://gre/modules/devtools/dbg-server.jsm');
   return DebuggerServer;
 });
 
-XPCOMUtils.defineLazyGetter(this, 'devtools', function() {
-  const { devtools } =
-    Cu.import('resource://gre/modules/devtools/Loader.jsm', {});
-  return devtools;
-});
-
-XPCOMUtils.defineLazyGetter(this, 'discovery', function() {
-  return devtools.require('devtools/toolkit/discovery/discovery');
-});
-
 XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
   return Cc["@mozilla.org/parentprocessmessagemanager;1"]
          .getService(Ci.nsIMessageListenerManager);
 });
 
 #ifdef MOZ_WIDGET_GONK
 XPCOMUtils.defineLazyGetter(this, "libcutils", function () {
   Cu.import("resource://gre/modules/systemlibs.js");
@@ -811,21 +801,20 @@ let IndexedDBPromptHelper = {
 
     setTimeout(function() {
       observer.observe(null, responseTopic,
                        Ci.nsIPermissionManager.DENY_ACTION);
     }, 0);
   }
 }
 
-function RemoteDebugger() {}
-RemoteDebugger.prototype = {
+let RemoteDebugger = {
   _promptDone: false,
   _promptAnswer: false,
-  _listener: null,
+  _running: false,
 
   prompt: function debugger_prompt() {
     this._promptDone = false;
 
     shell.sendChromeEvent({
       "type": "remote-debugger-prompt"
     });
 
@@ -836,156 +825,118 @@ RemoteDebugger.prototype = {
     return this._promptAnswer;
   },
 
   handleEvent: function debugger_handleEvent(detail) {
     this._promptAnswer = detail.value;
     this._promptDone = true;
   },
 
-  initServer: function() {
-    if (DebuggerServer.initialized) {
-      return;
-    }
-
-    // Ask for remote connections.
-    DebuggerServer.init(this.prompt.bind(this));
-
-    // /!\ Be careful when adding a new actor, especially global actors.
-    // Any new global actor will be exposed and returned by the root actor.
-
-    // Add Firefox-specific actors, but prevent tab actors to be loaded in
-    // the parent process, unless we enable certified apps debugging.
-    let restrictPrivileges = Services.prefs.getBoolPref("devtools.debugger.forbid-certified-apps");
-    DebuggerServer.addBrowserActors("navigator:browser", restrictPrivileges);
-
-    /**
-     * Construct a root actor appropriate for use in a server running in B2G.
-     * The returned root actor respects the factories registered with
-     * DebuggerServer.addGlobalActor only if certified apps debugging is on,
-     * otherwise we used an explicit limited list of global actors
-     *
-     * * @param connection DebuggerServerConnection
-     *        The conection to the client.
-     */
-    DebuggerServer.createRootActor = function createRootActor(connection)
-    {
-      let { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
-      let parameters = {
-        // We do not expose browser tab actors yet,
-        // but we still have to define tabList.getList(),
-        // otherwise, client won't be able to fetch global actors
-        // from listTabs request!
-        tabList: {
-          getList: function() {
-            return promise.resolve([]);
-          }
-        },
-        // Use an explicit global actor list to prevent exposing
-        // unexpected actors
-        globalActorFactories: restrictPrivileges ? {
-          webappsActor: DebuggerServer.globalActorFactories.webappsActor,
-          deviceActor: DebuggerServer.globalActorFactories.deviceActor,
-        } : DebuggerServer.globalActorFactories
-      };
-      let { RootActor } = devtools.require("devtools/server/actors/root");
-      let root = new RootActor(connection, parameters);
-      root.applicationType = "operating-system";
-      return root;
-    };
-
-#ifdef MOZ_WIDGET_GONK
-    DebuggerServer.on("connectionchange", function() {
-      AdbController.updateState();
-    });
-#endif
-  }
-};
-
-let USBRemoteDebugger = new RemoteDebugger();
-
-Object.defineProperty(USBRemoteDebugger, "isDebugging", {
-  get: function() {
-    if (!this._listener) {
+  get isDebugging() {
+    if (!this._running) {
       return false;
     }
 
     return DebuggerServer._connections &&
            Object.keys(DebuggerServer._connections).length > 0;
-  }
-});
+  },
+
+  // Start the debugger server.
+  start: function debugger_start() {
+    if (this._running) {
+      return;
+    }
 
-USBRemoteDebugger.start = function() {
-  if (this._listener) {
-    return;
-  }
+    if (!DebuggerServer.initialized) {
+      // Ask for remote connections.
+      DebuggerServer.init(this.prompt.bind(this));
 
-  this.initServer();
+      // /!\ Be careful when adding a new actor, especially global actors.
+      // Any new global actor will be exposed and returned by the root actor.
 
-  let portOrPath =
-    Services.prefs.getCharPref("devtools.debugger.unix-domain-socket") ||
-    "/data/local/debugger-socket";
+      // Add Firefox-specific actors, but prevent tab actors to be loaded in
+      // the parent process, unless we enable certified apps debugging.
+      let restrictPrivileges = Services.prefs.getBoolPref("devtools.debugger.forbid-certified-apps");
+      DebuggerServer.addBrowserActors("navigator:browser", restrictPrivileges);
 
-  try {
-    debug("Starting USB debugger on " + portOrPath);
-    this._listener = DebuggerServer.openListener(portOrPath);
-    // Temporary event, until bug 942756 lands and offers a way to know
-    // when the server is up and running.
-    Services.obs.notifyObservers(null, 'debugger-server-started', null);
-  } catch (e) {
-    debug('Unable to start USB debugger server: ' + e);
-  }
-};
+      /**
+       * Construct a root actor appropriate for use in a server running in B2G.
+       * The returned root actor respects the factories registered with
+       * DebuggerServer.addGlobalActor only if certified apps debugging is on,
+       * otherwise we used an explicit limited list of global actors
+       *
+       * * @param connection DebuggerServerConnection
+       *        The conection to the client.
+       */
+      DebuggerServer.createRootActor = function createRootActor(connection)
+      {
+        let { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
+        let parameters = {
+          // We do not expose browser tab actors yet,
+          // but we still have to define tabList.getList(),
+          // otherwise, client won't be able to fetch global actors
+          // from listTabs request!
+          tabList: {
+            getList: function() {
+              return promise.resolve([]);
+            }
+          },
+          // Use an explicit global actor list to prevent exposing
+          // unexpected actors
+          globalActorFactories: restrictPrivileges ? {
+            webappsActor: DebuggerServer.globalActorFactories.webappsActor,
+            deviceActor: DebuggerServer.globalActorFactories.deviceActor,
+          } : DebuggerServer.globalActorFactories
+        };
+        let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
+        let { RootActor } = devtools.require("devtools/server/actors/root");
+        let root = new RootActor(connection, parameters);
+        root.applicationType = "operating-system";
+        return root;
+      };
 
-USBRemoteDebugger.stop = function() {
-  if (!this._listener) {
-    return;
-  }
+#ifdef MOZ_WIDGET_GONK
+      DebuggerServer.on("connectionchange", function() {
+        AdbController.updateState();
+      });
+#endif
+    }
 
-  try {
-    this._listener.close();
-    this._listener = null;
-  } catch (e) {
-    debug('Unable to stop USB debugger server: ' + e);
+    let path = Services.prefs.getCharPref("devtools.debugger.unix-domain-socket") ||
+               "/data/local/debugger-socket";
+    try {
+      DebuggerServer.openListener(path);
+      // Temporary event, until bug 942756 lands and offers a way to know
+      // when the server is up and running.
+      Services.obs.notifyObservers(null, 'debugger-server-started', null);
+      this._running = true;
+    } catch (e) {
+      dump('Unable to start debugger server: ' + e + '\n');
+    }
+  },
+
+  stop: function debugger_stop() {
+    if (!this._running) {
+      return;
+    }
+
+    if (!DebuggerServer.initialized) {
+      // Can this really happen if we are running?
+      this._running = false;
+      return;
+    }
+
+    try {
+      DebuggerServer.closeAllListeners();
+    } catch (e) {
+      dump('Unable to stop debugger server: ' + e + '\n');
+    }
+    this._running = false;
   }
-};
-
-let WiFiRemoteDebugger = new RemoteDebugger();
-
-WiFiRemoteDebugger.start = function() {
-  if (this._listener) {
-    return;
-  }
-
-  this.initServer();
-
-  try {
-    debug("Starting WiFi debugger");
-    this._listener = DebuggerServer.openListener(-1);
-    let port = this._listener.port;
-    debug("Started WiFi debugger on " + port);
-    discovery.addService("devtools", { port: port });
-  } catch (e) {
-    debug('Unable to start WiFi debugger server: ' + e);
-  }
-};
-
-WiFiRemoteDebugger.stop = function() {
-  if (!this._listener) {
-    return;
-  }
-
-  try {
-    discovery.removeService("devtools");
-    this._listener.close();
-    this._listener = null;
-  } catch (e) {
-    debug('Unable to stop WiFi debugger server: ' + e);
-  }
-};
+}
 
 let KeyboardHelper = {
   handleEvent: function keyboard_handleEvent(detail) {
     Keyboard.setLayouts(detail.layouts);
   }
 };
 
 // This is the backend for Gaia's screenshot feature.  Gaia requests a
--- a/configure.in
+++ b/configure.in
@@ -5015,27 +5015,31 @@ dnl enable once Signaling lands
     AC_DEFINE(MOZ_WEBRTC_SIGNALING)
 dnl enable once PeerConnection lands
     MOZ_PEERCONNECTION=1
     AC_DEFINE(MOZ_PEERCONNECTION)
     MOZ_SCTP=1
     MOZ_SRTP=1
     AC_DEFINE(MOZ_SCTP)
     AC_DEFINE(MOZ_SRTP)
+    if test -n "$MOZ_X11"; then
+      MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
+    fi
 else
     MOZ_SYNTH_PICO=
 fi
 
 AC_SUBST(MOZ_WEBRTC)
 AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
 AC_SUBST(MOZ_WEBRTC_SIGNALING)
 AC_SUBST(MOZ_PEERCONNECTION)
 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
 AC_SUBST(MOZ_SCTP)
 AC_SUBST(MOZ_SRTP)
+AC_SUBST(MOZ_WEBRTC_X11_LIBS)
 
 dnl Use integers over floats for audio on B2G and Android, because audio
 dnl backends for those platforms don't support floats.
 if test "$OS_TARGET" = "Android"; then
     MOZ_SAMPLE_TYPE_S16=1
     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
 else
@@ -8127,17 +8131,17 @@ if test "$MOZ_TREE_CAIRO"; then
     AC_SUBST(QUARTZ_FONT_FEATURE)
     AC_SUBST(PNG_FUNCTIONS_FEATURE)
     AC_SUBST(QT_SURFACE_FEATURE)
     AC_SUBST(TEE_SURFACE_FEATURE)
 
     MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
 
     if test "$MOZ_X11"; then
-        MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXext -lXdamage -lXfixes -lXcomposite -lXrender"
+        MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
     fi
 
     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
 else
     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
--- a/media/webrtc/signaling/test/Makefile.in
+++ b/media/webrtc/signaling/test/Makefile.in
@@ -1,16 +1,17 @@
 # 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/. */
 
 LIBS = \
   $(XPCOM_LIBS) \
   $(NSPR_LIBS) \
   $(NSS_LIBS) \
+  $(MOZ_WEBRTC_X11_LIBS) \
   $(REALTIME_LIBS) \
   $(DEPTH)/xpcom/glue/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
   $(DEPTH)/media/mtransport/standalone/$(LIB_PREFIX)mtransport_s.$(LIB_SUFFIX) \
   $(DEPTH)/media/webrtc/signalingtest/signaling_ecc/$(LIB_PREFIX)ecc.$(LIB_SUFFIX) \
   $(DEPTH)/media/webrtc/signalingtest/signaling_sipcc/$(LIB_PREFIX)sipcc.$(LIB_SUFFIX) \
   $(DEPTH)/layout/media/webrtc/$(LIB_PREFIX)webrtc.$(LIB_SUFFIX) \
   $(DEPTH)/layout/media/$(LIB_PREFIX)gkmedias.$(LIB_SUFFIX) \
   $(DEPTH)/media/webrtc/trunk/testing/gtest_gtest/$(LIB_PREFIX)gtest.$(LIB_SUFFIX) \
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -649,20 +649,16 @@ pref("devtools.defaultColorUnit", "hex")
 
 // Used for devtools debugging
 pref("devtools.dump.emit", false);
 
 // Disable device discovery logging
 pref("devtools.discovery.log", false);
 // Disable scanning for DevTools devices via WiFi
 pref("devtools.remote.wifi.scan", false);
-// Hide UI options for controlling device visibility over WiFi
-// N.B.: This does not set whether the device can be discovered via WiFi, only
-// whether the UI control to make such a choice is shown to the user
-pref("devtools.remote.wifi.visible", false);
 
 // view source
 pref("view_source.syntax_highlight", true);
 pref("view_source.wrap_long_lines", false);
 pref("view_source.editor.external", false);
 pref("view_source.editor.path", "");
 // allows to add further arguments to the editor; use the %LINE% placeholder
 // for jumping to a specific line (e.g. "/line:%LINE%" or "--goto %LINE%")
--- a/toolkit/library/libxul.mk
+++ b/toolkit/library/libxul.mk
@@ -46,16 +46,17 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 OS_LIBS += -lcups
 endif
 
 EXTRA_DSO_LDOPTS += \
   $(LIBS_DIR) \
   $(MOZ_JS_LIBS) \
   $(NSS_LIBS) \
   $(MOZ_CAIRO_OSLIBS) \
+  $(MOZ_WEBRTC_X11_LIBS) \
   $(MOZ_APP_EXTRA_LIBS) \
   $(SQLITE_LIBS) \
   $(NULL)
 
 ifdef ENABLE_INTL_API
 ifdef JS_SHARED_LIBRARY
 EXTRA_DSO_LDOPTS += $(MOZ_ICU_LIBS)
 endif
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
@@ -7,11 +7,12 @@ support-files =
   data/**
   xpcshell-shared.ini
 
 [include:xpcshell-shared.ini]
 
 [test_addon_path_service.js]
 [test_asyncBlocklistLoad.js]
 [test_DeferredSave.js]
-[test_XPIcancel.js]
 [test_metadata_update.js]
 [test_openh264.js]
+run-if = appname == "firefox"
+[test_XPIcancel.js]