Bug 1148307 - Part 5 - pref off data channel session transport, r=smaug
☠☠ backed out by 8e36a279195d ☠ ☠
authorJunior Hsu <juhsu@mozilla.com>
Mon, 11 Apr 2016 11:28:36 +0800
changeset 316368 4441e42e5bec17ebb8558b980adb2de087208041
parent 316367 3cb658c3e3f93eaa1403e9227b6f6a02630d4bf3
child 316369 efd6926125e25711dcd2dc7d390564652ac86b74
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1148307
milestone48.0a1
Bug 1148307 - Part 5 - pref off data channel session transport, r=smaug
dom/presentation/PresentationSessionInfo.cpp
modules/libpref/init/all.js
--- a/dom/presentation/PresentationSessionInfo.cpp
+++ b/dom/presentation/PresentationSessionInfo.cpp
@@ -834,16 +834,18 @@ NS_IMETHODIMP
 PresentationPresentingInfo::OnError(nsresult reason)
 {
   return PresentationSessionInfo::OnError(reason);
 }
 
 nsresult
 PresentationPresentingInfo::InitTransportAndSendAnswer()
 {
+  MOZ_ASSERT(NS_IsMainThread());
+
   uint8_t type = 0;
   nsresult rv = mRequesterDescription->GetType(&type);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (type == nsIPresentationChannelDescription::TYPE_TCP) {
     // Establish a data transport channel |mTransport| to the sender and use
@@ -855,16 +857,19 @@ PresentationPresentingInfo::InitTranspor
     }
 
     mBuilder = builder;
     mTransportType = nsIPresentationChannelDescription::TYPE_TCP;
     return builder->BuildTCPReceiverTransport(mRequesterDescription, this);
   }
 
   if (type == nsIPresentationChannelDescription::TYPE_DATACHANNEL) {
+    if (!Preferences::GetBool("dom.presentation.session_transport.data_channel.enable")) {
+      return NS_ERROR_NOT_IMPLEMENTED;
+    }
     nsCOMPtr<nsIPresentationDataChannelSessionTransportBuilder> builder =
       do_CreateInstance("@mozilla.org/presentation/datachanneltransportbuilder;1");
 
     if (NS_WARN_IF(!builder)) {
       return NS_ERROR_NOT_AVAILABLE;
     }
 
     mBuilder = builder;
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5059,17 +5059,17 @@ pref("dom.udpsocket.enabled", false);
 pref("dom.beforeAfterKeyboardEvent.enabled", false);
 
 // Presentation API
 pref("dom.presentation.enabled", false);
 pref("dom.presentation.tcp_server.debug", false);
 pref("dom.presentation.discovery.enabled", false);
 pref("dom.presentation.discovery.timeout_ms", 10000);
 pref("dom.presentation.discoverable", false);
-pref("dom.presentation.session_transport.data_channel.enable", true);
+pref("dom.presentation.session_transport.data_channel.enable", false);
 
 #ifdef XP_MACOSX
 #if !defined(RELEASE_BUILD) || defined(DEBUG)
 // In non-release builds we crash by default on insecure text input (when a
 // password editor has focus but secure event input isn't enabled).  The
 // following pref, when turned on, disables this behavior.  See bug 1188425.
 pref("intl.allow-insecure-text-input", false);
 #endif