Merge mozilla-aurora to b2g37. a=merge
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 13 Jan 2015 18:02:57 -0500
changeset 232158 748b20315f7578791078126b77dbf1fc308291f8
parent 232153 428ef5586cf3db78e5cb90e57517ebf857633279 (current diff)
parent 232157 4be2ace2bb828062e5f0304fb61d8d0d5347cfb6 (diff)
child 232163 b9f06080d24757cb59f2f35bc7aad54e86a7af55
push id11
push userryanvm@gmail.com
push dateTue, 13 Jan 2015 23:02:56 +0000
treeherdermozilla-b2g37_v2_2@748b20315f75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone37.0a2
Merge mozilla-aurora to b2g37. a=merge
--- a/dom/media/fmp4/MP4Reader.cpp
+++ b/dom/media/fmp4/MP4Reader.cpp
@@ -2,16 +2,17 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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/. */
 
 #include "MP4Reader.h"
 #include "MP4Stream.h"
 #include "MediaResource.h"
+#include "nsPrintfCString.h"
 #include "nsSize.h"
 #include "VideoUtils.h"
 #include "mozilla/dom/HTMLMediaElement.h"
 #include "ImageContainer.h"
 #include "Layers.h"
 #include "SharedThreadPool.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/TimeRanges.h"
