diff --git a/b2g/config/aries-l/sources.xml b/b2g/config/aries-l/sources.xml index f98b3992684..e4e95dd761a 100644 --- a/b2g/config/aries-l/sources.xml +++ b/b2g/config/aries-l/sources.xml @@ -21,7 +21,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index 7ac051087ba..98f9f438f73 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -21,7 +21,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 4486e7ec4b6..2421cb4f315 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -21,7 +21,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index f97c0613f90..2c3e03df1a7 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -21,7 +21,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index d15c190a63d..947499805cf 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -21,7 +21,7 @@ - + @@ -31,7 +31,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index d0f6254e655..829f2709b78 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -21,7 +21,7 @@ - + @@ -34,7 +34,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 9610a52adc6..2b580abe5fd 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -21,7 +21,7 @@ - + @@ -34,7 +34,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index f97c0613f90..2c3e03df1a7 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -21,7 +21,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index c4819f17e25..b749ca9f49a 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -21,7 +21,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 9d60d5c0185..f997cd82f7a 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "92ed2a5ffd685bc8797bb15a84307cafe6d04f64", + "git_revision": "385ec34c8fe447342e81a40b4e1cc9a80f37fc33", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "36973054378673c8a4a8bc5904f1c08f800b5c28", + "revision": "c53c24531e4d32550f37c5ff5359eb70af822a73", "repo_path": "integration/gaia-central" } diff --git a/b2g/config/nexus-4-kk/sources.xml b/b2g/config/nexus-4-kk/sources.xml index bfdcd6d031d..e622981f7a9 100644 --- a/b2g/config/nexus-4-kk/sources.xml +++ b/b2g/config/nexus-4-kk/sources.xml @@ -21,7 +21,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 5500269500e..5521a1df954 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -21,7 +21,7 @@ - + @@ -32,7 +32,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index b181d2d58d3..507821ae98c 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -21,7 +21,7 @@ - + @@ -35,7 +35,7 @@ - + diff --git a/dom/bluetooth/common/webapi/BluetoothAdapter.cpp b/dom/bluetooth/common/webapi/BluetoothAdapter.cpp index 34c5b4ab204..8d7918c45b8 100644 --- a/dom/bluetooth/common/webapi/BluetoothAdapter.cpp +++ b/dom/bluetooth/common/webapi/BluetoothAdapter.cpp @@ -458,7 +458,11 @@ BluetoothAdapter::SetPropertyByValue(const BluetoothNamedValue& aValue) } else if (name.EqualsLiteral("Name")) { RemoteNameToString(value.get_BluetoothRemoteName(), mName); } else if (name.EqualsLiteral("Address")) { - AddressToString(value.get_BluetoothAddress(), mAddress); + if (value.get_BluetoothAddress().IsCleared()) { + mAddress.Truncate(); // Reset to empty string + } else { + AddressToString(value.get_BluetoothAddress(), mAddress); + } } else if (name.EqualsLiteral("Discoverable")) { mDiscoverable = value.get_bool(); } else if (name.EqualsLiteral("Discovering")) { diff --git a/dom/bluetooth/common/webapi/BluetoothDevice.cpp b/dom/bluetooth/common/webapi/BluetoothDevice.cpp index 5f2cab91213..e3d3fe496bb 100644 --- a/dom/bluetooth/common/webapi/BluetoothDevice.cpp +++ b/dom/bluetooth/common/webapi/BluetoothDevice.cpp @@ -148,7 +148,11 @@ BluetoothDevice::SetPropertyByValue(const BluetoothNamedValue& aValue) if (name.EqualsLiteral("Name")) { RemoteNameToString(value.get_BluetoothRemoteName(), mName); } else if (name.EqualsLiteral("Address")) { - AddressToString(value.get_BluetoothAddress(), mAddress); + if (value.get_BluetoothAddress().IsCleared()) { + mAddress.Truncate(); // Reset to empty string + } else { + AddressToString(value.get_BluetoothAddress(), mAddress); + } } else if (name.EqualsLiteral("Cod")) { mCod->Update(value.get_uint32_t()); } else if (name.EqualsLiteral("Paired")) { diff --git a/hal/gonk/UeventPoller.cpp b/hal/gonk/UeventPoller.cpp index a33faf1ca34..d6d66191e6b 100644 --- a/hal/gonk/UeventPoller.cpp +++ b/hal/gonk/UeventPoller.cpp @@ -31,13 +31,16 @@ #include "HalLog.h" #include "nsDebug.h" #include "base/message_loop.h" +#include "mozilla/ClearOnShutdown.h" #include "mozilla/FileUtils.h" -#include "nsAutoPtr.h" +#include "mozilla/Monitor.h" #include "nsThreadUtils.h" #include "nsXULAppAPI.h" #include "UeventPoller.h" +using namespace mozilla; + namespace mozilla { namespace hal_impl { @@ -72,8 +75,9 @@ public: void UnregisterObserver(IUeventObserver *aObserver) { mUeventObserverList.RemoveObserver(aObserver); - if (mUeventObserverList.Length() == 0) + if (mUeventObserverList.Length() == 0) { ShutdownUevent(); // this will destroy self + } } private: @@ -92,13 +96,16 @@ bool NetlinkPoller::OpenSocket() { mSocket.rwget() = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); - if (mSocket.get() < 0) + if (mSocket.get() < 0) { return false; + } int sz = kBuffsize; - if (setsockopt(mSocket.get(), SOL_SOCKET, SO_RCVBUFFORCE, &sz, sizeof(sz)) < 0) + if (setsockopt(mSocket.get(), SOL_SOCKET, SO_RCVBUFFORCE, &sz, + sizeof(sz)) < 0) { return false; + } // add FD_CLOEXEC flag int flags = fcntl(mSocket.get(), F_GETFD); @@ -106,12 +113,14 @@ NetlinkPoller::OpenSocket() return false; } flags |= FD_CLOEXEC; - if (fcntl(mSocket.get(), F_SETFD, flags) == -1) + if (fcntl(mSocket.get(), F_SETFD, flags) == -1) { return false; + } // set non-blocking - if (fcntl(mSocket.get(), F_SETFL, O_NONBLOCK) == -1) + if (fcntl(mSocket.get(), F_SETFL, O_NONBLOCK) == -1) { return false; + } struct sockaddr_nl saddr; bzero(&saddr, sizeof(saddr)); @@ -150,7 +159,7 @@ NetlinkPoller::OpenSocket() return true; } -static nsAutoPtr sPoller; +static StaticAutoPtr sPoller; class UeventInitTask : public Task { @@ -190,6 +199,69 @@ NetlinkPoller::OnFileCanReadWithoutBlocking(int fd) } } +static bool sShutdown = false; + +class ShutdownNetlinkPoller; +static StaticAutoPtr sShutdownPoller; +static Monitor* sMonitor = nullptr; + +class ShutdownNetlinkPoller { +public: + ~ShutdownNetlinkPoller() + { + // This is called from KillClearOnShutdown() on the main thread. + MOZ_ASSERT(NS_IsMainThread()); + MOZ_ASSERT(XRE_GetIOMessageLoop()); + + { + MonitorAutoLock lock(*sMonitor); + + XRE_GetIOMessageLoop()->PostTask( + FROM_HERE, + NewRunnableFunction(ShutdownUeventIOThread)); + + while (!sShutdown) { + lock.Wait(); + } + } + + sShutdown = true; + delete sMonitor; + } + + static void MaybeInit() + { + MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop()); + if (sShutdown || sMonitor) { + // Don't init twice or init after shutdown. + return; + } + + sMonitor = new Monitor("ShutdownNetlinkPoller.monitor"); + { + ShutdownNetlinkPoller* shutdownPoller = new ShutdownNetlinkPoller(); + + nsCOMPtr runnable = NS_NewRunnableFunction([=] () -> void + { + sShutdownPoller = shutdownPoller; + ClearOnShutdown(&sShutdownPoller); // Must run on the main thread. + }); + MOZ_ASSERT(runnable); + MOZ_ALWAYS_TRUE(NS_SUCCEEDED( + NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))); + } + } +private: + ShutdownNetlinkPoller() = default; + static void ShutdownUeventIOThread() + { + MonitorAutoLock l(*sMonitor); + ShutdownUevent(); // Must run on the IO thread. + sShutdown = true; + l.NotifyAll(); + } +}; + static void InitializeUevent() { @@ -197,6 +269,7 @@ InitializeUevent() sPoller = new NetlinkPoller(); sPoller->GetIOLoop()->PostTask(FROM_HERE, new UeventInitTask()); + ShutdownNetlinkPoller::MaybeInit(); } static void @@ -210,8 +283,13 @@ RegisterUeventListener(IUeventObserver *aObserver) { MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop()); - if (!sPoller) + if (sShutdown) { + return; + } + + if (!sPoller) { InitializeUevent(); + } sPoller->RegisterObserver(aObserver); } @@ -220,6 +298,10 @@ UnregisterUeventListener(IUeventObserver *aObserver) { MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop()); + if (sShutdown) { + return; + } + sPoller->UnregisterObserver(aObserver); } diff --git a/testing/taskcluster/tasks/builds/b2g_emulator_jb_debug.yml b/testing/taskcluster/tasks/builds/b2g_emulator_jb_debug.yml index c9bdafb48b7..3f58600ee8a 100644 --- a/testing/taskcluster/tasks/builds/b2g_emulator_jb_debug.yml +++ b/testing/taskcluster/tasks/builds/b2g_emulator_jb_debug.yml @@ -31,3 +31,6 @@ task: TARGET: 'emulator-jb' B2G_DEBUG: 1 TOOLTOOL_MANIFEST: 'b2g/config/emulator-jb/releng-emulator-jb.tt' + # This setting is to offset the number of arugments passsed into docker run + # for https://github.com/docker/docker/issues/14203 + DOCKER_OVERRIDE: 1 diff --git a/testing/taskcluster/tasks/builds/b2g_emulator_kk_debug.yml b/testing/taskcluster/tasks/builds/b2g_emulator_kk_debug.yml index 51528cbb7dd..b20c5637d39 100644 --- a/testing/taskcluster/tasks/builds/b2g_emulator_kk_debug.yml +++ b/testing/taskcluster/tasks/builds/b2g_emulator_kk_debug.yml @@ -31,3 +31,6 @@ task: TARGET: 'emulator-kk' TOOLTOOL_MANIFEST: 'b2g/config/emulator-kk/releng-emulator-kk.tt' B2G_DEBUG: 1 + # This setting is to offset the number of arugments passsed into docker run + # for https://github.com/docker/docker/issues/14203 + DOCKER_OVERRIDE: 1