diff --git a/browser/components/build/moz.build b/browser/components/build/moz.build
--- a/browser/components/build/moz.build
+++ b/browser/components/build/moz.build
@@ -13,31 +13,12 @@ SOURCES += [
 ]
 
 Library('browsercomps')
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../about',
     '../dirprovider',
     '../feeds',
     '../migration',
     '../shell',
 ]
-
-if CONFIG['OS_ARCH'] == 'WINNT':
-    OS_LIBS += [
-        'esent',
-        'netapi32',
-        'ole32',
-        'shell32',
-        'shlwapi',
-        'version',
-    ]
-    DELAYLOAD_DLLS += [
-        'esent.dll',
-        'netapi32.dll',
-    ]
-
-# Mac: Need to link with CoreFoundation for Mac Migrators (PList reading code)
-# GTK2: Need to link with glib for GNOME shell service
-#if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'gtk2', 'gtk3'):
-#    OS_LIBS += CONFIG['TK_LIBS']
diff --git a/browser/components/migration/nsIEHistoryEnumerator.cpp b/browser/components/migration/nsIEHistoryEnumerator.cpp
--- a/browser/components/migration/nsIEHistoryEnumerator.cpp
+++ b/browser/components/migration/nsIEHistoryEnumerator.cpp
@@ -1,37 +1,38 @@
 /* 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 "nsIEHistoryEnumerator.h"
 
 #include <urlhist.h>
 #include <shlguid.h>
 
 #include "nsArrayEnumerator.h"
 #include "nsCOMArray.h"
+#include "nsIURI.h"
 #include "nsIVariant.h"
 #include "nsNetUtil.h"
 #include "nsString.h"
 #include "nsWindowsMigrationUtils.h"
 #include "prtime.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsIEHistoryEnumerator
 
 NS_IMPL_ISUPPORTS(nsIEHistoryEnumerator, nsISimpleEnumerator)
 
 nsIEHistoryEnumerator::nsIEHistoryEnumerator()
 {
-  ::CoInitialize(nullptr);  
+  ::CoInitialize(nullptr);
 }
 
 nsIEHistoryEnumerator::~nsIEHistoryEnumerator()
 {
   ::CoUninitialize();
 }
 
 void
 nsIEHistoryEnumerator::EnsureInitialized()
 {
   if (mURLEnumerator)
     return;
diff --git a/browser/components/shell/nsWindowsShellService.cpp b/browser/components/shell/nsWindowsShellService.cpp
--- a/browser/components/shell/nsWindowsShellService.cpp
+++ b/browser/components/shell/nsWindowsShellService.cpp
@@ -3,24 +3,25 @@
  * 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 "nsWindowsShellService.h"
 
 #include "imgIContainer.h"
 #include "imgIRequest.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMHTMLImageElement.h"
 #include "nsIImageLoadingContent.h"
+#include "nsIOutputStream.h"
 #include "nsIPrefService.h"
 #include "nsIPrefLocalizedString.h"
 #include "nsIServiceManager.h"
 #include "nsIStringBundle.h"
 #include "nsNetUtil.h"
 #include "nsServiceManagerUtils.h"
 #include "nsShellService.h"
 #include "nsIProcess.h"
 #include "nsICategoryManager.h"
 #include "nsBrowserCompsCID.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsAppDirectoryServiceDefs.h"
@@ -456,37 +457,36 @@ nsWindowsShellService::IsDefaultBrowser(
     if (REG_FAILED(res) ||
         _wcsicmp(valueData.get(), currValue)) {
       // Key wasn't set or was set to something other than our registry entry.
       NS_ConvertUTF8toUTF16 oldValueData(settings->oldValueData);
       offset = oldValueData.Find("%APPPATH%");
       oldValueData.Replace(offset, 9, appLongPath);
       // The current registry value doesn't match the current or the old format.
       if (_wcsicmp(oldValueData.get(), currValue)) {
         *aIsDefaultBrowser = false;
         return NS_OK;
       }
 
-      res = ::RegOpenKeyExW(HKEY_CLASSES_ROOT, PromiseFlatString(keyName).get(),
+      res = ::RegOpenKeyExW(HKEY_CLASSES_ROOT, keyName.get(),
                             0, KEY_SET_VALUE, &theKey);
       if (REG_FAILED(res)) {
         // If updating the open command fails try to update it using the helper
         // application when setting Firefox as the default browser.
         *aIsDefaultBrowser = false;
         return NS_OK;
       }
 
-      const nsString &flatValue = PromiseFlatString(valueData);
       res = ::RegSetValueExW(theKey, L"", 0, REG_SZ,
-                             (const BYTE *) flatValue.get(),
-                             (flatValue.Length() + 1) * sizeof(char16_t));
+                             (const BYTE *) valueData.get(),
+                             (valueData.Length() + 1) * sizeof(char16_t));
       // Close the key that was created.
       ::RegCloseKey(theKey);
       if (REG_FAILED(res)) {
         // If updating the open command fails try to update it using the helper
         // application when setting Firefox as the default browser.
         *aIsDefaultBrowser = false;
         return NS_OK;
       }
     }
   }
 
   // Only check if Firefox is the default browser on Vista and above if the
@@ -520,27 +520,26 @@ nsWindowsShellService::IsDefaultBrowser(
         return NS_OK;
       }
 
       ::ZeroMemory(currValue, sizeof(currValue));
       DWORD len = sizeof currValue;
       res = ::RegQueryValueExW(theKey, L"", nullptr, nullptr,
                                (LPBYTE)currValue, &len);
       // Close the key that was opened.
       ::RegCloseKey(theKey);
       if (REG_FAILED(res) || char16_t('\0') != *currValue) {
         // Key wasn't set or was set to something other than our registry entry.
         // Delete the key along with all of its childrean and then recreate it.
-        const nsString &flatName = PromiseFlatString(keyName);
-        ::SHDeleteKeyW(HKEY_CURRENT_USER, flatName.get());
-        res = ::RegCreateKeyExW(HKEY_CURRENT_USER, flatName.get(), 0, nullptr,
+        ::SHDeleteKeyW(HKEY_CURRENT_USER, keyName.get());
+        res = ::RegCreateKeyExW(HKEY_CURRENT_USER, keyName.get(), 0, nullptr,
                                 REG_OPTION_NON_VOLATILE, KEY_SET_VALUE,
                                 nullptr, &theKey, nullptr);
         if (REG_FAILED(res)) {
           // If disabling DDE fails try to disable it using the helper
           // application when setting Firefox as the default browser.
           *aIsDefaultBrowser = false;
           return NS_OK;
         }
 
         res = ::RegSetValueExW(theKey, L"", 0, REG_SZ, (const BYTE *) L"",
                                sizeof(char16_t));
         // Close the key that was created.
@@ -574,28 +573,27 @@ nsWindowsShellService::IsDefaultBrowser(
                              &len);
 
     // Don't update the FTP protocol handler's shell open command when the
     // current registry value doesn't exist or matches the old format.
     if (REG_FAILED(res) ||
         _wcsicmp(oldValueOpen.get(), currValue)) {
       ::RegCloseKey(theKey);
       return NS_OK;
     }
 
     NS_ConvertUTF8toUTF16 valueData(VAL_OPEN);
     valueData.Replace(offset, 9, appLongPath);
-    const nsString &flatValue = PromiseFlatString(valueData);
     res = ::RegSetValueExW(theKey, L"", 0, REG_SZ,
-                           (const BYTE *) flatValue.get(),
-                           (flatValue.Length() + 1) * sizeof(char16_t));
+                           (const BYTE *) valueData.get(),
+                           (valueData.Length() + 1) * sizeof(char16_t));
     // Close the key that was created.
     ::RegCloseKey(theKey);
     // If updating the FTP protocol handlers shell open command fails try to
     // update it using the helper application when setting Firefox as the
     // default browser.
     if (REG_FAILED(res)) {
       *aIsDefaultBrowser = false;
     }
   }
 
   return NS_OK;
 }
diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -600,26 +600,26 @@ double nsIWidget::DefaultScaleOverride()
   }
 
   return devPixelsPerCSSPixel;
 }
 
 //-------------------------------------------------------------------------
 //
 // Add a child to the list of children
 //
 //-------------------------------------------------------------------------
 void nsBaseWidget::AddChild(nsIWidget* aChild)
 {
-  MOZ_RELEASE_ASSERT(!aChild->GetNextSibling() && !aChild->GetPrevSibling(),
-                     "aChild not properly removed from its old child list");
+  MOZ_ASSERT(!aChild->GetNextSibling() && !aChild->GetPrevSibling(),
+             "aChild not properly removed from its old child list");
 
   if (!mFirstChild) {
     mFirstChild = mLastChild = aChild;
   } else {
     // append to the list
     MOZ_RELEASE_ASSERT(mLastChild);
     MOZ_RELEASE_ASSERT(!mLastChild->GetNextSibling());
     mLastChild->SetNextSibling(aChild);
     aChild->SetPrevSibling(mLastChild);
     mLastChild = aChild;
   }
 }