@@ -83,42 +84,28 @@ InvokeAndRetry(ThisType* aThisVal, Retur
   AutoPinned<MP4Stream> stream(aStream);
   MP4Stream::ReadRecord prevFailure(-1, 0);
   while (true) {
     ReturnType result = ((*aThisVal).*aMethod)();
     if (result) {
       return result;
     }
     MP4Stream::ReadRecord failure(-1, 0);
-    if (!stream->LastReadFailed(&failure) || failure == prevFailure) {
+    if (NS_WARN_IF(!stream->LastReadFailed(&failure))) {
       return result;
     }
-    prevFailure = failure;
 
-    // Our goal here is to forcibly read the data we want into the cache: since
-    // the stream is pinned, the data is guaranteed to stay in the cache once
-    // it's there, which means that retrying the non-blocking read from inside
-    // the demuxer should succeed.
-    //
-    // But there's one wrinkle: if we read less than an entire cache line and
-    // the data ends up in MediaCacheStream's mPartialBlockBuffer, the data can
-    // be returned by a blocking read but never actually committed to the cache,
-    // and abandoned by a subsequent seek (possibly by another stream accessing
-    // the same underlying resource).
-    //
-    // The way to work around this problem is to round our "priming" read up to the
-    // size of an entire cache block. Note that this may hit EOS for bytes that the
-    // original demuxer read never actually requested. This is OK though because the
-    // call to BlockingReadAt will still return true (just with a less-than-expected
-    // number of actually read bytes, which we ignore).
-    size_t bufferSize = failure.mCount + (MediaCacheStream::BLOCK_SIZE - failure.mCount % MediaCacheStream::BLOCK_SIZE);
-    nsAutoArrayPtr<uint8_t> dummyBuffer(new uint8_t[bufferSize]);
-    MonitorAutoUnlock unlock(*aMonitor);
-    size_t ignored;
-    if (NS_WARN_IF(!stream->BlockingReadAt(failure.mOffset, dummyBuffer, bufferSize, &ignored))) {
+    if (NS_WARN_IF(failure == prevFailure)) {
+      NS_WARNING(nsPrintfCString("Failed reading the same block twice: offset=%lld, count=%lu",
+                                 failure.mOffset, failure.mCount).get());
+      return result;
+    }
+
+    prevFailure = failure;
+    if (NS_WARN_IF(!stream->BlockingReadIntoCache(failure.mOffset, failure.mCount, aMonitor))) {
       return result;
     }
   }
 }
 
 
 MP4Reader::MP4Reader(AbstractMediaDecoder* aDecoder)
   : MediaDecoderReader(aDecoder)
--- a/dom/media/fmp4/MP4Stream.cpp
+++ b/dom/media/fmp4/MP4Stream.cpp
@@ -6,43 +6,52 @@
 
 #include "MP4Stream.h"
 #include "MediaResource.h"
 
 namespace mozilla {
 
 MP4Stream::MP4Stream(MediaResource* aResource)
   : mResource(aResource)
+  , mPinCount(0)
 {
   MOZ_COUNT_CTOR(MP4Stream);
   MOZ_ASSERT(aResource);
 }
 
 MP4Stream::~MP4Stream()
 {
   MOZ_COUNT_DTOR(MP4Stream);
+  MOZ_ASSERT(mPinCount == 0);
 }
 
 bool
-MP4Stream::BlockingReadAt(int64_t aOffset, void* aBuffer, size_t aCount,
-                          size_t* aBytesRead)
+MP4Stream::BlockingReadIntoCache(int64_t aOffset, size_t aCount, Monitor* aToUnlock)
 {
+  MOZ_ASSERT(mPinCount > 0);
+  CacheBlock block(aOffset, aCount);
+
   uint32_t sum = 0;
   uint32_t bytesRead = 0;
   do {
     uint64_t offset = aOffset + sum;
-    char* buffer = reinterpret_cast<char*>(aBuffer) + sum;
+    char* buffer = reinterpret_cast<char*>(block.mBuffer.get()) + sum;
     uint32_t toRead = aCount - sum;
+    MonitorAutoUnlock unlock(*aToUnlock);
     nsresult rv = mResource->ReadAt(offset, buffer, toRead, &bytesRead);
     if (NS_FAILED(rv)) {
       return false;
     }
     sum += bytesRead;
   } while (sum < aCount && bytesRead > 0);
-  *aBytesRead = sum;
+
+  MOZ_ASSERT(block.mCount >= sum);
+  block.mCount = sum;
+
+  mCache.AppendElement(block);
   return true;
 }
 
 // We surreptitiously reimplement the supposedly-blocking ReadAt as a non-
 // blocking CachedReadAt, and record when it fails. This allows MP4Reader
 // to retry the read as an actual blocking read without holding the lock.
 bool
 MP4Stream::ReadAt(int64_t aOffset, void* aBuffer, size_t aCount,
@@ -59,16 +68,24 @@ MP4Stream::ReadAt(int64_t aOffset, void*
 
   return true;
 }
 
 bool
 MP4Stream::CachedReadAt(int64_t aOffset, void* aBuffer, size_t aCount,
                         size_t* aBytesRead)
 {
+  // First, check our local cache.
+  for (size_t i = 0; i < mCache.Length(); ++i) {
+    if (mCache[i].mOffset == aOffset && mCache[i].mCount >= aCount) {
+      memcpy(aBuffer, mCache[i].mBuffer, aCount);
+      *aBytesRead = aCount;
+      return true;
+    }
+  }
 
   nsresult rv = mResource->ReadFromCache(reinterpret_cast<char*>(aBuffer),
                                          aOffset, aCount);
   if (NS_FAILED(rv)) {
     *aBytesRead = 0;
     return false;
   }
   *aBytesRead = aCount;
--- a/dom/media/fmp4/MP4Stream.h
+++ b/dom/media/fmp4/MP4Stream.h
@@ -7,26 +7,27 @@
 #ifndef MP4_STREAM_H_
 #define MP4_STREAM_H_
 
 #include "mp4_demuxer/mp4_demuxer.h"
 
 #include "MediaResource.h"
 
 #include "mozilla/Maybe.h"
+#include "mozilla/Monitor.h"
 
 namespace mozilla {
 
 class Monitor;
 
 class MP4Stream : public mp4_demuxer::Stream {
 public:
   explicit MP4Stream(MediaResource* aResource);
   virtual ~MP4Stream();
-  bool BlockingReadAt(int64_t aOffset, void* aBuffer, size_t aCount, size_t* aBytesRead);
+  bool BlockingReadIntoCache(int64_t aOffset, size_t aCount, Monitor* aToUnlock);
   virtual bool ReadAt(int64_t aOffset, void* aBuffer, size_t aCount,
                       size_t* aBytesRead) MOZ_OVERRIDE;
   virtual bool CachedReadAt(int64_t aOffset, void* aBuffer, size_t aCount,
                             size_t* aBytesRead) MOZ_OVERRIDE;
   virtual bool Length(int64_t* aSize) MOZ_OVERRIDE;
 
   struct ReadRecord {
     ReadRecord(int64_t aOffset, size_t aCount) : mOffset(aOffset), mCount(aCount) {}
@@ -39,19 +40,42 @@ public:
     if (mFailedRead.isSome()) {
       *aOut = mFailedRead.ref();
       return true;
     }
 
     return false;
   }
 
-  void Pin() { mResource->Pin(); }
-  void Unpin() { mResource->Unpin(); }
+  void Pin()
+  {
+    mResource->Pin();
+    ++mPinCount;
+  }
+
+  void Unpin()
+  {
+    mResource->Unpin();
+    MOZ_ASSERT(mPinCount);
+    --mPinCount;
+    if (mPinCount == 0) {
+      mCache.Clear();
+    }
+  }
 
 private:
   nsRefPtr<MediaResource> mResource;
   Maybe<ReadRecord> mFailedRead;
+  uint32_t mPinCount;
+
+  struct CacheBlock {
+    CacheBlock(int64_t aOffset, size_t aCount)
+      : mOffset(aOffset), mCount(aCount), mBuffer(new uint8_t[aCount]) {}
+    int64_t mOffset;
+    size_t mCount;
+    nsAutoArrayPtr<uint8_t> mBuffer;
+  };
+  nsTArray<CacheBlock> mCache;
 };
 
 }
 
 #endif
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -1593,18 +1593,16 @@ bool DoesD3D11DeviceWork(ID3D11Device *d
 #endif
       return false;
     }
   }
   result = true;
   return true;
 }
 
-#define TEXTURE_SIZE 32
-
 // See bug 1083071. On some drivers, Direct3D 11 CreateShaderResourceView fails
 // with E_OUTOFMEMORY.
 bool DoesD3D11TextureSharingWork(ID3D11Device *device)
 {
   static bool checked;
   static bool result;
 
   if (checked)
@@ -1613,39 +1611,45 @@ bool DoesD3D11TextureSharingWork(ID3D11D
 
   if (gfxPrefs::Direct2DForceEnabled() ||
       gfxPrefs::LayersAccelerationForceEnabled())
   {
     result = true;
     return true;
   }
 
+  if (GetModuleHandleW(L"atidxx32.dll")) {
+    nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
+    if (gfxInfo) {
+      nsString vendorID, vendorID2;
+      gfxInfo->GetAdapterVendorID(vendorID);
+      gfxInfo->GetAdapterVendorID2(vendorID2);
+      if (vendorID.EqualsLiteral("0x8086") && vendorID2.IsEmpty()) {
+#if defined(MOZ_CRASHREPORTER)
+        CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("Unexpected Intel/AMD dual-GPU setup\n"));
+#endif
+        return false;
+      }
+    }
+  }
+
   RefPtr<ID3D11Texture2D> texture;
   D3D11_TEXTURE2D_DESC desc;
-  desc.Width = TEXTURE_SIZE;
-  desc.Height = TEXTURE_SIZE;
+  desc.Width = 32;
+  desc.Height = 32;
   desc.MipLevels = 1;
   desc.ArraySize = 1;
   desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
   desc.SampleDesc.Count = 1;
   desc.SampleDesc.Quality = 0;
   desc.Usage = D3D11_USAGE_DEFAULT;
   desc.CPUAccessFlags = 0;
   desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;
   desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
-
-  int color[TEXTURE_SIZE * TEXTURE_SIZE];
-  D3D11_SUBRESOURCE_DATA data;
-  data.pSysMem = color;
-  data.SysMemPitch = TEXTURE_SIZE * 4;
-  data.SysMemSlicePitch = 0;
-  for (int i = 0; i < sizeof(color)/sizeof(color[0]); i++) {
-      color[i] = 0xff00ffff;
-  }
-  if (FAILED(device->CreateTexture2D(&desc, &data, byRef(texture)))) {
+  if (FAILED(device->CreateTexture2D(&desc, NULL, byRef(texture)))) {
     return false;
   }
 
   HANDLE shareHandle;
   nsRefPtr<IDXGIResource> otherResource;
   if (FAILED(texture->QueryInterface(__uuidof(IDXGIResource),
                                      getter_AddRefs(otherResource))))
   {
@@ -1665,57 +1669,16 @@ bool DoesD3D11TextureSharingWork(ID3D11D
   }
 
   if (FAILED(sharedResource->QueryInterface(__uuidof(ID3D11Texture2D),
                                             getter_AddRefs(sharedTexture))))
   {
     return false;
   }
 
-  desc.Usage = D3D11_USAGE_STAGING;
-  desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
-  desc.MiscFlags = 0;
-  desc.BindFlags = 0;
-
-  RefPtr<ID3D11Texture2D> cpuTexture;
-  if (FAILED(device->CreateTexture2D(&desc, &data, byRef(cpuTexture)))) {
-    return false;
-  }
-
-  nsRefPtr<IDXGIKeyedMutex> sharedMutex;
-  nsRefPtr<ID3D11DeviceContext> deviceContext;
-  sharedResource->QueryInterface(__uuidof(IDXGIKeyedMutex), getter_AddRefs(sharedMutex));
-  device->GetImmediateContext(getter_AddRefs(deviceContext));
-  if (FAILED(sharedMutex->AcquireSync(0, 30*1000))) {
-#if defined(MOZ_CRASHREPORTER)
-    CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("Keyed Mutex timeout\n"));
-#endif
-    // only wait for 30 seconds
-    return false;
-  }
-
-  int resultColor;
-  deviceContext->CopyResource(cpuTexture, sharedTexture);
-
-  D3D11_MAPPED_SUBRESOURCE mapped;
-  deviceContext->Map(cpuTexture, 0, D3D11_MAP_READ, 0, &mapped);
-  resultColor = *(int*)mapped.pData;
-  deviceContext->Unmap(cpuTexture, 0);
-
-  sharedMutex->ReleaseSync(0);
-
-  if (resultColor != color[0]) {
-    // Shared surfaces seem to be broken on dual AMD & Intel HW when using the
-    // AMD GPU
-#if defined(MOZ_CRASHREPORTER)
-    CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("Shared Surfaces don't work\n"));
-#endif
-    return false;
-  }
-
   RefPtr<ID3D11ShaderResourceView> sharedView;
 
   // This if(FAILED()) is the one that actually fails on systems affected by bug 1083071.
   if (FAILED(device->CreateShaderResourceView(sharedTexture, NULL, byRef(sharedView)))) {
 #if defined(MOZ_CRASHREPORTER)
     CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("CreateShaderResourceView failed\n"));
 #endif
     return false;
--- a/mobile/android/config/mozconfigs/android-api-10/debug
+++ b/mobile/android/config/mozconfigs/android-api-10/debug
@@ -5,15 +5,15 @@ ac_add_options --enable-debug
 
 # Android
 ac_add_options --with-android-min-sdk=10
 ac_add_options --target=arm-linux-androideabi
 
 export MOZILLA_OFFICIAL=1
 export MOZ_TELEMETRY_REPORTING=1
 
-ac_add_options --with-branding=mobile/android/branding/nightly
+ac_add_options --with-branding=mobile/android/branding/aurora
 
 # Treat warnings as errors in directories with FAIL_ON_WARNINGS.
 ac_add_options --enable-warnings-as-errors
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
 
--- a/mobile/android/config/mozconfigs/android-api-10/l10n-nightly
+++ b/mobile/android/config/mozconfigs/android-api-10/l10n-nightly
@@ -15,13 +15,13 @@ ac_add_options --target=arm-linux-androi
 
 ac_add_options --with-system-zlib
 ac_add_options --enable-updater
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 
 export MOZILLA_OFFICIAL=1
 export MOZ_DISABLE_GECKOVIEW=1
 
-ac_add_options --with-branding=mobile/android/branding/nightly
+ac_add_options --with-branding=mobile/android/branding/aurora
 
 ac_add_options --disable-stdcxx-compat
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/android-api-10/nightly
+++ b/mobile/android/config/mozconfigs/android-api-10/nightly
@@ -1,17 +1,17 @@
 . "$topsrcdir/mobile/android/config/mozconfigs/common"
 
 ac_add_options --enable-profiling
 
 # Android
 ac_add_options --with-android-min-sdk=10
 ac_add_options --target=arm-linux-androideabi
 
-ac_add_options --with-branding=mobile/android/branding/nightly
+ac_add_options --with-branding=mobile/android/branding/aurora
 
 # This will overwrite the default of stripping everything and keep the symbol table.
 # This is useful for profiling with eideticker. See bug 788680
 STRIP_FLAGS="--strip-debug"
 
 export MOZILLA_OFFICIAL=1
 export MOZ_TELEMETRY_REPORTING=1
 
--- a/mobile/android/config/mozconfigs/android-api-11/debug
+++ b/mobile/android/config/mozconfigs/android-api-11/debug
@@ -5,15 +5,15 @@ ac_add_options --enable-debug
 
 # Android
 ac_add_options --with-android-min-sdk=11
 ac_add_options --target=arm-linux-androideabi
 
 export MOZILLA_OFFICIAL=1
 export MOZ_TELEMETRY_REPORTING=1
 
-ac_add_options --with-branding=mobile/android/branding/nightly
+ac_add_options --with-branding=mobile/android/branding/aurora
 
 # Treat warnings as errors in directories with FAIL_ON_WARNINGS.
 ac_add_options --enable-warnings-as-errors
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
 
--- a/mobile/android/config/mozconfigs/android-api-11/l10n-nightly
+++ b/mobile/android/config/mozconfigs/android-api-11/l10n-nightly
@@ -15,13 +15,13 @@ ac_add_options --target=arm-linux-androi
 
 ac_add_options --with-system-zlib
 ac_add_options --enable-updater
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 
 export MOZILLA_OFFICIAL=1
 export MOZ_DISABLE_GECKOVIEW=1
 
-ac_add_options --with-branding=mobile/android/branding/nightly
+ac_add_options --with-branding=mobile/android/branding/aurora
 
 ac_add_options --disable-stdcxx-compat
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/android-api-11/nightly
+++ b/mobile/android/config/mozconfigs/android-api-11/nightly
@@ -1,17 +1,17 @@
 . "$topsrcdir/mobile/android/config/mozconfigs/common"
 
 ac_add_options --enable-profiling
 
 # Android
 ac_add_options --with-android-min-sdk=11
 ac_add_options --target=arm-linux-androideabi
 
-ac_add_options --with-branding=mobile/android/branding/nightly
+ac_add_options --with-branding=mobile/android/branding/aurora
 
 # This will overwrite the default of stripping everything and keep the symbol table.
 # This is useful for profiling with eideticker. See bug 788680
 STRIP_FLAGS="--strip-debug"
 
 export MOZILLA_OFFICIAL=1
 export MOZ_TELEMETRY_REPORTING=1
 
--- a/mobile/android/config/mozconfigs/android-api-9-10-constrained/debug
+++ b/mobile/android/config/mozconfigs/android-api-9-10-constrained/debug
@@ -9,14 +9,14 @@ ac_add_options --with-android-max-sdk=10
 ac_add_options --enable-android-resource-constrained
 export MOZ_DISABLE_GECKOVIEW=1
 
 ac_add_options --target=arm-linux-androideabi
 
 export MOZILLA_OFFICIAL=1
 export MOZ_TELEMETRY_REPORTING=1
 
-ac_add_options --with-branding=mobile/android/branding/nightly
+ac_add_options --with-branding=mobile/android/branding/aurora
 
 # Treat warnings as errors in directories with FAIL_ON_WARNINGS.
 ac_add_options --enable-warnings-as-errors
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/android-api-9-10-constrained/l10n-nightly
+++ b/mobile/android/config/mozconfigs/android-api-9-10-constrained/l10n-nightly
@@ -17,13 +17,13 @@ ac_add_options --target=arm-linux-androi
 
 ac_add_options --with-system-zlib
 ac_add_options --enable-updater
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 
 export MOZILLA_OFFICIAL=1
 export MOZ_DISABLE_GECKOVIEW=1
 
-ac_add_options --with-branding=mobile/android/branding/nightly
+ac_add_options --with-branding=mobile/android/branding/aurora
 
 ac_add_options --disable-stdcxx-compat
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/android-api-9-10-constrained/nightly
+++ b/mobile/android/config/mozconfigs/android-api-9-10-constrained/nightly
@@ -5,17 +5,17 @@ ac_add_options --enable-profiling
 # Android
 ac_add_options --with-android-min-sdk=9
 ac_add_options --with-android-max-sdk=10
 ac_add_options --enable-android-resource-constrained
 export MOZ_DISABLE_GECKOVIEW=1
 
 ac_add_options --target=arm-linux-androideabi
 
-ac_add_options --with-branding=mobile/android/branding/nightly
+ac_add_options --with-branding=mobile/android/branding/aurora
 
 # This will overwrite the default of stripping everything and keep the symbol table.
 # This is useful for profiling with eideticker. See bug 788680
 STRIP_FLAGS="--strip-debug"
 
 export MOZILLA_OFFICIAL=1
 export MOZ_TELEMETRY_REPORTING=1
 
--- a/mobile/android/config/mozconfigs/android-api-9-constrained/debug
+++ b/mobile/android/config/mozconfigs/android-api-9-constrained/debug
@@ -9,14 +9,14 @@ ac_add_options --with-android-max-sdk=9
 ac_add_options --enable-android-resource-constrained
 export MOZ_DISABLE_GECKOVIEW=1
 
 ac_add_options --target=arm-linux-androideabi
 
 export MOZILLA_OFFICIAL=1
 export MOZ_TELEMETRY_REPORTING=1
 
-ac_add_options --with-branding=mobile/android/branding/nightly
+ac_add_options --with-branding=mobile/android/branding/aurora
 
 # Treat warnings as errors in directories with FAIL_ON_WARNINGS.
 ac_add_options --enable-warnings-as-errors
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/android-api-9-constrained/l10n-nightly
+++ b/mobile/android/config/mozconfigs/android-api-9-constrained/l10n-nightly
@@ -17,13 +17,13 @@ ac_add_options --target=arm-linux-androi
 
 ac_add_options --with-system-zlib
 ac_add_options --enable-updater
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 
 export MOZILLA_OFFICIAL=1
 export MOZ_DISABLE_GECKOVIEW=1
 
-ac_add_options --with-branding=mobile/android/branding/nightly
+ac_add_options --with-branding=mobile/android/branding/aurora
 
 ac_add_options --disable-stdcxx-compat
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/android-api-9-constrained/nightly
+++ b/mobile/android/config/mozconfigs/android-api-9-constrained/nightly
@@ -5,17 +5,17 @@ ac_add_options --enable-profiling
 # Android
 ac_add_options --with-android-min-sdk=9
 ac_add_options --with-android-max-sdk=9
 ac_add_options --enable-android-resource-constrained
 export MOZ_DISABLE_GECKOVIEW=1
 
 ac_add_options --target=arm-linux-androideabi
 
-ac_add_options --with-branding=mobile/android/branding/nightly
+ac_add_options --with-branding=mobile/android/branding/aurora
 
 # This will overwrite the default of stripping everything and keep the symbol table.
 # This is useful for profiling with eideticker. See bug 788680
 STRIP_FLAGS="--strip-debug"
 
 export MOZILLA_OFFICIAL=1
 export MOZ_TELEMETRY_REPORTING=1
 
--- a/uriloader/exthandler/tests/unit_ipc/test_encoding.js
+++ b/uriloader/exthandler/tests/unit_ipc/test_encoding.js
@@ -103,16 +103,18 @@ registerTemporaryComponent(DownloadMgrUI
 registerTemporaryComponent(AlertsSVC);
 
 function initChildTestEnv()
 {
   sendCommand('                                                                \
     const Cc = Components.classes;                                             \
     const Ci = Components.interfaces;                                          \
     const Cr = Components.results;                                             \
+    const Cu = Components.utils;                                               \
+    Cu.import("resource://gre/modules/Services.jsm");                          \
     function WindowContext() { }                                               \
                                                                                \
     WindowContext.prototype = {                                                \
       getInterface: function (iid) {                                           \
         if (iid.equals(Ci.nsIInterfaceRequestor) ||                            \
             iid.equals(Ci.nsIURIContentListener) ||                            \
             iid.equals(Ci.nsILoadGroup) ||                                     \
             iid.equals(Ci.nsIDocumentLoader) ||                                \