merge mozilla-inbound to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Tue, 29 Mar 2016 14:16:13 +0200
changeset 328595 d5d53a3b4e50b94cdf85d20690526e5a00d5b63e
parent 328530 971ee95dade06b20742e94d58c471e76705ca478 (current diff)
parent 328594 72c2846e2d161e3c73f04c679e52717ccde38f7b (diff)
child 328601 b4941d71b4df56c6f49c6f176cd65bf8af4b0e32
child 328734 8898c7f8ea957a2a1527ab37a48b01b37a4bcb3e
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone48.0a1
first release with
nightly linux32
d5d53a3b4e50 / 48.0a1 / 20160330030326 / files
nightly linux64
d5d53a3b4e50 / 48.0a1 / 20160330030326 / files
nightly mac
d5d53a3b4e50 / 48.0a1 / 20160330030326 / files
nightly win32
d5d53a3b4e50 / 48.0a1 / 20160330030326 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
merge mozilla-inbound to mozilla-central a=merge
ipc/chromium/src/base/base_switches.cc
ipc/chromium/src/base/base_switches.h
ipc/chromium/src/base/idle_timer.cc
ipc/chromium/src/base/idle_timer.h
ipc/chromium/src/base/idle_timer_none.cc
ipc/chromium/src/base/linux_util.h
ipc/chromium/src/base/registry.cc
ipc/chromium/src/base/registry.h
ipc/chromium/src/base/string_tokenizer.h
ipc/chromium/src/base/thread_collision_warner.cc
ipc/chromium/src/base/thread_collision_warner.h
ipc/chromium/src/base/time_format.h
ipc/chromium/src/chrome/common/env_vars.cc
ipc/chromium/src/chrome/common/env_vars.h
memory/replace/dmd/test/full-empty-cumulative-expected.txt
memory/replace/dmd/test/full-empty-dark-matter-expected.txt
memory/replace/dmd/test/full-empty-live-expected.txt
memory/replace/dmd/test/full-sampled-live-expected.txt
memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt
memory/replace/dmd/test/full-unsampled1-live-expected.txt
memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt
memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -11,16 +11,17 @@
 #include "AccGroupInfo.h"
 #include "AccIterator.h"
 #include "nsAccUtils.h"
 #include "nsAccessibilityService.h"
 #include "ApplicationAccessible.h"
 #include "nsEventShell.h"
 #include "nsTextEquivUtils.h"
 #include "DocAccessibleChild.h"
+#include "Logging.h"
 #include "Relation.h"
 #include "Role.h"
 #include "RootAccessible.h"
 #include "States.h"
 #include "StyleInfo.h"
 #include "TableAccessible.h"
 #include "TableCellAccessible.h"
 #include "TreeWalker.h"
@@ -1954,17 +1955,28 @@ Accessible::NativeName(nsString& aName)
 // Accessible protected
 void
 Accessible::BindToParent(Accessible* aParent, uint32_t aIndexInParent)
 {
   NS_PRECONDITION(aParent, "This method isn't used to set null parent!");
 
   if (mParent) {
     if (mParent != aParent) {
-      NS_ERROR("Adopting child!");
+#ifdef A11Y_LOG
+      if (logging::IsEnabled(logging::eTree)) {
+        logging::MsgBegin("TREE", "BindToParent: stealing accessible");
+        logging::AccessibleInfo("old parent", mParent);
+        logging::AccessibleInfo("new parent", aParent);
+        logging::AccessibleInfo("child", this);
+        logging::MsgEnd();
+      }
+#endif
+      // XXX: legalize adoption. As long as we don't invalidate the children,
+      // the accessibles start to steal them.
+
       mParent->InvalidateChildrenGroupInfo();
       mParent->RemoveChild(this);
     } else {
       NS_ERROR("Binding to the same parent!");
       return;
     }
   }
 
--- a/accessible/generic/Accessible.h
+++ b/accessible/generic/Accessible.h
@@ -389,16 +389,24 @@ public:
   virtual void InvalidateChildren();
 
   /**
    * Append/insert/remove a child. Return true if operation was successful.
    */
   bool AppendChild(Accessible* aChild)
     { return InsertChildAt(mChildren.Length(), aChild); }
   virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild);
+
+  bool InsertAfter(Accessible* aNewChild, Accessible* aRefChild)
+  {
+    MOZ_ASSERT(aNewChild, "No new child to insert");
+    return InsertChildAt(aRefChild ? aRefChild->IndexInParent() + 1 : 0,
+                         aNewChild);
+  }
+
   virtual bool RemoveChild(Accessible* aChild);
 
   /**
    * Reallocates the child withing its parent.
    */
   void MoveChild(uint32_t aNewIndex, Accessible* aChild);
 
   //////////////////////////////////////////////////////////////////////////////
--- a/accessible/generic/DocAccessible-inl.h
+++ b/accessible/generic/DocAccessible-inl.h
@@ -17,16 +17,28 @@
 
 #ifdef A11Y_LOG
 #include "Logging.h"
 #endif
 
 namespace mozilla {
 namespace a11y {
 
+inline Accessible*
+DocAccessible::AccessibleOrTrueContainer(nsINode* aNode) const
+{
+  // HTML comboboxes have no-content list accessible as an intermediate
+  // containing all options.
+  Accessible* container = GetAccessibleOrContainer(aNode);
+  if (container && container->IsHTMLCombobox()) {
+    return container->FirstChild();
+  }
+  return container;
+}
+
 inline nsIAccessiblePivot*
 DocAccessible::VirtualCursor()
 {
   if (!mVirtualCursor) {
     mVirtualCursor = new nsAccessiblePivot(this);
     mVirtualCursor->AddObserver(this);
   }
   return mVirtualCursor;
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -1344,17 +1344,17 @@ DocAccessible::ContentInserted(nsIConten
                                nsIContent* aEndChildNode)
 {
   // Ignore content insertions until we constructed accessible tree. Otherwise
   // schedule tree update on content insertion after layout.
   if (mNotificationController && HasLoadState(eTreeConstructed)) {
     // Update the whole tree of this document accessible when the container is
     // null (document element is inserted or removed).
     Accessible* container = aContainerNode ?
-      GetAccessibleOrContainer(aContainerNode) : this;
+      AccessibleOrTrueContainer(aContainerNode) : this;
     if (container) {
       // Ignore notification if the container node is no longer in the DOM tree.
       mNotificationController->ScheduleContentInsertion(container,
                                                         aStartChildNode,
                                                         aEndChildNode);
     }
   }
 }
@@ -1664,61 +1664,202 @@ DocAccessible::UpdateAccessibleOnAttrCha
     RecreateAccessible(aElement);
 
     return true;
   }
 
   return false;
 }
 
-void
-DocAccessible::ProcessContentInserted(Accessible* aContainer,
-                                      const nsTArray<nsCOMPtr<nsIContent> >* aInsertedContent)
+/**
+ * Content insertion helper.
+ */
+class InsertIterator final
 {
-  // Process insertions if the container accessible is still in tree.
-  if (!HasAccessible(aContainer->GetNode()))
-    return;
+public:
+  InsertIterator(Accessible* aContext,
+                 const nsTArray<nsCOMPtr<nsIContent> >* aNodes) :
+    mChild(nullptr), mChildBefore(nullptr), mWalker(aContext),
+    mStopNode(nullptr), mNodes(aNodes), mNodesIdx(0)
+  {
+    MOZ_ASSERT(aContext, "No context");
+    MOZ_ASSERT(aNodes, "No nodes to search for accessible elements");
+    MOZ_COUNT_CTOR(InsertIterator);
+  }
+  ~InsertIterator() { MOZ_COUNT_DTOR(InsertIterator); }
+
+  Accessible* Context() const { return mWalker.Context(); }
+  Accessible* Child() const { return mChild; }
+  Accessible* ChildBefore() const { return mChildBefore; }
+  DocAccessible* Document() const { return mWalker.Document(); }
+
+  /**
+   * Iterates to a next accessible within the inserted content.
+   */
+  bool Next();
 
-  for (uint32_t idx = 0; idx < aInsertedContent->Length(); idx++) {
+private:
+  Accessible* mChild;
+  Accessible* mChildBefore;
+  TreeWalker mWalker;
+  nsIContent* mStopNode;
+
+  const nsTArray<nsCOMPtr<nsIContent> >* mNodes;
+  uint32_t mNodesIdx;
+};
+
+bool
+InsertIterator::Next()
+{
+  if (mNodesIdx > 0) {
+    Accessible* nextChild = mWalker.Next(mStopNode);
+    if (nextChild) {
+      mChildBefore = mChild;
+      mChild = nextChild;
+      return true;
+    }
+  }
+
+  while (mNodesIdx < mNodes->Length()) {
+    // Ignore nodes that are not contained by the container anymore.
+
     // The container might be changed, for example, because of the subsequent
     // overlapping content insertion (i.e. other content was inserted between
     // this inserted content and its container or the content was reinserted
     // into different container of unrelated part of tree). To avoid a double
     // processing of the content insertion ignore this insertion notification.
-    // Note, the inserted content might be not in tree at all at this point what
-    // means there's no container. Ignore the insertion too.
-
-    Accessible* container =
-      GetContainerAccessible(aInsertedContent->ElementAt(idx));
-    if (container != aContainer)
+    // Note, the inserted content might be not in tree at all at this point
+    // what means there's no container. Ignore the insertion too.
+    nsIContent* prevNode = mNodes->SafeElementAt(mNodesIdx - 1);
+    nsIContent* node = mNodes->ElementAt(mNodesIdx++);
+    Accessible* container = Document()->AccessibleOrTrueContainer(node);
+    if (container != Context()) {
       continue;
-
-    if (container == this) {
-      // If new root content has been inserted then update it.
-      UpdateRootElIfNeeded();
-
-      // Continue to update the tree even if we don't have root content.
-      // For example, elements may be inserted under the document element while
-      // there is no HTML body element.
     }
 
     // HTML comboboxes have no-content list accessible as an intermediate
     // containing all options.
-    if (container && container->IsHTMLCombobox()) {
+    if (container->IsHTMLCombobox()) {
       container = container->FirstChild();
     }
 
-    // We have a DOM/layout change under the container accessible, and its tree
-    // might need an update. Since DOM/layout change of the element may affect
-    // on the accessibleness of adjacent elements (for example, insertion of
-    // extra HTML:body make the old body accessible) then we have to recache
-    // children of the container, and then fire show/hide events for a change.
-    UpdateTreeOnInsertion(container);
-    break;
+    if (!container->IsAcceptableChild(node)) {
+      continue;
+    }
+
+#ifdef A11Y_LOG
+    logging::TreeInfo("traversing an inserted node", logging::eVerbose,
+                      "container", container, "node", node);
+#endif
+
+    // If inserted nodes are siblings then just move the walker next.
+    if (prevNode && prevNode->GetNextSibling() == node) {
+      mStopNode = node;
+      Accessible* nextChild = mWalker.Next(mStopNode);
+      if (nextChild) {
+        mChildBefore = mChild;
+        mChild = nextChild;
+        return true;
+      }
+    }
+    else if (mWalker.Seek(node)) {
+      mStopNode = node;
+      mChildBefore = mWalker.Prev();
+      mChild = mWalker.Next(mStopNode);
+      if (mChild) {
+        return true;
+      }
+    }
+  }
+
+  return false;
+}
+
+void
+DocAccessible::ProcessContentInserted(Accessible* aContainer,
+                                      const nsTArray<nsCOMPtr<nsIContent> >* aNodes)
+{
+  // Process insertions if the container accessible is still in tree.
+  if (!HasAccessible(aContainer->GetNode()))
+    return;
+
+  // If new root content has been inserted then update it.
+  if (aContainer == this) {
+    UpdateRootElIfNeeded();
   }
+
+  uint32_t updateFlags = 0;
+  AutoTreeMutation mut(aContainer);
+  RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(aContainer);
+
+#ifdef A11Y_LOG
+  logging::TreeInfo("children before insertion", logging::eVerbose,
+                    aContainer);
+#endif
+
+  InsertIterator iter(aContainer, aNodes);
+  while (iter.Next()) {
+    Accessible* parent = iter.Child()->Parent();
+    if (parent) {
+      if (parent != aContainer) {
+#ifdef A11Y_LOG
+        logging::TreeInfo("stealing accessible", 0,
+                          "old parent", parent, "new parent",
+                          aContainer, "child", iter.Child(), nullptr);
+#endif
+        MOZ_ASSERT_UNREACHABLE("stealing accessible");
+        continue;
+      }
+
+#ifdef A11Y_LOG
+      logging::TreeInfo("binding to same parent", logging::eVerbose,
+                        "parent", aContainer, "child", iter.Child(), nullptr);
+#endif
+      continue;
+    }
+
+    if (aContainer->InsertAfter(iter.Child(), iter.ChildBefore())) {
+#ifdef A11Y_LOG
+      logging::TreeInfo("accessible was inserted", 0,
+                        "container", aContainer, "child", iter.Child(), nullptr);
+#endif
+
+      updateFlags |= UpdateTreeInternal(iter.Child(), true, reorderEvent);
+      continue;
+    }
+
+    MOZ_ASSERT_UNREACHABLE("accessible was rejected");
+  }
+
+#ifdef A11Y_LOG
+  logging::TreeInfo("children after insertion", logging::eVerbose,
+                    aContainer);
+#endif
+
+  // Content insertion did not cause an accessible tree change.
+  if (updateFlags == eNoAccessible) {
+    return;
+  }
+
+  // Check to see if change occurred inside an alert, and fire an EVENT_ALERT
+  // if it did.
+  if (!(updateFlags & eAlertAccessible) &&
+      (aContainer->IsAlert() || aContainer->IsInsideAlert())) {
+    Accessible* ancestor = aContainer;
+    do {
+      if (ancestor->IsAlert()) {
+        FireDelayedEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor);
+        break;
+      }
+    }
+    while ((ancestor = ancestor->Parent()));
+  }
+
+  MaybeNotifyOfValueChange(aContainer);
+  FireDelayedEvent(reorderEvent);
 }
 
 void
 DocAccessible::UpdateTreeOnInsertion(Accessible* aContainer)
 {
   for (uint32_t idx = 0; idx < aContainer->ContentChildCount(); idx++) {
     Accessible* child = aContainer->ContentChildAt(idx);
     child->SetSurvivingInUpdate(true);
@@ -2256,9 +2397,8 @@ DocAccessible::IsLoadEventTarget() const
     // while there's no parent document yet).
     DocAccessible* parentDoc = ParentDocument();
     return parentDoc && parentDoc->HasLoadState(eCompletelyLoaded);
   }
 
   // It's content (not chrome) root document.
   return (treeItem->ItemType() == nsIDocShellTreeItem::typeContent);
 }
-
--- a/accessible/generic/DocAccessible.h
+++ b/accessible/generic/DocAccessible.h
@@ -271,16 +271,22 @@ public:
    * Return a container accessible for the given DOM node.
    */
   Accessible* GetContainerAccessible(nsINode* aNode) const
   {
     return aNode ? GetAccessibleOrContainer(aNode->GetParentNode()) : nullptr;
   }
 
   /**
+   * Return an accessible for the given node if any, or an immediate accessible
+   * container for it.
+   */
+  Accessible* AccessibleOrTrueContainer(nsINode* aNode) const;
+
+  /**
    * Return an accessible for the given node or its first accessible descendant.
    */
   Accessible* GetAccessibleOrDescendant(nsINode* aNode) const;
 
   /**
    * Returns aria-owns seized child at the given index.
    */
   Accessible* ARIAOwnedAt(Accessible* aParent, uint32_t aIndex) const
--- a/accessible/tests/mochitest/actions/test_general.xul
+++ b/accessible/tests/mochitest/actions/test_general.xul
@@ -16,16 +16,19 @@
           src="../common.js" />
   <script type="application/javascript"
           src="../events.js" />
   <script type="application/javascript"
           src="../actions.js" />
 
   <script type="application/javascript">
   <![CDATA[
+    //gA11yEventDumpToConsole = true;
+    //enableLogging("tree,verbose"); // debug
+
     if (navigator.platform.startsWith("Mac")) {
       SimpleTest.expectAssertions(0, 1);
     } else {
       SimpleTest.expectAssertions(0, 1);
     }
 
     function doTest()
     {
--- a/accessible/tests/mochitest/actions/test_link.html
+++ b/accessible/tests/mochitest/actions/test_link.html
@@ -50,17 +50,18 @@
 
       this.getID = function linkChecker_getID()
       {
         return "link '" + aID + "' states check ";
       }
     }
 
     //gA11yEventDumpID = "eventdump"; // debug stuff
-    gA11yEventDumpToConsole = true;
+    //gA11yEventDumpToConsole = true;
+    //enableLogging("tree");
 
     function doTest()
     {
       var actionsArray = [
         {
           ID: "link1",
           actionName: "jump",
           events: CLICK_EVENTS,
--- a/accessible/tests/mochitest/bounds/test_zoom.html
+++ b/accessible/tests/mochitest/bounds/test_zoom.html
@@ -18,16 +18,17 @@
           src="../events.js"></script>
   <script type="application/javascript"
           src="../layout.js"></script>
   <script type="application/javascript"
           src="../browser.js"></script>
 
   <script type="application/javascript">
     //gA11yEventDumpToConsole = true;
+    //enableLogging("tree,verbose");
     function doPreTest()
     {
       var tabDocument = currentTabDocument();
       var imgMap = tabDocument.getElementById("imgmap");
       waitForImageMap(imgMap, doTest);
     }
 
     function doTest()
--- a/accessible/tests/mochitest/editabletext/editabletext.js
+++ b/accessible/tests/mochitest/editabletext/editabletext.js
@@ -291,16 +291,18 @@ function editableTextTest(aID)
   {
     var et = this;
     var invoker = {
       eventSeq: [],
 
       invoke: aInvokeFunc,
       finalCheck: function finalCheck()
       {
+        //dumpTree(aID, `'${aID}' tree:`);
+
         aChecker.check();
         et.unwrapNextTest(); // replace dummy invoker on real invoker object.
       },
       getID: function getID() { return aInvokerID; }
     };
 
     if (aRemoveTriple) {
       var checker = new textChangeChecker(aID, aRemoveTriple[0],
--- a/accessible/tests/mochitest/editabletext/test_1.html
+++ b/accessible/tests/mochitest/editabletext/test_1.html
@@ -14,16 +14,18 @@ https://bugzilla.mozilla.org/show_bug.cg
   <script type="application/javascript"
           src="../common.js"></script>
   <script type="application/javascript"
           src="../events.js"></script>
   <script type="application/javascript"
           src="editabletext.js"></script>
 
   <script type="application/javascript">
+    //gA11yEventDumpToConsole = true;
+    //enableLogging("tree,verbose"); // debug
 
     function addTestEditable(aID, aTestRun, aBeforeContent, aAfterContent)
     {
       var et = new editableTextTest(aID);
       var startOffset = aBeforeContent ? aBeforeContent.length : 0;
       // XXX afterContent currently is not used
 
       //////////////////////////////////////////////////////////////////////////
--- a/accessible/tests/mochitest/events/test_coalescence.html
+++ b/accessible/tests/mochitest/events/test_coalescence.html
@@ -323,16 +323,17 @@
       this.initSequence();
     }
 
     ////////////////////////////////////////////////////////////////////////////
     // Do tests.
 
     var gQueue = null;
     //gA11yEventDumpToConsole = true; // debug stuff
+    //enableLogging("tree");
 
     function doTests()
     {
       gQueue = new eventQueue();
 
       gQueue.push(new removeChildNParent("option1", "select1"));
       gQueue.push(new removeParentNChild("option2", "select2"));
       gQueue.push(new hideChildNParent("option3", "select3"));
--- a/accessible/tests/mochitest/events/test_mutation.html
+++ b/accessible/tests/mochitest/events/test_mutation.html
@@ -409,21 +409,23 @@
       return children;
     }
 
     function getParent(aNode)
     {
       return aNode.parentNode;
     }
 
+    //gA11yEventDumpToConsole = true; // debug stuff
+    //enableLogging("tree,verbose");
+
     /**
      * Do tests.
      */
     var gQueue = null;
-    //gA11yEventDumpToConsole = true; // debug stuff
 
     function doTests()
     {
       gQueue = new eventQueue();
 
       // Show/hide events by changing of display style of accessible DOM node
       // from 'inline' to 'none', 'none' to 'inline'.
       var id = "link1";
@@ -564,11 +566,10 @@
   </div>
   <div id="testContainer2"></div>
   <div id="testContainer3"></div>
 
   <div id="c4">
     <div style="visibility:hidden" id="c4_middle">
      <div style="visibility:visible" id="c4_child"></div>
    </div>
-  </div>
 </body>
 </html>
--- a/accessible/tests/mochitest/textcaret/test_browserui.xul
+++ b/accessible/tests/mochitest/textcaret/test_browserui.xul
@@ -23,18 +23,18 @@
           src="../browser.js"></script>
 
   <script type="application/javascript">
   <![CDATA[
 
     ////////////////////////////////////////////////////////////////////////////
     // Tests
 
-    //gA11yEventDumpID = "eventdump"; // debug stuff
     //gA11yEventDumpToConsole = true; // debug
+    //enableLogging("tree,verbose");
 
     var gQueue = null;
     function doTests()
     {
       gQueue = new eventQueue();
       gQueue.push(new setCaretOffset(urlbarInput(), -1, urlbarInput()));
       gQueue.push(new setCaretOffset(urlbarInput(), 0));
       gQueue.onFinish = function()
@@ -50,20 +50,18 @@
   ]]>
   </script>
 
   <vbox flex="1" style="overflow: auto;">
   <body xmlns="http://www.w3.org/1999/xhtml">
     <a target="_blank"
        href="https://bugzilla.mozilla.org/show_bug.cgi?id=723833"
        title="IAccessibleText::setCaretOffset on location or search bar causes focus to jump">
-      Mozilla Bug 723833
+      Bug 723833
     </a>
     <p id="display"></p>
     <div id="content" style="display: none">
     </div>
     <pre id="test">
     </pre>
   </body>
-
-  <vbox id="eventdump"></vbox>
   </vbox>
 </window>
--- a/accessible/tests/mochitest/tree/test_dockids.html
+++ b/accessible/tests/mochitest/tree/test_dockids.html
@@ -11,16 +11,18 @@
   <script type="application/javascript"
           src="../common.js"></script>
   <script type="application/javascript"
           src="../role.js"></script>
   <script type="application/javascript"
           src="../states.js"></script>
 
   <script type="application/javascript">
+  //gA11yEventDumpToConsole = true;
+  //enableLogging("tree,verbose");
   function doTest()
   {
     var tree =
      { DOCUMENT: [
        { TEXT_CONTAINER: [ // head
          { TEXT_CONTAINER: [ // link
            { STATICTEXT: [] }, // generated content
            { STATICTEXT: [] } // generated content
--- a/accessible/tests/mochitest/tree/test_tabbrowser.xul
+++ b/accessible/tests/mochitest/tree/test_tabbrowser.xul
@@ -196,16 +196,19 @@
       this.getID = function testTabHierarchy_getID()
       {
         return "hierarchy of tabs";
       }
     }
 
     ////////////////////////////////////////////////////////////////////////////
     // Test
+    //gA11yEventDumpToConsole = true;
+    //enableLogging("tree,verbose,stack");
+
     var gQueue = null;
     function doTest()
     {
       // Load documents into tabs and wait for docLoadComplete events caused by these
       // documents load before we start the test.
       gQueue = new eventQueue();
 
       gQueue.push(new testTabHierarchy());
--- a/accessible/tests/mochitest/tree/test_txtctrl.xul
+++ b/accessible/tests/mochitest/tree/test_txtctrl.xul
@@ -13,16 +13,19 @@
           src="../common.js" />
   <script type="application/javascript"
           src="../role.js" />
   <script type="application/javascript"
           src="../events.js" />
 
   <script type="application/javascript">
   <![CDATA[
+    //gA11yEventDumpToConsole = true;
+    //enableLogging("tree,verbose"); // debug stuff
+
     ////////////////////////////////////////////////////////////////////////////
     // Test
 
     function doTest()
     {
       //////////////////////////////////////////////////////////////////////////
       // textboxes
 
@@ -155,16 +158,17 @@
           }
         );
         test_AutocompleteControl();
 
       } else {
         SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget.");
 
         // Dumb access to trigger popup lazy creation.
+        dump("Trigget popup lazy creation");
         waitForEvent(EVENT_REORDER, txc, test_AutocompleteControl);
         txc.popup;
 
         accTree.children.push(
           {
             role: ROLE_LIST,
             children: [
               {
--- a/accessible/tests/mochitest/treeupdate/test_ariadialog.html
+++ b/accessible/tests/mochitest/treeupdate/test_ariadialog.html
@@ -67,16 +67,17 @@
 
     //gA11yEventDumpID = "eventdump"; // debug stuff
     //gA11yEventDumpToConsole = true;
 
     var gQueue = null;
 
     function doTest()
     {
+      //enableLogging("tree");
       gQueue = new eventQueue();
 
       // make the accessible an inaccessible
       gQueue.push(new showARIADialog("dialog"));
 
       gQueue.invoke(); // SimpleTest.finish() will be called in the end
     }
 
--- a/accessible/tests/mochitest/treeupdate/test_ariaowns.html
+++ b/accessible/tests/mochitest/treeupdate/test_ariaowns.html
@@ -189,18 +189,18 @@
       }
 
       this.finalCheck = function appendEl_finalCheck()
       {
         // children are invalidated, they includes aria-owns swapped kids and
         // newly inserted child.
         var tree =
           { SECTION: [
-              { CHECKBUTTON: [ ] },
-              { RADIOBUTTON: [ ] },
+              { CHECKBUTTON: [ ] }, // existing explicit, t1_checkbox
+              { RADIOBUTTON: [ ] }, // new explicit, t1_child3
               { PUSHBUTTON: [ ] }, // ARIA owned, t1_button
               { SECTION: [ ] }, // ARIA owned, t1_subdiv
               { GROUPING: [ ] } // ARIA owned, t1_group
           ] };
         testAccessibleTree("t1_container", tree);
       }
 
       this.getID = function appendEl_getID()
@@ -223,18 +223,18 @@
         getNode("t1_span").parentNode.removeChild(getNode("t1_span"));
       }
 
       this.finalCheck = function removeEl_finalCheck()
       {
         // subdiv should go away
         var tree =
           { SECTION: [
-              { CHECKBUTTON: [ ] },
-              { RADIOBUTTON: [ ] },
+              { CHECKBUTTON: [ ] }, // explicit, t1_checkbox
+              { RADIOBUTTON: [ ] }, // explicit, t1_child3
               { PUSHBUTTON: [ ] }, // ARIA owned, t1_button
               { GROUPING: [ ] } // ARIA owned, t1_group
           ] };
         testAccessibleTree("t1_container", tree);
       }
 
       this.getID = function removeEl_getID()
       {
--- a/accessible/tests/mochitest/treeupdate/test_contextmenu.xul
+++ b/accessible/tests/mochitest/treeupdate/test_contextmenu.xul
@@ -112,18 +112,18 @@
       }
 
       this.getID = function closeMenu_getID()
       {
         return "close menu " + prettyName(aID);
       }
     }
 
-    //gA11yEventDumpID = "eventdump";
     //gA11yEventDumpToConsole = true;
+    //enableLogging("tree,verbose");
 
     var gQueue = null;
     var gContextTree = {};
 
     // Linux and Windows menu trees discrepancy: bug 527646.
 
     /**
      * Return the context menu tree before submenus were open.
@@ -307,13 +307,11 @@
                 <menuitem id="item2.0.0" label="item2.0.0"/>
               </menupopup>
             </menu>
           </menupopup>
         </menu>
       </menupopup>
 
       <button context="context" id="button">btn</button>
-
-      <vbox id="eventdump" role="log"/>
     </vbox>
   </hbox>
 </window>
--- a/browser/themes/shared/customizableui/panelUIOverlay.inc.css
+++ b/browser/themes/shared/customizableui/panelUIOverlay.inc.css
@@ -204,29 +204,29 @@ panelmultiview[nosubviews=true] > .panel
 
 #PanelUI-popup > .panel-arrowcontainer > .panel-arrowcontent,
 .cui-widget-panel > .panel-arrowcontainer > .panel-arrowcontent > .popup-internal-box {
   padding: 0;
 }
 
 .panelUI-grid .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text,
 .panelUI-grid .toolbarbutton-1 > .toolbarbutton-multiline-text {
-  line-height: 1.1;
-  max-height: 2.2em;
+  line-height: 1.2;
+  max-height: 2.4em;
 }
 
 .panelUI-grid .toolbarbutton-1:not([auto-hyphens="off"]) > .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text,
 .panelUI-grid .toolbarbutton-1:not([auto-hyphens="off"]) > .toolbarbutton-multiline-text {
   -moz-hyphens: auto;
 }
 
 .panelUI-grid:not([customize-transitioning]) .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text,
 .panelUI-grid:not([customize-transitioning]) .toolbarbutton-1 > .toolbarbutton-multiline-text {
   position: absolute;
-  clip: rect(auto, auto, 2.3em, auto);
+  clip: rect(-0.1em, auto, 2.6em, auto);
 }
 
 .panelUI-grid .toolbarbutton-1 > .toolbarbutton-text,
 .panelUI-grid .toolbarbutton-1 > .toolbarbutton-multiline-text {
   text-align: center;
   /* Need to override toolkit theming which sets margin: 0 !important; */
   margin: 2px 0 0 !important;
 }
--- a/docshell/base/LoadContext.cpp
+++ b/docshell/base/LoadContext.cpp
@@ -52,21 +52,19 @@ LoadContext::LoadContext(nsIPrincipal* a
 {
   PrincipalOriginAttributes poa = BasePrincipal::Cast(aPrincipal)->OriginAttributesRef();
   mOriginAttributes.InheritFromDocToChildDocShell(poa);
 
   if (!aOptionalBase) {
     return;
   }
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aOptionalBase->GetIsContent(&mIsContent)));
-  MOZ_ALWAYS_TRUE(
-    NS_SUCCEEDED(aOptionalBase->GetUsePrivateBrowsing(&mUsePrivateBrowsing)));
-  MOZ_ALWAYS_TRUE(
-    NS_SUCCEEDED(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs)));
+  MOZ_ALWAYS_SUCCEEDS(aOptionalBase->GetIsContent(&mIsContent));
+  MOZ_ALWAYS_SUCCEEDS(aOptionalBase->GetUsePrivateBrowsing(&mUsePrivateBrowsing));
+  MOZ_ALWAYS_SUCCEEDS(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs));
 }
 
 //-----------------------------------------------------------------------------
 // LoadContext::nsILoadContext
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 LoadContext::GetAssociatedWindow(mozIDOMWindowProxy**)
--- a/dom/asmjscache/AsmJSCache.cpp
+++ b/dom/asmjscache/AsmJSCache.cpp
@@ -459,18 +459,17 @@ private:
   FailOnNonOwningThread()
   {
     AssertIsOnNonOwningThread();
     MOZ_ASSERT(mState != eOpened &&
                mState != eFailing &&
                mState != eFinished);
 
     mState = eFailing;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(this,
-                                                         NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
   }
 
   void
   InitPersistenceType();
 
   nsresult
   InitOnMainThread();
 
@@ -911,18 +910,17 @@ ParentRunnable::Run()
 
       rv = InitOnMainThread();
       if (NS_FAILED(rv)) {
         FailOnNonOwningThread();
         return NS_OK;
       }
 
       mState = eWaitingToFinishInit;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL)));
+      MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
 
       return NS_OK;
     }
 
     case eWaitingToFinishInit: {
       AssertIsOnOwningThread();
 
       if (QuotaManager::IsShuttingDown()) {
@@ -954,38 +952,35 @@ ParentRunnable::Run()
     }
 
     case eReadyToReadMetadata: {
       AssertIsOnIOThread();
 
       rv = ReadMetadata();
       if (NS_FAILED(rv)) {
         mState = eFailedToReadMetadata;
-        MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-          mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL)));
+        MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
         return NS_OK;
       }
 
       if (mOpenMode == eOpenForRead) {
         mState = eSendingMetadataForRead;
-        MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-          mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL)));
+        MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
 
         return NS_OK;
       }
 
       rv = OpenCacheFileForWrite();
       if (NS_FAILED(rv)) {
         FailOnNonOwningThread();
         return NS_OK;
       }
 
       mState = eSendingCacheFile;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL)));
+      MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
       return NS_OK;
     }
 
     case eFailedToReadMetadata: {
       AssertIsOnOwningThread();
 
       if (mOpenMode == eOpenForRead) {
         CacheMiss();
@@ -1017,18 +1012,17 @@ ParentRunnable::Run()
 
       rv = OpenCacheFileForRead();
       if (NS_FAILED(rv)) {
         FailOnNonOwningThread();
         return NS_OK;
       }
 
       mState = eSendingCacheFile;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL)));
+      MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
       return NS_OK;
     }
 
     case eSendingCacheFile: {
       AssertIsOnOwningThread();
 
       mState = eOpened;
 
--- a/dom/base/Console.cpp
+++ b/dom/base/Console.cpp
@@ -328,17 +328,17 @@ public:
     if (!DispatchInternal(aCx)) {
       ReleaseData();
       return false;
     }
 
     return true;
   }
 
-  virtual bool Notify(JSContext* aCx, workers::Status aStatus) override
+  virtual bool Notify(workers::Status aStatus) override
   {
     // We don't care about the notification. We just want to keep the
     // mWorkerPrivate alive.
     return true;
   }
 
 private:
   NS_IMETHOD
--- a/dom/base/DOMRequest.cpp
+++ b/dom/base/DOMRequest.cpp
@@ -311,17 +311,17 @@ public:
   // can't fetch a js context), set up an initiatization function to make sure
   // we can return the failure appropriately
   static nsresult
   Dispatch(DOMRequest* aRequest,
            const JS::Value& aResult)
   {
     RefPtr<FireSuccessAsyncTask> asyncTask =
       new FireSuccessAsyncTask(aRequest, aResult);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(asyncTask)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(asyncTask));
     return NS_OK;
   }
 
   NS_IMETHODIMP
   Run()
   {
     mReq->FireSuccess(JS::Handle<JS::Value>::fromMarkedLocation(mResult.address()));
     return NS_OK;
@@ -363,17 +363,17 @@ DOMRequestService::FireSuccessAsync(nsID
 
 NS_IMETHODIMP
 DOMRequestService::FireErrorAsync(nsIDOMDOMRequest* aRequest,
                                   const nsAString& aError)
 {
   NS_ENSURE_STATE(aRequest);
   nsCOMPtr<nsIRunnable> asyncTask =
     new FireErrorAsyncTask(static_cast<DOMRequest*>(aRequest), aError);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(asyncTask)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(asyncTask));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DOMRequestService::FireDone(nsIDOMDOMCursor* aCursor) {
   NS_ENSURE_STATE(aCursor);
   static_cast<DOMCursor*>(aCursor)->FireDone();
 
--- a/dom/base/FileReader.cpp
+++ b/dom/base/FileReader.cpp
@@ -713,17 +713,17 @@ FileReader::DecreaseBusyCounter()
 {
   MOZ_ASSERT_IF(mWorkerPrivate, mBusyCount);
   if (mWorkerPrivate && --mBusyCount == 0) {
     mWorkerPrivate->RemoveFeature(this);
   }
 }
 
 bool
-FileReader::Notify(JSContext* aCx, Status aStatus)
+FileReader::Notify(Status aStatus)
 {
   MOZ_ASSERT(mWorkerPrivate);
   mWorkerPrivate->AssertIsOnWorkerThread();
 
   if (aStatus > Running) {
     Shutdown();
   }
 
--- a/dom/base/FileReader.h
+++ b/dom/base/FileReader.h
@@ -102,17 +102,17 @@ public:
   IMPL_EVENT_HANDLER(loadend)
 
   void ReadAsBinaryString(Blob& aBlob, ErrorResult& aRv)
   {
     ReadFileContent(aBlob, EmptyString(), FILE_AS_BINARY, aRv);
   }
 
   // WorkerFeature
-  bool Notify(JSContext* aCx, workers::Status) override;
+  bool Notify(workers::Status) override;
 
 private:
   virtual ~FileReader();
 
   // This must be in sync with dom/webidl/FileReader.webidl
   enum eReadyState {
     EMPTY = 0,
     LOADING = 1,
--- a/dom/base/StructuredCloneHolder.cpp
+++ b/dom/base/StructuredCloneHolder.cpp
@@ -584,17 +584,17 @@ EnsureBlobForBackgroundManager(BlobImpl*
 
       blobImpl = blobChild->GetBlobImpl();
       MOZ_ASSERT(blobImpl);
 
       DebugOnly<bool> isMutable;
       MOZ_ASSERT(NS_SUCCEEDED(blobImpl->GetMutable(&isMutable)));
       MOZ_ASSERT(!isMutable);
     } else {
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(blobImpl->SetMutable(false)));
+      MOZ_ALWAYS_SUCCEEDS(blobImpl->SetMutable(false));
     }
 
     return blobImpl.forget();
   }
 
   const uint32_t subBlobCount = subBlobImpls->Length();
   MOZ_ASSERT(subBlobCount);
 
@@ -634,17 +634,17 @@ EnsureBlobForBackgroundManager(BlobImpl*
     } else {
       blobImpl = MultipartBlobImpl::Create(newSubBlobImpls, contentType, aRv);
     }
 
     if (NS_WARN_IF(aRv.Failed())) {
       return nullptr;
     }
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(blobImpl->SetMutable(false)));
+    MOZ_ALWAYS_SUCCEEDS(blobImpl->SetMutable(false));
   }
 
   return blobImpl.forget();
 }
 
 JSObject*
 ReadBlob(JSContext* aCx,
          uint32_t aIndex,
@@ -693,17 +693,17 @@ WriteBlob(JSStructuredCloneWriter* aWrit
     EnsureBlobForBackgroundManager(aBlob->Impl(), nullptr, rv);
   if (NS_WARN_IF(rv.Failed())) {
     rv.SuppressException();
     return false;
   }
 
   MOZ_ASSERT(blobImpl);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(blobImpl->SetMutable(false)));
+  MOZ_ALWAYS_SUCCEEDS(blobImpl->SetMutable(false));
 
   // We store the position of the blobImpl in the array as index.
   if (JS_WriteUint32Pair(aWriter, SCTAG_DOM_BLOB,
                          aHolder->BlobImpls().Length())) {
     aHolder->BlobImpls().AppendElement(blobImpl);
     return true;
   }
 
--- a/dom/base/WebSocket.cpp
+++ b/dom/base/WebSocket.cpp
@@ -2142,17 +2142,17 @@ namespace {
 class WebSocketWorkerFeature final : public WorkerFeature
 {
 public:
   explicit WebSocketWorkerFeature(WebSocketImpl* aWebSocketImpl)
     : mWebSocketImpl(aWebSocketImpl)
   {
   }
 
-  bool Notify(JSContext* aCx, Status aStatus) override
+  bool Notify(Status aStatus) override
   {
     MOZ_ASSERT(aStatus > workers::Running);
 
     if (aStatus >= Canceling) {
       {
         MutexAutoLock lock(mWebSocketImpl->mMutex);
         mWebSocketImpl->mWorkerShuttingDown = true;
       }
--- a/dom/base/nsContentIterator.cpp
+++ b/dom/base/nsContentIterator.cpp
@@ -1324,18 +1324,18 @@ nsContentSubtreeIterator::Init(nsIDOMRan
   }
 
   firstCandidate = GetDeepFirstChild(firstCandidate);
 
   // confirm that this first possible contained node is indeed contained.  Else
   // we have a range that does not fully contain any node.
 
   bool nodeBefore, nodeAfter;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    nsRange::CompareNodeToRange(firstCandidate, mRange, &nodeBefore, &nodeAfter)));
+  MOZ_ALWAYS_SUCCEEDS(
+    nsRange::CompareNodeToRange(firstCandidate, mRange, &nodeBefore, &nodeAfter));
 
   if (nodeBefore || nodeAfter) {
     MakeEmpty();
     return NS_OK;
   }
 
   // cool, we have the first node in the range.  Now we walk up its ancestors
   // to find the most senior that is still in the range.  That's the real first
@@ -1368,18 +1368,18 @@ nsContentSubtreeIterator::Init(nsIDOMRan
     return NS_OK;
   }
 
   lastCandidate = GetDeepLastChild(lastCandidate);
 
   // confirm that this last possible contained node is indeed contained.  Else
   // we have a range that does not fully contain any node.
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    nsRange::CompareNodeToRange(lastCandidate, mRange, &nodeBefore, &nodeAfter)));
+  MOZ_ALWAYS_SUCCEEDS(
+    nsRange::CompareNodeToRange(lastCandidate, mRange, &nodeBefore, &nodeAfter));
 
   if (nodeBefore || nodeAfter) {
     MakeEmpty();
     return NS_OK;
   }
 
   // cool, we have the last node in the range.  Now we walk up its ancestors to
   // find the most senior that is still in the range.  That's the real first
@@ -1521,18 +1521,18 @@ nsContentSubtreeIterator::GetTopAncestor
     // i.e., either it's not content, or it is content but its own parent is
     // null -- then we're finished, since we don't go up to the root.
     //
     // We have to special-case this because CompareNodeToRange treats the root
     // node differently -- see bug 765205.
     if (!parent || !parent->GetParentNode()) {
       return content;
     }
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      nsRange::CompareNodeToRange(parent, mRange, &nodeBefore, &nodeAfter)));
+    MOZ_ALWAYS_SUCCEEDS(
+      nsRange::CompareNodeToRange(parent, mRange, &nodeBefore, &nodeAfter));
 
     if (nodeBefore || nodeAfter) {
       return content;
     }
     content = parent;
   }
 
   MOZ_CRASH("This should only be possible if aNode was null");
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -8134,17 +8134,17 @@ nsContentUtils::InternalStorageAllowedFo
   // This means that behavior for storage with internal about: URIs should not be
   // affected, which is desireable due to the lack of automated testing for about:
   // URIs with these preferences set, and the importance of the correct functioning
   // of these URIs even with custom preferences.
   nsCOMPtr<nsIURI> uri;
   nsresult rv = aPrincipal->GetURI(getter_AddRefs(uri));
   if (NS_SUCCEEDED(rv) && uri) {
     bool isAbout = false;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(uri->SchemeIs("about", &isAbout)));
+    MOZ_ALWAYS_SUCCEEDS(uri->SchemeIs("about", &isAbout));
     if (isAbout) {
       return access;
     }
   }
 
   // We don't want to prompt for every attempt to access permissions.
   if (sCookiesBehavior == nsICookieService::BEHAVIOR_REJECT) {
     return StorageAccess::eDeny;
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -301,16 +301,17 @@ GK_ATOM(dialog, "dialog")
 GK_ATOM(difference, "difference")
 GK_ATOM(digit, "digit")
 GK_ATOM(dir, "dir")
 GK_ATOM(dirAutoSetBy, "dirAutoSetBy")
 GK_ATOM(directionality, "directionality")
 GK_ATOM(directory, "directory")
 GK_ATOM(disableOutputEscaping, "disable-output-escaping")
 GK_ATOM(disabled, "disabled")
+GK_ATOM(disableglobalhistory, "disableglobalhistory")
 GK_ATOM(disablehistory, "disablehistory")
 GK_ATOM(display, "display")
 GK_ATOM(displayMode, "display-mode")
 GK_ATOM(distinct, "distinct")
 GK_ATOM(div, "div")
 GK_ATOM(dl, "dl")
 GK_ATOM(doctypePublic, "doctype-public")
 GK_ATOM(doctypeSystem, "doctype-system")
--- a/dom/base/test/unit/test_thirdpartyutil.js
+++ b/dom/base/test/unit/test_thirdpartyutil.js
@@ -36,18 +36,19 @@ function run_test() {
   let util = Cc["@mozilla.org/thirdpartyutil;1"].getService(Ci.mozIThirdPartyUtil);
 
   // Create URIs and channels pointing to foo.com and bar.com.
   // We will use these to put foo.com into first and third party contexts.
   let spec1 = "http://foo.com/foo.html";
   let spec2 = "http://bar.com/bar.html";
   let uri1 = NetUtil.newURI(spec1);
   let uri2 = NetUtil.newURI(spec2);
-  let channel1 = NetUtil.newChannel({uri: uri1, loadUsingSystemPrincipal: true});
-  let channel2 = NetUtil.newChannel({uri: uri2, loadUsingSystemPrincipal: true});
+  const contentPolicyType = Ci.nsIContentPolicy.TYPE_DOCUMENT;
+  let channel1 = NetUtil.newChannel({uri: uri1, loadUsingSystemPrincipal: true, contentPolicyType});
+  let channel2 = NetUtil.newChannel({uri: uri2, loadUsingSystemPrincipal: true, contentPolicyType});
 
   // Create some file:// URIs.
   let filespec1 = "file://foo.txt";
   let filespec2 = "file://bar.txt";
   let fileuri1 = NetUtil.newURI(filespec1);
   let fileuri2 = NetUtil.newURI(filespec2);
   let filechannel1 = NetUtil.newChannel({uri: fileuri1, loadUsingSystemPrincipal: true});
   let filechannel2 = NetUtil.newChannel({uri: fileuri2, loadUsingSystemPrincipal: true});
@@ -65,22 +66,22 @@ function run_test() {
     NS_ERROR_INVALID_ARG);
   do_check_throws(function() { util.isThirdPartyURI(null, null); },
     NS_ERROR_INVALID_ARG);
 
   // We can't test isThirdPartyWindow since we can't really set up a window
   // hierarchy. We leave that to mochitests.
 
   // Test isThirdPartyChannel. As above, we can't test the bits that require
-  // a load context or window heirarchy. Because of that, the code assumes
-  // that these are all third-party loads.
+  // a load context or window heirarchy. Because of bug 1259873, we assume
+  // that these are not third-party.
   do_check_throws(function() { util.isThirdPartyChannel(null); },
     NS_ERROR_INVALID_ARG);
-  do_check_true(util.isThirdPartyChannel(channel1));
-  do_check_true(util.isThirdPartyChannel(channel1, uri1));
+  do_check_false(util.isThirdPartyChannel(channel1));
+  do_check_false(util.isThirdPartyChannel(channel1, uri1));
   do_check_true(util.isThirdPartyChannel(channel1, uri2));
 
   let httpchannel1 = channel1.QueryInterface(Ci.nsIHttpChannelInternal);
   httpchannel1.forceAllowThirdPartyCookie = true;
   do_check_false(util.isThirdPartyChannel(channel1));
   do_check_false(util.isThirdPartyChannel(channel1, uri1));
   do_check_true(util.isThirdPartyChannel(channel1, uri2));
 }
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -435,17 +435,17 @@ class CGDOMJSClass(CGThing):
             enumerateHook = "mozilla::dom::EnumerateGlobal"
         else:
             resolveHook = "nullptr"
             mayResolveHook = "nullptr"
             enumerateHook = "nullptr"
 
         return fill(
             """
-            static const DOMJSClass Class = {
+            static const DOMJSClass sClass = {
               { "${name}",
                 ${flags},
                 ${addProperty}, /* addProperty */
                 nullptr,               /* delProperty */
                 nullptr,               /* getProperty */
                 nullptr,               /* setProperty */
                 ${enumerate}, /* enumerate */
                 ${resolve}, /* resolve */
@@ -502,17 +502,17 @@ class CGDOMProxyJSClass(CGThing):
         # We don't use an IDL annotation for JSCLASS_EMULATES_UNDEFINED because
         # we don't want people ever adding that to any interface other than
         # HTMLAllCollection.  So just hardcode it here.
         if self.descriptor.interface.identifier.name == "HTMLAllCollection":
             flags.append("JSCLASS_EMULATES_UNDEFINED")
         objectMovedHook = OBJECT_MOVED_HOOK_NAME if self.descriptor.wrapperCache else 'nullptr'
         return fill(
             """
-            static const DOMJSClass Class = {
+            static const DOMJSClass sClass = {
               PROXY_CLASS_WITH_EXT("${name}",
                                    ${flags},
                                    PROXY_MAKE_EXT(false,   /* isWrappedNative */
                                                   ${objectMoved})),
               $*{descriptor}
             };
             """,
             name=self.descriptor.interface.identifier.name,
@@ -581,17 +581,17 @@ class CGPrototypeJSClass(CGThing):
         prototypeID, depth = PrototypeIDAndDepth(self.descriptor)
         slotCount = "DOM_INTERFACE_PROTO_SLOTS_BASE"
         if self.descriptor.hasUnforgeableMembers:
             slotCount += " + 1 /* slot for the JSObject holding the unforgeable properties */"
         (protoGetter, _) = InterfacePrototypeObjectProtoGetter(self.descriptor)
         type = "eGlobalInterfacePrototype" if self.descriptor.isGlobal() else "eInterfacePrototype"
         return fill(
             """
-            static const DOMIfaceAndProtoJSClass PrototypeClass = {
+            static const DOMIfaceAndProtoJSClass sPrototypeClass = {
               {
                 "${name}Prototype",
                 JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(${slotCount}),
                 nullptr,               /* addProperty */
                 nullptr,               /* delProperty */
                 nullptr,               /* getProperty */
                 nullptr,               /* setProperty */
                 nullptr,               /* enumerate */
@@ -677,17 +677,17 @@ class CGInterfaceObjectJSClass(CGThing):
         slotCount = "DOM_INTERFACE_SLOTS_BASE"
         if len(self.descriptor.interface.namedConstructors) > 0:
             slotCount += (" + %i /* slots for the named constructors */" %
                           len(self.descriptor.interface.namedConstructors))
         (protoGetter, _) = InterfaceObjectProtoGetter(self.descriptor)
 
         return fill(
             """
-            static const DOMIfaceAndProtoJSClass InterfaceObjectClass = {
+            static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
               {
                 "Function",
                 JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(${slotCount}),
                 nullptr,               /* addProperty */
                 nullptr,               /* delProperty */
                 nullptr,               /* getProperty */
                 nullptr,               /* setProperty */
                 nullptr,               /* enumerate */
@@ -1522,17 +1522,17 @@ class CGAbstractClassHook(CGAbstractStat
 
 
 class CGGetJSClassMethod(CGAbstractMethod):
     def __init__(self, descriptor):
         CGAbstractMethod.__init__(self, descriptor, 'GetJSClass', 'const JSClass*',
                                   [])
 
     def definition_body(self):
-        return "return Class.ToJSClass();\n"
+        return "return sClass.ToJSClass();\n"
 
 
 class CGAddPropertyHook(CGAbstractClassHook):
     """
     A hook for addProperty, used to preserve our wrapper from GC.
     """
     def __init__(self, descriptor):
         args = [Argument('JSContext*', 'cx'),
@@ -2847,28 +2847,28 @@ class CGCreateInterfaceObjectsMethod(CGA
         else:
             constructArgs = 0
         if len(self.descriptor.interface.namedConstructors) > 0:
             namedConstructors = "namedConstructors"
         else:
             namedConstructors = "nullptr"
 
         if needInterfacePrototypeObject:
-            protoClass = "&PrototypeClass.mBase"
+            protoClass = "&sPrototypeClass.mBase"
             protoCache = "&aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::%s)" % self.descriptor.name
             parentProto = "parentProto"
             getParentProto = CGGeneric(getParentProto)
         else:
             protoClass = "nullptr"
             protoCache = "nullptr"
             parentProto = "nullptr"
             getParentProto = None
 
         if needInterfaceObject:
-            interfaceClass = "&InterfaceObjectClass.mBase"
+            interfaceClass = "&sInterfaceObjectClass.mBase"
             interfaceCache = "&aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::%s)" % self.descriptor.name
         else:
             # We don't have slots to store the named constructors.
             assert len(self.descriptor.interface.namedConstructors) == 0
             interfaceClass = "nullptr"
             interfaceCache = "nullptr"
 
         isGlobal = self.descriptor.isGlobal() is not None
@@ -2991,17 +2991,17 @@ class CGCreateInterfaceObjectsMethod(CGA
             # Also, for a global we can't use the global's class; just use
             # nullpr and when we do the copy off the holder we'll take a slower
             # path.  This also means that we don't need to worry about matching
             # the prototype.
             if self.descriptor.proxy or self.descriptor.isGlobal():
                 holderClass = "nullptr"
                 holderProto = "nullptr"
             else:
-                holderClass = "Class.ToJSClass()"
+                holderClass = "sClass.ToJSClass()"
                 holderProto = "*protoCache"
             createUnforgeableHolder = CGGeneric(fill(
                 """
                 JS::Rooted<JSObject*> unforgeableHolder(aCx);
                 {
                   JS::Rooted<JSObject*> holderProto(aCx, ${holderProto});
                   unforgeableHolder = JS_NewObjectWithoutMetadata(aCx, ${holderClass}, holderProto);
                   if (!unforgeableHolder) {
@@ -3258,17 +3258,17 @@ class CGDefineDOMInterfaceMethod(CGAbstr
 
     def definition_body(self):
         if len(self.descriptor.interface.namedConstructors) > 0:
             getConstructor = dedent("""
                 JSObject* interfaceObject = GetConstructorObjectHandle(aCx, aGlobal, aDefineOnGlobal);
                 if (!interfaceObject) {
                   return nullptr;
                 }
-                for (unsigned slot = DOM_INTERFACE_SLOTS_BASE; slot < JSCLASS_RESERVED_SLOTS(&InterfaceObjectClass.mBase); ++slot) {
+                for (unsigned slot = DOM_INTERFACE_SLOTS_BASE; slot < JSCLASS_RESERVED_SLOTS(&sInterfaceObjectClass.mBase); ++slot) {
                   JSObject* constructor = &js::GetReservedSlot(interfaceObject, slot).toObject();
                   if (JS_GetFunctionId(JS_GetObjectFunction(constructor)) == JSID_TO_STRING(id)) {
                     return constructor;
                   }
                 }
                 return interfaceObject;
                 """)
         else:
@@ -3357,33 +3357,33 @@ class CGConstructorEnabled(CGAbstractMet
 def CreateBindingJSObject(descriptor, properties):
     objDecl = "BindingJSObjectCreator<%s> creator(aCx);\n" % descriptor.nativeType
 
     # We don't always need to root obj, but there are a variety
     # of cases where we do, so for simplicity, just always root it.
     if descriptor.proxy:
         create = dedent(
             """
-            creator.CreateProxyObject(aCx, &Class.mBase, DOMProxyHandler::getInstance(),
+            creator.CreateProxyObject(aCx, &sClass.mBase, DOMProxyHandler::getInstance(),
                                       proto, aObject, aReflector);
             if (!aReflector) {
               return false;
             }
 
             """)
         if descriptor.interface.getExtendedAttribute('OverrideBuiltins'):
             create += dedent("""
                 js::SetProxyExtra(aReflector, JSPROXYSLOT_EXPANDO,
                                   JS::PrivateValue(&aObject->mExpandoAndGeneration));
 
                 """)
     else:
         create = dedent(
             """
-            creator.CreateObject(aCx, Class.ToJSClass(), proto, aObject, aReflector);
+            creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
             if (!aReflector) {
               return false;
             }
             """)
     return objDecl + create
 
 
 def InitUnforgeablePropertiesOnHolder(descriptor, properties, failureCode):
@@ -3781,17 +3781,17 @@ class CGWrapGlobalMethod(CGAbstractMetho
             $*{assertions}
             MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
                        "nsISupports must be on our primary inheritance chain");
 
             $*{declareProto}
               CreateGlobal<${nativeType}, GetProtoObjectHandle>(aCx,
                                              aObject,
                                              aCache,
-                                             Class.ToJSClass(),
+                                             sClass.ToJSClass(),
                                              aOptions,
                                              aPrincipal,
                                              aInitStandardClasses,
                                              aReflector);
             if (!aReflector) {
               return false;
             }
             $*{assertProto}
--- a/dom/broadcastchannel/BroadcastChannel.cpp
+++ b/dom/broadcastchannel/BroadcastChannel.cpp
@@ -276,17 +276,17 @@ class BroadcastChannelFeature final : pu
 
 public:
   explicit BroadcastChannelFeature(BroadcastChannel* aChannel)
     : mChannel(aChannel)
   {
     MOZ_COUNT_CTOR(BroadcastChannelFeature);
   }
 
-  virtual bool Notify(JSContext* aCx, workers::Status aStatus) override
+  virtual bool Notify(workers::Status aStatus) override
   {
     if (aStatus >= Closing) {
       mChannel->Shutdown();
     }
 
     return true;
   }
 
--- a/dom/cache/Connection.cpp
+++ b/dom/cache/Connection.cpp
@@ -23,32 +23,32 @@ Connection::Connection(mozIStorageConnec
   , mClosed(false)
 {
   MOZ_ASSERT(mBase);
 }
 
 Connection::~Connection()
 {
   NS_ASSERT_OWNINGTHREAD(Connection);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(Close()));
+  MOZ_ALWAYS_SUCCEEDS(Close());
 }
 
 NS_IMETHODIMP
 Connection::Close()
 {
   NS_ASSERT_OWNINGTHREAD(Connection);
 
   if (mClosed) {
     return NS_OK;
   }
   mClosed = true;
 
   // If we are closing here, then Cache must not have a transaction
   // open anywhere else.  This should be guaranteed to succeed.
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(db::IncrementalVacuum(this)));
+  MOZ_ALWAYS_SUCCEEDS(db::IncrementalVacuum(this));
 
   return mBase->Close();
 }
 
 // The following methods are all boilerplate that either forward to the
 // base connection or block the method.  All the async execution methods
 // are blocked because Cache does not use them and they would require more
 // work to wrap properly.
--- a/dom/cache/Context.cpp
+++ b/dom/cache/Context.cpp
@@ -211,18 +211,18 @@ private:
   void Complete(nsresult aResult)
   {
     MOZ_ASSERT(mState == STATE_RUNNING || NS_FAILED(aResult));
 
     MOZ_ASSERT(NS_SUCCEEDED(mResult));
     mResult = aResult;
 
     mState = STATE_COMPLETING;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      mInitiatingThread->Dispatch(this, nsIThread::DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(
+      mInitiatingThread->Dispatch(this, nsIThread::DISPATCH_NORMAL));
   }
 
   void Clear()
   {
     NS_ASSERT_OWNINGTHREAD(QuotaInitRunnable);
     MOZ_ASSERT(mContext);
     mContext = nullptr;
     mManager = nullptr;
@@ -381,18 +381,18 @@ Context::QuotaInitRunnable::Run()
                                                        &mQuotaInfo.mOrigin,
                                                        &mQuotaInfo.mIsApp);
       if (NS_WARN_IF(NS_FAILED(rv))) {
         resolver->Resolve(rv);
         break;
       }
 
       mState = STATE_CREATE_QUOTA_MANAGER;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        mInitiatingThread->Dispatch(this, nsIThread::DISPATCH_NORMAL)));
+      MOZ_ALWAYS_SUCCEEDS(
+        mInitiatingThread->Dispatch(this, nsIThread::DISPATCH_NORMAL));
       break;
     }
     // ----------------------------------
     case STATE_CREATE_QUOTA_MANAGER:
     {
       NS_ASSERT_OWNINGTHREAD(QuotaInitRunnable);
 
       if (mCanceled || QuotaManager::IsShuttingDown()) {
@@ -441,18 +441,18 @@ Context::QuotaInitRunnable::Run()
                                                   getter_AddRefs(mQuotaInfo.mDir));
       if (NS_FAILED(rv)) {
         resolver->Resolve(rv);
         break;
       }
 
       mState = STATE_RUN_ON_TARGET;
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        mTarget->Dispatch(this, nsIThread::DISPATCH_NORMAL)));
+      MOZ_ALWAYS_SUCCEEDS(
+        mTarget->Dispatch(this, nsIThread::DISPATCH_NORMAL));
       break;
     }
     // -------------------
     case STATE_RUN_ON_TARGET:
     {
       MOZ_ASSERT(NS_GetCurrentThread() == mTarget);
 
       mState = STATE_RUNNING;
@@ -463,17 +463,17 @@ Context::QuotaInitRunnable::Run()
       MOZ_ASSERT(resolver->Resolved());
 
       mData = nullptr;
 
       // If the database was opened, then we should always succeed when creating
       // the marker file.  If it wasn't opened successfully, then no need to
       // create a marker file anyway.
       if (NS_SUCCEEDED(resolver->Result())) {
-        MOZ_ALWAYS_TRUE(NS_SUCCEEDED(CreateMarkerFile(mQuotaInfo)));
+        MOZ_ALWAYS_SUCCEEDS(CreateMarkerFile(mQuotaInfo));
       }
 
       break;
     }
     // -------------------
     case STATE_COMPLETING:
     {
       NS_ASSERT_OWNINGTHREAD(QuotaInitRunnable);
@@ -574,18 +574,18 @@ public:
     // The Run() method will handle this by looking at mState after
     // RunOnTarget() returns.
     if (mExecutingRunOnTarget) {
       return;
     }
 
     // Otherwise we are in an asynchronous resolve.  And must perform a thread
     // bounce to run on the target thread again.
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      mTarget->Dispatch(this, nsIThread::DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(
+      mTarget->Dispatch(this, nsIThread::DISPATCH_NORMAL));
   }
 
 private:
   ~ActionRunnable()
   {
     MOZ_ASSERT(mState == STATE_COMPLETE);
     MOZ_ASSERT(!mContext);
     MOZ_ASSERT(!mAction);
@@ -699,18 +699,18 @@ Context::ActionRunnable::Run()
     {
       MOZ_ASSERT(NS_GetCurrentThread() == mTarget);
       // The call to Action::RunOnTarget() must have returned now if we
       // are running on the target thread again.  We may now proceed
       // with completion.
       mState = STATE_COMPLETING;
       // Shutdown must be delayed until all Contexts are destroyed.  Crash
       // for this invariant violation.
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        mInitiatingThread->Dispatch(this, nsIThread::DISPATCH_NORMAL)));
+      MOZ_ALWAYS_SUCCEEDS(
+        mInitiatingThread->Dispatch(this, nsIThread::DISPATCH_NORMAL));
       break;
     }
     // -------------------
     case STATE_COMPLETING:
     {
       NS_ASSERT_OWNINGTHREAD(ActionRunnable);
       mAction->CompleteOnInitiatingThread(mResult);
       mState = STATE_COMPLETE;
@@ -736,34 +736,34 @@ Context::ThreadsafeHandle::AllowToClose(
     AllowToCloseOnOwningThread();
     return;
   }
 
   // Dispatch is guaranteed to succeed here because we block shutdown until
   // all Contexts have been destroyed.
   nsCOMPtr<nsIRunnable> runnable =
     NS_NewRunnableMethod(this, &ThreadsafeHandle::AllowToCloseOnOwningThread);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(
+    mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL));
 }
 
 void
 Context::ThreadsafeHandle::InvalidateAndAllowToClose()
 {
   if (mOwningThread == NS_GetCurrentThread()) {
     InvalidateAndAllowToCloseOnOwningThread();
     return;
   }
 
   // Dispatch is guaranteed to succeed here because we block shutdown until
   // all Contexts have been destroyed.
   nsCOMPtr<nsIRunnable> runnable =
     NS_NewRunnableMethod(this, &ThreadsafeHandle::InvalidateAndAllowToCloseOnOwningThread);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(
+    mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL));
 }
 
 Context::ThreadsafeHandle::ThreadsafeHandle(Context* aContext)
   : mStrongRef(aContext)
   , mWeakRef(aContext)
   , mOwningThread(NS_GetCurrentThread())
 {
 }
@@ -777,18 +777,18 @@ Context::ThreadsafeHandle::~ThreadsafeHa
   if (!mStrongRef || mOwningThread == NS_GetCurrentThread()) {
     return;
   }
 
   // Dispatch is guaranteed to succeed here because we block shutdown until
   // all Contexts have been destroyed.
   nsCOMPtr<nsIRunnable> runnable =
     NS_NewNonOwningRunnableMethod(mStrongRef.forget().take(), &Context::Release);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(
+    mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL));
 }
 
 void
 Context::ThreadsafeHandle::AllowToCloseOnOwningThread()
 {
   MOZ_ASSERT(mOwningThread == NS_GetCurrentThread());
 
   // A Context "closes" when its ref count drops to zero.  Dropping this
@@ -960,17 +960,17 @@ Context::~Context()
   if (mThreadsafeHandle) {
     mThreadsafeHandle->ContextDestroyed(this);
   }
 
   // Note, this may set the mOrphanedData flag.
   mManager->RemoveContext(this);
 
   if (mQuotaInfo.mDir && !mOrphanedData) {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(DeleteMarkerFile(mQuotaInfo)));
+    MOZ_ALWAYS_SUCCEEDS(DeleteMarkerFile(mQuotaInfo));
   }
 
   if (mNextContext) {
     mNextContext->Start();
   }
 }
 
 void
--- a/dom/cache/Feature.cpp
+++ b/dom/cache/Feature.cpp
@@ -64,17 +64,17 @@ Feature::RemoveActor(ActorChild* aActor)
 
 bool
 Feature::Notified() const
 {
   return mNotified;
 }
 
 bool
-Feature::Notify(JSContext* aCx, Status aStatus)
+Feature::Notify(Status aStatus)
 {
   NS_ASSERT_OWNINGTHREAD(Feature);
 
   // When the service worker thread is stopped we will get Terminating,
   // but nothing higher than that.  We must shut things down at Terminating.
   if (aStatus < Terminating || mNotified) {
     return true;
   }
--- a/dom/cache/Feature.h
+++ b/dom/cache/Feature.h
@@ -28,17 +28,17 @@ public:
   static already_AddRefed<Feature> Create(workers::WorkerPrivate* aWorkerPrivate);
 
   void AddActor(ActorChild* aActor);
   void RemoveActor(ActorChild* aActor);
 
   bool Notified() const;
 
   // WorkerFeature methods
-  virtual bool Notify(JSContext* aCx, workers::Status aStatus) override;
+  virtual bool Notify(workers::Status aStatus) override;
 
 private:
   explicit Feature(workers::WorkerPrivate *aWorkerPrivate);
   ~Feature();
 
   workers::WorkerPrivate* mWorkerPrivate;
   nsTArray<ActorChild*> mActorList;
   bool mNotified;
--- a/dom/cache/Manager.cpp
+++ b/dom/cache/Manager.cpp
@@ -909,18 +909,18 @@ private:
   void
   CallOnAsyncCopyCompleteOnTargetThread(nsresult aRv)
   {
     // May be on any thread, including STS event target.  Non-owning runnable
     // here since we are guaranteed the Action will survive until
     // CompleteOnInitiatingThread is called.
     nsCOMPtr<nsIRunnable> runnable = NS_NewNonOwningRunnableMethodWithArgs<nsresult>(
       this, &CachePutAllAction::OnAsyncCopyComplete, aRv);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      mTargetThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(
+      mTargetThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL));
   }
 
   void
   DoResolve(nsresult aRv)
   {
     MOZ_ASSERT(mTargetThread == NS_GetCurrentThread());
 
     // DoResolve() must not be called until all async copying has completed.
@@ -1758,17 +1758,17 @@ Manager::~Manager()
 
   nsCOMPtr<nsIThread> ioThread;
   mIOThread.swap(ioThread);
 
   // Don't spin the event loop in the destructor waiting for the thread to
   // shutdown.  Defer this to the main thread, instead.
   nsCOMPtr<nsIRunnable> runnable =
     NS_NewRunnableMethod(ioThread, &nsIThread::Shutdown);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
 }
 
 void
 Manager::Init(Manager* aOldManager)
 {
   NS_ASSERT_OWNINGTHREAD(Manager);
 
   RefPtr<Context> oldContext;
--- a/dom/cache/PrincipalVerifier.cpp
+++ b/dom/cache/PrincipalVerifier.cpp
@@ -36,17 +36,17 @@ PrincipalVerifier::CreateAndDispatch(Lis
   // We must get the ContentParent actor from the PBackgroundParent.  This
   // only works on the PBackground thread.
   AssertIsOnBackgroundThread();
 
   RefPtr<PrincipalVerifier> verifier = new PrincipalVerifier(aListener,
                                                                aActor,
                                                                aPrincipalInfo);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(verifier)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(verifier));
 
   return verifier.forget();
 }
 
 void
 PrincipalVerifier::AddListener(Listener* aListener)
 {
   AssertIsOnBackgroundThread();
--- a/dom/cache/ReadStream.cpp
+++ b/dom/cache/ReadStream.cpp
@@ -353,36 +353,36 @@ ReadStream::Inner::NoteClosed()
   }
 
   if (NS_GetCurrentThread() == mOwningThread) {
     NoteClosedOnOwningThread();
     return;
   }
 
   nsCOMPtr<nsIRunnable> runnable = new NoteClosedRunnable(this);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(
+    mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL));
 }
 
 void
 ReadStream::Inner::Forget()
 {
   // Any thread
   if (mState == Closed) {
     return;
   }
 
   if (NS_GetCurrentThread() == mOwningThread) {
     ForgetOnOwningThread();
     return;
   }
 
   nsCOMPtr<nsIRunnable> runnable = new ForgetRunnable(this);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(
+    mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL));
 }
 
 void
 ReadStream::Inner::NoteClosedOnOwningThread()
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mOwningThread);
 
   // Mark closed and do nothing if we were already closed
--- a/dom/canvas/WebGLContextLossHandler.cpp
+++ b/dom/canvas/WebGLContextLossHandler.cpp
@@ -219,17 +219,17 @@ WebGLContextLossHandler::DisableTimer()
 
     if (!mIsTimerRunning)
         return;
 
     mTimer->SetDelay(0);
 }
 
 bool
-WebGLContextLossHandler::Notify(JSContext* aCx, dom::workers::Status aStatus)
+WebGLContextLossHandler::Notify(dom::workers::Status aStatus)
 {
     bool isWorkerRunning = aStatus < dom::workers::Closing;
     if (!isWorkerRunning && mIsTimerRunning) {
         mIsTimerRunning = false;
         this->Release();
     }
 
     return true;
--- a/dom/canvas/WebGLContextLossHandler.h
+++ b/dom/canvas/WebGLContextLossHandler.h
@@ -32,17 +32,17 @@ class WebGLContextLossHandler : public d
 
 public:
     NS_INLINE_DECL_REFCOUNTING(WebGLContextLossHandler)
 
     explicit WebGLContextLossHandler(WebGLContext* webgl);
 
     void RunTimer();
     void DisableTimer();
-    bool Notify(JSContext* aCx, dom::workers::Status aStatus) override;
+    bool Notify(dom::workers::Status aStatus) override;
 
 protected:
     ~WebGLContextLossHandler();
 
     void StartTimer(unsigned long delayMS);
     static void StaticTimerCallback(nsITimer*, void* tempRefForTimer);
     void TimerCallback();
 };
--- a/dom/fetch/Fetch.cpp
+++ b/dom/fetch/Fetch.cpp
@@ -216,17 +216,17 @@ FetchRequest(nsIGlobalObject* aGlobal, c
     RefPtr<WorkerFetchResolver> resolver = WorkerFetchResolver::Create(worker, p);
     if (!resolver) {
       NS_WARNING("Could not add WorkerFetchResolver feature to worker");
       aRv.Throw(NS_ERROR_DOM_ABORT_ERR);
       return nullptr;
     }
 
     RefPtr<MainThreadFetchRunnable> run = new MainThreadFetchRunnable(resolver, r);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(run)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(run));
   }
 
   return p.forget();
 }
 
 MainThreadFetchResolver::MainThreadFetchResolver(Promise* aPromise)
   : mPromise(aPromise)
 {
@@ -735,17 +735,17 @@ public:
   explicit FetchBodyFeature(FetchBody<Derived>* aBody)
     : mBody(aBody)
     , mWasNotified(false)
   { }
 
   ~FetchBodyFeature()
   { }
 
-  bool Notify(JSContext* aCx, workers::Status aStatus) override
+  bool Notify(workers::Status aStatus) override
   {
     MOZ_ASSERT(aStatus > workers::Running);
     if (!mWasNotified) {
       mWasNotified = true;
       mBody->ContinueConsumeBody(NS_BINDING_ABORTED, 0, nullptr);
     }
     return true;
   }
--- a/dom/fetch/InternalRequest.cpp
+++ b/dom/fetch/InternalRequest.cpp
@@ -270,30 +270,30 @@ InternalRequest::IsClientRequest() const
 
 // static
 RequestMode
 InternalRequest::MapChannelToRequestMode(nsIChannel* aChannel)
 {
   MOZ_ASSERT(aChannel);
 
   nsCOMPtr<nsILoadInfo> loadInfo;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aChannel->GetLoadInfo(getter_AddRefs(loadInfo))));
+  MOZ_ALWAYS_SUCCEEDS(aChannel->GetLoadInfo(getter_AddRefs(loadInfo)));
 
   nsContentPolicyType contentPolicy = loadInfo->InternalContentPolicyType();
   if (IsNavigationContentPolicy(contentPolicy)) {
     return RequestMode::Navigate;
   }
 
   // TODO: remove the worker override once securityMode is fully implemented (bug 1189945)
   if (IsWorkerContentPolicy(contentPolicy)) {
     return RequestMode::Same_origin;
   }
 
   uint32_t securityMode;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(loadInfo->GetSecurityMode(&securityMode)));
+  MOZ_ALWAYS_SUCCEEDS(loadInfo->GetSecurityMode(&securityMode));
 
   switch(securityMode) {
     case nsILoadInfo::SEC_REQUIRE_SAME_ORIGIN_DATA_INHERITS:
     case nsILoadInfo::SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED:
       return RequestMode::Same_origin;
     case nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS:
     case nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL:
       return RequestMode::No_cors;
@@ -306,34 +306,34 @@ InternalRequest::MapChannelToRequestMode
       break;
   }
 
   // TODO: remove following code once securityMode is fully implemented (bug 1189945)
 
   nsCOMPtr<nsIHttpChannelInternal> httpChannel = do_QueryInterface(aChannel);
 
   uint32_t corsMode;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(httpChannel->GetCorsMode(&corsMode)));
+  MOZ_ALWAYS_SUCCEEDS(httpChannel->GetCorsMode(&corsMode));
   MOZ_ASSERT(corsMode != nsIHttpChannelInternal::CORS_MODE_NAVIGATE);
 
   // This cast is valid due to static asserts in ServiceWorkerManager.cpp.
   return static_cast<RequestMode>(corsMode);
 }
 
 // static
 RequestCredentials
 InternalRequest::MapChannelToRequestCredentials(nsIChannel* aChannel)
 {
   MOZ_ASSERT(aChannel);
 
   nsCOMPtr<nsILoadInfo> loadInfo;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aChannel->GetLoadInfo(getter_AddRefs(loadInfo))));
+  MOZ_ALWAYS_SUCCEEDS(aChannel->GetLoadInfo(getter_AddRefs(loadInfo)));
 
   uint32_t securityMode;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(loadInfo->GetSecurityMode(&securityMode)));
+  MOZ_ALWAYS_SUCCEEDS(loadInfo->GetSecurityMode(&securityMode));
 
   // TODO: Remove following code after stylesheet and image support cookie policy
   if (securityMode == nsILoadInfo::SEC_NORMAL) {
     uint32_t loadFlags;
     aChannel->GetLoadFlags(&loadFlags);
 
     if (loadFlags & nsIRequest::LOAD_ANONYMOUS) {
       return RequestCredentials::Omit;
--- a/dom/filehandle/ActorsParent.cpp
+++ b/dom/filehandle/ActorsParent.cpp
@@ -816,17 +816,17 @@ FileHandleThreadPool::Create()
 #ifdef DEBUG
 
 void
 FileHandleThreadPool::AssertIsOnOwningThread() const
 {
   MOZ_ASSERT(mOwningThread);
 
   bool current;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->IsOnCurrentThread(&current)));
+  MOZ_ALWAYS_SUCCEEDS(mOwningThread->IsOnCurrentThread(&current));
   MOZ_ASSERT(current);
 }
 
 nsIEventTarget*
 FileHandleThreadPool::GetThreadPoolEventTarget() const
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mThreadPool);
@@ -986,17 +986,17 @@ void
 FileHandleThreadPool::Cleanup()
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mThreadPool);
   MOZ_ASSERT(mShutdownRequested);
   MOZ_ASSERT(!mShutdownComplete);
   MOZ_ASSERT(!mDirectoryInfos.Count());
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mThreadPool->Shutdown()));
+  MOZ_ALWAYS_SUCCEEDS(mThreadPool->Shutdown());
 
   if (!mCompleteCallbacks.IsEmpty()) {
     // Run all callbacks manually now.
     for (uint32_t count = mCompleteCallbacks.Length(), index = 0;
          index < count;
          index++) {
       nsAutoPtr<StoragesCompleteCallback> completeCallback(
         mCompleteCallbacks[index].forget());
@@ -1007,17 +1007,17 @@ FileHandleThreadPool::Cleanup()
     }
 
     mCompleteCallbacks.Clear();
 
     // And make sure they get processed.
     nsIThread* currentThread = NS_GetCurrentThread();
     MOZ_ASSERT(currentThread);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_ProcessPendingEvents(currentThread)));
+    MOZ_ALWAYS_SUCCEEDS(NS_ProcessPendingEvents(currentThread));
   }
 
   mShutdownComplete = true;
 }
 
 void
 FileHandleThreadPool::FinishFileHandle(FileHandle* aFileHandle)
 {
@@ -1130,17 +1130,17 @@ FileHandleQueue::ProcessQueue()
   }
 
   mCurrentOp = mQueue[0];
   mQueue.RemoveElementAt(0);
 
   nsCOMPtr<nsIThreadPool> threadPool = mOwningFileHandleThreadPool->mThreadPool;
   MOZ_ASSERT(threadPool);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(threadPool->Dispatch(this, NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(threadPool->Dispatch(this, NS_DISPATCH_NORMAL));
 }
 
 NS_IMETHODIMP
 FileHandleThreadPool::
 FileHandleQueue::Run()
 {
   MOZ_ASSERT(mCurrentOp);
 
@@ -1151,18 +1151,18 @@ FileHandleQueue::Run()
     ProcessQueue();
 
     currentOp->RunOnOwningThread();
   } else {
     mCurrentOp->RunOnThreadPool();
 
     nsCOMPtr<nsIEventTarget> backgroundThread = mCurrentOp->OwningThread();
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      backgroundThread->Dispatch(this, NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(
+      backgroundThread->Dispatch(this, NS_DISPATCH_NORMAL));
   }
 
   return NS_OK;
 }
 
 auto
 FileHandleThreadPool::
 DirectoryInfo::CreateFileHandleQueue(FileHandle* aFileHandle)
@@ -1999,17 +1999,17 @@ FinishOp::RunOnThreadPool()
 
   if (!stream) {
     return;
   }
 
   nsCOMPtr<nsIInputStream> inputStream = do_QueryInterface(stream);
   MOZ_ASSERT(inputStream);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(inputStream->Close()));
+  MOZ_ALWAYS_SUCCEEDS(inputStream->Close());
 
   stream = nullptr;
 }
 
 void
 FileHandle::
 FinishOp::RunOnOwningThread()
 {
@@ -2251,19 +2251,19 @@ CopyFileHandleOp::DoFileWork(FileHandle*
       new ProgressRunnable(this, mOffset, mSize);
 
     mOwningThread->Dispatch(runnable, NS_DISPATCH_NORMAL);
   } while (true);
 
   MOZ_ASSERT(mOffset == mSize);
 
   if (mRead) {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(outputStream->Close()));
+    MOZ_ALWAYS_SUCCEEDS(outputStream->Close());
   } else {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(inputStream->Close()));
+    MOZ_ALWAYS_SUCCEEDS(inputStream->Close());
   }
 
   return NS_OK;
 }
 
 void
 CopyFileHandleOp::Cleanup()
 {
--- a/dom/html/HTMLOptionElement.cpp
+++ b/dom/html/HTMLOptionElement.cpp
@@ -139,18 +139,17 @@ HTMLOptionElement::Index()
   }
 
   HTMLOptionsCollection* options = selectElement->GetOptions();
   if (!options) {
     return defaultIndex;
   }
 
   int32_t index = defaultIndex;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    options->GetOptionIndex(this, 0, true, &index)));
+  MOZ_ALWAYS_SUCCEEDS(options->GetOptionIndex(this, 0, true, &index));
   return index;
 }
 
 bool
 HTMLOptionElement::Selected() const
 {
   // If we haven't been explictly selected or deselected, use our default value
   if (!mSelectedChanged) {
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -689,17 +689,17 @@ HTMLSelectElement::SetLength(uint32_t aL
 
 void
 HTMLSelectElement::SetLength(uint32_t aLength, ErrorResult& aRv)
 {
   uint32_t curlen = Length();
 
   if (curlen > aLength) { // Remove extra options
     for (uint32_t i = curlen; i > aLength; --i) {
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(Remove(i - 1)));
+      MOZ_ALWAYS_SUCCEEDS(Remove(i - 1));
     }
   } else if (aLength > curlen) {
     if (aLength > MAX_DYNAMIC_SELECT_LENGTH) {
       aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
       return;
     }
 
     RefPtr<mozilla::dom::NodeInfo> nodeInfo;
@@ -1692,17 +1692,17 @@ HTMLSelectElement::SubmitNamesValues(nsF
       continue;
     }
 
     if (!option->Selected()) {
       continue;
     }
 
     nsString value;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(option->GetValue(value)));
+    MOZ_ALWAYS_SUCCEEDS(option->GetValue(value));
 
     if (keyGenProcessor) {
       nsString tmp(value);
       if (NS_SUCCEEDED(keyGenProcessor->ProcessValue(this, name, tmp))) {
         value = tmp;
       }
     }
 
@@ -1778,17 +1778,17 @@ HTMLSelectElement::IsValueMissing()
       continue;
     }
 
     if (IsOptionDisabled(option)) {
       continue;
     }
 
     nsAutoString value;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(option->GetValue(value)));
+    MOZ_ALWAYS_SUCCEEDS(option->GetValue(value));
     if (!value.IsEmpty()) {
       return false;
     }
   }
 
   return true;
 }
 
--- a/dom/indexedDB/ActorsChild.cpp
+++ b/dom/indexedDB/ActorsChild.cpp
@@ -924,17 +924,17 @@ public:
     if (completed) {
       OperationCompleted();
     }
 
     return NS_OK;
   }
 
   virtual bool
-  Notify(JSContext* aCx, workers::Status aStatus) override
+  Notify(workers::Status aStatus) override
   {
     // We don't care about the notification. We just want to keep the
     // mWorkerPrivate alive.
     return true;
   }
 
   void
   OperationCompleted()
@@ -1410,17 +1410,17 @@ BackgroundFactoryRequestChild::RecvPermi
     RefPtr<WorkerPermissionChallenge> challenge =
       new WorkerPermissionChallenge(workerPrivate, this, mFactory,
                                     aPrincipalInfo);
 
     if (NS_WARN_IF(!workerPrivate->AddFeature(challenge))) {
       return false;
     }
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(challenge)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(challenge));
     return true;
   }
 
   nsresult rv;
   nsCOMPtr<nsIPrincipal> principal =
     mozilla::ipc::PrincipalInfoToPrincipal(aPrincipalInfo, &rv);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return false;
@@ -2672,17 +2672,17 @@ BackgroundCursorChild::SendContinueInter
 
     default:
       MOZ_CRASH("Should never get here!");
   }
 
   if (!mCachedResponses.IsEmpty()) {
     nsCOMPtr<nsIRunnable> continueRunnable = new DelayedActionRunnable(
       this, &BackgroundCursorChild::SendDelayedContinueInternal);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(continueRunnable)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(continueRunnable));
   } else {
     MOZ_ALWAYS_TRUE(PBackgroundIDBCursorChild::SendContinue(params, key));
   }
 }
 
 void
 BackgroundCursorChild::SendDelayedContinueInternal()
 {
@@ -2761,17 +2761,17 @@ BackgroundCursorChild::HandleResponse(co
   }
 
   ResultHelper helper(mRequest, mTransaction, &JS::NullHandleValue);
   DispatchSuccessEvent(&helper);
 
   if (!mCursor) {
     nsCOMPtr<nsIRunnable> deleteRunnable = new DelayedActionRunnable(
       this, &BackgroundCursorChild::SendDeleteMeInternal);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(deleteRunnable)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(deleteRunnable));
   }
 }
 
 void
 BackgroundCursorChild::HandleResponse(
     const nsTArray<ObjectStoreCursorResponse>& aResponses)
 {
   AssertIsOnOwningThread();
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -2732,31 +2732,31 @@ InsertIndexDataValuesFunction::OnFunctio
   MOZ_ASSERT(!NS_IsMainThread());
   MOZ_ASSERT(!IsOnBackgroundThread());
   MOZ_ASSERT(aValues);
   MOZ_ASSERT(_retval);
 
 #ifdef DEBUG
   {
     uint32_t argCount;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aValues->GetNumEntries(&argCount)));
+    MOZ_ALWAYS_SUCCEEDS(aValues->GetNumEntries(&argCount));
     MOZ_ASSERT(argCount == 4);
 
     int32_t valueType;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aValues->GetTypeOfIndex(0, &valueType)));
+    MOZ_ALWAYS_SUCCEEDS(aValues->GetTypeOfIndex(0, &valueType));
     MOZ_ASSERT(valueType == mozIStorageValueArray::VALUE_TYPE_NULL ||
                valueType == mozIStorageValueArray::VALUE_TYPE_BLOB);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aValues->GetTypeOfIndex(1, &valueType)));
+    MOZ_ALWAYS_SUCCEEDS(aValues->GetTypeOfIndex(1, &valueType));
     MOZ_ASSERT(valueType == mozIStorageValueArray::VALUE_TYPE_INTEGER);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aValues->GetTypeOfIndex(2, &valueType)));
+    MOZ_ALWAYS_SUCCEEDS(aValues->GetTypeOfIndex(2, &valueType));
     MOZ_ASSERT(valueType == mozIStorageValueArray::VALUE_TYPE_INTEGER);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aValues->GetTypeOfIndex(3, &valueType)));
+    MOZ_ALWAYS_SUCCEEDS(aValues->GetTypeOfIndex(3, &valueType));
     MOZ_ASSERT(valueType == mozIStorageValueArray::VALUE_TYPE_BLOB);
   }
 #endif
 
   // Read out the previous value. It may be NULL, in which case we'll just end
   // up with an empty array.
   AutoTArray<IndexDataValue, 32> indexValues;
   nsresult rv = ReadCompressedIndexDataValues(aValues, 0, indexValues);
@@ -2997,21 +2997,21 @@ UpgradeKeyFunction::OnFunctionCall(mozIS
   MOZ_ASSERT(!NS_IsMainThread());
   MOZ_ASSERT(!IsOnBackgroundThread());
   MOZ_ASSERT(aValues);
   MOZ_ASSERT(_retval);
 
 #ifdef DEBUG
   {
     uint32_t argCount;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aValues->GetNumEntries(&argCount)));
+    MOZ_ALWAYS_SUCCEEDS(aValues->GetNumEntries(&argCount));
     MOZ_ASSERT(argCount == 1);
 
     int32_t valueType;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aValues->GetTypeOfIndex(0, &valueType)));
+    MOZ_ALWAYS_SUCCEEDS(aValues->GetTypeOfIndex(0, &valueType));
     MOZ_ASSERT(valueType == mozIStorageValueArray::VALUE_TYPE_BLOB);
   }
 #endif
 
   // Dig the old key out of the values.
   const uint8_t* blobData;
   uint32_t blobDataLength;
   nsresult rv = aValues->GetSharedBlob(0, &blobDataLength, &blobData);
@@ -3066,27 +3066,24 @@ UpgradeSchemaFrom17_0To18_0Helper::DoUpg
   // Register the |insert_idv| function.
   RefPtr<InsertIndexDataValuesFunction> insertIDVFunction =
     new InsertIndexDataValuesFunction();
 
   NS_NAMED_LITERAL_CSTRING(insertIDVFunctionName, "insert_idv");
 
   rv = aConnection->CreateFunction(insertIDVFunctionName, 4, insertIDVFunction);
   if (NS_WARN_IF(NS_FAILED(rv))) {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      aConnection->RemoveFunction(upgradeKeyFunctionName)));
+    MOZ_ALWAYS_SUCCEEDS(aConnection->RemoveFunction(upgradeKeyFunctionName));
     return rv;
   }
 
   rv = DoUpgradeInternal(aConnection, aOrigin);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    aConnection->RemoveFunction(upgradeKeyFunctionName)));
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    aConnection->RemoveFunction(insertIDVFunctionName)));
+  MOZ_ALWAYS_SUCCEEDS(aConnection->RemoveFunction(upgradeKeyFunctionName));
+  MOZ_ALWAYS_SUCCEEDS(aConnection->RemoveFunction(insertIDVFunctionName));
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return NS_OK;
 }
 
@@ -4238,17 +4235,17 @@ struct StorageOpenTraits<nsIFileURL*>
   {
     return aStorageService->OpenDatabaseWithFileURL(aFileURL, aConnection);
   }
 
 #ifdef DEBUG
   static void
   GetPath(nsIFileURL* aFileURL, nsCString& aPath)
   {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aFileURL->GetFileName(aPath)));
+    MOZ_ALWAYS_SUCCEEDS(aFileURL->GetFileName(aPath));
   }
 #endif
 };
 
 template <>
 struct StorageOpenTraits<nsIFile*>
 {
   static nsresult
@@ -4259,17 +4256,17 @@ struct StorageOpenTraits<nsIFile*>
     return aStorageService->OpenUnsharedDatabase(aFile, aConnection);
   }
 
 #ifdef DEBUG
   static void
   GetPath(nsIFile* aFile, nsCString& aPath)
   {
     nsString path;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aFile->GetPath(path)));
+    MOZ_ALWAYS_SUCCEEDS(aFile->GetPath(path));
 
     aPath.AssignWithConversion(path);
   }
 #endif
 };
 
 template <template <class> class SmartPtr, class FileOrURLType>
 struct StorageOpenTraits<SmartPtr<FileOrURLType>>
@@ -4498,19 +4495,19 @@ CreateStorageConnection(nsIFile* aDBFile
         return rv;
       }
 
       journalModeSet = true;
     } else {
 #ifdef DEBUG
     // Disable foreign key support while upgrading. This has to be done before
     // starting a transaction.
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+    MOZ_ALWAYS_SUCCEEDS(
       connection->ExecuteSimpleSQL(
-        NS_LITERAL_CSTRING("PRAGMA foreign_keys = OFF;"))));
+        NS_LITERAL_CSTRING("PRAGMA foreign_keys = OFF;")));
 #endif
     }
 
     bool vacuumNeeded = false;
 
     mozStorageTransaction transaction(connection, false,
                                   mozIStorageConnection::TRANSACTION_IMMEDIATE);
 
@@ -4618,28 +4615,28 @@ CreateStorageConnection(nsIFile* aDBFile
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
 #ifdef DEBUG
     if (!newDatabase) {
       // Re-enable foreign key support after doing a foreign key check.
       nsCOMPtr<mozIStorageStatement> checkStmt;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+      MOZ_ALWAYS_SUCCEEDS(
         connection->CreateStatement(
           NS_LITERAL_CSTRING("PRAGMA foreign_key_check;"),
-          getter_AddRefs(checkStmt))));
+          getter_AddRefs(checkStmt)));
 
       bool hasResult;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(checkStmt->ExecuteStep(&hasResult)));
+      MOZ_ALWAYS_SUCCEEDS(checkStmt->ExecuteStep(&hasResult));
       MOZ_ASSERT(!hasResult, "Database has inconsisistent foreign keys!");
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+      MOZ_ALWAYS_SUCCEEDS(
         connection->ExecuteSimpleSQL(
-          NS_LITERAL_CSTRING("PRAGMA foreign_keys = OFF;"))));
+          NS_LITERAL_CSTRING("PRAGMA foreign_keys = OFF;")));
     }
 #endif
 
     if (kSQLitePageSizeOverride && !newDatabase) {
       nsCOMPtr<mozIStorageStatement> stmt;
       rv = connection->CreateStatement(NS_LITERAL_CSTRING(
         "PRAGMA page_size;"
       ), getter_AddRefs(stmt));
@@ -4987,17 +4984,17 @@ public:
 
     return CheckpointInternal(CheckpointMode::Full);
   }
 
   void
   DoIdleProcessing(bool aNeedsCheckpoint);
 
   void
-  Close(uintptr_t aCallsite = 0);
+  Close();
 
   nsresult
   DisableQuotaChecks();
 
   void
   EnableQuotaChecks();
 
 private:
@@ -5294,20 +5291,19 @@ public:
 
   void
   Dispatch(uint64_t aTransactionId, nsIRunnable* aRunnable);
 
   void
   Finish(uint64_t aTransactionId, FinishCallback* aCallback);
 
   void
-  CloseDatabaseWhenIdle(const nsACString& aDatabaseId,
-                        uintptr_t aCallsite)
-  {
-    Unused << CloseDatabaseWhenIdleInternal(aDatabaseId, aCallsite);
+  CloseDatabaseWhenIdle(const nsACString& aDatabaseId)
+  {
+    Unused << CloseDatabaseWhenIdleInternal(aDatabaseId);
   }
 
   void
   WaitForDatabasesToComplete(nsTArray<nsCString>&& aDatabaseIds,
                              nsIRunnable* aCallback);
 
   void
   Shutdown();
@@ -5356,21 +5352,20 @@ private:
 
   bool
   MaybeFireCallback(DatabasesCompleteCallback* aCallback);
 
   void
   PerformIdleDatabaseMaintenance(DatabaseInfo* aDatabaseInfo);
 
   void
-  CloseDatabase(DatabaseInfo* aDatabaseInfo, uintptr_t aCallsite);
-
-  bool
-  CloseDatabaseWhenIdleInternal(const nsACString& aDatabaseId,
-                                uintptr_t aCallsite);
+  CloseDatabase(DatabaseInfo* aDatabaseInfo);
+
+  bool
+  CloseDatabaseWhenIdleInternal(const nsACString& aDatabaseId);
 };
 
 class ConnectionPool::ConnectionRunnable
   : public nsRunnable
 {
 protected:
   DatabaseInfo* mDatabaseInfo;
   nsCOMPtr<nsIEventTarget> mOwningThread;
@@ -5403,31 +5398,27 @@ private:
   NS_DECL_NSIRUNNABLE
 };
 
 class ConnectionPool::CloseConnectionRunnable final
   : public ConnectionRunnable
 {
 public:
   explicit
-  CloseConnectionRunnable(DatabaseInfo* aDatabaseInfo,
-                          uintptr_t aCallsite)
-    : ConnectionRunnable(aDatabaseInfo),
-      mCallsite(aCallsite)
+  CloseConnectionRunnable(DatabaseInfo* aDatabaseInfo)
+    : ConnectionRunnable(aDatabaseInfo)
   { }
 
   NS_DECL_ISUPPORTS_INHERITED
 
 private:
   ~CloseConnectionRunnable()
   { }
 
   NS_DECL_NSIRUNNABLE
-
-  uintptr_t mCallsite;
 };
 
 struct ConnectionPool::ThreadInfo
 {
   nsCOMPtr<nsIThread> mThread;
   RefPtr<ThreadRunnable> mRunnable;
 
   ThreadInfo();
@@ -9582,56 +9573,56 @@ TelemetryIdForFile(nsIFile* aFile)
   // The storage directory is structured like this:
   //
   //   <profile>/storage/<persistence>/<origin>/idb/<filename>.sqlite
   //
   // For the purposes of this function we're only concerned with the
   // <persistence>, <origin>, and <filename> pieces.
 
   nsString filename;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aFile->GetLeafName(filename)));
+  MOZ_ALWAYS_SUCCEEDS(aFile->GetLeafName(filename));
 
   // Make sure we were given a database file.
   NS_NAMED_LITERAL_STRING(sqliteExtension, ".sqlite");
 
   MOZ_ASSERT(StringEndsWith(filename, sqliteExtension));
 
   filename.Truncate(filename.Length() - sqliteExtension.Length());
 
   // Get the "idb" directory.
   nsCOMPtr<nsIFile> idbDirectory;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aFile->GetParent(getter_AddRefs(idbDirectory))));
+  MOZ_ALWAYS_SUCCEEDS(aFile->GetParent(getter_AddRefs(idbDirectory)));
 
   DebugOnly<nsString> idbLeafName;
   MOZ_ASSERT(NS_SUCCEEDED(idbDirectory->GetLeafName(idbLeafName)));
   MOZ_ASSERT(static_cast<nsString&>(idbLeafName).EqualsLiteral("idb"));
 
   // Get the <origin> directory.
   nsCOMPtr<nsIFile> originDirectory;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    idbDirectory->GetParent(getter_AddRefs(originDirectory))));
+  MOZ_ALWAYS_SUCCEEDS(
+    idbDirectory->GetParent(getter_AddRefs(originDirectory)));
 
   nsString origin;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(originDirectory->GetLeafName(origin)));
+  MOZ_ALWAYS_SUCCEEDS(originDirectory->GetLeafName(origin));
 
   // Any databases in these directories are owned by the application and should
   // not have their filenames masked. Hopefully they also appear in the
   // Telemetry.cpp whitelist.
   if (origin.EqualsLiteral("chrome") ||
       origin.EqualsLiteral("moz-safe-about+home")) {
     return 0;
   }
 
   // Get the <persistence> directory.
   nsCOMPtr<nsIFile> persistenceDirectory;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    originDirectory->GetParent(getter_AddRefs(persistenceDirectory))));
+  MOZ_ALWAYS_SUCCEEDS(
+    originDirectory->GetParent(getter_AddRefs(persistenceDirectory)));
 
   nsString persistence;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(persistenceDirectory->GetLeafName(persistence)));
+  MOZ_ALWAYS_SUCCEEDS(persistenceDirectory->GetLeafName(persistence));
 
   NS_NAMED_LITERAL_STRING(separator, "*");
 
   uint32_t hashValue = HashString(persistence + separator +
                                   origin + separator +
                                   filename);
 
   MutexAutoLock lock(*gTelemetryIdMutex);
@@ -9725,17 +9716,17 @@ DeallocPBackgroundIndexedDBUtilsParent(P
 bool
 RecvFlushPendingFileDeletions()
 {
   AssertIsOnBackgroundThread();
 
   RefPtr<FlushPendingFileDeletionsRunnable> runnable =
     new FlushPendingFileDeletionsRunnable();
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
 
   return true;
 }
 
 PIndexedDBPermissionRequestParent*
 AllocPIndexedDBPermissionRequestParent(Element* aOwnerElement,
                                        nsIPrincipal* aPrincipal)
 {
@@ -9878,18 +9869,17 @@ DatabaseConnection::GetCachedStatement(c
   nsCOMPtr<mozIStorageStatement> stmt;
 
   if (!mCachedStatements.Get(aQuery, getter_AddRefs(stmt))) {
     nsresult rv =
       mStorageConnection->CreateStatement(aQuery, getter_AddRefs(stmt));
     if (NS_FAILED(rv)) {
 #ifdef DEBUG
       nsCString msg;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        mStorageConnection->GetLastErrorString(msg)));
+      MOZ_ALWAYS_SUCCEEDS(mStorageConnection->GetLastErrorString(msg));
 
       nsAutoCString error =
         NS_LITERAL_CSTRING("The statement '") + aQuery +
         NS_LITERAL_CSTRING("' failed to compile with the error message '") +
         msg + NS_LITERAL_CSTRING("'.");
 
       NS_WARNING(error.get());
 #endif
@@ -10453,41 +10443,37 @@ DatabaseConnection::GetFreelistCount(Cac
 
   MOZ_ASSERT(freelistCount >= 0);
 
   *aFreelistCount = uint32_t(freelistCount);
   return NS_OK;
 }
 
 void
-DatabaseConnection::Close(uintptr_t aCallsite)
+DatabaseConnection::Close()
 {
   AssertIsOnConnectionThread();
   MOZ_ASSERT(mStorageConnection);
   MOZ_ASSERT(!mDEBUGSavepointCount);
-  if (mInWriteTransaction) {
-    uint32_t* crashPtr = (uint32_t*)aCallsite;
-    *crashPtr = 42;
-    MOZ_RELEASE_ASSERT(!mInWriteTransaction);
-  }
+  MOZ_RELEASE_ASSERT(!mInWriteTransaction);
 
   PROFILER_LABEL("IndexedDB",
                  "DatabaseConnection::Close",
                  js::ProfileEntry::Category::STORAGE);
 
   if (mUpdateRefcountFunction) {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+    MOZ_ALWAYS_SUCCEEDS(
       mStorageConnection->RemoveFunction(
-        NS_LITERAL_CSTRING("update_refcount"))));
+        NS_LITERAL_CSTRING("update_refcount")));
     mUpdateRefcountFunction = nullptr;
   }
 
   mCachedStatements.Clear();
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mStorageConnection->Close()));
+  MOZ_ALWAYS_SUCCEEDS(mStorageConnection->Close());
   mStorageConnection = nullptr;
 
   mFileManager = nullptr;
 }
 
 nsresult
 DatabaseConnection::DisableQuotaChecks()
 {
@@ -11370,17 +11356,17 @@ ConnectionPool::IdleTimerCallback(nsITim
 
   for (uint32_t count = self->mIdleDatabases.Length(); index < count; index++) {
     IdleDatabaseInfo& info = self->mIdleDatabases[index];
 
     if (now >= info.mIdleTime) {
       if (info.mDatabaseInfo->mIdle) {
         self->PerformIdleDatabaseMaintenance(info.mDatabaseInfo);
       } else {
-        self->CloseDatabase(info.mDatabaseInfo, 1);
+        self->CloseDatabase(info.mDatabaseInfo);
       }
     } else {
       break;
     }
   }
 
   if (index) {
     self->mIdleDatabases.RemoveElementsAt(0, index);
@@ -11589,18 +11575,18 @@ ConnectionPool::Dispatch(uint64_t aTrans
     DatabaseInfo* dbInfo = transactionInfo->mDatabaseInfo;
     MOZ_ASSERT(dbInfo);
     MOZ_ASSERT(dbInfo->mThreadInfo.mThread);
     MOZ_ASSERT(dbInfo->mThreadInfo.mRunnable);
     MOZ_ASSERT(!dbInfo->mClosing);
     MOZ_ASSERT_IF(transactionInfo->mIsWriteTransaction,
                   dbInfo->mRunningWriteTransaction == transactionInfo);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      dbInfo->mThreadInfo.mThread->Dispatch(aRunnable, NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(
+      dbInfo->mThreadInfo.mThread->Dispatch(aRunnable, NS_DISPATCH_NORMAL));
   } else {
     transactionInfo->mQueuedRunnables.AppendElement(aRunnable);
   }
 }
 
 void
 ConnectionPool::Finish(uint64_t aTransactionId, FinishCallback* aCallback)
 {
@@ -11642,17 +11628,17 @@ ConnectionPool::WaitForDatabasesToComple
   bool mayRunCallbackImmediately = true;
 
   for (uint32_t index = 0, count = aDatabaseIds.Length();
        index < count;
        index++) {
     const nsCString& databaseId = aDatabaseIds[index];
     MOZ_ASSERT(!databaseId.IsEmpty());
 
-    if (CloseDatabaseWhenIdleInternal(databaseId, 0x6)) {
+    if (CloseDatabaseWhenIdleInternal(databaseId)) {
       mayRunCallbackImmediately = false;
     }
   }
 
   if (mayRunCallbackImmediately) {
     Unused << aCallback->Run();
     return;
   }
@@ -11729,17 +11715,17 @@ ConnectionPool::Cleanup()
     }
 
     mCompleteCallbacks.Clear();
 
     // And make sure they get processed.
     nsIThread* currentThread = NS_GetCurrentThread();
     MOZ_ASSERT(currentThread);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_ProcessPendingEvents(currentThread)));
+    MOZ_ALWAYS_SUCCEEDS(NS_ProcessPendingEvents(currentThread));
   }
 
   mShutdownComplete = true;
 }
 
 void
 ConnectionPool::AdjustIdleTimer()
 {
@@ -11785,34 +11771,34 @@ ConnectionPool::AdjustIdleTimer()
 
     uint32_t delay;
     if (delta > 0) {
       delay = uint32_t(std::min(delta, double(UINT32_MAX)));
     } else {
       delay = 0;
     }
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+    MOZ_ALWAYS_SUCCEEDS(
       mIdleTimer->InitWithFuncCallback(IdleTimerCallback,
                                        this,
                                        delay,
-                                       nsITimer::TYPE_ONE_SHOT)));
+                                       nsITimer::TYPE_ONE_SHOT));
 
     mTargetIdleTime = newTargetIdleTime;
   }
 }
 
 void
 ConnectionPool::CancelIdleTimer()
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mIdleTimer);
 
   if (!mTargetIdleTime.IsNull()) {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mIdleTimer->Cancel()));
+    MOZ_ALWAYS_SUCCEEDS(mIdleTimer->Cancel());
 
     mTargetIdleTime = TimeStamp();
     MOZ_ASSERT(mTargetIdleTime.IsNull());
   }
 }
 
 void
 ConnectionPool::ShutdownThread(ThreadInfo& aThreadInfo)
@@ -11827,46 +11813,46 @@ ConnectionPool::ShutdownThread(ThreadInf
 
   nsCOMPtr<nsIThread> thread;
   aThreadInfo.mThread.swap(thread);
 
   IDB_DEBUG_LOG(("ConnectionPool shutting down thread %lu",
                  runnable->SerialNumber()));
 
   // This should clean up the thread with the profiler.
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(thread->Dispatch(runnable, NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(thread->Dispatch(runnable, NS_DISPATCH_NORMAL));
 
   nsCOMPtr<nsIRunnable> shutdownRunnable =
     NS_NewRunnableMethod(thread, &nsIThread::Shutdown);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(shutdownRunnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(shutdownRunnable));
 
   mTotalThreadCount--;
 }
 
 void
 ConnectionPool::CloseIdleDatabases()
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mShutdownRequested);
 
   PROFILER_LABEL("IndexedDB",
                  "ConnectionPool::CloseIdleDatabases",
                  js::ProfileEntry::Category::STORAGE);
 
   if (!mIdleDatabases.IsEmpty()) {
     for (IdleDatabaseInfo& idleInfo : mIdleDatabases) {
-      CloseDatabase(idleInfo.mDatabaseInfo, 2);
+      CloseDatabase(idleInfo.mDatabaseInfo);
     }
     mIdleDatabases.Clear();
   }
 
   if (!mDatabasesPerformingIdleMaintenance.IsEmpty()) {
     for (DatabaseInfo* dbInfo : mDatabasesPerformingIdleMaintenance) {
       MOZ_ASSERT(dbInfo);
-      CloseDatabase(dbInfo, 3);
+      CloseDatabase(dbInfo);
     }
     mDatabasesPerformingIdleMaintenance.Clear();
   }
 }
 
 void
 ConnectionPool::ShutdownIdleThreads()
 {
@@ -11945,19 +11931,19 @@ ConnectionPool::ScheduleTransaction(Tran
 
         for (uint32_t index = mDatabasesPerformingIdleMaintenance.Length();
              index > 0;
              index--) {
           DatabaseInfo* dbInfo = mDatabasesPerformingIdleMaintenance[index - 1];
           MOZ_ASSERT(dbInfo);
           MOZ_ASSERT(dbInfo->mThreadInfo.mThread);
 
-          MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+          MOZ_ALWAYS_SUCCEEDS(
             dbInfo->mThreadInfo.mThread->Dispatch(runnable,
-                                                  NS_DISPATCH_NORMAL)));
+                                                  NS_DISPATCH_NORMAL));
         }
       }
 
       if (!created) {
         if (!aFromQueuedTransactions) {
           MOZ_ASSERT(!mQueuedTransactions.Contains(aTransactionInfo));
           mQueuedTransactions.AppendElement(aTransactionInfo);
         }
@@ -12003,18 +11989,18 @@ ConnectionPool::ScheduleTransaction(Tran
 
   if (!queuedRunnables.IsEmpty()) {
     for (uint32_t index = 0, count = queuedRunnables.Length();
          index < count;
          index++) {
       nsCOMPtr<nsIRunnable> runnable;
       queuedRunnables[index].swap(runnable);
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        dbInfo->mThreadInfo.mThread->Dispatch(runnable, NS_DISPATCH_NORMAL)));
+      MOZ_ALWAYS_SUCCEEDS(
+        dbInfo->mThreadInfo.mThread->Dispatch(runnable, NS_DISPATCH_NORMAL));
     }
 
     queuedRunnables.Clear();
   }
 
   return true;
 }
 
@@ -12162,17 +12148,17 @@ ConnectionPool::NoteIdleDatabase(Databas
 
   const bool otherDatabasesWaiting = !mQueuedTransactions.IsEmpty();
 
   if (mShutdownRequested ||
       otherDatabasesWaiting ||
       aDatabaseInfo->mCloseOnIdle) {
     // Make sure we close the connection if we're shutting down or giving the
     // thread to another database.
-    CloseDatabase(aDatabaseInfo, 4);
+    CloseDatabase(aDatabaseInfo);
 
     if (otherDatabasesWaiting) {
       // Let another database use this thread.
       ScheduleQueuedTransactions(aDatabaseInfo->mThreadInfo);
     } else if (mShutdownRequested) {
       // If there are no other databases that need to run then we can shut this
       // thread down immediately instead of going through the idle thread
       // mechanism.
@@ -12337,59 +12323,56 @@ ConnectionPool::PerformIdleDatabaseMaint
   nsCOMPtr<nsIRunnable> runnable =
     new IdleConnectionRunnable(aDatabaseInfo, aDatabaseInfo->mNeedsCheckpoint);
 
   aDatabaseInfo->mNeedsCheckpoint = false;
   aDatabaseInfo->mIdle = false;
 
   mDatabasesPerformingIdleMaintenance.AppendElement(aDatabaseInfo);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+  MOZ_ALWAYS_SUCCEEDS(
     aDatabaseInfo->mThreadInfo.mThread->Dispatch(runnable,
-                                                 NS_DISPATCH_NORMAL)));
-}
-
-void
-ConnectionPool::CloseDatabase(DatabaseInfo* aDatabaseInfo,
-                              uintptr_t aCallsite)
+                                                 NS_DISPATCH_NORMAL));
+}
+
+void
+ConnectionPool::CloseDatabase(DatabaseInfo* aDatabaseInfo)
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(aDatabaseInfo);
-  MOZ_ASSERT(!aDatabaseInfo->TotalTransactionCount());
+  MOZ_RELEASE_ASSERT(!aDatabaseInfo->TotalTransactionCount());
   MOZ_ASSERT(aDatabaseInfo->mThreadInfo.mThread);
   MOZ_ASSERT(aDatabaseInfo->mThreadInfo.mRunnable);
   MOZ_ASSERT(!aDatabaseInfo->mClosing);
 
   aDatabaseInfo->mIdle = false;
   aDatabaseInfo->mNeedsCheckpoint = false;
   aDatabaseInfo->mClosing = true;
 
-  nsCOMPtr<nsIRunnable> runnable = new CloseConnectionRunnable(aDatabaseInfo,
-                                                               aCallsite);
-
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+  nsCOMPtr<nsIRunnable> runnable = new CloseConnectionRunnable(aDatabaseInfo);
+
+  MOZ_ALWAYS_SUCCEEDS(
     aDatabaseInfo->mThreadInfo.mThread->Dispatch(runnable,
-                                                 NS_DISPATCH_NORMAL)));
-}
-
-bool
-ConnectionPool::CloseDatabaseWhenIdleInternal(const nsACString& aDatabaseId,
-                                              uintptr_t aCallsite)
+                                                 NS_DISPATCH_NORMAL));
+}
+
+bool
+ConnectionPool::CloseDatabaseWhenIdleInternal(const nsACString& aDatabaseId)
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(!aDatabaseId.IsEmpty());
 
   PROFILER_LABEL("IndexedDB",
                  "ConnectionPool::CloseDatabaseWhenIdleInternal",
                  js::ProfileEntry::Category::STORAGE);
 
   if (DatabaseInfo* dbInfo = mDatabases.Get(aDatabaseId)) {
     if (mIdleDatabases.RemoveElement(dbInfo) ||
         mDatabasesPerformingIdleMaintenance.RemoveElement(dbInfo)) {
-      CloseDatabase(dbInfo, aCallsite);
+      CloseDatabase(dbInfo);
       AdjustIdleTimer();
     } else {
       dbInfo->mCloseOnIdle = true;
     }
 
     return true;
   }
 
@@ -12421,18 +12404,18 @@ IdleConnectionRunnable::Run()
   nsCOMPtr<nsIEventTarget> owningThread;
   mOwningThread.swap(owningThread);
 
   if (owningThread) {
     mDatabaseInfo->AssertIsOnConnectionThread();
     MOZ_ASSERT(mDatabaseInfo->mConnection);
     mDatabaseInfo->mConnection->DoIdleProcessing(mNeedsCheckpoint);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      owningThread->Dispatch(this, NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(
+      owningThread->Dispatch(this, NS_DISPATCH_NORMAL));
     return NS_OK;
   }
 
   RefPtr<ConnectionPool> connectionPool = mDatabaseInfo->mConnectionPool;
   MOZ_ASSERT(connectionPool);
 
   if (mDatabaseInfo->mClosing) {
     MOZ_ASSERT(!connectionPool->
@@ -12467,30 +12450,30 @@ CloseConnectionRunnable::Run()
     MOZ_ASSERT(mDatabaseInfo->mClosing);
 
     nsCOMPtr<nsIEventTarget> owningThread;
     mOwningThread.swap(owningThread);
 
     if (mDatabaseInfo->mConnection) {
       mDatabaseInfo->AssertIsOnConnectionThread();
 
-      mDatabaseInfo->mConnection->Close(mCallsite);
+      mDatabaseInfo->mConnection->Close();
 
       IDB_DEBUG_LOG(("ConnectionPool closed connection 0x%p",
                      mDatabaseInfo->mConnection.get()));
 
       mDatabaseInfo->mConnection = nullptr;
 
 #ifdef DEBUG
       mDatabaseInfo->mDEBUGConnectionThread = nullptr;
 #endif
     }
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      owningThread->Dispatch(this, NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(
+      owningThread->Dispatch(this, NS_DISPATCH_NORMAL));
     return NS_OK;
   }
 
   RefPtr<ConnectionPool> connectionPool = mDatabaseInfo->mConnectionPool;
   MOZ_ASSERT(connectionPool);
 
   connectionPool->NoteClosedDatabase(mDatabaseInfo);
   return NS_OK;
@@ -12595,18 +12578,18 @@ FinishCallbackWrapper::Run()
 
   if (!mHasRunOnce) {
     MOZ_ASSERT(!IsOnBackgroundThread());
 
     mHasRunOnce = true;
 
     Unused << mCallback->Run();
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(
+      mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
 
     return NS_OK;
   }
 
   mConnectionPool->AssertIsOnOwningThread();
   MOZ_ASSERT(mHasRunOnce);
 
   RefPtr<ConnectionPool> connectionPool = Move(mConnectionPool);
@@ -12684,18 +12667,18 @@ ThreadRunnable::Run()
     if (kDEBUGTransactionThreadPriority !=
           nsISupportsPriority::PRIORITY_NORMAL) {
       NS_WARNING("ConnectionPool thread debugging enabled, priority has been "
                  "modified!");
 
       nsCOMPtr<nsISupportsPriority> thread = do_QueryInterface(currentThread);
       MOZ_ASSERT(thread);
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        thread->SetPriority(kDEBUGTransactionThreadPriority)));
+      MOZ_ALWAYS_SUCCEEDS(
+        thread->SetPriority(kDEBUGTransactionThreadPriority));
     }
 
     if (kDEBUGTransactionThreadSleepMS) {
       NS_WARNING("TransactionThreadPool thread debugging enabled, sleeping "
                  "after every event!");
     }
 #endif // DEBUG
 
@@ -13047,29 +13030,29 @@ Factory::Create(const LoggingInfo& aLogg
 #ifdef DEBUG
     if (kDEBUGThreadPriority != nsISupportsPriority::PRIORITY_NORMAL) {
       NS_WARNING("PBackground thread debugging enabled, priority has been "
                  "modified!");
       nsCOMPtr<nsISupportsPriority> thread =
         do_QueryInterface(NS_GetCurrentThread());
       MOZ_ASSERT(thread);
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(thread->SetPriority(kDEBUGThreadPriority)));
+      MOZ_ALWAYS_SUCCEEDS(thread->SetPriority(kDEBUGThreadPriority));
     }
 
     if (kDEBUGThreadSleepMS) {
       NS_WARNING("PBackground thread debugging enabled, sleeping after every "
                  "event!");
       nsCOMPtr<nsIThreadInternal> thread =
         do_QueryInterface(NS_GetCurrentThread());
       MOZ_ASSERT(thread);
 
       gDEBUGThreadSlower = new DEBUGThreadSlower();
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(thread->AddObserver(gDEBUGThreadSlower)));
+      MOZ_ALWAYS_SUCCEEDS(thread->AddObserver(gDEBUGThreadSlower));
     }
 #endif // DEBUG
   }
 
   RefPtr<DatabaseLoggingInfo> loggingInfo =
     gLoggingInfoHashtable->Get(aLoggingInfo.backgroundChildLoggingId());
   if (loggingInfo) {
     MOZ_ASSERT(aLoggingInfo.backgroundChildLoggingId() == loggingInfo->Id());
@@ -13122,28 +13105,28 @@ Factory::ActorDestroy(ActorDestroyReason
     gFactoryOps = nullptr;
 
 #ifdef DEBUG
     if (kDEBUGThreadPriority != nsISupportsPriority::PRIORITY_NORMAL) {
       nsCOMPtr<nsISupportsPriority> thread =
         do_QueryInterface(NS_GetCurrentThread());
       MOZ_ASSERT(thread);
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        thread->SetPriority(nsISupportsPriority::PRIORITY_NORMAL)));
+      MOZ_ALWAYS_SUCCEEDS(
+        thread->SetPriority(nsISupportsPriority::PRIORITY_NORMAL));
     }
 
     if (kDEBUGThreadSleepMS) {
       MOZ_ASSERT(gDEBUGThreadSlower);
 
       nsCOMPtr<nsIThreadInternal> thread =
         do_QueryInterface(NS_GetCurrentThread());
       MOZ_ASSERT(thread);
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(thread->RemoveObserver(gDEBUGThreadSlower)));
+      MOZ_ALWAYS_SUCCEEDS(thread->RemoveObserver(gDEBUGThreadSlower));
 
       gDEBUGThreadSlower = nullptr;
     }
 #endif // DEBUG
   }
 }
 
 bool
@@ -13242,17 +13225,17 @@ Factory::RecvPBackgroundIDBFactoryReques
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aActor);
   MOZ_ASSERT(aParams.type() != FactoryRequestParams::T__None);
   MOZ_ASSERT(!QuotaClient::IsShuttingDownOnBackgroundThread());
 
   auto* op = static_cast<FactoryOp*>(aActor);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(op)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(op));
   return true;
 }
 
 bool
 Factory::DeallocPBackgroundIDBFactoryRequestParent(
                                      PBackgroundIDBFactoryRequestParent* aActor)
 {
   AssertIsOnBackgroundThread();
@@ -13654,17 +13637,17 @@ Database::CloseInternal()
 
     // Ignore harmless race when we just invalidated the database.
     return true;
   }
 
   mClosed = true;
 
   if (gConnectionPool) {
-    gConnectionPool->CloseDatabaseWhenIdle(Id(), 0x7);
+    gConnectionPool->CloseDatabaseWhenIdle(Id());
   }
 
   DatabaseActorInfo* info;
   MOZ_ALWAYS_TRUE(gLiveDatabaseHashtable->Get(Id(), &info));
 
   MOZ_ASSERT(info->mLiveDatabases.Contains(this));
 
   if (info->mWaitingFactoryOp) {
@@ -13977,17 +13960,17 @@ Database::RecvPBackgroundIDBTransactionC
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aActor);
   MOZ_ASSERT(!aObjectStoreNames.IsEmpty());
   MOZ_ASSERT(aMode == IDBTransaction::READ_ONLY ||
              aMode == IDBTransaction::READ_WRITE ||
              aMode == IDBTransaction::READ_WRITE_FLUSH ||
              aMode == IDBTransaction::CLEANUP);
-  MOZ_ASSERT(!mClosed);
+  MOZ_RELEASE_ASSERT(!mClosed);
 
   if (IsInvalidated()) {
     // This is an expected race. We don't want the child to die here, just don't
     // actually do any work.
     return true;
   }
 
   if (!gConnectionPool) {
@@ -15410,17 +15393,17 @@ VersionChangeTransaction::SendCompleteNo
   }
 
   openDatabaseOp->mState = OpenDatabaseOp::State::SendingResults;
 
   if (!IsActorDestroyed()) {
     Unused << SendComplete(aResult);
   }
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(openDatabaseOp->Run()));
+  MOZ_ALWAYS_SUCCEEDS(openDatabaseOp->Run());
 }
 
 void
 VersionChangeTransaction::ActorDestroy(ActorDestroyReason aWhy)
 {
   AssertIsOnBackgroundThread();
 
   NoteActorDestroyed();
@@ -16704,29 +16687,25 @@ QuotaClient::GetOrCreateThreadPool()
 
     // PR_GetNumberOfProcessors() can return -1 on error, so make sure we
     // don't set some huge number here. We add 2 in case some threads block on
     // the disk I/O.
     const uint32_t threadCount =
       std::max(int32_t(PR_GetNumberOfProcessors()), int32_t(1)) +
       2;
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      threadPool->SetThreadLimit(threadCount)));
+    MOZ_ALWAYS_SUCCEEDS(threadPool->SetThreadLimit(threadCount));
 
     // Don't keep more than one idle thread.
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      threadPool->SetIdleThreadLimit(1)));
+    MOZ_ALWAYS_SUCCEEDS(threadPool->SetIdleThreadLimit(1));
 
     // Don't keep idle threads alive very long.
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      threadPool->SetIdleThreadTimeout(5 * PR_MSEC_PER_SEC)));
-
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      threadPool->SetName(NS_LITERAL_CSTRING("IndexedDB Mnt"))));
+    MOZ_ALWAYS_SUCCEEDS(threadPool->SetIdleThreadTimeout(5 * PR_MSEC_PER_SEC));
+
+    MOZ_ALWAYS_SUCCEEDS(threadPool->SetName(NS_LITERAL_CSTRING("IndexedDB Mnt")));
 
     mMaintenanceThreadPool = Move(threadPool);
   }
 
   return mMaintenanceThreadPool;
 }
 
 mozilla::dom::quota::Client::Type
@@ -17002,24 +16981,24 @@ QuotaClient::InitOrigin(PersistenceType 
 
   // We have to do this after file manager initialization.
   if (!unknownFiles.IsEmpty()) {
 #ifdef DEBUG
     for (uint32_t count = unknownFiles.Length(), i = 0; i < count; i++) {
       nsCOMPtr<nsIFile>& unknownFile = unknownFiles[i];
 
       nsString leafName;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(unknownFile->GetLeafName(leafName)));
+      MOZ_ALWAYS_SUCCEEDS(unknownFile->GetLeafName(leafName));
 
       MOZ_ASSERT(!StringEndsWith(leafName, journalSuffix));
       MOZ_ASSERT(!StringEndsWith(leafName, shmSuffix));
       MOZ_ASSERT(!StringEndsWith(leafName, walSuffix));
 
       nsString path;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(unknownFile->GetPath(path)));
+      MOZ_ALWAYS_SUCCEEDS(unknownFile->GetPath(path));
       MOZ_ASSERT(!path.IsEmpty());
 
       nsPrintfCString warning("Refusing to open databases for \"%s\" because "
                               "an unexpected file exists in the storage "
                               "area: \"%s\"",
                               PromiseFlatCString(aOrigin).get(),
                               NS_ConvertUTF16toUTF8(path).get());
       NS_WARNING(warning.get());
@@ -17378,17 +17357,17 @@ Maintenance::Start()
   // for low disk space mode.
 
   if (IndexedDatabaseManager::Get()) {
     OpenDirectory();
     return NS_OK;
   }
 
   mState = State::CreateIndexedDatabaseManager;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(this)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(this));
 
   return NS_OK;
 }
 
 nsresult
 Maintenance::CreateIndexedDatabaseManager()
 {
   MOZ_ASSERT(NS_IsMainThread());
@@ -17399,18 +17378,18 @@ Maintenance::CreateIndexedDatabaseManage
   }
 
   IndexedDatabaseManager* mgr = IndexedDatabaseManager::GetOrCreate();
   if (NS_WARN_IF(!mgr)) {
     return NS_ERROR_FAILURE;
   }
 
   mState = State::IndexedDatabaseManagerOpen;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    mQuotaClient->BackgroundThread()->Dispatch(this, NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(
+    mQuotaClient->BackgroundThread()->Dispatch(this, NS_DISPATCH_NORMAL));
 
   return NS_OK;
 }
 
 nsresult
 Maintenance::OpenDirectory()
 {
   AssertIsOnBackgroundThread();
@@ -17479,23 +17458,23 @@ Maintenance::DirectoryWork()
 
   QuotaManager* quotaManager = QuotaManager::Get();
   MOZ_ASSERT(quotaManager);
 
   nsCOMPtr<nsIFile> storageDir = GetFileForPath(quotaManager->GetStoragePath());
   MOZ_ASSERT(storageDir);
 
   bool exists;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(storageDir->Exists(&exists)));
+  MOZ_ALWAYS_SUCCEEDS(storageDir->Exists(&exists));
   if (!exists) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   bool isDirectory;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(storageDir->IsDirectory(&isDirectory)));
+  MOZ_ALWAYS_SUCCEEDS(storageDir->IsDirectory(&isDirectory));
   if (NS_WARN_IF(!isDirectory)) {
     return NS_ERROR_FAILURE;
   }
 
   // There are currently only 3 persistence types, and we want to iterate them
   // in this order:
   static const PersistenceType kPersistenceTypes[] = {
     PERSISTENCE_TYPE_PERSISTENT,
@@ -17520,126 +17499,126 @@ Maintenance::DirectoryWork()
     if (persistenceType == PERSISTENCE_TYPE_PERSISTENT) {
       // XXX This shouldn't be a special case...
       persistenceTypeString.AssignLiteral("permanent");
     } else {
       PersistenceTypeToText(persistenceType, persistenceTypeString);
     }
 
     nsCOMPtr<nsIFile> persistenceDir;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      storageDir->Clone(getter_AddRefs(persistenceDir))));
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      persistenceDir->Append(NS_ConvertASCIItoUTF16(persistenceTypeString))));
-
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(persistenceDir->Exists(&exists)));
+    MOZ_ALWAYS_SUCCEEDS(
+      storageDir->Clone(getter_AddRefs(persistenceDir)));
+    MOZ_ALWAYS_SUCCEEDS(
+      persistenceDir->Append(NS_ConvertASCIItoUTF16(persistenceTypeString)));
+
+    MOZ_ALWAYS_SUCCEEDS(persistenceDir->Exists(&exists));
     if (!exists) {
       continue;
     }
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(persistenceDir->IsDirectory(&isDirectory)));
+    MOZ_ALWAYS_SUCCEEDS(persistenceDir->IsDirectory(&isDirectory));
     if (NS_WARN_IF(!isDirectory)) {
       continue;
     }
 
     nsCOMPtr<nsISimpleEnumerator> persistenceDirEntries;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+    MOZ_ALWAYS_SUCCEEDS(
       persistenceDir->GetDirectoryEntries(
-        getter_AddRefs(persistenceDirEntries))));
+        getter_AddRefs(persistenceDirEntries)));
     if (!persistenceDirEntries) {
       continue;
     }
 
     while (true) {
       // Loop over "<origin>/idb" directories.
       if (IsAborted()) {
         return NS_ERROR_ABORT;
       }
 
       bool persistenceDirHasMoreEntries;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        persistenceDirEntries->HasMoreElements(&persistenceDirHasMoreEntries)));
+      MOZ_ALWAYS_SUCCEEDS(
+        persistenceDirEntries->HasMoreElements(&persistenceDirHasMoreEntries));
 
       if (!persistenceDirHasMoreEntries) {
         break;
       }
 
       nsCOMPtr<nsISupports> persistenceDirEntry;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        persistenceDirEntries->GetNext(getter_AddRefs(persistenceDirEntry))));
+      MOZ_ALWAYS_SUCCEEDS(
+        persistenceDirEntries->GetNext(getter_AddRefs(persistenceDirEntry)));
 
       nsCOMPtr<nsIFile> originDir = do_QueryInterface(persistenceDirEntry);
       MOZ_ASSERT(originDir);
 
       MOZ_ASSERT(NS_SUCCEEDED(originDir->Exists(&exists)));
       MOZ_ASSERT(exists);
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(originDir->IsDirectory(&isDirectory)));
+      MOZ_ALWAYS_SUCCEEDS(originDir->IsDirectory(&isDirectory));
       if (!isDirectory) {
         continue;
       }
 
       nsCOMPtr<nsIFile> idbDir;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(originDir->Clone(getter_AddRefs(idbDir))));
-
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(idbDir->Append(idbDirName)));
-
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(idbDir->Exists(&exists)));
+      MOZ_ALWAYS_SUCCEEDS(originDir->Clone(getter_AddRefs(idbDir)));
+
+      MOZ_ALWAYS_SUCCEEDS(idbDir->Append(idbDirName));
+
+      MOZ_ALWAYS_SUCCEEDS(idbDir->Exists(&exists));
       if (!exists) {
         continue;
       }
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(idbDir->IsDirectory(&isDirectory)));
+      MOZ_ALWAYS_SUCCEEDS(idbDir->IsDirectory(&isDirectory));
       if (NS_WARN_IF(!isDirectory)) {
         continue;
       }
 
       nsCOMPtr<nsISimpleEnumerator> idbDirEntries;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        idbDir->GetDirectoryEntries(getter_AddRefs(idbDirEntries))));
+      MOZ_ALWAYS_SUCCEEDS(
+        idbDir->GetDirectoryEntries(getter_AddRefs(idbDirEntries)));
       if (!idbDirEntries) {
         continue;
       }
 
       nsCString group;
       nsCString origin;
       nsTArray<nsString> databasePaths;
 
       while (true) {
         // Loop over files in the "idb" directory.
         if (IsAborted()) {
           return NS_ERROR_ABORT;
         }
 
         bool idbDirHasMoreEntries;
-        MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-          idbDirEntries->HasMoreElements(&idbDirHasMoreEntries)));
+        MOZ_ALWAYS_SUCCEEDS(
+          idbDirEntries->HasMoreElements(&idbDirHasMoreEntries));
 
         if (!idbDirHasMoreEntries) {
           break;
         }
 
         nsCOMPtr<nsISupports> idbDirEntry;
-        MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-          idbDirEntries->GetNext(getter_AddRefs(idbDirEntry))));
+        MOZ_ALWAYS_SUCCEEDS(
+          idbDirEntries->GetNext(getter_AddRefs(idbDirEntry)));
 
         nsCOMPtr<nsIFile> idbDirFile = do_QueryInterface(idbDirEntry);
         MOZ_ASSERT(idbDirFile);
 
         nsString idbFilePath;
-        MOZ_ALWAYS_TRUE(NS_SUCCEEDED(idbDirFile->GetPath(idbFilePath)));
+        MOZ_ALWAYS_SUCCEEDS(idbDirFile->GetPath(idbFilePath));
 
         if (!StringEndsWith(idbFilePath, sqliteExtension)) {
           continue;
         }
 
         MOZ_ASSERT(NS_SUCCEEDED(idbDirFile->Exists(&exists)));
         MOZ_ASSERT(exists);
 
-        MOZ_ALWAYS_TRUE(NS_SUCCEEDED(idbDirFile->IsDirectory(&isDirectory)));
+        MOZ_ALWAYS_SUCCEEDS(idbDirFile->IsDirectory(&isDirectory));
         if (isDirectory) {
           continue;
         }
 
         // Found a database.
         if (databasePaths.IsEmpty()) {
           MOZ_ASSERT(group.IsEmpty());
           MOZ_ASSERT(origin.IsEmpty());
@@ -17668,18 +17647,18 @@ Maintenance::DirectoryWork()
                                                     origin,
                                                     Move(databasePaths)));
       }
     }
   }
 
   mState = State::BeginDatabaseMaintenance;
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    mQuotaClient->BackgroundThread()->Dispatch(this, NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(
+    mQuotaClient->BackgroundThread()->Dispatch(this, NS_DISPATCH_NORMAL));
 
   return NS_OK;
 }
 
 nsresult
 Maintenance::BeginDatabaseMaintenance()
 {
   AssertIsOnBackgroundThread();
@@ -17730,18 +17709,18 @@ Maintenance::BeginDatabaseMaintenance()
                                   directoryInfo.mOrigin,
                                   databasePath);
 
         if (!threadPool) {
           threadPool = mQuotaClient->GetOrCreateThreadPool();
           MOZ_ASSERT(threadPool);
         }
 
-        MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-          threadPool->Dispatch(databaseMaintenance, NS_DISPATCH_NORMAL)));
+        MOZ_ALWAYS_SUCCEEDS(
+          threadPool->Dispatch(databaseMaintenance, NS_DISPATCH_NORMAL));
 
         RegisterDatabaseMaintenance(databaseMaintenance);
       }
     }
   }
 
   mDirectoryInfos.Clear();
 
@@ -17809,18 +17788,18 @@ Maintenance::Run()
   if (NS_WARN_IF(NS_FAILED(rv)) && mState != State::Finishing) {
     // Must set mState before dispatching otherwise we will race with the owning
     // thread.
     mState = State::Finishing;
 
     if (IsOnBackgroundThread()) {
       Finish();
     } else {
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        mQuotaClient->BackgroundThread()->Dispatch(this, NS_DISPATCH_NORMAL)));
+      MOZ_ALWAYS_SUCCEEDS(
+        mQuotaClient->BackgroundThread()->Dispatch(this, NS_DISPATCH_NORMAL));
     }
   }
 
   return NS_OK;
 }
 
 void
 Maintenance::DirectoryLockAcquired(DirectoryLock* aLock)
@@ -17872,17 +17851,17 @@ DatabaseMaintenance::PerformMaintenanceO
     {
       MOZ_ASSERT(aConnection);
     }
 
     ~AutoClose()
     {
       MOZ_ASSERT(mConnection);
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mConnection->Close()));
+      MOZ_ALWAYS_SUCCEEDS(mConnection->Close());
     }
   };
 
   nsCOMPtr<nsIFile> databaseFile = GetFileForPath(mDatabasePath);
   MOZ_ASSERT(databaseFile);
 
   nsCOMPtr<mozIStorageConnection> connection;
   nsresult rv = GetStorageConnection(databaseFile,
@@ -18347,34 +18326,33 @@ DatabaseMaintenance::FullVacuum(mozIStor
 }
 
 void
 DatabaseMaintenance::RunOnOwningThread()
 {
   AssertIsOnBackgroundThread();
 
   if (mCompleteCallback) {
-    MOZ_ALWAYS_TRUE(
-      NS_SUCCEEDED(NS_DispatchToCurrentThread(mCompleteCallback)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(mCompleteCallback));
     mCompleteCallback = nullptr;
   }
 
   mMaintenance->UnregisterDatabaseMaintenance(this);
 }
 
 void
 DatabaseMaintenance::RunOnConnectionThread()
 {
   MOZ_ASSERT(!NS_IsMainThread());
   MOZ_ASSERT(!IsOnBackgroundThread());
 
   PerformMaintenanceOnDatabase();
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    mMaintenance->BackgroundThread()->Dispatch(this, NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(
+    mMaintenance->BackgroundThread()->Dispatch(this, NS_DISPATCH_NORMAL));
 }
 
 NS_IMETHODIMP
 DatabaseMaintenance::Run()
 {
   if (IsOnBackgroundThread()) {
     RunOnOwningThread();
   } else {
@@ -19258,17 +19236,17 @@ DatabaseOperationBase::DeleteObjectStore
     }
 
     rv = DeleteIndexDataTableRows(aConnection, objectStoreKey, indexValues);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     if (deleteStmt) {
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(deleteStmt->Reset()));
+      MOZ_ALWAYS_SUCCEEDS(deleteStmt->Reset());
     } else {
       rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
         "DELETE FROM object_data "
           "WHERE object_store_id = :object_store_id "
           "AND key = :key;"),
         &deleteStmt);
       if (NS_WARN_IF(NS_FAILED(rv))) {
         return rv;
@@ -19442,18 +19420,18 @@ AutoSetProgressHandler::AutoSetProgressH
 
 DatabaseOperationBase::
 AutoSetProgressHandler::~AutoSetProgressHandler()
 {
   MOZ_ASSERT(!IsOnBackgroundThread());
 
   if (mConnection) {
     nsCOMPtr<mozIStorageProgressHandler> oldHandler;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      mConnection->RemoveProgressHandler(getter_AddRefs(oldHandler))));
+    MOZ_ALWAYS_SUCCEEDS(
+      mConnection->RemoveProgressHandler(getter_AddRefs(oldHandler)));
     MOZ_ASSERT(oldHandler == mDEBUGDatabaseOp);
   }
 }
 
 nsresult
 DatabaseOperationBase::
 AutoSetProgressHandler::Register(mozIStorageConnection* aConnection,
                                  DatabaseOperationBase* aDatabaseOp)
@@ -19722,26 +19700,24 @@ FactoryOp::Open()
                              Client::IDB,
                              mDatabaseId);
 
   mDatabaseId.Append('*');
   mDatabaseId.Append(NS_ConvertUTF16toUTF8(metadata.name()));
 
   if (permission == PermissionRequestBase::kPermissionPrompt) {
     mState = State::PermissionChallenge;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(this,
-                                                         NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
     return NS_OK;
   }
 
   MOZ_ASSERT(permission == PermissionRequestBase::kPermissionAllowed);
 
   mState = State::FinishOpen;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(this,
-                                                       NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
 
   return NS_OK;
 }
 
 nsresult
 FactoryOp::ChallengePermission()
 {
   AssertIsOnOwningThread();
@@ -19788,18 +19764,17 @@ FactoryOp::RetryCheckPermission()
   if (permission == PermissionRequestBase::kPermissionDenied ||
       permission == PermissionRequestBase::kPermissionPrompt) {
     return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
   }
 
   MOZ_ASSERT(permission == PermissionRequestBase::kPermissionAllowed);
 
   mState = State::FinishOpen;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(this,
-                                                       NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
 
   return NS_OK;
 }
 
 nsresult
 FactoryOp::DirectoryOpen()
 {
   AssertIsOnOwningThread();
@@ -19908,17 +19883,17 @@ FactoryOp::FinishSendResults()
   MOZ_ASSERT(mFactory);
 
   // Make sure to release the factory on this thread.
   RefPtr<Factory> factory;
   mFactory.swap(factory);
 
   if (mBlockedDatabaseOpen) {
     if (mDelayedOp) {
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(mDelayedOp)));
+      MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(mDelayedOp));
       mDelayedOp = nullptr;
     }
 
     MOZ_ASSERT(gFactoryOps);
     gFactoryOps->RemoveElement(this);
   }
 
   mState = State::Completed;
@@ -20402,18 +20377,17 @@ FactoryOp::Run()
 
     // Must set mState before dispatching otherwise we will race with the owning
     // thread.
     mState = State::SendingResults;
 
     if (IsOnOwningThread()) {
       SendResults();
     } else {
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-        mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL)));
+      MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
     }
   }
 
   return NS_OK;
 }
 
 void
 FactoryOp::DirectoryLockAcquired(DirectoryLock* aLock)
@@ -20466,17 +20440,17 @@ FactoryOp::RecvPermissionRetry()
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(!IsActorDestroyed());
   MOZ_ASSERT(mState == State::PermissionChallenge);
 
   mContentParent = BackgroundParent::GetContentParent(Manager()->Manager());
 
   mState = State::PermissionRetry;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(this)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(this));
 
   return true;
 }
 
 OpenDatabaseOp::OpenDatabaseOp(Factory* aFactory,
                                already_AddRefed<ContentParent> aContentParent,
                                const CommonFactoryRequestParams& aParams)
   : FactoryOp(aFactory, Move(aContentParent), aParams, /* aDeleting */ false)
@@ -21247,17 +21221,17 @@ OpenDatabaseOp::NoteDatabaseClosed(Datab
   }
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     if (NS_SUCCEEDED(mResultCode)) {
       mResultCode = rv;
     }
 
     mState = State::SendingResults;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(Run()));
+    MOZ_ALWAYS_SUCCEEDS(Run());
   }
 }
 
 void
 OpenDatabaseOp::SendBlockedNotification()
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mState == State::WaitingForOtherDatabasesToClose);
@@ -21752,17 +21726,17 @@ VersionChangeOp::SendFailureResult(nsres
   AssertIsOnOwningThread();
   MOZ_ASSERT(mOpenDatabaseOp);
   MOZ_ASSERT(mOpenDatabaseOp->mState == State::DatabaseWorkVersionChange);
   MOZ_ASSERT(mOpenDatabaseOp->mVersionChangeOp == this);
 
   mOpenDatabaseOp->SetFailureCode(aResultCode);
   mOpenDatabaseOp->mState = State::SendingResults;
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOpenDatabaseOp->Run()));
+  MOZ_ALWAYS_SUCCEEDS(mOpenDatabaseOp->Run());
 
   return false;
 }
 
 void
 OpenDatabaseOp::
 VersionChangeOp::Cleanup()
 {
@@ -21807,27 +21781,27 @@ DeleteDatabaseOp::LoadPreviousVersion(ns
   rv = OpenDatabaseAndHandleBusy(ss, aDatabaseFile, getter_AddRefs(connection));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return;
   }
 
 #ifdef DEBUG
   {
     nsCOMPtr<mozIStorageStatement> stmt;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+    MOZ_ALWAYS_SUCCEEDS(
       connection->CreateStatement(NS_LITERAL_CSTRING(
         "SELECT name "
           "FROM database"
-        ), getter_AddRefs(stmt))));
+        ), getter_AddRefs(stmt)));
 
     bool hasResult;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)));
+    MOZ_ALWAYS_SUCCEEDS(stmt->ExecuteStep(&hasResult));
 
     nsString databaseName;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(stmt->GetString(0, databaseName)));
+    MOZ_ALWAYS_SUCCEEDS(stmt->GetString(0, databaseName));
 
     MOZ_ASSERT(mCommonParams.metadata().name() == databaseName);
   }
 #endif
 
   nsCOMPtr<mozIStorageStatement> stmt;
   rv = connection->CreateStatement(NS_LITERAL_CSTRING(
     "SELECT version "
@@ -22063,17 +22037,17 @@ DeleteDatabaseOp::NoteDatabaseClosed(Dat
   }
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     if (NS_SUCCEEDED(mResultCode)) {
       mResultCode = rv;
     }
 
     mState = State::SendingResults;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(Run()));
+    MOZ_ALWAYS_SUCCEEDS(Run());
   }
 }
 
 void
 DeleteDatabaseOp::SendBlockedNotification()
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mState == State::WaitingForOtherDatabasesToClose);
@@ -22388,17 +22362,17 @@ VersionChangeOp::RunOnOwningThread()
 
           MOZ_ASSERT(!gLiveDatabaseHashtable->Get(deleteOp->mDatabaseId));
         }
       }
     }
   }
 
   deleteOp->mState = State::SendingResults;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(deleteOp->Run()));
+  MOZ_ALWAYS_SUCCEEDS(deleteOp->Run());
 
 #ifdef DEBUG
   // A bit hacky but the DeleteDatabaseOp::VersionChangeOp is not really a
   // normal database operation that is tied to an actor. Do this to make our
   // assertions happy.
   NoteActorDestroyed();
 #endif
 }
@@ -22416,18 +22390,17 @@ VersionChangeOp::Run()
     rv = NS_OK;
   }
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     if (NS_SUCCEEDED(mResultCode)) {
       mResultCode = rv;
     }
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(this,
-                                                         NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
   }
 
   return NS_OK;
 }
 
 TransactionDatabaseOperationBase::TransactionDatabaseOperationBase(
                                                   TransactionBase* aTransaction)
   : DatabaseOperationBase(aTransaction->GetLoggingInfo()->Id(),
@@ -22548,18 +22521,17 @@ TransactionDatabaseOperationBase::RunOnC
 
         if (NS_FAILED(rv)) {
           mResultCode = rv;
         }
       }
     }
   }
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(this,
-                                                       NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
 }
 
 void
 TransactionDatabaseOperationBase::RunOnOwningThread()
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mTransaction);
 
@@ -22670,17 +22642,17 @@ CommitOp::WriteAutoIncrementCounts()
     for (uint32_t count = metadataArray.Length(), index = 0;
          index < count;
          index++) {
       const RefPtr<FullObjectStoreMetadata>& metadata = metadataArray[index];
       MOZ_ASSERT(!metadata->mDeleted);
       MOZ_ASSERT(metadata->mNextAutoIncrementId > 1);
 
       if (stmt) {
-        MOZ_ALWAYS_TRUE(NS_SUCCEEDED(stmt->Reset()));
+        MOZ_ALWAYS_SUCCEEDS(stmt->Reset());
       } else {
         rv = connection->GetCachedStatement(
           NS_LITERAL_CSTRING("UPDATE object_store "
                              "SET auto_increment = :") + ai +
           NS_LITERAL_CSTRING(" WHERE id = :") + osid +
           NS_LITERAL_CSTRING(";"),
           &stmt);
         if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -22746,37 +22718,37 @@ TransactionBase::
 CommitOp::AssertForeignKeyConsistency(DatabaseConnection* aConnection)
 {
   MOZ_ASSERT(aConnection);
   MOZ_ASSERT(mTransaction);
   mTransaction->AssertIsOnConnectionThread();
   MOZ_ASSERT(mTransaction->GetMode() != IDBTransaction::READ_ONLY);
 
   DatabaseConnection::CachedStatement pragmaStmt;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+  MOZ_ALWAYS_SUCCEEDS(
     aConnection->GetCachedStatement(NS_LITERAL_CSTRING("PRAGMA foreign_keys;"),
-                                    &pragmaStmt)));
+                                    &pragmaStmt));
 
   bool hasResult;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(pragmaStmt->ExecuteStep(&hasResult)));
+  MOZ_ALWAYS_SUCCEEDS(pragmaStmt->ExecuteStep(&hasResult));
 
   MOZ_ASSERT(hasResult);
 
   int32_t foreignKeysEnabled;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(pragmaStmt->GetInt32(0, &foreignKeysEnabled)));
+  MOZ_ALWAYS_SUCCEEDS(pragmaStmt->GetInt32(0, &foreignKeysEnabled));
 
   MOZ_ASSERT(foreignKeysEnabled, "Database doesn't have foreign keys enabled!");
 
   DatabaseConnection::CachedStatement checkStmt;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+  MOZ_ALWAYS_SUCCEEDS(
     aConnection->GetCachedStatement(
       NS_LITERAL_CSTRING("PRAGMA foreign_key_check;"),
-      &checkStmt)));
-
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(checkStmt->ExecuteStep(&hasResult)));
+      &checkStmt));
+
+  MOZ_ALWAYS_SUCCEEDS(checkStmt->ExecuteStep(&hasResult));
 
   MOZ_ASSERT(!hasResult, "Database has inconsisistent foreign keys!");
 }
 
 #endif // DEBUG
 
 NS_IMPL_ISUPPORTS_INHERITED0(TransactionBase::CommitOp, DatabaseOperationBase)
 
@@ -22984,18 +22956,17 @@ DatabaseOp::Run()
     if (NS_SUCCEEDED(mResultCode)) {
       mResultCode = rv;
     }
 
     // Must set mState before dispatching otherwise we will race with the owning
     // thread.
     mState = State::SendingResults;
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(this,
-                                                         NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
   }
 
   return NS_OK;
 }
 
 void
 DatabaseOp::ActorDestroy(ActorDestroyReason aWhy)
 {
@@ -23202,28 +23173,28 @@ CreateObjectStoreOp::DoDatabaseWork(Data
   }
 
 #ifdef DEBUG
   {
     // Make sure that we're not creating an object store with the same name as
     // another that already exists. This should be impossible because we should
     // have thrown an error long before now...
     DatabaseConnection::CachedStatement stmt;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+    MOZ_ALWAYS_SUCCEEDS(
       aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
         "SELECT name "
           "FROM object_store "
           "WHERE name = :name;"),
-        &stmt)));
-
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mMetadata.name())));
+        &stmt));
+
+    MOZ_ALWAYS_SUCCEEDS(
+      stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mMetadata.name()));
 
     bool hasResult;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)));
+    MOZ_ALWAYS_SUCCEEDS(stmt->ExecuteStep(&hasResult));
     MOZ_ASSERT(!hasResult);
   }
 #endif
 
   DatabaseConnection::AutoSavepoint autoSave;
   nsresult rv = autoSave.Start(Transaction());
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
@@ -23272,18 +23243,18 @@ CreateObjectStoreOp::DoDatabaseWork(Data
   rv = stmt->Execute();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
 #ifdef DEBUG
   {
     int64_t id;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      aConnection->GetStorageConnection()->GetLastInsertRowID(&id)));
+    MOZ_ALWAYS_SUCCEEDS(
+      aConnection->GetStorageConnection()->GetLastInsertRowID(&id));
     MOZ_ASSERT(mMetadata.id() == id);
   }
 #endif
 
   rv = autoSave.Commit();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
@@ -23302,35 +23273,35 @@ DeleteObjectStoreOp::DoDatabaseWork(Data
                  js::ProfileEntry::Category::STORAGE);
 
   NS_NAMED_LITERAL_CSTRING(objectStoreIdString, "object_store_id");
 
 #ifdef DEBUG
   {
     // Make sure |mIsLastObjectStore| is telling the truth.
     DatabaseConnection::CachedStatement stmt;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+    MOZ_ALWAYS_SUCCEEDS(
       aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
         "SELECT id "
           "FROM object_store;"),
-        &stmt)));
+        &stmt));
 
     bool foundThisObjectStore = false;
     bool foundOtherObjectStore = false;
 
     while (true) {
       bool hasResult;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)));
+      MOZ_ALWAYS_SUCCEEDS(stmt->ExecuteStep(&hasResult));
 
       if (!hasResult) {
         break;
       }
 
       int64_t id;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(stmt->GetInt64(0, &id)));
+      MOZ_ALWAYS_SUCCEEDS(stmt->GetInt64(0, &id));
 
       if (id == mMetadata->mCommonMetadata.id()) {
         foundThisObjectStore = true;
       } else {
         foundOtherObjectStore = true;
       }
     }
 
@@ -23489,19 +23460,19 @@ DeleteObjectStoreOp::DoDatabaseWork(Data
     rv = stmt->Execute();
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
 #ifdef DEBUG
     {
       int32_t deletedRowCount;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+      MOZ_ALWAYS_SUCCEEDS(
         aConnection->GetStorageConnection()->
-          GetAffectedRows(&deletedRowCount)));
+          GetAffectedRows(&deletedRowCount));
       MOZ_ASSERT(deletedRowCount == 1);
     }
 #endif
   }
 
   rv = autoSave.Commit();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
@@ -23567,18 +23538,17 @@ CreateIndexOp::InsertDataFromObjectStore
                                       4,
                                       updateFunction);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   rv = InsertDataFromObjectStoreInternal(aConnection);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    storageConnection->RemoveFunction(updateFunctionName)));
+  MOZ_ALWAYS_SUCCEEDS(storageConnection->RemoveFunction(updateFunctionName));
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return NS_OK;
 }
 
@@ -23671,30 +23641,30 @@ CreateIndexOp::DoDatabaseWork(DatabaseCo
   }
 
 #ifdef DEBUG
   {
     // Make sure that we're not creating an index with the same name and object
     // store as another that already exists. This should be impossible because
     // we should have thrown an error long before now...
     DatabaseConnection::CachedStatement stmt;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+    MOZ_ALWAYS_SUCCEEDS(
       aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
         "SELECT name "
           "FROM object_store_index "
           "WHERE object_store_id = :osid "
           "AND name = :name;"),
-        &stmt)));
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mObjectStoreId)));
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mMetadata.name())));
+        &stmt));
+    MOZ_ALWAYS_SUCCEEDS(
+      stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mObjectStoreId));
+    MOZ_ALWAYS_SUCCEEDS(
+      stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mMetadata.name()));
 
     bool hasResult;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)));
+    MOZ_ALWAYS_SUCCEEDS(stmt->ExecuteStep(&hasResult));
 
     MOZ_ASSERT(!hasResult);
   }
 #endif
 
   DatabaseConnection::AutoSavepoint autoSave;
   nsresult rv = autoSave.Start(Transaction());
   if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -23767,18 +23737,18 @@ CreateIndexOp::DoDatabaseWork(DatabaseCo
   rv = stmt->Execute();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
 #ifdef DEBUG
   {
     int64_t id;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      aConnection->GetStorageConnection()->GetLastInsertRowID(&id)));
+    MOZ_ALWAYS_SUCCEEDS(
+      aConnection->GetStorageConnection()->GetLastInsertRowID(&id));
     MOZ_ASSERT(mMetadata.id() == id);
   }
 #endif
 
   rv = InsertDataFromObjectStore(aConnection);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
@@ -23898,32 +23868,32 @@ UpdateIndexDataValuesFunction::OnFunctio
 
   PROFILER_LABEL("IndexedDB",
                  "CreateIndexOp::UpdateIndexDataValuesFunction::OnFunctionCall",
                  js::ProfileEntry::Category::STORAGE);
 
 #ifdef DEBUG
   {
     uint32_t argCount;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aValues->GetNumEntries(&argCount)));
+    MOZ_ALWAYS_SUCCEEDS(aValues->GetNumEntries(&argCount));
     MOZ_ASSERT(argCount == 4); // key, index_data_values, file_ids, data
 
     int32_t valueType;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aValues->GetTypeOfIndex(0, &valueType)));
+    MOZ_ALWAYS_SUCCEEDS(aValues->GetTypeOfIndex(0, &valueType));
     MOZ_ASSERT(valueType == mozIStorageValueArray::VALUE_TYPE_BLOB);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aValues->GetTypeOfIndex(1, &valueType)));
+    MOZ_ALWAYS_SUCCEEDS(aValues->GetTypeOfIndex(1, &valueType));
     MOZ_ASSERT(valueType == mozIStorageValueArray::VALUE_TYPE_NULL ||
                valueType == mozIStorageValueArray::VALUE_TYPE_BLOB);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aValues->GetTypeOfIndex(2, &valueType)));
+    MOZ_ALWAYS_SUCCEEDS(aValues->GetTypeOfIndex(2, &valueType));
     MOZ_ASSERT(valueType == mozIStorageValueArray::VALUE_TYPE_NULL ||
                valueType == mozIStorageValueArray::VALUE_TYPE_TEXT);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aValues->GetTypeOfIndex(3, &valueType)));
+    MOZ_ALWAYS_SUCCEEDS(aValues->GetTypeOfIndex(3, &valueType));
     MOZ_ASSERT(valueType == mozIStorageValueArray::VALUE_TYPE_BLOB);
   }
 #endif
 
   StructuredCloneReadInfo cloneInfo;
   nsresult rv =
     GetStructuredCloneReadInfoFromValueArray(aValues,
                                              /* aDataIndex */ 3,
@@ -24233,40 +24203,40 @@ DeleteIndexOp::DoDatabaseWork(DatabaseCo
 {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
 
 #ifdef DEBUG
   {
     // Make sure |mIsLastIndex| is telling the truth.
     DatabaseConnection::CachedStatement stmt;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+    MOZ_ALWAYS_SUCCEEDS(
       aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
         "SELECT id "
           "FROM object_store_index "
           "WHERE object_store_id = :object_store_id;"),
-        &stmt)));
-
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+        &stmt));
+
+    MOZ_ALWAYS_SUCCEEDS(
       stmt->BindInt64ByName(NS_LITERAL_CSTRING("object_store_id"),
-                            mObjectStoreId)));
+                            mObjectStoreId));
 
     bool foundThisIndex = false;
     bool foundOtherIndex = false;
 
     while (true) {
       bool hasResult;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)));
+      MOZ_ALWAYS_SUCCEEDS(stmt->ExecuteStep(&hasResult));
 
       if (!hasResult) {
         break;
       }
 
       int64_t id;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(stmt->GetInt64(0, &id)));
+      MOZ_ALWAYS_SUCCEEDS(stmt->GetInt64(0, &id));
 
       if (id == mIndexId) {
         foundThisIndex = true;
       } else {
         foundOtherIndex = true;
       }
     }
 
@@ -24427,17 +24397,17 @@ DeleteIndexOp::DoDatabaseWork(DatabaseCo
           IDB_REPORT_INTERNAL_ERR();
           return NS_ERROR_FILE_CORRUPTED;
         }
       }
     }
 
     // Now delete the index row.
     if (deleteIndexRowStmt) {
-        MOZ_ALWAYS_TRUE(NS_SUCCEEDED(deleteIndexRowStmt->Reset()));
+        MOZ_ALWAYS_SUCCEEDS(deleteIndexRowStmt->Reset());
     } else {
       if (mUnique) {
         rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
           "DELETE FROM unique_index_data "
             "WHERE index_id = :index_id "
             "AND value = :value;"),
           &deleteIndexRowStmt);
       } else {
@@ -24509,18 +24479,18 @@ DeleteIndexOp::DoDatabaseWork(DatabaseCo
   rv = deleteStmt->Execute();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
 #ifdef DEBUG
   {
     int32_t deletedRowCount;
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      aConnection->GetStorageConnection()->GetAffectedRows(&deletedRowCount)));
+    MOZ_ALWAYS_SUCCEEDS(
+      aConnection->GetStorageConnection()->GetAffectedRows(&deletedRowCount));
     MOZ_ASSERT(deletedRowCount == 1);
   }
 #endif
 
   rv = autoSave.Commit();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
--- a/dom/indexedDB/FileInfo.cpp
+++ b/dom/indexedDB/FileInfo.cpp
@@ -211,17 +211,17 @@ FileInfo::Cleanup()
 {
   int64_t id = Id();
 
   // IndexedDatabaseManager is main-thread only.
   if (!NS_IsMainThread()) {
     RefPtr<CleanupFileRunnable> cleaner =
       new CleanupFileRunnable(mFileManager, id);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(cleaner)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(cleaner));
     return;
   }
 
   CleanupFileRunnable::DoCleanup(mFileManager, id);
 }
 
 // static
 void
--- a/dom/indexedDB/FileSnapshot.cpp
+++ b/dom/indexedDB/FileSnapshot.cpp
@@ -84,18 +84,18 @@ private:
     if (IsOnOwningThread()) {
       delete this;
       return;
     }
 
     nsCOMPtr<nsIRunnable> destroyRunnable =
       NS_NewNonOwningRunnableMethod(this, &StreamWrapper::Destroy);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(destroyRunnable,
-                                                         NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(destroyRunnable,
+                                                NS_DISPATCH_NORMAL));
   }
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIINPUTSTREAM
   NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM
 };
 
 class StreamWrapper::CloseRunnable final
@@ -214,18 +214,18 @@ NS_IMPL_QUERY_INTERFACE(StreamWrapper,
 
 NS_IMETHODIMP
 StreamWrapper::Close()
 {
   MOZ_ASSERT(!IsOnOwningThread());
 
   RefPtr<CloseRunnable> closeRunnable = new CloseRunnable(this);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(closeRunnable,
-                                                       NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(closeRunnable,
+                                              NS_DISPATCH_NORMAL));
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 StreamWrapper::Available(uint64_t* _retval)
 {
   // Can't assert here, this method is sometimes called on the owning thread
--- a/dom/indexedDB/IDBDatabase.cpp
+++ b/dom/indexedDB/IDBDatabase.cpp
@@ -274,18 +274,18 @@ IDBDatabase::CloseInternal()
       mObserver->Revoke();
 
       nsCOMPtr<nsIObserverService> obsSvc = GetObserverService();
       if (obsSvc) {
         // These might not have been registered.
         obsSvc->RemoveObserver(mObserver, kCycleCollectionObserverTopic);
         obsSvc->RemoveObserver(mObserver, kMemoryPressureObserverTopic);
 
-        MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-          obsSvc->RemoveObserver(mObserver, kWindowObserverTopic)));
+        MOZ_ALWAYS_SUCCEEDS(
+          obsSvc->RemoveObserver(mObserver, kWindowObserverTopic));
       }
 
       mObserver = nullptr;
     }
 
     if (mBackgroundActor && !mInvalidated) {
       mBackgroundActor->SendClose();
     }
@@ -1037,17 +1037,17 @@ IDBDatabase::DelayedMaybeExpireFileActor
   MOZ_ASSERT(runnable);
 
   if (!NS_IsMainThread()) {
     // Wrap as a nsICancelableRunnable to make workers happy.
     nsCOMPtr<nsIRunnable> cancelable = new CancelableRunnableWrapper(runnable);
     cancelable.swap(runnable);
   }
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(runnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(runnable));
 }
 
 nsresult
 IDBDatabase::GetQuotaInfo(nsACString& aOrigin,
                           PersistenceType* aPersistenceType)
 {
   using mozilla::dom::quota::QuotaManager;
 
@@ -1313,17 +1313,17 @@ Observer::Observe(nsISupports* aSubject,
   MOZ_ASSERT(aTopic);
 
   if (!strcmp(aTopic, kWindowObserverTopic)) {
     if (mWeakDatabase) {
       nsCOMPtr<nsISupportsPRUint64> supportsInt = do_QueryInterface(aSubject);
       MOZ_ASSERT(supportsInt);
 
       uint64_t windowId;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(supportsInt->GetData(&windowId)));
+      MOZ_ALWAYS_SUCCEEDS(supportsInt->GetData(&windowId));
 
       if (windowId == mWindowId) {
         RefPtr<IDBDatabase> database = mWeakDatabase;
         mWeakDatabase = nullptr;
 
         database->InvalidateInternal();
       }
     }
--- a/dom/indexedDB/IDBFactory.cpp
+++ b/dom/indexedDB/IDBFactory.cpp
@@ -380,21 +380,21 @@ IDBFactory::AllowedForWindowInternal(nsP
   if (nsContentUtils::IsSystemPrincipal(principal)) {
     principal.forget(aPrincipal);
     return NS_OK;
   }
 
   // About URIs shouldn't be able to access IndexedDB unless they have the
   // nsIAboutModule::ENABLE_INDEXED_DB flag set on them.
   nsCOMPtr<nsIURI> uri;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(principal->GetURI(getter_AddRefs(uri))));
+  MOZ_ALWAYS_SUCCEEDS(principal->GetURI(getter_AddRefs(uri)));
   MOZ_ASSERT(uri);
 
   bool isAbout = false;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(uri->SchemeIs("about", &isAbout)));
+  MOZ_ALWAYS_SUCCEEDS(uri->SchemeIs("about", &isAbout));
 
   if (isAbout) {
     nsCOMPtr<nsIAboutModule> module;
     if (NS_SUCCEEDED(NS_GetAboutModule(uri, getter_AddRefs(module)))) {
       uint32_t flags;
       if (NS_SUCCEEDED(module->GetURIFlags(uri, &flags))) {
         if (!(flags & nsIAboutModule::ENABLE_INDEXED_DB)) {
           return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
@@ -702,17 +702,17 @@ IDBFactory::OpenInternal(JSContext* aCx,
     if (threadLocal && threadLocal->mIndexedDBThreadLocal) {
       idbThreadLocal = threadLocal->mIndexedDBThreadLocal;
     } else {
       nsCOMPtr<nsIUUIDGenerator> uuidGen =
         do_GetService("@mozilla.org/uuid-generator;1");
       MOZ_ASSERT(uuidGen);
 
       nsID id;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(uuidGen->GenerateUUIDInPlace(&id)));
+      MOZ_ALWAYS_SUCCEEDS(uuidGen->GenerateUUIDInPlace(&id));
 
       newIDBThreadLocal = idbThreadLocal = new ThreadLocal(id);
     }
 
     if (PBackgroundChild* actor = BackgroundChild::GetForCurrentThread()) {
       BackgroundActorCreated(actor, idbThreadLocal->GetLoggingInfo());
     } else {
       // We need to start the sequence to create a background actor for this
--- a/dom/indexedDB/IDBRequest.cpp
+++ b/dom/indexedDB/IDBRequest.cpp
@@ -503,17 +503,17 @@ public:
     MOZ_ASSERT(mWorkerPrivate);
     mWorkerPrivate->AssertIsOnWorkerThread();
 
     mWorkerPrivate = nullptr;
   }
 
 private:
   virtual bool
-  Notify(JSContext* aCx, Status aStatus) override;
+  Notify(Status aStatus) override;
 };
 
 IDBOpenDBRequest::IDBOpenDBRequest(IDBFactory* aFactory,
                                    nsPIDOMWindowInner* aOwner,
                                    bool aFileHandleDisabled)
   : IDBRequest(aOwner)
   , mFactory(aFactory)
   , mFileHandleDisabled(aFileHandleDisabled)
@@ -644,17 +644,17 @@ IDBOpenDBRequest::WrapObject(JSContext* 
 {
   AssertIsOnOwningThread();
 
   return IDBOpenDBRequestBinding::Wrap(aCx, this, aGivenProto);
 }
 
 bool
 IDBOpenDBRequest::
-WorkerFeature::Notify(JSContext* aCx, Status aStatus)
+WorkerFeature::Notify(Status aStatus)
 {
   MOZ_ASSERT(mWorkerPrivate);
   mWorkerPrivate->AssertIsOnWorkerThread();
   MOZ_ASSERT(aStatus > Running);
 
   // There's nothing we can really do here at the moment...
   NS_WARNING("Worker closing but IndexedDB is waiting to open a database!");
 
--- a/dom/indexedDB/IDBTransaction.cpp
+++ b/dom/indexedDB/IDBTransaction.cpp
@@ -62,17 +62,17 @@ public:
 
     MOZ_COUNT_DTOR(IDBTransaction::WorkerFeature);
 
     mWorkerPrivate->RemoveFeature(this);
   }
 
 private:
   virtual bool
-  Notify(JSContext* aCx, Status aStatus) override;
+  Notify(Status aStatus) override;
 };
 
 IDBTransaction::IDBTransaction(IDBDatabase* aDatabase,
                                const nsTArray<nsString>& aObjectStoreNames,
                                Mode aMode)
   : IDBWrapperCache(aDatabase)
   , mDatabase(aDatabase)
   , mObjectStoreNames(aObjectStoreNames)
@@ -988,17 +988,17 @@ IDBTransaction::Run()
     SendCommit();
   }
 
   return NS_OK;
 }
 
 bool
 IDBTransaction::
-WorkerFeature::Notify(JSContext* aCx, Status aStatus)
+WorkerFeature::Notify(Status aStatus)
 {
   MOZ_ASSERT(mWorkerPrivate);
   mWorkerPrivate->AssertIsOnWorkerThread();
   MOZ_ASSERT(aStatus > Running);
 
   if (mTransaction && aStatus > Terminating) {
     mTransaction->AssertIsOnOwningThread();
 
--- a/dom/indexedDB/IndexedDatabaseManager.cpp
+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
@@ -455,17 +455,17 @@ IndexedDatabaseManager::CommonPostHandle
   Event* internalEvent = aVisitor.mDOMEvent->InternalDOMEvent();
   MOZ_ASSERT(internalEvent);
 
   if (!internalEvent->IsTrusted()) {
     return NS_OK;
   }
 
   nsString type;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(internalEvent->GetType(type)));
+  MOZ_ALWAYS_SUCCEEDS(internalEvent->GetType(type));
 
   MOZ_ASSERT(nsDependentString(kErrorEventType).EqualsLiteral("error"));
   if (!type.EqualsLiteral("error")) {
     return NS_OK;
   }
 
   nsCOMPtr<EventTarget> eventTarget = internalEvent->GetTarget();
   MOZ_ASSERT(eventTarget);
@@ -1141,18 +1141,17 @@ DeleteFilesRunnable::DeleteFilesRunnable
 }
 
 void
 DeleteFilesRunnable::Dispatch()
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(mState == State_Initial);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    mBackgroundThread->Dispatch(this, NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(mBackgroundThread->Dispatch(this, NS_DISPATCH_NORMAL));
 }
 
 NS_IMPL_ISUPPORTS(DeleteFilesRunnable, nsIRunnable)
 
 NS_IMETHODIMP
 DeleteFilesRunnable::Run()
 {
   nsresult rv;
@@ -1307,18 +1306,17 @@ DeleteFilesRunnable::DoDatabaseWork()
 
 void
 DeleteFilesRunnable::Finish()
 {
   // Must set mState before dispatching otherwise we will race with the main
   // thread.
   mState = State_UnblockingOpen;
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    mBackgroundThread->Dispatch(this, NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(mBackgroundThread->Dispatch(this, NS_DISPATCH_NORMAL));
 }
 
 void
 DeleteFilesRunnable::UnblockOpen()
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(mState == State_UnblockingOpen);
 
--- a/dom/indexedDB/PermissionRequestBase.cpp
+++ b/dom/indexedDB/PermissionRequestBase.cpp
@@ -224,17 +224,17 @@ PermissionRequestBase::Observe(nsISuppor
   nsCOMPtr<Element> element;
   element.swap(mOwnerElement);
 
   nsCOMPtr<nsIPrincipal> principal;
   mPrincipal.swap(principal);
 
   nsresult rv;
   uint32_t promptResult = nsDependentString(aData).ToInteger(&rv);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(rv));
+  MOZ_ALWAYS_SUCCEEDS(rv);
 
   // The UI prompt code will only return one of these three values. We have to
   // transform it to our values.
   MOZ_ASSERT(promptResult == kPermissionDefault ||
              promptResult == kPermissionAllowed ||
              promptResult == kPermissionDenied);
 
   if (promptResult != kPermissionDefault) {
--- a/dom/indexedDB/ProfilerHelpers.h
+++ b/dom/indexedDB/ProfilerHelpers.h
@@ -260,17 +260,17 @@ public:
   LoggingString(nsIDOMEvent* aEvent, const char16_t* aDefault)
     : nsAutoCString(kQuote)
   {
     MOZ_ASSERT(aDefault);
 
     nsString eventType;
 
     if (aEvent) {
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aEvent->GetType(eventType)));
+      MOZ_ALWAYS_SUCCEEDS(aEvent->GetType(eventType));
     } else {
       eventType = nsDependentString(aDefault);
     }
 
     AppendUTF16toUTF8(eventType, *this);
     Append(kQuote);
   }
 };
--- a/dom/indexedDB/ScriptErrorHelper.cpp
+++ b/dom/indexedDB/ScriptErrorHelper.cpp
@@ -118,37 +118,37 @@ public:
       do_GetService(NS_CONSOLESERVICE_CONTRACTID);
     MOZ_ASSERT(consoleService);
 
     nsCOMPtr<nsIScriptError> scriptError =
       do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
     MOZ_ASSERT(scriptError);
 
     if (aInnerWindowID) {
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+      MOZ_ALWAYS_SUCCEEDS(
         scriptError->InitWithWindowID(aMessage,
                                       aFilename,
                                       /* aSourceLine */ EmptyString(),
                                       aLineNumber,
                                       aColumnNumber,
                                       aSeverityFlag,
                                       category,
-                                      aInnerWindowID)));
+                                      aInnerWindowID));
     } else {
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+      MOZ_ALWAYS_SUCCEEDS(
         scriptError->Init(aMessage,
                           aFilename,
                           /* aSourceLine */ EmptyString(),
                           aLineNumber,
                           aColumnNumber,
                           aSeverityFlag,
-                          category.get())));
+                          category.get()));
     }
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(consoleService->LogMessage(scriptError)));
+    MOZ_ALWAYS_SUCCEEDS(consoleService->LogMessage(scriptError));
   }
 
   NS_IMETHOD
   Run() override
   {
     MOZ_ASSERT(NS_IsMainThread());
     MOZ_ASSERT(mMessage.IsVoid() != mMessageName.IsVoid());
 
@@ -205,17 +205,17 @@ ScriptErrorHelper::Dump(const nsAString&
     RefPtr<ScriptErrorRunnable> runnable =
       new ScriptErrorRunnable(aMessage,
                               aFilename,
                               aLineNumber,
                               aColumnNumber,
                               aSeverityFlag,
                               aIsChrome,
                               aInnerWindowID);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
   }
 }
 
 /*static*/ void
 ScriptErrorHelper::DumpLocalizedMessage(const nsACString& aMessageName,
                                         const nsAString& aFilename,
                                         uint32_t aLineNumber,
                                         uint32_t aColumnNumber,
@@ -235,15 +235,15 @@ ScriptErrorHelper::DumpLocalizedMessage(
     RefPtr<ScriptErrorRunnable> runnable =
       new ScriptErrorRunnable(aMessageName,
                               aFilename,
                               aLineNumber,
                               aColumnNumber,
                               aSeverityFlag,
                               aIsChrome,
                               aInnerWindowID);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
   }
 }
 
 } // namespace indexedDB
 } // namespace dom
-} // namespace mozilla
\ No newline at end of file
+} // namespace mozilla
--- a/dom/ipc/Blob.cpp
+++ b/dom/ipc/Blob.cpp
@@ -201,17 +201,17 @@ ActorManagerIsSameProcess(PBackgroundPar
 bool
 EventTargetIsOnCurrentThread(nsIEventTarget* aEventTarget)
 {
   if (!aEventTarget) {
     return NS_IsMainThread();
   }
 
   bool current;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aEventTarget->IsOnCurrentThread(&current)));
+  MOZ_ALWAYS_SUCCEEDS(aEventTarget->IsOnCurrentThread(&current));
 
   return current;
 }
 
 class CancelableRunnableWrapper final
   : public nsCancelableRunnable
 {
   nsCOMPtr<nsIRunnable> mRunnable;
@@ -296,20 +296,20 @@ ReleaseOnTarget(SmartPtr<T>& aDoomed, ns
     NS_NewNonOwningRunnableMethod(doomedSupports, &nsISupports::Release);
   MOZ_ASSERT(releaseRunnable);
 
   if (aTarget) {
     // If we're targeting a non-main thread then make sure the runnable is
     // cancelable.
     releaseRunnable = new CancelableRunnableWrapper(releaseRunnable, aTarget);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aTarget->Dispatch(releaseRunnable,
-                                                   NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(aTarget->Dispatch(releaseRunnable,
+                                          NS_DISPATCH_NORMAL));
   } else {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(releaseRunnable)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(releaseRunnable));
   }
 }
 
 template <class ManagerType>
 void
 ConstructFileDescriptorSet(ManagerType* aManager,
                            nsTArray<FileDescriptor>& aFDs,
                            OptionalFileDescriptorSet& aOptionalFDSet)
@@ -806,17 +806,17 @@ CreateBlobImpl(const nsTArray<uint8_t>& 
     blobImpl =
       new EmptyBlobImpl(aMetadata.mName,
                         aMetadata.mContentType,
                         aMetadata.mLastModifiedDate);
   } else {
     blobImpl = new EmptyBlobImpl(aMetadata.mContentType);
   }
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(blobImpl->SetMutable(false)));
+  MOZ_ALWAYS_SUCCEEDS(blobImpl->SetMutable(false));
 
   return blobImpl.forget();
 }
 
 already_AddRefed<BlobImpl>
 CreateBlobImpl(const nsTArray<BlobData>& aBlobData,
                CreateBlobImplMetadata& aMetadata);
 
@@ -909,17 +909,17 @@ CreateBlobImpl(const nsTArray<BlobData>&
   } else {
     blobImpl = MultipartBlobImpl::Create(blobImpls, aMetadata.mContentType, rv);
   }
 
   if (NS_WARN_IF(rv.Failed())) {
     return nullptr;
   }
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(blobImpl->SetMutable(false)));
+  MOZ_ALWAYS_SUCCEEDS(blobImpl->SetMutable(false));
 
   return blobImpl.forget();
 }
 
 already_AddRefed<BlobImpl>
 CreateBlobImpl(const ParentBlobConstructorParams& aParams,
                const BlobData& aBlobData,
                bool aIsSameProcessActor)
@@ -1008,31 +1008,31 @@ BlobDataFromBlobImpl(BlobImpl* aBlobImpl
   aBlobImpl->GetInternalStream(getter_AddRefs(inputStream), rv);
   MOZ_ALWAYS_TRUE(!rv.Failed());
 
   DebugOnly<bool> isNonBlocking;
   MOZ_ASSERT(NS_SUCCEEDED(inputStream->IsNonBlocking(&isNonBlocking)));
   MOZ_ASSERT(isNonBlocking);
 
   uint64_t available;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(inputStream->Available(&available)));
+  MOZ_ALWAYS_SUCCEEDS(inputStream->Available(&available));
 
   MOZ_ASSERT(available <= uint64_t(UINT32_MAX));
 
   aBlobData = nsTArray<uint8_t>();
 
   nsTArray<uint8_t>& blobData = aBlobData.get_ArrayOfuint8_t();
 
   blobData.SetLength(size_t(available));
 
   uint32_t readCount;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+  MOZ_ALWAYS_SUCCEEDS(
     inputStream->Read(reinterpret_cast<char*>(blobData.Elements()),
                       uint32_t(available),
-                      &readCount)));
+                      &readCount));
 }
 
 RemoteInputStream::RemoteInputStream(BlobImpl* aBlobImpl,
                                      uint64_t aStart,
                                      uint64_t aLength)
   : mMonitor("RemoteInputStream.mMonitor")
   , mActor(nullptr)
   , mBlobImpl(aBlobImpl)
@@ -1626,17 +1626,17 @@ private:
     if (NS_FAILED(mStream->Available(&available))) {
       NS_WARNING("Available failed on this stream!");
     }
 
     if (mActorTarget) {
       nsresult rv = mActorTarget->Dispatch(this, NS_DISPATCH_NORMAL);
       NS_ENSURE_SUCCESS(rv, rv);
     } else {
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(this)));
+      MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(this));
     }
 
     return NS_OK;
   }
 
   nsresult
   CloseStream()
   {
@@ -1651,17 +1651,17 @@ private:
     mIOTarget.swap(ioTarget);
 
     NS_WARN_IF_FALSE(NS_SUCCEEDED(stream->Close()), "Failed to close stream!");
 
     nsCOMPtr<nsIRunnable> shutdownRunnable =
       NS_NewRunnableMethod(ioTarget, &nsIThread::Shutdown);
     MOZ_ASSERT(shutdownRunnable);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(shutdownRunnable)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(shutdownRunnable));
 
     return NS_OK;
   }
 
   nsresult
   SendResponse()
   {
     AssertIsOnOwningThread();
@@ -2191,20 +2191,20 @@ RemoteBlobImpl::Destroy()
 
   nsCOMPtr<nsIRunnable> destroyRunnable =
     NS_NewNonOwningRunnableMethod(this, &RemoteBlobImpl::Destroy);
 
   if (mActorTarget) {
     destroyRunnable =
       new CancelableRunnableWrapper(destroyRunnable, mActorTarget);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mActorTarget->Dispatch(destroyRunnable,
-                                                        NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(mActorTarget->Dispatch(destroyRunnable,
+                                               NS_DISPATCH_NORMAL));
   } else {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(destroyRunnable)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(destroyRunnable));
   }
 }
 
 NS_IMPL_ADDREF(BlobChild::RemoteBlobImpl)
 NS_IMPL_RELEASE_WITH_DESTROY(BlobChild::RemoteBlobImpl, Destroy())
 NS_IMPL_QUERY_INTERFACE_INHERITED(BlobChild::RemoteBlobImpl,
                                   BlobImpl,
                                   nsIRemoteBlob)
@@ -2539,17 +2539,17 @@ RemoteBlobSliceImpl::EnsureActorWasCreat
 
   mActorWasCreated = true;
 
   BlobChild* baseActor = mParent->GetActor();
   MOZ_ASSERT(baseActor);
   MOZ_ASSERT(baseActor->HasManager());
 
   nsID id;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(gUUIDGenerator->GenerateUUIDInPlace(&id)));
+  MOZ_ALWAYS_SUCCEEDS(gUUIDGenerator->GenerateUUIDInPlace(&id));
 
   ParentBlobConstructorParams params(
     SlicedBlobConstructorParams(nullptr /* sourceParent */,
                                 baseActor /* sourceChild */,
                                 id /* id */,
                                 mStart /* begin */,
                                 mStart + mLength /* end */,
                                 mContentType /* contentType */));
@@ -2619,20 +2619,20 @@ RemoteBlobImpl::Destroy()
 
   nsCOMPtr<nsIRunnable> destroyRunnable =
     NS_NewNonOwningRunnableMethod(this, &RemoteBlobImpl::Destroy);
 
   if (mActorTarget) {
     destroyRunnable =
       new CancelableRunnableWrapper(destroyRunnable, mActorTarget);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mActorTarget->Dispatch(destroyRunnable,
-                                                        NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(mActorTarget->Dispatch(destroyRunnable,
+                                               NS_DISPATCH_NORMAL));
   } else {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(destroyRunnable)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(destroyRunnable));
   }
 }
 
 NS_IMPL_ADDREF(BlobParent::RemoteBlobImpl)
 NS_IMPL_RELEASE_WITH_DESTROY(BlobParent::RemoteBlobImpl, Destroy())
 NS_IMPL_QUERY_INTERFACE_INHERITED(BlobParent::RemoteBlobImpl,
                                   BlobImpl,
                                   nsIRemoteBlob)
@@ -3474,20 +3474,20 @@ BlobChild::NoteDyingRemoteBlobImpl()
   // on the owning thread, so we proxy here if necessary.
   if (!IsOnOwningThread()) {
     nsCOMPtr<nsIRunnable> runnable =
       NS_NewNonOwningRunnableMethod(this, &BlobChild::NoteDyingRemoteBlobImpl);
 
     if (mEventTarget) {
       runnable = new CancelableRunnableWrapper(runnable, mEventTarget);
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mEventTarget->Dispatch(runnable,
-                                                          NS_DISPATCH_NORMAL)));
+      MOZ_ALWAYS_SUCCEEDS(mEventTarget->Dispatch(runnable,
+                                                 NS_DISPATCH_NORMAL));
     } else {
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+      MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
     }
 
     return;
   }
 
   // Must do this before calling Send__delete__ or we'll crash there trying to
   // access a dangling pointer.
   mBlobImpl = nullptr;
@@ -3805,17 +3805,17 @@ BlobParent::GetOrCreateFromImpl(ParentMa
                                     void_t());
       } else {
         blobParams = NormalBlobConstructorParams(contentType, length, void_t());
       }
     }
   }
 
   nsID id;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(gUUIDGenerator->GenerateUUIDInPlace(&id)));
+  MOZ_ALWAYS_SUCCEEDS(gUUIDGenerator->GenerateUUIDInPlace(&id));
 
   RefPtr<IDTableEntry> idTableEntry =
     IDTableEntry::GetOrCreate(id, ActorManagerProcessID(aManager), aBlobImpl);
   MOZ_ASSERT(idTableEntry);
 
   BlobParent* actor = new BlobParent(aManager, idTableEntry);
 
   ChildBlobConstructorParams params(id, blobParams);
@@ -3861,17 +3861,17 @@ BlobParent::CreateFromParams(ParentManag
                        optionalBlobData.get_BlobData(),
                        ActorManagerIsSameProcess(aManager));
       if (NS_WARN_IF(!blobImpl)) {
         ASSERT_UNLESS_FUZZING();
         return nullptr;
       }
 
       nsID id;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(gUUIDGenerator->GenerateUUIDInPlace(&id)));
+      MOZ_ALWAYS_SUCCEEDS(gUUIDGenerator->GenerateUUIDInPlace(&id));
 
       RefPtr<IDTableEntry> idTableEntry =
         IDTableEntry::Create(id, ActorManagerProcessID(aManager), blobImpl);
       if (NS_WARN_IF(!idTableEntry)) {
         ASSERT_UNLESS_FUZZING();
         return nullptr;
       }
 
@@ -3901,17 +3901,17 @@ BlobParent::CreateFromParams(ParentManag
                             params.end() - params.begin(),
                             params.contentType(),
                             rv);
       if (NS_WARN_IF(rv.Failed())) {
         ASSERT_UNLESS_FUZZING();
         return nullptr;
       }
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(slice->SetMutable(false)));
+      MOZ_ALWAYS_SUCCEEDS(slice->SetMutable(false));
 
       RefPtr<IDTableEntry> idTableEntry =
         IDTableEntry::Create(params.id(),
                              ActorManagerProcessID(aManager),
                              slice);
       if (NS_WARN_IF(!idTableEntry)) {
         ASSERT_UNLESS_FUZZING();
         return nullptr;
@@ -3943,17 +3943,17 @@ BlobParent::CreateFromParams(ParentManag
       const SameProcessBlobConstructorParams& params =
         blobParams.get_SameProcessBlobConstructorParams();
 
       RefPtr<BlobImpl> blobImpl =
         dont_AddRef(reinterpret_cast<BlobImpl*>(params.addRefedBlobImpl()));
       MOZ_ASSERT(blobImpl);
 
       nsID id;
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(gUUIDGenerator->GenerateUUIDInPlace(&id)));
+      MOZ_ALWAYS_SUCCEEDS(gUUIDGenerator->GenerateUUIDInPlace(&id));
 
       RefPtr<IDTableEntry> idTableEntry =
         IDTableEntry::Create(id, ActorManagerProcessID(aManager), blobImpl);
       MOZ_ASSERT(idTableEntry);
 
       return new BlobParent(aManager, blobImpl, idTableEntry);
     }
 
@@ -4053,20 +4053,20 @@ BlobParent::NoteDyingRemoteBlobImpl()
   // on the main thread, so we proxy here if necessary.
   if (!IsOnOwningThread()) {
     nsCOMPtr<nsIRunnable> runnable =
       NS_NewNonOwningRunnableMethod(this, &BlobParent::NoteDyingRemoteBlobImpl);
 
     if (mEventTarget) {
       runnable = new CancelableRunnableWrapper(runnable, mEventTarget);
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mEventTarget->Dispatch(runnable,
-                                                          NS_DISPATCH_NORMAL)));
+      MOZ_ALWAYS_SUCCEEDS(mEventTarget->Dispatch(runnable,
+                                                 NS_DISPATCH_NORMAL));
     } else {
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+      MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
     }
 
     return;
   }
 
   // Must do this before calling Send__delete__ or we'll crash there trying to
   // access a dangling pointer.
   mBlobImpl = nullptr;
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1185,28 +1185,30 @@ ContentParent::CreateBrowserOrApp(const 
       }
 
       if (tabId == 0) {
         return nullptr;
       }
       RefPtr<TabParent> tp(new TabParent(constructorSender, tabId,
                                          aContext, chromeFlags));
       tp->SetInitedByParent();
-      tp->SetOwnerElement(aFrameElement);
 
       PBrowserParent* browser =
       constructorSender->SendPBrowserConstructor(
         // DeallocPBrowserParent() releases this ref.
         tp.forget().take(), tabId,
         aContext.AsIPCTabContext(),
         chromeFlags,
         constructorSender->ChildID(),
         constructorSender->IsForApp(),
         constructorSender->IsForBrowser());
-      return TabParent::GetFrom(browser);
+
+      RefPtr<TabParent> constructedTabParent = TabParent::GetFrom(browser);
+      constructedTabParent->SetOwnerElement(aFrameElement);
+      return constructedTabParent;
     }
     return nullptr;
   }
 
   // If we got here, we have an app and we're not a browser element.  ownApp
   // shouldn't be null, because we otherwise would have gone into the
   // !HasOwnApp() branch above.
   RefPtr<nsIContentParent> parent;
@@ -1294,27 +1296,31 @@ ContentParent::CreateBrowserOrApp(const 
   if (!parent || (tabId == 0)) {
     return nullptr;
   }
 
   uint32_t chromeFlags = 0;
 
   RefPtr<TabParent> tp = new TabParent(parent, tabId, aContext, chromeFlags);
   tp->SetInitedByParent();
-  tp->SetOwnerElement(aFrameElement);
   PBrowserParent* browser = parent->SendPBrowserConstructor(
     // DeallocPBrowserParent() releases this ref.
     RefPtr<TabParent>(tp).forget().take(),
     tabId,
     aContext.AsIPCTabContext(),
     chromeFlags,
     parent->ChildID(),
     parent->IsForApp(),
     parent->IsForBrowser());
 
+  if (browser) {
+    RefPtr<TabParent> constructedTabParent = TabParent::GetFrom(browser);
+    constructedTabParent->SetOwnerElement(aFrameElement);
+  }
+
   if (isInContentProcess) {
     // Just return directly without the following check in content process.
     return TabParent::GetFrom(browser);
   }
 
   if (!browser) {
     // We failed to actually start the PBrowser.  This can happen if the
     // other process has already died.
--- a/dom/ipc/NuwaChild.cpp
+++ b/dom/ipc/NuwaChild.cpp
@@ -130,17 +130,17 @@ NuwaChild::RecvFork()
         "Terminating child process %d for unauthorized IPC message: "
           "RecvFork(%d)", getpid()).get());
     return false;
   }
 
   nsCOMPtr<nsIRunnable> runnable =
     NS_NewRunnableFunction(&NuwaFork);
   MOZ_ASSERT(runnable);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
 
   return true;
 #else
   NS_ERROR("NuwaChild::RecvFork() not implemented!");
   return false;
 #endif
 }
 
--- a/dom/ipc/NuwaParent.cpp
+++ b/dom/ipc/NuwaParent.cpp
@@ -96,18 +96,17 @@ NuwaParent::CloneProtocol(Channel* aChan
   {
     MonitorAutoLock lock(self->mMonitor);
     // XXX Calling NuwaParent::Alloc() leads to a compilation error. Use
     // self->Alloc() as a workaround.
     self->mClonedActor = self->Alloc();
     lock.Notify();
   });
   MOZ_ASSERT(runnable);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mWorkerThread->Dispatch(runnable,
-                                                       NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(mWorkerThread->Dispatch(runnable, NS_DISPATCH_NORMAL));
 
   while (!mClonedActor) {
     lock.Wait();
   }
   RefPtr<NuwaParent> actor = mClonedActor;
   mClonedActor = nullptr;
 
   // mManager of the cloned actor is assigned after returning from this method.
@@ -123,22 +122,21 @@ NuwaParent::CloneProtocol(Channel* aChan
 
       // Call NuwaParent::ActorConstructed() on the worker thread.
       actor->ActorConstructed();
 
       // The actor can finally be deleted after fully constructed.
       mozilla::Unused << actor->Send__delete__(actor);
     });
     MOZ_ASSERT(nested);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      actor->mWorkerThread->Dispatch(nested, NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(actor->mWorkerThread->Dispatch(nested, NS_DISPATCH_NORMAL));
   });
 
   MOZ_ASSERT(runnable);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
 
   return actor;
 }
 
 void
 NuwaParent::ActorDestroy(ActorDestroyReason aWhy)
 {
   AssertIsOnWorkerThread();
@@ -150,17 +148,17 @@ NuwaParent::ActorDestroy(ActorDestroyRea
     // deletion in breaking the ref cycle.
     RefPtr<ContentParent> contentParent = self->mContentParent;
 
     contentParent->SetNuwaParent(nullptr);
     // Need to clear the ref to ContentParent on the main thread.
     self->mContentParent = nullptr;
   });
   MOZ_ASSERT(runnable);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
 }
 
 bool
 NuwaParent::RecvNotifyReady()
 {
 #ifdef MOZ_NUWA_PROCESS
   if (!mContentParent || !mContentParent->IsNuwaProcess()) {
     NS_ERROR("Received NotifyReady() message from a non-Nuwa process.");
@@ -169,17 +167,17 @@ NuwaParent::RecvNotifyReady()
 
   // Creating a NonOwningRunnableMethod here is safe because refcount changes of
   // mContentParent have to go the the main thread. The mContentParent will
   // be alive when the runnable runs.
   nsCOMPtr<nsIRunnable> runnable =
     NS_NewNonOwningRunnableMethod(mContentParent.get(),
                                   &ContentParent::OnNuwaReady);
   MOZ_ASSERT(runnable);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
 
   return true;
 #else
   NS_ERROR("NuwaParent::RecvNotifyReady() not implemented!");
   return false;
 #endif
 }
 
@@ -205,17 +203,17 @@ NuwaParent::RecvAddNewProcess(const uint
       NS_NewNonOwningRunnableMethodWithArgs<
         uint32_t,
         UniquePtr<nsTArray<ProtocolFdMapping>>&& >(
           mContentParent.get(),
           &ContentParent::OnNewProcessCreated,
           mNewProcessPid,
           Move(mNewProcessFds));
     MOZ_ASSERT(runnable);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
   }
   return true;
 #else
   NS_ERROR("NuwaParent::RecvAddNewProcess() not implemented!");
   return false;
 #endif
 }
 
@@ -230,18 +228,17 @@ NuwaParent::ForkNewProcess(uint32_t& aPi
   mNewProcessFds = Move(aFds);
 
   RefPtr<NuwaParent> self = this;
   nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction([self] () -> void
   {
     mozilla::Unused << self->SendFork();
   });
   MOZ_ASSERT(runnable);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mWorkerThread->Dispatch(runnable,
-                                                       NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(mWorkerThread->Dispatch(runnable, NS_DISPATCH_NORMAL));
   if (!aBlocking) {
     return false;
   }
 
   MonitorAutoLock lock(mMonitor);
   mBlocked = true;
   while (mBlocked) {
     // This will be notified in NuwaParent::RecvAddNewProcess().
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -720,16 +720,23 @@ child:
 
     /**
      * Propagate a refresh to the child process
      */
     async AudioChannelChangeNotification(uint32_t aAudioChannel,
                                          float aVolume,
                                          bool aMuted);
 
+    /**
+     * Tells the root child docShell whether or not to use
+     * global history. This is sent right after the PBrowser
+     * is bound to a frameloader element.
+     */
+    async SetUseGlobalHistory(bool aUse);
+
 /*
  * FIXME: write protocol!
 
 state LIVE:
     send LoadURL goto LIVE;
 //etc.
     send Destroy goto DYING;
 
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -2346,16 +2346,30 @@ TabChild::RecvAudioChannelChangeNotifica
                                   static_cast<AudioChannel>(aAudioChannel),
                                   aMuted);
   }
 
   return true;
 }
 
 bool
+TabChild::RecvSetUseGlobalHistory(const bool& aUse)
+{
+  nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
+  MOZ_ASSERT(docShell);
+
+  nsresult rv = docShell->SetUseGlobalHistory(aUse);
+  if (NS_FAILED(rv)) {
+    NS_WARNING("Failed to set UseGlobalHistory on TabChild docShell");
+  }
+
+  return true;
+}
+
+bool
 TabChild::RecvDestroy()
 {
   MOZ_ASSERT(mDestroyed == false);
   mDestroyed = true;
 
   nsTArray<PContentPermissionRequestChild*> childArray =
       nsContentPermissionUtils::GetContentPermissionRequestChildById(GetTabId());
 
@@ -2394,17 +2408,17 @@ TabChild::RecvDestroy()
   }
 
   // XXX what other code in ~TabChild() should we be running here?
   DestroyWindow();
 
   // Bounce through the event loop once to allow any delayed teardown runnables
   // that were just generated to have a chance to run.
   nsCOMPtr<nsIRunnable> deleteRunnable = new DelayedDeleteRunnable(this);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(deleteRunnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(deleteRunnable));
 
   return true;
 }
 
 bool
 TabChild::RecvSetUpdateHitRegion(const bool& aEnabled)
 {
     mUpdateHitRegion = aEnabled;
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -568,16 +568,18 @@ public:
   virtual bool RecvHandleAccessKey(nsTArray<uint32_t>&& aCharCodes,
                                    const bool& aIsTrusted,
                                    const int32_t& aModifierMask) override;
 
   virtual bool RecvAudioChannelChangeNotification(const uint32_t& aAudioChannel,
                                                   const float& aVolume,
                                                   const bool& aMuted) override;
 
+  virtual bool RecvSetUseGlobalHistory(const bool& aUse) override;
+
   /**
    * Native widget remoting protocol for use with windowed plugins with e10s.
    */
   PPluginWidgetChild* AllocPPluginWidgetChild() override;
 
   bool DeallocPPluginWidgetChild(PPluginWidgetChild* aActor) override;
 
   nsresult CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut);
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -367,16 +367,22 @@ TabParent::SetOwnerElement(Element* aEle
 
   // Update to the new content, and register to listen for events from it.
   mFrameElement = aElement;
 
   if (newTopLevelWin && !isSameTopLevelWin) {
     newTopLevelWin->AddBrowser(this);
   }
 
+  if (mFrameElement) {
+    bool useGlobalHistory =
+      !mFrameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::disableglobalhistory);
+    Unused << SendSetUseGlobalHistory(useGlobalHistory);
+  }
+
   AddWindowListeners();
   TryCacheDPIAndScale();
 }
 
 void
 TabParent::AddWindowListeners()
 {
   if (mFrameElement && mFrameElement->OwnerDoc()) {
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -2,16 +2,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/. */
 
 #include <MediaStreamGraphImpl.h>
 #include "mozilla/dom/AudioContext.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/ClearOnShutdown.h"
+#include "mozilla/unused.h"
 #include "CubebUtils.h"
 
 #ifdef MOZ_WEBRTC
 #include "webrtc/MediaEngineWebRTC.h"
 #endif
 
 #ifdef XP_MACOSX
 #include <sys/sysctl.h>
@@ -222,17 +223,17 @@ public:
 private:
   ThreadedDriver* mDriver;
 };
 
 void
 ThreadedDriver::Start()
 {
   LIFECYCLE_LOG("Starting thread for a SystemClockDriver  %p\n", mGraphImpl);
-  NS_WARN_IF(!mThread);
+  Unused << NS_WARN_IF(mThread);
   if (!mThread) { // Ensure we haven't already started it
     nsCOMPtr<nsIRunnable> event = new MediaStreamGraphInitThreadRunnable(this);
     // Note: mThread may be null during event->Run() if we pass to NewNamedThread!  See AudioInitTask
     nsresult rv = NS_NewNamedThread("MediaStreamGrph", getter_AddRefs(mThread));
     if (NS_SUCCEEDED(rv)) {
       mThread->Dispatch(event, NS_DISPATCH_NORMAL);
     }
   }
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -53,17 +53,17 @@ MediaResource::Destroy()
 {
   // Ensures we only delete the MediaResource on the main thread.
   if (NS_IsMainThread()) {
     delete this;
     return;
   }
   nsCOMPtr<nsIRunnable> destroyRunnable =
     NS_NewNonOwningRunnableMethod(this, &MediaResource::Destroy);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(destroyRunnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(destroyRunnable));
 }
 
 NS_IMPL_ADDREF(MediaResource)
 NS_IMPL_RELEASE_WITH_DESTROY(MediaResource, Destroy())
 NS_IMPL_QUERY_INTERFACE0(MediaResource)
 
 ChannelMediaResource::ChannelMediaResource(MediaResourceCallback* aCallback,
                                            nsIChannel* aChannel,
--- a/dom/media/gmp/GMPProcessChild.cpp
+++ b/dom/media/gmp/GMPProcessChild.cpp
@@ -2,17 +2,16 @@
 /* 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 "GMPProcessChild.h"
 
 #include "base/command_line.h"
 #include "base/string_util.h"
-#include "chrome/common/chrome_switches.h"
 #include "mozilla/ipc/IOThreadChild.h"
 #include "mozilla/BackgroundHangMonitor.h"
 
 using mozilla::ipc::IOThreadChild;
 
 namespace mozilla {
 namespace gmp {
 
--- a/dom/media/gmp/GMPService.cpp
+++ b/dom/media/gmp/GMPService.cpp
@@ -297,17 +297,17 @@ GeckoMediaPluginService::RunPluginCrashC
 
 nsresult
 GeckoMediaPluginService::Init()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
   MOZ_ASSERT(obsService);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(obsService->AddObserver(this, NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID, false)));
+  MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(this, NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID, false));
 
   // Kick off scanning for plugins
   nsCOMPtr<nsIThread> thread;
   return GetThread(getter_AddRefs(thread));
 }
 
 void
 GeckoMediaPluginService::ShutdownGMPThread()
--- a/dom/media/gmp/GMPServiceParent.cpp
+++ b/dom/media/gmp/GMPServiceParent.cpp
@@ -118,22 +118,22 @@ GeckoMediaPluginServiceParent::AsyncShut
 
 nsresult
 GeckoMediaPluginServiceParent::Init()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
   MOZ_ASSERT(obsService);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(obsService->AddObserver(this, "profile-change-teardown", false)));
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(obsService->AddObserver(this, "last-pb-context-exited", false)));
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(obsService->AddObserver(this, "browser:purge-session-history", false)));
+  MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(this, "profile-change-teardown", false));
+  MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(this, "last-pb-context-exited", false));
+  MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(this, "browser:purge-session-history", false));
 
 #ifdef DEBUG
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(obsService->AddObserver(this, "mediakeys-request", false)));
+  MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(this, "mediakeys-request", false));
 #endif
 
   nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefs) {
     prefs->AddObserver("media.gmp.plugin.crash", this, false);
   }
 
   nsresult rv = InitStorage();
--- a/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp
+++ b/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp
@@ -248,9 +248,18 @@ void
 GonkAudioDecoderManager::ProcessFlush()
 {
   GADM_LOG("FLUSH<<<");
   mAudioQueue.Reset();
   GADM_LOG(">>>FLUSH");
   GonkDecoderManager::ProcessFlush();
 }
 
+void
+GonkAudioDecoderManager::ResetEOS()
+{
+  GADM_LOG("ResetEOS(<<<");
+  mAudioQueue.Reset();
+  GADM_LOG(">>>ResetEOS(");
+  GonkDecoderManager::ResetEOS();
+}
+
 } // namespace mozilla
--- a/dom/media/platforms/gonk/GonkAudioDecoderManager.h
+++ b/dom/media/platforms/gonk/GonkAudioDecoderManager.h
@@ -27,16 +27,17 @@ public:
   virtual ~GonkAudioDecoderManager();
 
   RefPtr<InitPromise> Init() override;
 
   nsresult Output(int64_t aStreamOffset,
                           RefPtr<MediaData>& aOutput) override;
 
   void ProcessFlush() override;
+  virtual void ResetEOS() override;
 
   const char* GetDescriptionName() const override
   {
     return "gonk audio decoder";
   }
 
 private:
   bool InitMediaCodecProxy();
--- a/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp
+++ b/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp
@@ -243,16 +243,17 @@ GonkDecoderManager::ProcessToDo(bool aEn
       MOZ_ASSERT(mQueuedSamples.IsEmpty());
       if (output) {
         mDecodeCallback->Output(output);
         UpdateWaitingList(output->mTime);
       }
       MOZ_ASSERT(mWaitOutput.Length() == 1);
       mWaitOutput.RemoveElementAt(0);
       mDecodeCallback->DrainComplete();
+      ResetEOS();
       return;
     } else if (rv == NS_ERROR_NOT_AVAILABLE) {
       break;
     } else {
       mDecodeCallback->Error();
       return;
     }
   }
@@ -269,16 +270,27 @@ GonkDecoderManager::ProcessToDo(bool aEn
     if (aEndOfStream) {
       mToDo->setInt32("input-eos", 1);
     }
     mDecoder->requestActivityNotification(mToDo);
   }
 }
 
 void
+GonkDecoderManager::ResetEOS()
+{
+  // After eos, android::MediaCodec needs to be flushed to receive next input
+  mWaitOutput.Clear();
+  if (mDecoder->flush() != OK) {
+    GMDD_LOG("flush error");
+    mDecodeCallback->Error();
+  }
+}
+
+void
 GonkDecoderManager::onMessageReceived(const sp<AMessage> &aMessage)
 {
   switch (aMessage->what()) {
     case kNotifyProcessInput:
     {
       int32_t eos = 0;
       ProcessInput(aMessage->findInt32("input-eos", &eos) && eos);
       break;
--- a/dom/media/platforms/gonk/GonkMediaDataDecoder.h
+++ b/dom/media/platforms/gonk/GonkMediaDataDecoder.h
@@ -72,16 +72,17 @@ protected:
 
   // Send queued samples to OMX. It returns how many samples are still in
   // queue after processing, or negative error code if failed.
   int32_t ProcessQueuedSamples();
 
   void ProcessInput(bool aEndOfStream);
   virtual void ProcessFlush();
   void ProcessToDo(bool aEndOfStream);
+  virtual void ResetEOS();
 
   RefPtr<MediaByteBuffer> mCodecSpecificData;
 
   nsAutoCString mMimeType;
 
   // MediaCodedc's wrapper that performs the decoding.
   android::sp<android::MediaCodecProxy> mDecoder;
   // Looper for mDecoder to run on.
--- a/dom/messagechannel/MessagePort.cpp
+++ b/dom/messagechannel/MessagePort.cpp
@@ -206,17 +206,17 @@ class MessagePortFeature final : public 
 public:
   explicit MessagePortFeature(MessagePort* aPort)
     : mPort(aPort)
   {
     MOZ_ASSERT(aPort);
     MOZ_COUNT_CTOR(MessagePortFeature);
   }
 
-  virtual bool Notify(JSContext* aCx, workers::Status aStatus) override
+  virtual bool Notify(workers::Status aStatus) override
   {
     if (aStatus > Running) {
       // We cannot process messages anymore because we cannot dispatch new
       // runnables. Let's force a Close().
       mPort->CloseForced();
     }
 
     return true;
@@ -563,17 +563,17 @@ MessagePort::Dispatch()
       break;
   }
 
   RefPtr<SharedMessagePortMessage> data = mMessages.ElementAt(0);
   mMessages.RemoveElementAt(0);
 
   mPostMessageRunnable = new PostMessageRunnable(this, data);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(mPostMessageRunnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(mPostMessageRunnable));
 }
 
 void
 MessagePort::Close()
 {
   CloseInternal(true /* aSoftly */);
 }
 
--- a/dom/notification/Notification.cpp
+++ b/dom/notification/Notification.cpp
@@ -2240,17 +2240,17 @@ Notification::WorkerGet(WorkerPrivate* a
     aRv.Throw(NS_ERROR_DOM_ABORT_ERR);
     return nullptr;
   }
 
   RefPtr<WorkerGetRunnable> r =
     new WorkerGetRunnable(proxy, aFilter.mTag, aScope);
   // Since this is called from script via
   // ServiceWorkerRegistration::GetNotifications, we can assert dispatch.
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
   return p.forget();
 }
 
 JSObject*
 Notification::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return mozilla::dom::NotificationBinding::Wrap(aCx, this, aGivenProto);
 }
@@ -2467,17 +2467,17 @@ class CloseNotificationRunnable final
   bool
   HadObserver()
   {
     return mHadObserver;
   }
 };
 
 bool
-NotificationFeature::Notify(JSContext* aCx, Status aStatus)
+NotificationFeature::Notify(Status aStatus)
 {
   if (aStatus >= Canceling) {
     // CloseNotificationRunnable blocks the worker by pushing a sync event loop
     // on the stack. Meanwhile, WorkerControlRunnables dispatched to the worker
     // can still continue running. One of these is
     // ReleaseNotificationControlRunnable that releases the notification,
     // invalidating the notification and this feature. We hold this reference to
     // keep the notification valid until we are done with it.
--- a/dom/notification/Notification.h
+++ b/dom/notification/Notification.h
@@ -41,17 +41,17 @@ class NotificationFeature final : public
   // Since the feature is strongly held by a Notification, it is ok to hold
   // a raw pointer here.
   Notification* mNotification;
 
 public:
   explicit NotificationFeature(Notification* aNotification);
 
   bool
-  Notify(JSContext* aCx, workers::Status aStatus) override;
+  Notify(workers::Status aStatus) override;
 };
 
 // Records telemetry probes at application startup, when a notification is
 // shown, and when the notification permission is revoked for a site.
 class NotificationTelemetryService final : public nsIObserver
 {
 public:
   NS_DECL_ISUPPORTS
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -1856,17 +1856,18 @@ nsPluginHost::GetSpecialType(const nsACS
 
   if (aMIMEType.LowerCaseEqualsASCII("application/x-shockwave-flash") ||
       aMIMEType.LowerCaseEqualsASCII("application/futuresplash") ||
       aMIMEType.LowerCaseEqualsASCII("application/x-shockwave-flash-test")) {
     return eSpecialType_Flash;
   }
 
   if (aMIMEType.LowerCaseEqualsASCII("application/x-silverlight") ||
-      aMIMEType.LowerCaseEqualsASCII("application/x-silverlight-2")) {
+      aMIMEType.LowerCaseEqualsASCII("application/x-silverlight-2") ||
+      aMIMEType.LowerCaseEqualsASCII("application/x-silverlight-test")) {
     return eSpecialType_Silverlight;
   }
 
   if (aMIMEType.LowerCaseEqualsASCII("audio/x-pn-realaudio-plugin")) {
     NS_WARNING("You are loading RealPlayer");
     return eSpecialType_RealPlayer;
   }
 
--- a/dom/plugins/ipc/PluginProcessChild.cpp
+++ b/dom/plugins/ipc/PluginProcessChild.cpp
@@ -6,17 +6,16 @@
 
 #include "mozilla/ipc/IOThreadChild.h"
 #include "mozilla/plugins/PluginProcessChild.h"
 
 #include "prlink.h"
 
 #include "base/command_line.h"
 #include "base/string_util.h"
-#include "chrome/common/chrome_switches.h"
 #include "nsDebugImpl.h"
 
 #if defined(XP_MACOSX)
 #include "nsCocoaFeatures.h"
 // An undocumented CoreGraphics framework method, present in the same form
 // since at least OS X 10.5.
 extern "C" CGError CGSSetDebugOptions(int options);
 #endif
--- a/dom/plugins/test/mochitest/mochitest.ini
+++ b/dom/plugins/test/mochitest/mochitest.ini
@@ -132,10 +132,10 @@ skip-if = os != "win"
 [test_windowless_flash.html]
 skip-if = !(os == "win" && processor == "x86_64" && !e10s) # Bug 1253957
 [test_windowless_ime.html]
 skip-if = os != "win" || e10s
 [test_visibility.html]
 skip-if = toolkit == "cocoa"
 [test_zero_opacity.html]
 [test_bug1165981.html]
-skip-if = !(os == "win" && processor == "x86_64" && !e10s) # Bug 1253957
+skip-if = !(os == "win" && processor == "x86_64")
 [test_bug1245545.html]
--- a/dom/plugins/test/mochitest/test_bug1165981.html
+++ b/dom/plugins/test/mochitest/test_bug1165981.html
@@ -1,18 +1,16 @@
 <html>
   <head>
      <title>Bug 1165981 Test</title>
 
     <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     <script type="text/javascript" src="plugin-utils.js"></script>
     <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   </head>
-
-  <body onload="run()">
     <script class="testbody" type="application/javascript">
       "use strict";
 
       SimpleTest.waitForExplicitFinish();
       ok(SpecialPowers.setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Flash Test Plug-in"), "Should find allowed test flash plugin");
       ok(SpecialPowers.setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Silverlight Test Plug-in"), "Should find allowed test silverlight plugin");
       ok(!SpecialPowers.setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Third Test Plug-in"), "Should not find disallowed plugin");
 
@@ -31,17 +29,29 @@
             var mimeType = navigator.mimeTypes[i];
             if (mimeType.type === mimeTypeType) {
               return mimeType;
             }
           }
           return null;
       }
 
+      function createNode(id, type) {
+          let obj = document.createElement("object");
+          obj.type = type;
+          obj.id = id;
+          obj.width = 200;
+          obj.height = 200;
+          document.body.appendChild(obj);
+      }
+
       function run() {
+        createNode("plugin-flash", "application/x-shockwave-flash-test");
+        createNode("plugin-silverlight", "application/x-silverlight-test");
+        createNode("disallowedPlugin", "application/x-third-test");
         var pluginElement = document.getElementById("plugin-flash");
         is(pluginElement.identifierToStringTest("foo"), "foo", "Should be able to call a function provided by the plugin");
 
         pluginElement = document.getElementById("plugin-silverlight");
         is(pluginElement.identifierToStringTest("foo"), "foo", "Should be able to call a function provided by the plugin");
 
         pluginElement = document.getElementById("disallowedPlugin");
         is(typeof pluginElement.identifierToStringTest, "undefined", "Should NOT be able to call a function on a disallowed plugin");
@@ -61,13 +71,11 @@
         ok(findMimeType("application/x-shockwave-flash-test"), "Should have found a MIME type named 'application/x-shockwave-flash-test'");
         ok(findMimeType("application/x-silverlight-test"), "Should have found a MIME type named 'application/x-silverlight-test'");
         ok(!findMimeType("application/x-third-test"), "Should NOT have found a disallowed MIME type named 'application/x-third-test'");
 
         SimpleTest.finish();
       }
     </script>
 
-    <object id="plugin-flash" type="application/x-shockwave-flash-test" width=200 height=200></object>
-    <object id="plugin-silverlight" type="application/x-silverlight-test" width=200 height=200></object>
-    <object id="disallowedPlugin" type="application/x-third-test" width=200 height=200></object>
+  <body onload="run()">
   </body>
 </html>
--- a/dom/promise/Promise.cpp
+++ b/dom/promise/Promise.cpp
@@ -2724,17 +2724,17 @@ Promise::RemoveFeature()
     workers::WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
     MOZ_ASSERT(worker);
     worker->RemoveFeature(mFeature);
     mFeature = nullptr;
   }
 }
 
 bool
-PromiseReportRejectFeature::Notify(JSContext* aCx, workers::Status aStatus)
+PromiseReportRejectFeature::Notify(workers::Status aStatus)
 {
   MOZ_ASSERT(aStatus > workers::Running);
   mPromise->MaybeReportRejectedOnce();
   // After this point, `this` has been deleted by RemoveFeature!
   return true;
 }
 #endif // defined(DOM_PROMISE_DEPRECATED_REPORTING)
 
@@ -2987,17 +2987,17 @@ PromiseWorkerProxy::ResolvedCallback(JSC
 void
 PromiseWorkerProxy::RejectedCallback(JSContext* aCx,
                                      JS::Handle<JS::Value> aValue)
 {
   RunCallback(aCx, aValue, &Promise::MaybeReject);
 }
 
 bool
-PromiseWorkerProxy::Notify(JSContext* aCx, Status aStatus)
+PromiseWorkerProxy::Notify(Status aStatus)
 {
   if (aStatus >= Canceling) {
     CleanUp();
   }
 
   return true;
 }
 
--- a/dom/promise/Promise.h
+++ b/dom/promise/Promise.h
@@ -57,17 +57,17 @@ class PromiseReportRejectFeature : publi
 public:
   explicit PromiseReportRejectFeature(Promise* aPromise)
     : mPromise(aPromise)
   {
     MOZ_ASSERT(mPromise);
   }
 
   virtual bool
-  Notify(JSContext* aCx, workers::Status aStatus) override;
+  Notify(workers::Status aStatus) override;
 };
 #endif // defined(DOM_PROMISE_DEPRECATED_REPORTING)
 
 #define NS_PROMISE_IID \
   { 0x1b8d6215, 0x3e67, 0x43ba, \
     { 0x8a, 0xf9, 0x31, 0x5e, 0x8f, 0xce, 0x75, 0x65 } }
 
 class Promise : public nsISupports,
--- a/dom/promise/PromiseWorkerProxy.h
+++ b/dom/promise/PromiseWorkerProxy.h
@@ -180,17 +180,17 @@ public:
 
 protected:
   virtual void ResolvedCallback(JSContext* aCx,
                                 JS::Handle<JS::Value> aValue) override;
 
   virtual void RejectedCallback(JSContext* aCx,
                                 JS::Handle<JS::Value> aValue) override;
 
-  virtual bool Notify(JSContext* aCx, workers::Status aStatus) override;
+  virtual bool Notify(workers::Status aStatus) override;
 
 private:
   PromiseWorkerProxy(workers::WorkerPrivate* aWorkerPrivate,
                      Promise* aWorkerPromise,
                      const PromiseWorkerProxyStructuredCloneCallbacks* aCallbacks = nullptr);
 
   virtual ~PromiseWorkerProxy();
 
--- a/dom/push/PushManager.cpp
+++ b/dom/push/PushManager.cpp
@@ -526,17 +526,17 @@ WorkerPushSubscription::Unsubscribe(Erro
   RefPtr<PromiseWorkerProxy> proxy = PromiseWorkerProxy::Create(worker, p);
   if (!proxy) {
     p->MaybeReject(NS_ERROR_DOM_PUSH_SERVICE_UNREACHABLE);
     return p.forget();
   }
 
   RefPtr<UnsubscribeRunnable> r =
     new UnsubscribeRunnable(proxy, mScope);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
 
   return p.forget();
 }
 
 void
 WorkerPushSubscription::ToJSON(PushSubscriptionJSON& aJSON)
 {
   SubscriptionToJSON(aJSON, mEndpoint, mRawP256dhKey, mAuthSecret);
@@ -823,17 +823,17 @@ WorkerPushManager::PerformSubscriptionAc
   RefPtr<PromiseWorkerProxy> proxy = PromiseWorkerProxy::Create(worker, p);
   if (!proxy) {
     p->MaybeReject(NS_ERROR_DOM_PUSH_ABORT_ERR);
     return p.forget();
   }
 
   RefPtr<GetSubscriptionRunnable> r =
     new GetSubscriptionRunnable(proxy, mScope, aAction);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
 
   return p.forget();
 }
 
 already_AddRefed<Promise>
 WorkerPushManager::Subscribe(ErrorResult& aRv)
 {
   return PerformSubscriptionAction(SubscribeAction, aRv);
--- a/dom/push/PushServiceWebSocket.jsm
+++ b/dom/push/PushServiceWebSocket.jsm
@@ -165,21 +165,16 @@ this.PushServiceWebSocket = {
 
     if (timer == this._pingTimer) {
       this._sendPing();
       return;
     }
 
     if (timer == this._backoffTimer) {
       console.debug("onTimerFired: Reconnecting after backoff");
-      if (this._reconnectTestCallback) {
-        // Notify the test callback once the client reconnects.
-        let actualRetryTimeout = Date.now() - this._lastDisconnect;
-        this._reconnectTestCallback(actualRetryTimeout);
-      }
       this._beginWSSetup();
       return;
     }
 
     if (timer == this._requestTimeoutTimer) {
       this._timeOutRequests();
       return;
     }
@@ -326,38 +321,26 @@ this.PushServiceWebSocket = {
 
   /**
    * The last time the client sent a ping to the server. If non-zero, keeps the
    * request timeout timer active. Reset to zero when the server responds with
    * a pong or pending messages.
    */
   _lastPingTime: 0,
 
-  /** The last time the connection was closed. */
-  _lastDisconnect: 0,
-
   /**
    * A one-shot timer used to ping the server, to avoid timing out idle
    * connections. Reset to the ping interval on each incoming message.
    */
   _pingTimer: null,
 
   /** A one-shot timer fired after the reconnect backoff period. */
   _backoffTimer: null,
 
   /**
-   * A function called when the client reconnects after backing off.
-   *
-   * @param {Number} actualRetryTimeout The time elapsed between the last
-   *  disconnect and reconnect time. This should be >= the backoff delay for
-   *  that attempt.
-   */
-  _reconnectTestCallback: null,
-
-  /**
    * Sends a message to the Push Server through an open websocket.
    * typeof(msg) shall be an object
    */
   _wsSendMessage: function(msg) {
     if (!this._ws) {
       console.warn("wsSendMessage: No WebSocket initialized.",
         "Cannot send a message");
       return;
@@ -429,18 +412,16 @@ this.PushServiceWebSocket = {
     if (shouldCancelPending) {
       this._cancelRegisterRequests();
     }
 
     if (this._notifyRequestQueue) {
       this._notifyRequestQueue();
       this._notifyRequestQueue = null;
     }
-
-    this._lastDisconnect = Date.now();
   },
 
   uninit: function() {
     if (this._udpServer) {
       this._udpServer.close();
       this._udpServer = null;
     }
 
--- a/dom/push/test/xpcshell/test_retry_ws.js
+++ b/dom/push/test/xpcshell/test_retry_ws.js
@@ -6,17 +6,17 @@
 const {PushDB, PushService, PushServiceWebSocket} = serviceExports;
 
 const userAgentID = '05f7b940-51b6-4b6f-8032-b83ebb577ded';
 
 function run_test() {
   do_get_profile();
   setPrefs({
     userAgentID: userAgentID,
-    pingInterval: 10000,
+    pingInterval: 2000,
     retryBaseInterval: 25,
   });
   run_next_test();
 }
 
 add_task(function* test_ws_retry() {
   let db = PushServiceWebSocket.newPushDB();
   do_register_cleanup(() => {return db.drop().then(_ => db.close());});
@@ -25,42 +25,46 @@ add_task(function* test_ws_retry() {
     channelID: '61770ba9-2d57-4134-b949-d40404630d5b',
     pushEndpoint: 'https://example.org/push/1',
     scope: 'https://example.net/push/1',
     version: 1,
     originAttributes: '',
     quota: Infinity,
   });
 
-  let alarmDelays = [];
-  PushServiceWebSocket._reconnectTestCallback = function(delay) {
-    alarmDelays.push(delay);
+  // Use a mock timer to avoid waiting for the backoff interval.
+  let reconnects = 0;
+  PushServiceWebSocket._backoffTimer = {
+    init(observer, delay, type) {
+      reconnects++;
+      ok(delay >= 5 && delay <= 2000, `Backoff delay ${
+        delay} out of range for attempt ${reconnects}`);
+      observer.observe(this, "timer-callback", null);
+    },
+
+    cancel() {},
   };
 
   let handshakeDone;
   let handshakePromise = new Promise(resolve => handshakeDone = resolve);
   PushService.init({
     serverURI: "wss://push.example.org/",
     networkInfo: new MockDesktopNetworkInfo(),
     makeWebSocket(uri) {
       return new MockWebSocket(uri, {
         onHello(request) {
-          if (alarmDelays.length == 10) {
+          if (reconnects == 10) {
             this.serverSendMsg(JSON.stringify({
               messageType: 'hello',
               status: 200,
               uaid: userAgentID,
             }));
             handshakeDone();
             return;
           }
           this.serverInterrupt();
         },
       });
     },
   });
 
   yield handshakePromise;
-  [25, 50, 100, 200, 400, 800, 1600, 3200, 6400, 10000].forEach(function(minDelay, index) {
-    ok(alarmDelays[index] >= minDelay, `Should wait at least ${
-      minDelay}ms before attempt ${index + 1}`);
-  });
 });
--- a/dom/quota/ActorsParent.cpp
+++ b/dom/quota/ActorsParent.cpp
@@ -840,17 +840,17 @@ protected:
   const bool mExclusive;
 
 public:
   void
   RunImmediately()
   {
     MOZ_ASSERT(GetState() == State_Initial);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(this->Run()));
+    MOZ_ALWAYS_SUCCEEDS(this->Run());
   }
 
 protected:
   NormalOriginOperationBase(Nullable<PersistenceType> aPersistenceType,
                             const OriginScope& aOriginScope,
                             bool aExclusive)
     : mPersistenceType(aPersistenceType)
     , mOriginScope(aOriginScope)
@@ -2276,17 +2276,17 @@ CreateRunnable::Run()
 
     mState = State::CallingCallbacks;
     thread = mOwningThread;
   } else {
     mState = GetNextState(thread);
   }
 
   if (thread) {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(thread->Dispatch(this, NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(thread->Dispatch(this, NS_DISPATCH_NORMAL));
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 QuotaManager::
 ShutdownRunnable::Run()
@@ -2306,17 +2306,17 @@ ShutdownRunnable::Run()
 
   RefPtr<QuotaManager> quotaManager = gInstance.get();
   if (quotaManager) {
     quotaManager->Shutdown();
 
     gInstance = nullptr;
   }
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(this)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(this));
 
   return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS(QuotaManager::ShutdownObserver, nsIObserver)
 
 NS_IMETHODIMP
 QuotaManager::
@@ -2325,18 +2325,18 @@ ShutdownObserver::Observe(nsISupports* a
                           const char16_t* aData)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!strcmp(aTopic, PROFILE_BEFORE_CHANGE_OBSERVER_ID));
 
   bool done = false;
 
   RefPtr<ShutdownRunnable> shutdownRunnable = new ShutdownRunnable(done);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    mBackgroundThread->Dispatch(shutdownRunnable, NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(
+    mBackgroundThread->Dispatch(shutdownRunnable, NS_DISPATCH_NORMAL));
 
   nsIThread* currentThread = NS_GetCurrentThread();
   MOZ_ASSERT(currentThread);
 
   while (!done) {
     MOZ_ALWAYS_TRUE(NS_ProcessNextEvent(currentThread));
   }
 
@@ -2636,21 +2636,21 @@ QuotaManager::GetOrCreate(nsIRunnable* a
     MOZ_ASSERT(false, "Calling GetOrCreate() after shutdown!");
     return;
   }
 
   if (gInstance || gCreateFailed) {
     MOZ_ASSERT(!gCreateRunnable);
     MOZ_ASSERT_IF(gCreateFailed, !gInstance);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(aCallback)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(aCallback));
   } else {
     if (!gCreateRunnable) {
       gCreateRunnable = new CreateRunnable();
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(gCreateRunnable)));
+      MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(gCreateRunnable));
     }
 
     gCreateRunnable->AddCallback(aCallback);
   }
 }
 
 // static
 QuotaManager*
@@ -3062,21 +3062,21 @@ QuotaManager::Shutdown()
   // further storagess from being created.
   if (gShutdown.exchange(true)) {
     NS_ERROR("Shutdown more than once?!");
   }
 
   StopIdleMaintenance();
 
   // Kick off the shutdown timer.
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+  MOZ_ALWAYS_SUCCEEDS(
     mShutdownTimer->InitWithFuncCallback(&ShutdownTimerCallback,
                                          this,
                                          DEFAULT_SHUTDOWN_TIMER_MS,
-                                         nsITimer::TYPE_ONE_SHOT)));
+                                         nsITimer::TYPE_ONE_SHOT));
 
   // Each client will spin the event loop while we wait on all the threads
   // to close. Our timer may fire during that loop.
   for (uint32_t index = 0; index < Client::TYPE_MAX; index++) {
     mClients[index]->ShutdownWorkThreads();
   }
 
   // Cancel the timer regardless of whether it actually fired.
@@ -4331,18 +4331,17 @@ QuotaManager::LockedCollectOriginsForEvi
 
   // Unlock while calling out to XPCOM (code behind the dispatch method needs
   // to acquire its own lock which can potentially lead to a deadlock and it
   // also calls an observer that can do various stuff like IO, so it's better
   // to not hold our mutex while that happens).
   {
     MutexAutoUnlock autoUnlock(mQuotaMutex);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(helper,
-                                                         NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(helper, NS_DISPATCH_NORMAL));
   }
 
   return helper->BlockAndReturnOriginsForEviction(aLocks);
 }
 
 void
 QuotaManager::LockedRemoveQuotaForOrigin(PersistenceType aPersistenceType,
                                          const nsACString& aGroup,
@@ -4876,33 +4875,32 @@ OriginOperationBase::Finish(nsresult aRe
   if (NS_SUCCEEDED(mResultCode)) {
     mResultCode = aResult;
   }
 
   // Must set mState before dispatching otherwise we will race with the main
   // thread.
   mState = State_UnblockingOpen;
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(this,
-                                                       NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
 }
 
 nsresult
 OriginOperationBase::Init()
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mState == State_Initial);
 
   AdvanceState();
 
   if (mNeedsMainThreadInit) {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(this)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(this));
   } else {
     AdvanceState();
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(Run()));
+    MOZ_ALWAYS_SUCCEEDS(Run());
   }
 
   return NS_OK;
 }
 
 nsresult
 OriginOperationBase::InitOnMainThread()
 {
@@ -4911,18 +4909,17 @@ OriginOperationBase::InitOnMainThread()
 
   nsresult rv = DoInitOnMainThread();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   AdvanceState();
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(this,
-                                                       NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
 
   return NS_OK;
 }
 
 nsresult
 OriginOperationBase::FinishInit()
 {
   AssertIsOnOwningThread();
@@ -4973,43 +4970,41 @@ OriginOperationBase::DirectoryWork()
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   // Must set mState before dispatching otherwise we will race with the owning
   // thread.
   AdvanceState();
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(this,
-                                                       NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
 
   return NS_OK;
 }
 
 void
 FinalizeOriginEvictionOp::Dispatch()
 {
   MOZ_ASSERT(!NS_IsMainThread());
   MOZ_ASSERT(GetState() == State_Initial);
 
   SetState(State_DirectoryOpenPending);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mOwningThread->Dispatch(this,
-                                                       NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
 }
 
 void
 FinalizeOriginEvictionOp::RunOnIOThreadImmediately()
 {
   AssertIsOnIOThread();
   MOZ_ASSERT(GetState() == State_Initial);
 
   SetState(State_DirectoryWorkOpen);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(this->Run()));
+  MOZ_ALWAYS_SUCCEEDS(this->Run());
 }
 
 void
 FinalizeOriginEvictionOp::Open()
 {
   MOZ_CRASH("Shouldn't get here!");
 }
 
@@ -6041,17 +6036,17 @@ StorageDirectoryHelper::AddOriginDirecto
 }
 
 nsresult
 StorageDirectoryHelper::ProcessOriginDirectories(bool aMove)
 {
   AssertIsOnIOThread();
   MOZ_ASSERT(!mOriginProps.IsEmpty());
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(this)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(this));
 
   {
     mozilla::MutexAutoLock autolock(mMutex);
     while (mWaiting) {
       mCondVar.Wait();
     }
   }
 
--- a/dom/quota/QuotaManagerService.cpp
+++ b/dom/quota/QuotaManagerService.cpp
@@ -274,18 +274,18 @@ QuotaManagerService::AbortOperationsForP
 
   if (!mBackgroundThread) {
     return;
   }
 
   RefPtr<AbortOperationsRunnable> runnable =
     new AbortOperationsRunnable(aContentParentId);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    mBackgroundThread->Dispatch(runnable, NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(
+    mBackgroundThread->Dispatch(runnable, NS_DISPATCH_NORMAL));
 }
 
 nsresult
 QuotaManagerService::Init()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (XRE_IsParentProcess()) {
@@ -458,36 +458,36 @@ QuotaManagerService::PerformIdleMaintena
   if (QuotaManager::kRunningXPCShellTests) {
     // We don't want user activity to impact this code if we're running tests.
     Unused << Observe(nullptr, OBSERVER_TOPIC_IDLE, nullptr);
   } else if (!mIdleObserverRegistered) {
     nsCOMPtr<nsIIdleService> idleService =
       do_GetService(kIdleServiceContractId);
     MOZ_ASSERT(idleService);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      idleService->AddIdleObserver(this, kIdleObserverTimeSec)));
+    MOZ_ALWAYS_SUCCEEDS(
+      idleService->AddIdleObserver(this, kIdleObserverTimeSec));
 
     mIdleObserverRegistered = true;
   }
 }
 
 void
 QuotaManagerService::RemoveIdleObserver()
 {
   MOZ_ASSERT(XRE_IsParentProcess());
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mIdleObserverRegistered) {
     nsCOMPtr<nsIIdleService> idleService =
       do_GetService(kIdleServiceContractId);
     MOZ_ASSERT(idleService);
 
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      idleService->RemoveIdleObserver(this, kIdleObserverTimeSec)));
+    MOZ_ALWAYS_SUCCEEDS(
+      idleService->RemoveIdleObserver(this, kIdleObserverTimeSec));
 
     mIdleObserverRegistered = false;
   }
 }
 
 NS_IMPL_ADDREF(QuotaManagerService)
 NS_IMPL_RELEASE_WITH_DESTROY(QuotaManagerService, Destroy())
 NS_IMPL_QUERY_INTERFACE(QuotaManagerService,
--- a/dom/webidl/WorkerDebuggerGlobalScope.webidl
+++ b/dom/webidl/WorkerDebuggerGlobalScope.webidl
@@ -3,16 +3,17 @@
  * 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/. */
 
 [Global=(WorkerDebugger), Exposed=WorkerDebugger]
 interface WorkerDebuggerGlobalScope : EventTarget {
   [Throws]
   readonly attribute object global;
 
+  [Throws]
   object createSandbox(DOMString name, object prototype);
 
   [Throws]
   void loadSubScript(DOMString url, optional object sandbox);
 
   void enterEventLoop();
 
   void leaveEventLoop();
--- a/dom/workers/DataStore.cpp
+++ b/dom/workers/DataStore.cpp
@@ -957,29 +957,28 @@ DataStoreChangeEventProxy::HandleEvent(n
   runnable->Dispatch();
 
   return NS_OK;
 }
 
 // WorkerFeature implementation.
 
 bool
-DataStoreChangeEventProxy::Notify(JSContext* aCx, Status aStatus)
+DataStoreChangeEventProxy::Notify(Status aStatus)
 {
   MutexAutoLock lock(mCleanUpLock);
 
   // |mWorkerPrivate| might not be safe to use anymore if we have already
   // cleaned up and RemoveFeature(), so we need to check |mCleanedUp| first.
   if (mCleanedUp) {
     return true;
   }
 
   MOZ_ASSERT(mWorkerPrivate);
   mWorkerPrivate->AssertIsOnWorkerThread();
-  MOZ_ASSERT(mWorkerPrivate->GetJSContext() == aCx);
 
   // Release the WorkerStore and remove the DataStoreChangeEventProxy from the
   // features of the worker thread since the worker thread has been cancelled.
   if (aStatus >= Canceling) {
     mWorkerStore = nullptr;
     mWorkerPrivate->RemoveFeature(this);
     mCleanedUp = true;
   }
--- a/dom/workers/DataStore.h
+++ b/dom/workers/DataStore.h
@@ -111,17 +111,17 @@ public:
 
   WorkerPrivate* GetWorkerPrivate() const;
 
   WorkerDataStore* GetWorkerStore() const;
 
 protected:
   // WorkerFeature implementation.
 
-  bool Notify(JSContext* aCx, Status aStatus) override;
+  bool Notify(Status aStatus) override;
 
 private:
   ~DataStoreChangeEventProxy() {};
 
   WorkerPrivate* mWorkerPrivate;
 
   RefPtr<WorkerDataStore> mWorkerStore;
 
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -1382,26 +1382,25 @@ RuntimeService::GetOrCreateService()
 // static
 RuntimeService*
 RuntimeService::GetService()
 {
   return gRuntimeService;
 }
 
 bool
-RuntimeService::RegisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
+RuntimeService::RegisterWorker(WorkerPrivate* aWorkerPrivate)
 {
   aWorkerPrivate->AssertIsOnParentThread();
 
   WorkerPrivate* parent = aWorkerPrivate->GetParent();
   if (!parent) {
     AssertIsOnMainThread();
 
     if (mShuttingDown) {
-      JS_ReportError(aCx, "Cannot create worker during shutdown!");
       return false;
     }
   }
 
   const bool isServiceWorker = aWorkerPrivate->IsServiceWorker();
   const bool isSharedWorker = aWorkerPrivate->IsSharedWorker();
   if (isServiceWorker) {
     AssertIsOnMainThread();
@@ -1413,17 +1412,16 @@ RuntimeService::RegisterWorker(JSContext
     AssertIsOnMainThread();
 
     nsCOMPtr<nsIURI> scriptURI = aWorkerPrivate->GetResolvedScriptURI();
     NS_ASSERTION(scriptURI, "Null script URI!");
 
     nsresult rv = scriptURI->GetSpec(sharedWorkerScriptSpec);
     if (NS_FAILED(rv)) {
       NS_WARNING("GetSpec failed?!");
-      xpc::Throw(aCx, rv);
       return false;
     }
 
     NS_ASSERTION(!sharedWorkerScriptSpec.IsEmpty(), "Empty spec!");
   }
 
   bool exemptFromPerDomainMax = false;
   if (isServiceWorker) {
@@ -1490,31 +1488,30 @@ RuntimeService::RegisterWorker(JSContext
         new SharedWorkerInfo(aWorkerPrivate, sharedWorkerScriptSpec,
                              sharedWorkerName);
       domainInfo->mSharedWorkerInfos.Put(key, sharedWorkerInfo);
     }
   }
 
   // From here on out we must call UnregisterWorker if something fails!
   if (parent) {
-    if (!parent->AddChildWorker(aCx, aWorkerPrivate)) {
-      UnregisterWorker(aCx, aWorkerPrivate);
+    if (!parent->AddChildWorker(aWorkerPrivate)) {
+      UnregisterWorker(aWorkerPrivate);
       return false;
     }
   }
   else {
     if (!mNavigatorPropertiesLoaded) {
       Navigator::AppName(mNavigatorProperties.mAppName,
                          false /* aUsePrefOverriddenValue */);
       if (NS_FAILED(Navigator::GetAppVersion(mNavigatorProperties.mAppVersion,
                                              false /* aUsePrefOverriddenValue */)) ||
           NS_FAILED(Navigator::GetPlatform(mNavigatorProperties.mPlatform,
                                            false /* aUsePrefOverriddenValue */))) {
-        JS_ReportError(aCx, "Failed to load navigator strings!");
-        UnregisterWorker(aCx, aWorkerPrivate);
+        UnregisterWorker(aWorkerPrivate);
         return false;
       }
 
       // The navigator overridden properties should have already been read.
 
       Navigator::GetAcceptLanguages(mNavigatorProperties.mLanguages);
       mNavigatorPropertiesLoaded = true;
     }
@@ -1533,17 +1530,17 @@ RuntimeService::RegisterWorker(JSContext
       if (!windowArray->Contains(aWorkerPrivate)) {
         windowArray->AppendElement(aWorkerPrivate);
       } else {
         MOZ_ASSERT(aWorkerPrivate->IsSharedWorker());
       }
     }
   }
 
-  if (!queued && !ScheduleWorker(aCx, aWorkerPrivate)) {
+  if (!queued && !ScheduleWorker(aWorkerPrivate)) {
     return false;
   }
 
   if (isServiceWorker) {
     AssertIsOnMainThread();
     Telemetry::Accumulate(Telemetry::SERVICE_WORKER_WAS_SPAWNED, 1);
   }
   return true;
@@ -1566,17 +1563,17 @@ RuntimeService::RemoveSharedWorker(Worke
 #endif
       iter.Remove();
       break;
     }
   }
 }
 
 void
-RuntimeService::UnregisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
+RuntimeService::UnregisterWorker(WorkerPrivate* aWorkerPrivate)
 {
   aWorkerPrivate->AssertIsOnParentThread();
 
   WorkerPrivate* parent = aWorkerPrivate->GetParent();
   if (!parent) {
     AssertIsOnMainThread();
   }
 
@@ -1647,17 +1644,17 @@ RuntimeService::UnregisterWorker(JSConte
 
   if (aWorkerPrivate->IsSharedWorker() ||
       aWorkerPrivate->IsServiceWorker()) {
     AssertIsOnMainThread();
     aWorkerPrivate->CloseAllSharedWorkers();
   }
 
   if (parent) {
-    parent->RemoveChildWorker(aCx, aWorkerPrivate);
+    parent->RemoveChildWorker(aWorkerPrivate);
   }
   else if (aWorkerPrivate->IsSharedWorker()) {
     AssertIsOnMainThread();
 
     for (auto iter = mWindowMap.Iter(); !iter.Done(); iter.Next()) {
       nsAutoPtr<nsTArray<WorkerPrivate*>>& workers = iter.Data();
       MOZ_ASSERT(workers.get());
 
@@ -1680,26 +1677,23 @@ RuntimeService::UnregisterWorker(JSConte
 
     MOZ_ALWAYS_TRUE(windowArray->RemoveElement(aWorkerPrivate));
 
     if (windowArray->IsEmpty()) {
       mWindowMap.Remove(window);
     }
   }
 
-  if (queuedWorker && !ScheduleWorker(aCx, queuedWorker)) {
-    UnregisterWorker(aCx, queuedWorker);
-    // There's nowhere sane to report the exception from ScheduleWorker, if any,
-    // here.
-    JS_ClearPendingException(aCx);
+  if (queuedWorker && !ScheduleWorker(queuedWorker)) {
+    UnregisterWorker(queuedWorker);
   }
 }
 
 bool
-RuntimeService::ScheduleWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
+RuntimeService::ScheduleWorker(WorkerPrivate* aWorkerPrivate)
 {
   if (!aWorkerPrivate->Start()) {
     // This is ok, means that we didn't need to make a thread for this worker.
     return true;
   }
 
   RefPtr<WorkerThread> thread;
   {
@@ -1711,35 +1705,35 @@ RuntimeService::ScheduleWorker(JSContext
     }
   }
 
   const WorkerThreadFriendKey friendKey;
 
   if (!thread) {
     thread = WorkerThread::Create(friendKey);
     if (!thread) {
-      UnregisterWorker(aCx, aWorkerPrivate);
-      JS_ReportError(aCx, "Could not create new thread!");
+      UnregisterWorker(aWorkerPrivate);
       return false;
     }
   }
 
   int32_t priority = aWorkerPrivate->IsChromeWorker() ?
                      nsISupportsPriority::PRIORITY_NORMAL :
                      nsISupportsPriority::PRIORITY_LOW;
 
   if (NS_FAILED(thread->SetPriority(priority))) {
     NS_WARNING("Could not set the thread's priority!");
   }
 
+  JSRuntime* rt = CycleCollectedJSRuntime::Get()->Runtime();
   nsCOMPtr<nsIRunnable> runnable =
-    new WorkerThreadPrimaryRunnable(aWorkerPrivate, thread, JS_GetParentRuntime(aCx));
+    new WorkerThreadPrimaryRunnable(aWorkerPrivate, thread,
+                                    JS_GetParentRuntime(rt));
   if (NS_FAILED(thread->DispatchPrimaryRunnable(friendKey, runnable.forget()))) {
-    UnregisterWorker(aCx, aWorkerPrivate);
-    JS_ReportError(aCx, "Could not dispatch to thread!");
+    UnregisterWorker(aWorkerPrivate);
     return false;
   }
 
   return true;
 }
 
 // static
 void
@@ -1778,21 +1772,21 @@ RuntimeService::ShutdownIdleThreads(nsIT
     }
   }
 
   if (!nextExpiration.IsNull()) {
     TimeDuration delta = nextExpiration - TimeStamp::NowLoRes();
     uint32_t delay(delta > TimeDuration(0) ? delta.ToMilliseconds() : 0);
 
     // Reschedule the timer.
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+    MOZ_ALWAYS_SUCCEEDS(
       aTimer->InitWithFuncCallback(ShutdownIdleThreads,
                                    nullptr,
                                    delay,
-                                   nsITimer::TYPE_ONE_SHOT)));
+                                   nsITimer::TYPE_ONE_SHOT));
   }
 
   for (uint32_t index = 0; index < expiredThreads.Length(); index++) {
     if (NS_FAILED(expiredThreads[index]->Shutdown())) {
       NS_WARNING("Failed to shutdown thread!");
     }
   }
 }
@@ -2387,23 +2381,23 @@ RuntimeService::NoteIdleThread(WorkerThr
     }
   }
 
   MOZ_ASSERT_IF(shutdownThread, !scheduleTimer);
   MOZ_ASSERT_IF(scheduleTimer, !shutdownThread);
 
   // Too many idle threads, just shut this one down.
   if (shutdownThread) {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aThread->Shutdown()));
+    MOZ_ALWAYS_SUCCEEDS(aThread->Shutdown());
   } else if (scheduleTimer) {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+    MOZ_ALWAYS_SUCCEEDS(
       mIdleThreadTimer->InitWithFuncCallback(ShutdownIdleThreads,
                                              nullptr,
                                              IDLE_THREAD_TIMEOUT_SEC * 1000,
-                                             nsITimer::TYPE_ONE_SHOT)));
+                                             nsITimer::TYPE_ONE_SHOT));
   }
 }
 
 void
 RuntimeService::UpdateAllWorkerRuntimeOptions()
 {
   BROADCAST_ALL_WORKERS(UpdateRuntimeOptions, sDefaultJSSettings.runtimeOptions);
 }
@@ -2731,18 +2725,18 @@ WorkerThreadPrimaryRunnable::Run()
   mWorkerPrivate = nullptr;
 
   // Now recycle this thread.
   nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
   MOZ_ASSERT(mainThread);
 
   RefPtr<FinishedRunnable> finishedRunnable =
     new FinishedRunnable(mThread.forget());
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mainThread->Dispatch(finishedRunnable,
-                                                    NS_DISPATCH_NORMAL)));
+  MOZ_ALWAYS_SUCCEEDS(mainThread->Dispatch(finishedRunnable,
+                                           NS_DISPATCH_NORMAL));
 
   profiler_unregister_thread();
   return NS_OK;
 }
 
 nsresult
 WorkerThreadPrimaryRunnable::SynchronouslyCreatePBackground()
 {
@@ -2782,13 +2776,13 @@ WorkerThreadPrimaryRunnable::FinishedRun
   RefPtr<WorkerThread> thread;
   mThread.swap(thread);
 
   RuntimeService* rts = RuntimeService::GetService();
   if (rts) {
     rts->NoteIdleThread(thread);
   }
   else if (thread->ShutdownRequired()) {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(thread->Shutdown()));
+    MOZ_ALWAYS_SUCCEEDS(thread->Shutdown());
   }
 
   return NS_OK;
 }
--- a/dom/workers/RuntimeService.h
+++ b/dom/workers/RuntimeService.h
@@ -119,20 +119,20 @@ public:
 
   static RuntimeService*
   GetOrCreateService();
 
   static RuntimeService*
   GetService();
 
   bool
-  RegisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate);
+  RegisterWorker(WorkerPrivate* aWorkerPrivate);
 
   void
-  UnregisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate);
+  UnregisterWorker(WorkerPrivate* aWorkerPrivate);
 
   void
   RemoveSharedWorker(WorkerDomainInfo* aDomainInfo,
                      WorkerPrivate* aWorkerPrivate);
 
   void
   CancelWorkersForWindow(nsPIDOMWindowInner* aWindow);
 
@@ -270,17 +270,17 @@ private:
   void
   AddAllTopLevelWorkersToArray(nsTArray<WorkerPrivate*>& aWorkers);
 
   void
   GetWorkersForWindow(nsPIDOMWindowInner* aWindow,
                       nsTArray<WorkerPrivate*>& aWorkers);
 
   bool
-  ScheduleWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate);
+  ScheduleWorker(WorkerPrivate* aWorkerPrivate);
 
   static void
   ShutdownIdleThreads(nsITimer* aTimer, void* aClosure);
 
   static void
   WorkerPrefChanged(const char* aPrefName, void* aClosure);
 
   static void
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -703,32 +703,28 @@ private:
 
     loadInfo.mCachePromise.swap(cachePromise);
     loadInfo.mCacheStatus = ScriptLoadInfo::WritingToCache;
 
     return NS_OK;
   }
 
   virtual bool
-  Notify(JSContext* aCx, Status aStatus) override
+  Notify(Status aStatus) override
   {
     mWorkerPrivate->AssertIsOnWorkerThread();
 
     if (aStatus >= Terminating && !mCanceled) {
       mCanceled = true;
 
       nsCOMPtr<nsIRunnable> runnable =
         NS_NewRunnableMethod(this,
           &ScriptLoaderRunnable::CancelMainThreadWithBindingAborted);
       NS_ASSERTION(runnable, "This should never fail!");
-
-      if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
-        JS_ReportError(aCx, "Failed to cancel script loader!");
-        return false;
-      }
+      MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
     }
 
     return true;
   }
 
   bool
   IsMainWorkerScript() const
   {
@@ -1433,17 +1429,17 @@ void
 CacheCreator::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
 {
   AssertIsOnMainThread();
   MOZ_ASSERT(aValue.isObject());
 
   JS::Rooted<JSObject*> obj(aCx, &aValue.toObject());
   Cache* cache = nullptr;
   nsresult rv = UNWRAP_OBJECT(Cache, obj, cache);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(rv));
+  MOZ_ALWAYS_SUCCEEDS(rv);
 
   mCache = cache;
   MOZ_ASSERT(mCache);
 
   // If the worker is canceled, CancelMainThread() will have cleared the
   // loaders.
   for (uint32_t i = 0, len = mLoaders.Length(); i < len; ++i) {
     mLoaders[i]->Load(cache);
--- a/dom/workers/ServiceWorkerClient.cpp
+++ b/dom/workers/ServiceWorkerClient.cpp
@@ -121,28 +121,47 @@ public:
   }
 
 private:
   NS_IMETHOD
   DispatchDOMEvent(JSContext* aCx, ServiceWorkerContainer* aTargetContainer)
   {
     AssertIsOnMainThread();
 
+    MOZ_ASSERT(aTargetContainer->GetParentObject(),
+               "How come we don't have a window here?!");
+
     JS::Rooted<JS::Value> messageData(aCx);
     ErrorResult rv;
     Read(aTargetContainer->GetParentObject(), aCx, &messageData, rv);
     if (NS_WARN_IF(rv.Failed())) {
       xpc::Throw(aCx, rv.StealNSResult());
       return NS_ERROR_FAILURE;
     }
 
     RootedDictionary<ServiceWorkerMessageEventInit> init(aCx);
 
+    nsCOMPtr<nsIPrincipal> principal = aTargetContainer->GetParentObject()->PrincipalOrNull();
+    NS_WARN_IF_FALSE(principal, "Why is the principal null here?");
+
+    bool isNullPrincipal = false;
+    bool isSystemPrincipal = false;
+    if (principal) {
+      principal->GetIsNullPrincipal(&isNullPrincipal);
+      MOZ_ASSERT(!isNullPrincipal);
+      principal->GetIsSystemPrincipal(&isSystemPrincipal);
+      MOZ_ASSERT(!isSystemPrincipal);
+    }
+
     init.mData = messageData;
-    init.mOrigin.Construct(EmptyString());
+    nsAutoCString origin;
+    if (principal && !isNullPrincipal && !isSystemPrincipal) {
+      principal->GetOrigin(origin);
+    }
+    init.mOrigin.Construct(NS_ConvertUTF8toUTF16(origin));
     init.mLastEventId.Construct(EmptyString());
     init.mPorts.Construct();
     init.mPorts.Value().SetNull();
 
     RefPtr<ServiceWorker> serviceWorker = aTargetContainer->GetController();
     init.mSource.Construct();
     if (serviceWorker) {
       init.mSource.Value().SetValue().SetAsServiceWorker() = serviceWorker;
--- a/dom/workers/ServiceWorkerClients.cpp
+++ b/dom/workers/ServiceWorkerClients.cpp
@@ -665,17 +665,17 @@ ServiceWorkerClients::Get(const nsAStrin
     PromiseWorkerProxy::Create(workerPrivate, promise);
   if (!promiseProxy) {
     promise->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
     return promise.forget();
   }
 
   RefPtr<GetRunnable> r =
     new GetRunnable(promiseProxy, aClientId);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 ServiceWorkerClients::MatchAll(const ClientQueryOptions& aOptions,
                                ErrorResult& aRv)
 {
   WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
@@ -701,17 +701,17 @@ ServiceWorkerClients::MatchAll(const Cli
     promise->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
     return promise.forget();
   }
 
   RefPtr<MatchAllRunnable> r =
     new MatchAllRunnable(promiseProxy,
                          NS_ConvertUTF16toUTF8(scope),
                          aOptions.mIncludeUncontrolled);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 ServiceWorkerClients::OpenWindow(const nsAString& aUrl,
                                  ErrorResult& aRv)
 {
   WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
@@ -742,17 +742,17 @@ ServiceWorkerClients::OpenWindow(const n
     return nullptr;
   }
 
   nsString scope;
   mWorkerScope->GetScope(scope);
 
   RefPtr<OpenWindowRunnable> r = new OpenWindowRunnable(promiseProxy,
                                                           aUrl, scope);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 ServiceWorkerClients::Claim(ErrorResult& aRv)
 {
   WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
@@ -771,11 +771,11 @@ ServiceWorkerClients::Claim(ErrorResult&
   }
 
   nsString scope;
   mWorkerScope->GetScope(scope);
 
   RefPtr<ClaimRunnable> runnable =
     new ClaimRunnable(promiseProxy, NS_ConvertUTF16toUTF8(scope));
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
   return promise.forget();
 }
--- a/dom/workers/ServiceWorkerEvents.cpp
+++ b/dom/workers/ServiceWorkerEvents.cpp
@@ -381,17 +381,17 @@ void RespondWithCopyComplete(void* aClos
                                       NS_ERROR_INTERCEPTION_FAILED);
   } else {
     event = new FinishResponse(data->mInterceptedChannel,
                                data->mInternalResponse,
                                data->mWorkerChannelInfo,
                                data->mScriptSpec,
                                data->mResponseURLSpec);
   }
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(event)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(event));
 }
 
 namespace {
 
 void
 ExtractErrorValues(JSContext* aCx, JS::Handle<JS::Value> aValue,
                   nsACString& aSourceSpecOut, uint32_t *aLineOut,
                   uint32_t *aColumnOut, nsString& aMessageOut)
@@ -836,18 +836,17 @@ public:
     if (!spec.IsEmpty()) {
       mSourceSpec = spec;
       mLine = line;
       mColumn = column;
     }
 
     nsCOMPtr<nsIRunnable> runnable =
       NS_NewRunnableMethod(this, &WaitUntilHandler::ReportOnMainThread);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      NS_DispatchToMainThread(runnable.forget())));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable.forget()));
   }
 
   void
   ReportOnMainThread()
   {
     AssertIsOnMainThread();
     RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
 
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -1124,17 +1124,17 @@ public:
   }
 
   void
   Start()
   {
     AssertIsOnMainThread();
     nsCOMPtr<nsIRunnable> r =
       NS_NewRunnableMethod(this, &ServiceWorkerInstallJob::Install);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
   }
 
   void
   Install()
   {
     RefPtr<ServiceWorkerJob> kungFuDeathGrip = this;
 
     if (mCanceled) {
@@ -1335,17 +1335,17 @@ public:
           Succeed();
 
           // Done() must always be called async from Start()
           nsCOMPtr<nsIRunnable> runnable =
             NS_NewRunnableMethodWithArg<nsresult>(
               this,
               &ServiceWorkerRegisterJob::Done,
               NS_OK);
-          MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(runnable)));
+          MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(runnable));
 
           return;
         }
       } else {
         mRegistration = swm->CreateNewRegistration(mScope, mPrincipal);
       }
     } else {
       MOZ_ASSERT(mJobType == UpdateJob);
@@ -1359,17 +1359,17 @@ public:
 
       // "If registration's uninstalling flag is set, abort these steps."
       if (mRegistration && mRegistration->mPendingUninstall) {
         nsCOMPtr<nsIRunnable> runnable =
           NS_NewRunnableMethodWithArg<nsresult>(
             this,
             &ServiceWorkerRegisterJob::Fail,
             NS_ERROR_DOM_INVALID_STATE_ERR);
-          MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(runnable)));
+          MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(runnable));
 
         return;
       }
 
       // If a different script spec has been registered between when this update
       // was scheduled and it running now, then simply abort.
       RefPtr<ServiceWorkerInfo> newest = mRegistration ? mRegistration->Newest()
                                                        : nullptr;
@@ -1377,17 +1377,17 @@ public:
           (newest && !mScriptSpec.Equals(newest->ScriptSpec()))) {
 
         // Done() must always be called async from Start()
         nsCOMPtr<nsIRunnable> runnable =
           NS_NewRunnableMethodWithArg<nsresult>(
             this,
             &ServiceWorkerRegisterJob::Fail,
             NS_ERROR_DOM_ABORT_ERR);
-          MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(runnable)));
+          MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(runnable));
 
         return;
       }
     }
 
     Update();
   }
 
@@ -1820,18 +1820,17 @@ ServiceWorkerManager::Register(mozIDOMWi
   RefPtr<WorkerLoadInfo::InterfaceRequestor> ir =
     new WorkerLoadInfo::InterfaceRequestor(documentPrincipal, docLoadGroup);
   ir->MaybeAddTabChild(docLoadGroup);
 
   // Create a load group that is separate from, yet related to, the document's load group.
   // This allows checks for interfaces like nsILoadContext to yield the values used by the
   // the document, yet will not cancel the update job if the document's load group is cancelled.
   nsCOMPtr<nsILoadGroup> loadGroup = do_CreateInstance(NS_LOADGROUP_CONTRACTID);
-  rv = loadGroup->SetNotificationCallbacks(ir);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(rv));
+  MOZ_ALWAYS_SUCCEEDS(loadGroup->SetNotificationCallbacks(ir));
 
   RefPtr<ServiceWorkerRegisterJob> job =
     new ServiceWorkerRegisterJob(queue, documentPrincipal, cleanedScope, spec,
                                  cb, loadGroup);
   queue->Append(job);
 
   AssertIsOnMainThread();
   Telemetry::Accumulate(Telemetry::SERVICE_WORKER_REGISTRATIONS, 1);
@@ -1868,17 +1867,17 @@ ServiceWorkerManager::AppendPendingOpera
 }
 
 void
 ServiceWorkerRegistrationInfo::TryToActivateAsync()
 {
   nsCOMPtr<nsIRunnable> r =
   NS_NewRunnableMethod(this,
                        &ServiceWorkerRegistrationInfo::TryToActivate);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
 }
 
 /*
  * TryToActivate should not be called directly, use TryToACtivateAsync instead.
  */
 void
 ServiceWorkerRegistrationInfo::TryToActivate()
 {
@@ -1950,17 +1949,17 @@ ServiceWorkerRegistrationInfo::Activate(
     new nsMainThreadPtrHolder<ContinueLifecycleTask>(new ContinueActivateTask(this)));
   RefPtr<LifeCycleEventCallback> callback =
     new ContinueLifecycleRunnable(continueActivateTask);
 
   ServiceWorkerPrivate* workerPrivate = mActiveWorker->WorkerPrivate();
   nsresult rv = workerPrivate->SendLifeCycleEvent(NS_LITERAL_STRING("activate"),
                                                   callback, failRunnable);
   if (NS_WARN_IF(NS_FAILED(rv))) {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(failRunnable)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(failRunnable));
     return;
   }
 }
 
 /*
  * Implements the async aspects of the getRegistrations algorithm.
  */
 class GetRegistrationsRunnable final : public nsRunnable
@@ -2478,17 +2477,17 @@ public:
   }
 
   void
   Start() override
   {
     AssertIsOnMainThread();
     nsCOMPtr<nsIRunnable> r =
       NS_NewRunnableMethod(this, &ServiceWorkerUnregisterJob::UnregisterAndDone);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
   }
 
 private:
   // You probably want UnregisterAndDone().
   nsresult
   Unregister()
   {
     AssertIsOnMainThread();
@@ -3724,17 +3723,17 @@ ServiceWorkerManager::DispatchFetchEvent
   if (NS_WARN_IF(aRv.Failed())) {
     return;
   }
 
   nsCOMPtr<nsIUploadChannel2> uploadChannel = do_QueryInterface(innerChannel);
 
   // If there is no upload stream, then continue immediately
   if (!uploadChannel) {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(continueRunnable->Run()));
+    MOZ_ALWAYS_SUCCEEDS(continueRunnable->Run());
     return;
   }
   // Otherwise, ensure the upload stream can be cloned directly.  This may
   // require some async copying, so provide a callback.
   aRv = uploadChannel->EnsureUploadStreamIsCloneable(continueRunnable);
 }
 
 bool
@@ -5229,17 +5228,17 @@ ServiceWorkerInfo::UpdateState(ServiceWo
   // activated state.
   // TODO: Do we care that these events will race with the propagation of the
   //       state change?
   if (aState == ServiceWorkerState::Activated && mState != aState) {
     mServiceWorkerPrivate->Activated();
   }
   mState = aState;
   nsCOMPtr<nsIRunnable> r = new ChangeStateUpdater(mInstances, mState);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r.forget())));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r.forget()));
 }
 
 ServiceWorkerInfo::ServiceWorkerInfo(nsIPrincipal* aPrincipal,
                                      const nsACString& aScope,
                                      const nsACString& aScriptSpec,
                                      const nsAString& aCacheName)
   : mPrincipal(aPrincipal)
   , mScope(aScope)
--- a/dom/workers/ServiceWorkerManagerParent.cpp
+++ b/dom/workers/ServiceWorkerManagerParent.cpp
@@ -201,18 +201,17 @@ ServiceWorkerManagerParent::RecvRegister
   if (!parent) {
     callback->Run();
     return true;
   }
 
   RefPtr<CheckPrincipalWithCallbackRunnable> runnable =
     new CheckPrincipalWithCallbackRunnable(parent.forget(), aData.principal(),
                                            callback);
-  nsresult rv = NS_DispatchToMainThread(runnable);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(rv));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
 
   return true;
 }
 
 bool
 ServiceWorkerManagerParent::RecvUnregister(const PrincipalInfo& aPrincipalInfo,
                                            const nsString& aScope)
 {
@@ -236,18 +235,17 @@ ServiceWorkerManagerParent::RecvUnregist
   if (!parent) {
     callback->Run();
     return true;
   }
 
   RefPtr<CheckPrincipalWithCallbackRunnable> runnable =
     new CheckPrincipalWithCallbackRunnable(parent.forget(), aPrincipalInfo,
                                            callback);
-  nsresult rv = NS_DispatchToMainThread(runnable);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(rv));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
 
   return true;
 }
 
 bool
 ServiceWorkerManagerParent::RecvPropagateSoftUpdate(const PrincipalOriginAttributes& aOriginAttributes,
                                                     const nsString& aScope)
 {
--- a/dom/workers/ServiceWorkerManagerService.cpp
+++ b/dom/workers/ServiceWorkerManagerService.cpp
@@ -71,18 +71,18 @@ public:
           if ((contextArray[j].OwnOrContainingAppId() == mOriginAttributes.mAppId) &&
               (contextArray[j].IsIsolatedMozBrowserElement() == mOriginAttributes.mInIsolatedMozBrowser)) {
             continue;
           }
           // Array entries with no mParent won't receive any notification.
           data.mParent = nullptr;
         }
       }
-      nsresult rv = mBackgroundThread->Dispatch(this, NS_DISPATCH_NORMAL);
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(rv));
+
+      MOZ_ALWAYS_SUCCEEDS(mBackgroundThread->Dispatch(this, NS_DISPATCH_NORMAL));
       return NS_OK;
     }
 
     AssertIsOnBackgroundThread();
 
     for (uint32_t i = 0; i < mData->Length(); ++i) {
       NotifySoftUpdateData& data = mData->ElementAt(i);
       MOZ_ASSERT(!(data.mContentParent));
@@ -226,18 +226,17 @@ ServiceWorkerManagerService::PropagateSo
   if (notifySoftUpdateDataArray->IsEmpty()) {
     return;
   }
 
   RefPtr<NotifySoftUpdateIfPrincipalOkRunnable> runnable =
     new NotifySoftUpdateIfPrincipalOkRunnable(notifySoftUpdateDataArray,
                                               aOriginAttributes, aScope);
   MOZ_ASSERT(!notifySoftUpdateDataArray);
-  nsresult rv = NS_DispatchToMainThread(runnable);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(rv));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
 
 #ifdef DEBUG
   MOZ_ASSERT(parentFound);
 #endif
 }
 
 void
 ServiceWorkerManagerService::PropagateUnregister(
--- a/dom/workers/ServiceWorkerPrivate.cpp
+++ b/dom/workers/ServiceWorkerPrivate.cpp
@@ -168,17 +168,17 @@ public:
 private:
   void
   Done(bool aResult)
   {
 #ifdef DEBUG
     mDone = true;
 #endif
     mCallback->SetResult(aResult);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(mCallback)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(mCallback));
   }
 };
 
 } // anonymous namespace
 
 nsresult
 ServiceWorkerPrivate::CheckScriptEvaluation(LifeCycleEventCallback* aCallback)
 {
@@ -374,17 +374,17 @@ public:
     MOZ_ASSERT(aWorkerPrivate);
     return DispatchLifecycleEvent(aCx, aWorkerPrivate);
   }
 
   NS_IMETHOD
   Cancel() override
   {
     mCallback->SetResult(false);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(mCallback)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(mCallback));
 
     return WorkerRunnable::Cancel();
   }
 
 private:
   bool
   DispatchLifecycleEvent(JSContext* aCx, WorkerPrivate* aWorkerPrivate);
 
@@ -447,17 +447,17 @@ public:
       ReportResult(false);
       return false;
     }
 
     return true;
   }
 
   bool
-  Notify(JSContext* aCx, Status aStatus) override
+  Notify(Status aStatus) override
   {
     if (aStatus < Terminating) {
       return true;
     }
 
     MOZ_ASSERT(GetCurrentThreadWorkerPrivate() == mWorkerPrivate);
     ReportResult(false);
 
@@ -1287,17 +1287,17 @@ private:
         nsCOMPtr<nsIRunnable> updateRunnable =
           new RegistrationUpdateRunnable(mRegistration, false /* time check */);
         NS_DispatchToMainThread(runnable.forget());
 
         runnable = new CancelChannelRunnable(mInterceptedChannel,
                                              NS_ERROR_INTERCEPTION_FAILED);
       }
 
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+      MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
     }
 
     RefPtr<Promise> waitUntilPromise = event->GetPromise();
     if (waitUntilPromise) {
       RefPtr<KeepAliveHandler> keepAliveHandler =
         new KeepAliveHandler(mKeepAliveToken);
       waitUntilPromise->AppendNativeHandler(keepAliveHandler);
     }
--- a/dom/workers/ServiceWorkerRegistration.cpp
+++ b/dom/workers/ServiceWorkerRegistration.cpp
@@ -993,17 +993,17 @@ ServiceWorkerRegistrationWorkerThread::U
 
   RefPtr<PromiseWorkerProxy> proxy = PromiseWorkerProxy::Create(worker, promise);
   if (!proxy) {
     aRv.Throw(NS_ERROR_DOM_ABORT_ERR);
     return nullptr;
   }
 
   RefPtr<UpdateRunnable> r = new UpdateRunnable(proxy, mScope);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 ServiceWorkerRegistrationWorkerThread::Unregister(ErrorResult& aRv)
 {
   WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
@@ -1025,17 +1025,17 @@ ServiceWorkerRegistrationWorkerThread::U
 
   RefPtr<PromiseWorkerProxy> proxy = PromiseWorkerProxy::Create(worker, promise);
   if (!proxy) {
     aRv.Throw(NS_ERROR_DOM_ABORT_ERR);
     return nullptr;
   }
 
   RefPtr<StartUnregisterRunnable> r = new StartUnregisterRunnable(proxy, mScope);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
 
   return promise.forget();
 }
 
 class StartListeningRunnable final : public nsRunnable
 {
   RefPtr<WorkerListener> mListener;
 public:
@@ -1063,17 +1063,17 @@ ServiceWorkerRegistrationWorkerThread::I
   if (!worker->AddFeature(this)) {
     mListener = nullptr;
     NS_WARNING("Could not add feature");
     return;
   }
 
   RefPtr<StartListeningRunnable> r =
     new StartListeningRunnable(mListener);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
 }
 
 class AsyncStopListeningRunnable final : public nsRunnable
 {
   RefPtr<WorkerListener> mListener;
 public:
   explicit AsyncStopListeningRunnable(WorkerListener* aListener)
     : mListener(aListener)
@@ -1120,17 +1120,17 @@ ServiceWorkerRegistrationWorkerThread::R
   mWorkerPrivate->AssertIsOnWorkerThread();
   mWorkerPrivate->RemoveFeature(this);
 
   mListener->ClearRegistration();
 
   if (aReason == RegistrationIsGoingAway) {
     RefPtr<AsyncStopListeningRunnable> r =
       new AsyncStopListeningRunnable(mListener);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
   } else if (aReason == WorkerIsGoingAway) {
     RefPtr<SyncStopListeningRunnable> r =
       new SyncStopListeningRunnable(mWorkerPrivate, mListener);
     ErrorResult rv;
     r->Dispatch(rv);
     if (rv.Failed()) {
       NS_ERROR("Failed to dispatch stop listening runnable!");
       // And now what?
@@ -1139,17 +1139,17 @@ ServiceWorkerRegistrationWorkerThread::R
   } else {
     MOZ_CRASH("Bad reason");
   }
   mListener = nullptr;
   mWorkerPrivate = nullptr;
 }
 
 bool
-ServiceWorkerRegistrationWorkerThread::Notify(JSContext* aCx, workers::Status aStatus)
+ServiceWorkerRegistrationWorkerThread::Notify(workers::Status aStatus)
 {
   ReleaseListener(WorkerIsGoingAway);
   return true;
 }
 
 class FireUpdateFoundRunnable final : public WorkerRunnable
 {
   RefPtr<WorkerListener> mListener;
--- a/dom/workers/ServiceWorkerRegistration.h
+++ b/dom/workers/ServiceWorkerRegistration.h
@@ -234,17 +234,17 @@ public:
 
   void
   GetScope(nsAString& aScope) const
   {
     aScope = mScope;
   }
 
   bool
-  Notify(JSContext* aCx, workers::Status aStatus) override;
+  Notify(workers::Status aStatus) override;
 
   already_AddRefed<WorkerPushManager>
   GetPushManager(ErrorResult& aRv);
 
 private:
   enum Reason
   {
     RegistrationIsGoingAway = 0,
--- a/dom/workers/ServiceWorkerWindowClient.cpp
+++ b/dom/workers/ServiceWorkerWindowClient.cpp
@@ -143,17 +143,17 @@ ServiceWorkerWindowClient::Focus(ErrorRe
   }
 
   if (workerPrivate->GlobalScope()->WindowInteractionAllowed()) {
     RefPtr<PromiseWorkerProxy> promiseProxy =
       PromiseWorkerProxy::Create(workerPrivate, promise);
     if (promiseProxy) {
       RefPtr<ClientFocusRunnable> r = new ClientFocusRunnable(mWindowId,
                                                                 promiseProxy);
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
+      MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));
     } else {
       promise->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
     }
 
   } else {
     promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
   }
 
--- a/dom/workers/WorkerDebuggerManager.cpp
+++ b/dom/workers/WorkerDebuggerManager.cpp
@@ -268,18 +268,17 @@ WorkerDebuggerManager::RegisterDebugger(
     {
       MutexAutoLock lock(mMutex);
 
       hasListeners = !mListeners.IsEmpty();
     }
 
     nsCOMPtr<nsIRunnable> runnable =
       new RegisterDebuggerMainThreadRunnable(aWorkerPrivate, hasListeners);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL));
 
     if (hasListeners) {
       aWorkerPrivate->WaitForIsDebuggerRegistered(true);
     }
   }
 }
 
 void
@@ -287,18 +286,17 @@ WorkerDebuggerManager::UnregisterDebugge
 {
   aWorkerPrivate->AssertIsOnParentThread();
 
   if (NS_IsMainThread()) {
     UnregisterDebuggerMainThread(aWorkerPrivate);
   } else {
     nsCOMPtr<nsIRunnable> runnable =
       new UnregisterDebuggerMainThreadRunnable(aWorkerPrivate);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL));
 
     aWorkerPrivate->WaitForIsDebuggerRegistered(false);
   }
 }
 
 void
 WorkerDebuggerManager::RegisterDebuggerMainThread(WorkerPrivate* aWorkerPrivate,
                                                   bool aNotifyListeners)
--- a/dom/workers/WorkerFeature.h
+++ b/dom/workers/WorkerFeature.h
@@ -69,14 +69,14 @@ enum Status
   Dead
 };
 
 class WorkerFeature
 {
 public:
   virtual ~WorkerFeature() { }
 
-  virtual bool Notify(JSContext* aCx, Status aStatus) = 0;
+  virtual bool Notify(Status aStatus) = 0;
 };
 
 END_WORKERS_NAMESPACE
 
 #endif /* mozilla_dom_workers_workerfeature_h__ */
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -400,17 +400,17 @@ private:
       NS_WARNING("Failed to dispatch, going to leak!");
     }
 
     RuntimeService* runtime = RuntimeService::GetService();
     NS_ASSERTION(runtime, "This should never be null!");
 
     mFinishedWorker->DisableDebugger();
 
-    runtime->UnregisterWorker(aCx, mFinishedWorker);
+    runtime->UnregisterWorker(mFinishedWorker);
 
     mFinishedWorker->ClearSelfRef();
     return true;
   }
 };
 
 class TopLevelWorkerFinishedRunnable final : public nsRunnable
 {
@@ -431,22 +431,19 @@ private:
   NS_IMETHOD
   Run() override
   {
     AssertIsOnMainThread();
 
     RuntimeService* runtime = RuntimeService::GetService();
     MOZ_ASSERT(runtime);
 
-    AutoSafeJSContext cx;
-    JSAutoRequest ar(cx);
-
     mFinishedWorker->DisableDebugger();
 
-    runtime->UnregisterWorker(cx, mFinishedWorker);
+    runtime->UnregisterWorker(mFinishedWorker);
 
     nsCOMPtr<nsILoadGroup> loadGroupToCancel;
     mFinishedWorker->ForgetOverridenLoadGroup(loadGroupToCancel);
 
     nsTArray<nsCOMPtr<nsISupports> > doomed;
     mFinishedWorker->ForgetMainThreadObjects(doomed);
 
     RefPtr<MainThreadReleaseRunnable> runnable =
@@ -1708,17 +1705,17 @@ private:
 };
 
 PRThread*
 PRThreadFromThread(nsIThread* aThread)
 {
   MOZ_ASSERT(aThread);
 
   PRThread* result;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aThread->GetPRThread(&result)));
+  MOZ_ALWAYS_SUCCEEDS(aThread->GetPRThread(&result));
   MOZ_ASSERT(result);
 
   return result;
 }
 
 } /* anonymous namespace */
 
 NS_IMPL_ISUPPORTS_INHERITED0(MainThreadReleaseRunnable, nsRunnable)
@@ -3480,18 +3477,18 @@ WorkerPrivateParent<Derived>::SetPrincip
     mLoadInfo.mReportCSPViolations = false;
   }
 
   mLoadInfo.mLoadGroup = aLoadGroup;
 
   mLoadInfo.mPrincipalInfo = new PrincipalInfo();
   mLoadInfo.mPrivateBrowsing = nsContentUtils::IsInPrivateBrowsing(aLoadGroup);
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    PrincipalToPrincipalInfo(aPrincipal, mLoadInfo.mPrincipalInfo)));
+  MOZ_ALWAYS_SUCCEEDS(
+    PrincipalToPrincipalInfo(aPrincipal, mLoadInfo.mPrincipalInfo));
 }
 
 template <class Derived>
 JSContext*
 WorkerPrivateParent<Derived>::ParentJSContext() const
 {
   AssertIsOnParentThread();
 
@@ -4092,32 +4089,31 @@ WorkerPrivate::Constructor(JSContext* aC
   // NB: This has to be done before creating the WorkerPrivate, because it will
   // attempt to use static variables that are initialized in the RuntimeService
   // constructor.
   RuntimeService* runtimeService;
 
   if (!parent) {
     runtimeService = RuntimeService::GetOrCreateService();
     if (!runtimeService) {
-      JS_ReportError(aCx, "Failed to create runtime service!");
       aRv.Throw(NS_ERROR_FAILURE);
       return nullptr;
     }
   }
   else {
     runtimeService = RuntimeService::GetService();
   }
 
   MOZ_ASSERT(runtimeService);
 
   RefPtr<WorkerPrivate> worker =
     new WorkerPrivate(parent, aScriptURL, aIsChromeWorker,
                       aWorkerType, aWorkerName, *aLoadInfo);
 
-  if (!runtimeService->RegisterWorker(aCx, worker)) {
+  if (!runtimeService->RegisterWorker(worker)) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
   }
 
   worker->EnableDebugger();
 
   RefPtr<CompileScriptRunnable> compiler =
     new CompileScriptRunnable(worker, aScriptURL);
@@ -4404,17 +4400,17 @@ WorkerPrivate::OverrideLoadInfoLoadGroup
   //  - private browsing = false
   //  - content = true
   //  - use remote tabs = false
   nsCOMPtr<nsILoadGroup> loadGroup =
     do_CreateInstance(NS_LOADGROUP_CONTRACTID);
 
   nsresult rv =
     loadGroup->SetNotificationCallbacks(aLoadInfo.mInterfaceRequestor);
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(rv));
+  MOZ_ALWAYS_SUCCEEDS(rv);
 
   aLoadInfo.mLoadGroup = loadGroup.forget();
 }
 
 void
 WorkerPrivate::DoRunLoop(JSContext* aCx)
 {
   AssertIsOnWorkerThread();
@@ -4597,17 +4593,17 @@ WorkerPrivate::MaybeDispatchLoadFailedRu
 {
   AssertIsOnWorkerThread();
 
   nsCOMPtr<nsIRunnable> runnable = StealLoadFailedAsyncRunnable();
   if (!runnable) {
     return;
   }
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable.forget())));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable.forget()));
 }
 
 void
 WorkerPrivate::InitializeGCTimers()
 {
   AssertIsOnWorkerThread();
 
   // We need a timer for GC. The basic plan is to run a non-shrinking GC
@@ -4637,17 +4633,17 @@ WorkerPrivate::SetGCTimerMode(GCTimerMod
   MOZ_ASSERT(mPeriodicGCTimerTarget);
   MOZ_ASSERT(mIdleGCTimerTarget);
 
   if ((aMode == PeriodicTimer && mPeriodicGCTimerRunning) ||
       (aMode == IdleTimer && mIdleGCTimerRunning)) {
     return;
   }
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mGCTimer->Cancel()));
+  MOZ_ALWAYS_SUCCEEDS(mGCTimer->Cancel());
 
   mPeriodicGCTimerRunning = false;
   mIdleGCTimerRunning = false;
   LOG(WorkerLog(),
       ("Worker %p canceled GC timer because %s\n", this,
        aMode == PeriodicTimer ?
        "periodic" :
        aMode == IdleTimer ? "idle" : "none"));
@@ -4668,20 +4664,20 @@ WorkerPrivate::SetGCTimerMode(GCTimerMod
     type = nsITimer::TYPE_REPEATING_SLACK;
   }
   else {
     target = mIdleGCTimerTarget;
     delay = IDLE_GC_TIMER_DELAY_SEC * 1000;
     type = nsITimer::TYPE_ONE_SHOT;
   }
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mGCTimer->SetTarget(target)));
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+  MOZ_ALWAYS_SUCCEEDS(mGCTimer->SetTarget(target));
+  MOZ_ALWAYS_SUCCEEDS(
     mGCTimer->InitWithNamedFuncCallback(DummyCallback, nullptr, delay, type,
-                                        "dom::workers::DummyCallback(2)")));
+                                        "dom::workers::DummyCallback(2)"));
 
   if (aMode == PeriodicTimer) {
     LOG(WorkerLog(), ("Worker %p scheduled periodic GC timer\n", this));
     mPeriodicGCTimerRunning = true;
   }
   else {
     LOG(WorkerLog(), ("Worker %p scheduled idle GC timer\n", this));
     mIdleGCTimerRunning = true;
@@ -4691,17 +4687,17 @@ WorkerPrivate::SetGCTimerMode(GCTimerMod
 void
 WorkerPrivate::ShutdownGCTimers()
 {
   AssertIsOnWorkerThread();
 
   MOZ_ASSERT(mGCTimer);
 
   // Always make sure the timer is canceled.
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mGCTimer->Cancel()));
+  MOZ_ALWAYS_SUCCEEDS(mGCTimer->Cancel());
 
   LOG(WorkerLog(), ("Worker %p killed the GC timer\n", this));
 
   mGCTimer = nullptr;
   mPeriodicGCTimerTarget = nullptr;
   mIdleGCTimerTarget = nullptr;
   mPeriodicGCTimerRunning = false;
   mIdleGCTimerRunning = false;
@@ -5112,17 +5108,17 @@ WorkerPrivate::ModifyBusyCountFromWorker
   }
 
   RefPtr<ModifyBusyCountRunnable> runnable =
     new ModifyBusyCountRunnable(this, aIncrease);
   return runnable->Dispatch();
 }
 
 bool
-WorkerPrivate::AddChildWorker(JSContext* aCx, ParentType* aChildWorker)
+WorkerPrivate::AddChildWorker(ParentType* aChildWorker)
 {
   AssertIsOnWorkerThread();
 
 #ifdef DEBUG
   {
     Status currentStatus;
     {
       MutexAutoLock lock(mMutex);
@@ -5138,17 +5134,17 @@ WorkerPrivate::AddChildWorker(JSContext*
   mChildWorkers.AppendElement(aChildWorker);
 
   return mChildWorkers.Length() == 1 ?
          ModifyBusyCountFromWorker(true) :
          true;
 }
 
 void
-WorkerPrivate::RemoveChildWorker(JSContext* aCx, ParentType* aChildWorker)
+WorkerPrivate::RemoveChildWorker(ParentType* aChildWorker)
 {
   AssertIsOnWorkerThread();
 
   NS_ASSERTION(mChildWorkers.Contains(aChildWorker),
                "Didn't know about this one!");
   mChildWorkers.RemoveElement(aChildWorker);
 
   if (mChildWorkers.IsEmpty() && !ModifyBusyCountFromWorker(false)) {
@@ -5202,17 +5198,17 @@ WorkerPrivate::NotifyFeatures(JSContext*
 
   if (aStatus >= Closing) {
     CancelAllTimeouts();
   }
 
   nsTObserverArray<WorkerFeature*>::ForwardIterator iter(mFeatures);
   while (iter.HasMore()) {
     WorkerFeature* feature = iter.GetNext();
-    if (!feature->Notify(aCx, aStatus)) {
+    if (!feature->Notify(aStatus)) {
       NS_WARNING("Failed to notify feature!");
     }
     MOZ_ASSERT(!JS_IsExceptionPending(aCx));
   }
 
   AutoTArray<ParentType*, 10> children;
   children.AppendElements(mChildWorkers);
 
@@ -5270,18 +5266,17 @@ already_AddRefed<nsIEventTarget>
 WorkerPrivate::CreateNewSyncLoop()
 {
   AssertIsOnWorkerThread();
 
   nsCOMPtr<nsIThreadInternal> thread = do_QueryInterface(NS_GetCurrentThread());
   MOZ_ASSERT(thread);
 
   nsCOMPtr<nsIEventTarget> realEventTarget;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(thread->PushEventQueue(
-                                             getter_AddRefs(realEventTarget))));
+  MOZ_ALWAYS_SUCCEEDS(thread->PushEventQueue(getter_AddRefs(realEventTarget)));
 
   RefPtr<EventTarget> workerEventTarget =
     new EventTarget(this, realEventTarget);
 
   {
     // Modifications must be protected by mMutex in DEBUG builds, see comment
     // about mSyncLoopStack in WorkerPrivate.h.
 #ifdef DEBUG
@@ -5388,17 +5383,17 @@ WorkerPrivate::DestroySyncLoop(uint32_t 
 #ifdef DEBUG
     MutexAutoLock lock(mMutex);
 #endif
 
     // This will delete |loopInfo|!
     mSyncLoopStack.RemoveElementAt(aLoopIndex);
   }
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aThread->PopEventQueue(nestedEventTarget)));
+  MOZ_ALWAYS_SUCCEEDS(aThread->PopEventQueue(nestedEventTarget));
 
   if (!mSyncLoopStack.Length() && mPendingEventQueueClearing) {
     ClearMainEventQueue(WorkerRan);
     mPendingEventQueueClearing = false;
   }
 
   return result;
 }
@@ -5714,17 +5709,17 @@ WorkerPrivate::NotifyInternal(JSContext*
   }
 
   // If this is the first time our status has changed we also need to schedule
   // the close handler unless we're being shut down.
   if (previousStatus == Running && aStatus != Killing) {
     MOZ_ASSERT(!mCloseHandlerStarted && !mCloseHandlerFinished);
 
     RefPtr<CloseEventRunnable> closeRunnable = new CloseEventRunnable(this);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(closeRunnable)));
+    MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(closeRunnable));
   }
 
   if (aStatus == Closing) {
     // Notify parent to stop sending us messages and balance our busy count.
     RefPtr<CloseRunnable> runnable = new CloseRunnable(this);
     if (!runnable->Dispatch()) {
       return false;
     }
@@ -5777,18 +5772,17 @@ WorkerPrivate::ScheduleKillCloseEventRun
   MOZ_ASSERT(!mKillTime.IsNull());
 
   RefPtr<KillCloseEventRunnable> killCloseEventRunnable =
     new KillCloseEventRunnable(this);
   if (!killCloseEventRunnable->SetTimeout(RemainingRunTimeMS())) {
     return false;
   }
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(
-                                                      killCloseEventRunnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(killCloseEventRunnable));
 
   return true;
 }
 
 void
 WorkerPrivate::ReportError(JSContext* aCx, const char* aFallbackMessage,
                            JSErrorReport* aReport)
 {
@@ -5871,17 +5865,18 @@ WorkerPrivate::SetTimeout(JSContext* aCx
   {
     MutexAutoLock lock(mMutex);
     currentStatus = mStatus;
   }
 
   // It's a script bug if setTimeout/setInterval are called from a close handler
   // so throw an exception.
   if (currentStatus == Closing) {
-    JS_ReportError(aCx, "Cannot schedule timeouts from the close handler!");
+    aRv.Throw(NS_ERROR_FAILURE);
+    return 0;
   }
 
   // If the worker is trying to call setTimeout/setInterval and the parent
   // thread has initiated the close process then just silently fail.
   if (currentStatus >= Closing) {
     aRv.Throw(NS_ERROR_FAILURE);
     return 0;
   }
@@ -6355,18 +6350,18 @@ WorkerPrivate::SetThread(WorkerThread* a
       MOZ_ASSERT(!mThread);
       MOZ_ASSERT(mStatus == Pending);
 
       mThread = aThread;
       mThread->SetWorker(friendKey, this);
 
       if (!mPreStartRunnables.IsEmpty()) {
         for (uint32_t index = 0; index < mPreStartRunnables.Length(); index++) {
-          MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-            mThread->DispatchAnyThread(friendKey, mPreStartRunnables[index].forget())));
+          MOZ_ALWAYS_SUCCEEDS(
+            mThread->DispatchAnyThread(friendKey, mPreStartRunnables[index].forget()));
         }
         mPreStartRunnables.Clear();
       }
     }
     else {
       MOZ_ASSERT(mThread);
 
       mThread->SetWorker(friendKey, nullptr);
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -1061,20 +1061,20 @@ public:
 
   void
   TraceTimeouts(const TraceCallbacks& aCallbacks, void* aClosure) const;
 
   bool
   ModifyBusyCountFromWorker(bool aIncrease);
 
   bool
-  AddChildWorker(JSContext* aCx, ParentType* aChildWorker);
+  AddChildWorker(ParentType* aChildWorker);
 
   void
-  RemoveChildWorker(JSContext* aCx, ParentType* aChildWorker);
+  RemoveChildWorker(ParentType* aChildWorker);
 
   bool
   AddFeature(WorkerFeature* aFeature);
 
   void
   RemoveFeature(WorkerFeature* aFeature);
 
   void
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -627,17 +627,17 @@ ServiceWorkerGlobalScope::SkipWaiting(Er
     promise->MaybeResolve(JS::UndefinedHandleValue);
     return promise.forget();
   }
 
   RefPtr<WorkerScopeSkipWaitingRunnable> runnable =
     new WorkerScopeSkipWaitingRunnable(promiseProxy,
                                        NS_ConvertUTF16toUTF8(mScope));
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
+  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
   return promise.forget();
 }
 
 bool
 ServiceWorkerGlobalScope::OpenWindowEnabled(JSContext* aCx, JSObject* aObj)
 {
   WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
   MOZ_ASSERT(worker);
@@ -809,60 +809,59 @@ const js::Class workerdebuggersandbox_cl
       nullptr,
       workerdebuggersandbox_moved
     }, JS_NULL_OBJECT_OPS
 };
 
 void
 WorkerDebuggerGlobalScope::CreateSandbox(JSContext* aCx, const nsAString& aName,
                                          JS::Handle<JSObject*> aPrototype,
-                                         JS::MutableHandle<JSObject*> aResult)
+                                         JS::MutableHandle<JSObject*> aResult,
+                                         ErrorResult& aRv)
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
 
+  aResult.set(nullptr);
+
   JS::CompartmentOptions options;
   options.creationOptions().setInvisibleToDebugger(true);
 
   JS::Rooted<JSObject*> sandbox(aCx,
     JS_NewGlobalObject(aCx, js::Jsvalify(&workerdebuggersandbox_class), nullptr,
                        JS::DontFireOnNewGlobalHook, options));
   if (!sandbox) {
-    JS_ReportError(aCx, "Can't create sandbox!");
-    aResult.set(nullptr);
+    aRv.NoteJSContextException(aCx);
     return;
   }
 
   {
     JSAutoCompartment ac(aCx, sandbox);
 
     JS::Rooted<JSObject*> prototype(aCx, aPrototype);
     if (!JS_WrapObject(aCx, &prototype)) {
-      JS_ReportError(aCx, "Can't wrap sandbox prototype!");
-      aResult.set(nullptr);
+      aRv.NoteJSContextException(aCx);
       return;
     }
 
     if (!JS_SetPrototype(aCx, sandbox, prototype)) {
-      JS_ReportError(aCx, "Can't set sandbox prototype!");
-      aResult.set(nullptr);
+      aRv.NoteJSContextException(aCx);
       return;
     }
 
     nsCOMPtr<nsIGlobalObject> globalObject =
       new WorkerDebuggerSandboxPrivate(sandbox);
 
     // Pass on ownership of globalObject to |sandbox|.
     JS_SetPrivate(sandbox, globalObject.forget().take());
   }
 
   JS_FireOnNewGlobalObject(aCx, sandbox);
 
   if (!JS_WrapObject(aCx, &sandbox)) {
-    JS_ReportError(aCx, "Can't wrap sandbox!");
-    aResult.set(nullptr);
+    aRv.NoteJSContextException(aCx);
     return;
   }
 
   aResult.set(sandbox);
 }
 
 void
 WorkerDebuggerGlobalScope::LoadSubScript(JSContext* aCx,
--- a/dom/workers/WorkerScope.h
+++ b/dom/workers/WorkerScope.h
@@ -305,17 +305,18 @@ public:
 
   void
   GetGlobal(JSContext* aCx, JS::MutableHandle<JSObject*> aGlobal,
             ErrorResult& aRv);
 
   void
   CreateSandbox(JSContext* aCx, const nsAString& aName,
                 JS::Handle<JSObject*> aPrototype,
-                JS::MutableHandle<JSObject*> aResult);
+                JS::MutableHandle<JSObject*> aResult,
+                ErrorResult& aRv);
 
   void
   LoadSubScript(JSContext* aCx, const nsAString& aURL,
                 const Optional<JS::Handle<JSObject*>>& aSandbox,
                 ErrorResult& aRv);
 
   void
   EnterEventLoop();
--- a/dom/workers/WorkerThread.cpp
+++ b/dom/workers/WorkerThread.cpp
@@ -112,19 +112,19 @@ WorkerThread::SetWorker(const WorkerThre
 
       mWorkerPrivate = aWorkerPrivate;
 #ifdef DEBUG
       mAcceptingNonWorkerRunnables = false;
 #endif
     }
 
     mObserver = new Observer(aWorkerPrivate);
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(AddObserver(mObserver)));
+    MOZ_ALWAYS_SUCCEEDS(AddObserver(mObserver));
   } else {
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(RemoveObserver(mObserver)));
+    MOZ_ALWAYS_SUCCEEDS(RemoveObserver(mObserver));
     mObserver = nullptr;
 
     {
       MutexAutoLock lock(mLock);
 
       MOZ_ASSERT(mWorkerPrivate);
       MOZ_ASSERT(!mAcceptingNonWorkerRunnables);
       MOZ_ASSERT(!mOtherThreadsDispatchingViaEventTarget,
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -1913,20 +1913,19 @@ XMLHttpRequest::SendInternal(SendRunnabl
   // for it will come from ProxyCompleteRunnable and that always passes true for
   // the second arg.
   if (!autoSyncLoop->Run() && !aRv.Failed()) {
     aRv.Throw(NS_ERROR_FAILURE);
   }
 }
 
 bool
-XMLHttpRequest::Notify(JSContext* aCx, Status aStatus)
+XMLHttpRequest::Notify(Status aStatus)
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
-  MOZ_ASSERT(mWorkerPrivate->GetJSContext() == aCx);
 
   if (aStatus >= Canceling && !mCanceled) {
     mCanceled = true;
     ReleaseProxy(WorkerIsGoingAway);
   }
 
   return true;
 }
--- a/dom/workers/XMLHttpRequest.h
+++ b/dom/workers/XMLHttpRequest.h
@@ -104,17 +104,17 @@ public:
 
     return Constructor(aGlobal, params, aRv);
   }
 
   void
   Unpin();
 
   bool
-  Notify(JSContext* aCx, Status aStatus) override;
+  Notify(Status aStatus) override;
 
   IMPL_EVENT_HANDLER(readystatechange)
 
   uint16_t
   ReadyState() const
   {
     return mStateData.mReadyState;
   }
new file mode 100644
--- /dev/null
+++ b/dom/workers/test/file_getcookie.sjs
@@ -0,0 +1,15 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+function handleRequest(request, response) {
+  try {
+    var cookie = request.getHeader("Cookie");
+  } catch (e) {
+    cookie = "EMPTY_COOKIE";
+  }
+
+  // avoid confusing cache behaviors.
+  response.setHeader("Cache-Control", "no-cache", false);
+  response.setHeader("Content-type", "text/plain", false);
+  response.setStatusLine(request.httpVersion, "200", "OK");
+  response.write(cookie);
+}
--- a/dom/workers/test/mochitest.ini
+++ b/dom/workers/test/mochitest.ini
@@ -20,16 +20,17 @@ support-files =
   csp_worker.js
   404_server.sjs
   errorPropagation_iframe.html
   errorPropagation_worker.js
   errorwarning_worker.js
   eventDispatch_worker.js
   fibonacci_worker.js
   file_bug1010784_worker.js
+  file_getcookie.sjs
   foreign.js
   importForeignScripts_worker.js
   importScripts_mixedcontent.html
   importScripts_worker.js
   importScripts_worker_imported1.js
   importScripts_worker_imported2.js
   importScripts_worker_imported3.js
   importScripts_worker_imported4.js
@@ -237,16 +238,17 @@ skip-if = buildapp == 'b2g' # no https o
 skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 982828
 [test_webSocket_sharedWorker.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 982828
 [test_worker_interfaces.html]
 [test_worker_performance_now.html]
 [test_workersDisabled.html]
 [test_xhr.html]
 [test_xhr2.html]
+[test_xhr_3rdparty.html]
 [test_xhr_headers.html]
 [test_xhr_implicit_cancel.html]
 [test_xhr_parameters.html]
 skip-if = buildapp == 'b2g'
 [test_xhr_responseURL.html]
 [test_xhr_system.html]
 [test_xhr_cors_redirect.html]
 skip-if = buildapp == 'b2g'
--- a/dom/workers/test/serviceworkers/test_match_all_client_id.html
+++ b/dom/workers/test/serviceworkers/test_match_all_client_id.html
@@ -29,16 +29,17 @@
       dump("Unregistering the SW failed with " + e + "\n");
     });
   }
 
   function getMessageListener() {
     return new Promise(function(res, rej) {
       window.onmessage = function(e) {
         ok(e.data, "Same client id for multiple calls.");
+        is(e.origin, "http://mochi.test:8888", "Event should have the correct origin");
 
         if (!e.data) {
           rej();
           return;
         }
 
         info("DONE from: " + e.source);
         res();
new file mode 100644
--- /dev/null
+++ b/dom/workers/test/test_xhr_3rdparty.html
@@ -0,0 +1,74 @@
+<!--
+  Any copyright is dedicated to the Public Domain.
+  http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<!--
+Tests of DOM Worker Threads XHR(Bug 450452 )
+-->
+<head>
+  <title>Test for DOM Worker Threads XHR (Bug 450452 )</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=450452">DOM Worker Threads XHR (Bug 450452)</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+  var worker = new Worker("xhr_worker.js");
+
+  var gotUploadLoad = false, gotLoadend = false;
+
+  worker.onmessage = function(event) {
+    is(event.target, worker);
+    var args = event.data;
+    switch (args.type) {
+      case "progress": {
+        ok(parseInt(args.current) <= parseInt(args.total));
+      } break;
+      case "error": {
+        ok(false, "XHR error: " + args.error);
+      } break;
+      case "upload.load": {
+        gotUploadLoad = true;
+      } break;
+      case "load": {
+        ok(gotUploadLoad, "Should have gotten upload load event");
+        gotLoadend = true;
+        is(args.data, "a=cookie_is_set", "correct data");
+        document.getElementById("content").textContent = args.data;
+      } break;
+      case "loadend": {
+        ok(gotLoadend, "Should have gotten load.");
+        SimpleTest.finish();
+        break;
+      }
+      default: {
+        ok(false, "Unexpected message");
+        SimpleTest.finish();
+      }
+    }
+  };
+
+  worker.onerror = function(event) {
+    is(event.target, worker);
+    ok(false, "Worker had an error:" + event.message);
+    SimpleTest.finish();
+  }
+
+  document.cookie = "a=cookie_is_set";
+  SpecialPowers.pushPrefEnv({ set: [[ "network.cookie.cookieBehavior", 1 ]] },
+                            () => worker.postMessage("file_getcookie.sjs"));
+
+  SimpleTest.waitForExplicitFinish();
+
+</script>
+</pre>
+</body>
+</html>
--- a/editor/libeditor/nsEditor.cpp
+++ b/editor/libeditor/nsEditor.cpp
@@ -2969,18 +2969,17 @@ already_AddRefed<nsIDOMNode>
 nsEditor::GetNodeLocation(nsIDOMNode* aChild, int32_t* outOffset)
 {
   MOZ_ASSERT(aChild && outOffset);
   NS_ENSURE_TRUE(aChild && outOffset, nullptr);
   *outOffset = -1;
 
   nsCOMPtr<nsIDOMNode> parent;
 
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    aChild->GetParentNode(getter_AddRefs(parent))));
+  MOZ_ALWAYS_SUCCEEDS(aChild->GetParentNode(getter_AddRefs(parent)));
   if (parent) {
     *outOffset = GetChildOffset(aChild, parent);
   }
 
   return parent.forget();
 }
 
 nsINode*
@@ -4143,51 +4142,47 @@ nsEditor::DeleteSelectionAndPrepareToCre
 }
 
 
 
 void
 nsEditor::DoAfterDoTransaction(nsITransaction *aTxn)
 {
   bool isTransientTransaction;
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    aTxn->GetIsTransient(&isTransientTransaction)));
+  MOZ_ALWAYS_SUCCEEDS(aTxn->GetIsTransient(&isTransientTransaction));
 
   if (!isTransientTransaction)
   {
     // we need to deal here with the case where the user saved after some
     // edits, then undid one or more times. Then, the undo count is -ve,
     // but we can't let a do take it back to zero. So we flip it up to
     // a +ve number.
     int32_t modCount;
     GetModificationCount(&modCount);
     if (modCount < 0)
       modCount = -modCount;
 
     // don't count transient transactions
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      IncrementModificationCount(1)));
+    MOZ_ALWAYS_SUCCEEDS(IncrementModificationCount(1));
   }
 }
 
 
 void
 nsEditor::DoAfterUndoTransaction()
 {
   // all undoable transactions are non-transient
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    IncrementModificationCount(-1)));
+  MOZ_ALWAYS_SUCCEEDS(IncrementModificationCount(-1));
 }
 
 void
 nsEditor::DoAfterRedoTransaction()
 {
   // all redoable transactions are non-transient
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    IncrementModificationCount(1)));
+  MOZ_ALWAYS_SUCCEEDS(IncrementModificationCount(1));
 }
 
 already_AddRefed<ChangeAttributeTxn>
 nsEditor::CreateTxnForSetAttribute(Element& aElement, nsIAtom& aAttribute,
                                    const nsAString& aValue)
 {
   RefPtr<ChangeAttributeTxn> txn =
     new ChangeAttributeTxn(aElement, aAttribute, &aValue);
--- a/editor/libeditor/nsHTMLCSSUtils.cpp
+++ b/editor/libeditor/nsHTMLCSSUtils.cpp
@@ -504,18 +504,18 @@ nsHTMLCSSUtils::GetCSSInlinePropertyBase
   NS_ENSURE_TRUE(element, NS_ERROR_NULL_POINTER);
 
   if (aStyleType == eComputed) {
     // Get the all the computed css styles attached to the element node
     RefPtr<nsComputedDOMStyle> cssDecl = GetComputedStyle(element);
     NS_ENSURE_STATE(cssDecl);
 
     // from these declarations, get the one we want and that one only
-    MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-      cssDecl->GetPropertyValue(nsDependentAtomString(aProperty), aValue)));
+    MOZ_ALWAYS_SUCCEEDS(
+      cssDecl->GetPropertyValue(nsDependentAtomString(aProperty), aValue));
 
     return NS_OK;
   }
 
   MOZ_ASSERT(aStyleType == eSpecified);
   RefPtr<css::Declaration> decl = element->GetInlineStyleDeclaration();
   if (!decl) {
     return NS_OK;
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -575,17 +575,17 @@ IsExpandedPrincipal(nsIPrincipal* aPrinc
 }
 
 } // namespace
 
 ////////////////////////////////////////////////////////////////////////////////
 
 nsPermissionManager::PermissionKey::PermissionKey(nsIPrincipal* aPrincipal)
 {
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aPrincipal->GetOrigin(mOrigin)));
+  MOZ_ALWAYS_SUCCEEDS(aPrincipal->GetOrigin(mOrigin));
 }
 
 /**
  * Simple callback used by |AsyncClose| to trigger a treatment once
  * the database is closed.
  *
  * Note: Beware that, if you hold onto a |CloseDatabaseListener| from a
  * |nsPermissionManager|, this will create a cycle.
--- a/gfx/2d/2D.h
+++ b/gfx/2d/2D.h
@@ -1368,17 +1368,21 @@ public:
   static already_AddRefed<DrawTarget> CreateDrawTargetForCairoCGContext(CGContextRef cg, const IntSize& aSize);
   static already_AddRefed<GlyphRenderingOptions>
     CreateCGGlyphRenderingOptions(const Color &aFontSmoothingBackgroundColor);
 #endif
 
 #ifdef WIN32
   static already_AddRefed<DrawTarget> CreateDrawTargetForD3D11Texture(ID3D11Texture2D *aTexture, SurfaceFormat aFormat);
 
-  static void SetDirect3D11Device(ID3D11Device *aDevice);
+  /*
+   * Attempts to create and install a D2D1 device from the supplied Direct3D11 device.
+   * Returns true on success, or false on failure and leaves the D2D1/Direct3D11 devices unset.
+   */
+  static bool SetDirect3D11Device(ID3D11Device *aDevice);
   static ID3D11Device *GetDirect3D11Device();
   static ID2D1Device *GetD2D1Device();
   static bool SupportsD2D1();
 
   static already_AddRefed<GlyphRenderingOptions>
     CreateDWriteGlyphRenderingOptions(IDWriteRenderingParams *aParams);
 
   static uint64_t GetD2DVRAMUsageDrawTarget();
--- a/gfx/2d/Factory.cpp
+++ b/gfx/2d/Factory.cpp
@@ -618,38 +618,43 @@ Factory::CreateDrawTargetForD3D11Texture
   }
 
   gfxWarning() << "Failed to create draw target for D3D11 texture.";
 
   // Failed
   return nullptr;
 }
 
-void
+bool
 Factory::SetDirect3D11Device(ID3D11Device *aDevice)
 {
   mD3D11Device = aDevice;
 
   if (mD2D1Device) {
     mD2D1Device->Release();
     mD2D1Device = nullptr;
   }
 
   if (!aDevice) {
-    return;
+    return true;
   }
 
   RefPtr<ID2D1Factory1> factory = D2DFactory1();
 
   RefPtr<IDXGIDevice> device;
   aDevice->QueryInterface((IDXGIDevice**)getter_AddRefs(device));
   HRESULT hr = factory->CreateDevice(device, &mD2D1Device);
   if (FAILED(hr)) {
     gfxCriticalError() << "[D2D1] Failed to create gfx factory's D2D1 device, code: " << hexa(hr);
+
+    mD3D11Device = nullptr;
+    return false;
   }
+
+  return true;
 }
 
 ID3D11Device*
 Factory::GetDirect3D11Device()
 {
   return mD3D11Device;
 }
 
--- a/gfx/2d/convolver.h
+++ b/gfx/2d/convolver.h
@@ -28,17 +28,16 @@
 
 #ifndef SKIA_EXT_CONVOLVER_H_
 #define SKIA_EXT_CONVOLVER_H_
 
 #include <cmath>
 #include <vector>
 
 #include "base/basictypes.h"
-#include "base/cpu.h"
 #include "mozilla/Assertions.h"
 #include "skia/include/core/SkTypes.h"
 
 // avoid confusion with Mac OS X's math library (Carbon)
 #if defined(__APPLE__)
 #undef FloatToFixed
 #undef FixedToFloat
 #endif
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1990,16 +1990,20 @@ nsEventStatus AsyncPanZoomController::On
   }
   if (!overscrollHandoffChain->CanScrollInDirection(this, Layer::VERTICAL)) {
     mY.SetVelocity(0);
   }
 
   SetState(NOTHING);
   RequestContentRepaint();
 
+  if (!aEvent.mFollowedByMomentum) {
+    RequestSnap();
+  }
+
   return nsEventStatus_eConsumeNoDefault;
 }
 
 nsEventStatus AsyncPanZoomController::OnPanMomentumStart(const PanGestureInput& aEvent) {
   APZC_LOG("%p got a pan-momentumstart in state %d\n", this, mState);
 
   if (mState == SMOOTH_SCROLL) {
     // SMOOTH_SCROLL scrolls are cancelled by pan gestures.
--- a/gfx/layers/d3d9/CompositorD3D9.cpp
+++ b/gfx/layers/d3d9/CompositorD3D9.cpp
@@ -665,17 +665,19 @@ CompositorD3D9::Ready()
 }
 
 void
 CompositorD3D9::FailedToResetDevice() {
   mFailedResetAttempts += 1;
   // 10 is a totally arbitrary number that we may want to increase or decrease
   // depending on how things behave in the wild.
   if (mFailedResetAttempts > 10) {
-    MOZ_CRASH("GFX: Unable to get a working D3D9 Compositor");
+    mFailedResetAttempts = 0;
+    gfxWindowsPlatform::GetPlatform()->D3D9DeviceReset();
+    gfxWarning() << "[D3D9] Unable to get a working D3D9 Compositor";
   }
 }
 
 void
 CompositorD3D9::BeginFrame(const nsIntRegion& aInvalidRegion,
                            const Rect *aClipRectIn,
                            const Rect& aRenderBounds,
                            bool aOpaque,
--- a/gfx/layers/d3d9/TextureD3D9.cpp
+++ b/gfx/layers/d3d9/TextureD3D9.cpp
@@ -336,17 +336,17 @@ DataTextureSourceD3D9::Update(gfx::DataS
   MOZ_ASSERT(!aSrcOffset);
 
   if (!mCompositor || !mCompositor->device()) {
     NS_WARNING("No D3D device to update the texture.");
     return false;
   }
 
   uint32_t bpp = BytesPerPixel(aSurface->GetFormat());
-  DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
+  RefPtr<DeviceManagerD3D9> deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
 
   mSize = aSurface->GetSize();
   mFormat = aSurface->GetFormat();
 
   _D3DFORMAT format = D3DFMT_A8R8G8B8;
   switch (mFormat) {
   case SurfaceFormat::B8G8R8X8:
     format = D3DFMT_X8R8G8B8;
@@ -563,17 +563,17 @@ D3D9TextureData::~D3D9TextureData()
   MOZ_COUNT_DTOR(D3D9TextureData);
 }
 
 D3D9TextureData*
 D3D9TextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
                         TextureAllocationFlags aAllocFlags)
 {
   _D3DFORMAT format = SurfaceFormatToD3D9Format(aFormat);
-  DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
+  RefPtr<DeviceManagerD3D9> deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
   RefPtr<IDirect3DTexture9> d3d9Texture = deviceManager ? deviceManager->CreateTexture(aSize, format,
                                                                                        D3DPOOL_SYSTEMMEM,
                                                                                        nullptr)
                                                         : nullptr;
   if (!d3d9Texture) {
     NS_WARNING("Could not create a d3d9 texture");
     return nullptr;
   }
@@ -825,17 +825,17 @@ DataTextureSourceD3D9::UpdateFromTexture
     // If we changed the compositor, the size might have been reset to zero
     // Otherwise the texture size must not change.
     MOZ_ASSERT(mFormat == D3D9FormatToSurfaceFormat(desc.Format));
     MOZ_ASSERT(!mSize.width || mSize.width == desc.Width);
     MOZ_ASSERT(!mSize.height || mSize.height == desc.Height);
     mSize = IntSize(desc.Width, desc.Height);
   }
 
-  DeviceManagerD3D9* dm = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
+  RefPtr<DeviceManagerD3D9> dm = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
   if (!dm || !dm->device()) {
     return false;
   }
 
   if (!mTexture) {
     mTexture = dm->CreateTexture(mSize, SurfaceFormatToD3D9Format(mFormat),
                                  D3DPOOL_DEFAULT, this);
     if (!mTexture) {
@@ -899,17 +899,17 @@ TextureHostD3D9::UpdatedInternal(const n
                                                nullptr, mFlags);
     if (mFlags & TextureFlags::COMPONENT_ALPHA) {
       // Update the full region the first time for component alpha textures.
       regionToUpdate = nullptr;
     }
   }
 
   if (!mTextureSource->UpdateFromTexture(mTexture, regionToUpdate)) {
-    gfxCriticalError() << "[D3D9] DataTextureSourceD3D9::UpdateFromTexture failed";
+    gfxWarning() << "[D3D9] DataTextureSourceD3D9::UpdateFromTexture failed";
   }
 }
 
 IDirect3DDevice9*
 TextureHostD3D9::GetDevice()
 {
   if (mFlags & TextureFlags::INVALID_COMPOSITOR) {
     return nullptr;
--- a/gfx/layers/d3d9/TextureD3D9.h
+++ b/gfx/layers/d3d9/TextureD3D9.h
@@ -78,17 +78,17 @@ protected:
     _D3DFORMAT aFormat);
 
   gfx::IntSize mSize;
 
   // Linked list of all objects holding d3d9 textures.
   TextureSourceD3D9* mPreviousHost;
   TextureSourceD3D9* mNextHost;
   // The device manager that created our textures.
-  DeviceManagerD3D9* mCreatingDeviceManager;
+  RefPtr<DeviceManagerD3D9> mCreatingDeviceManager;
 
   StereoMode mStereoMode;
   RefPtr<IDirect3DTexture9> mTexture;
 };
 
 /**
  * A TextureSource that implements the DataTextureSource interface.
  * it can be used without a TextureHost and is able to upload texture data
--- a/gfx/thebes/gfxEnv.h
+++ b/gfx/thebes/gfxEnv.h
@@ -43,16 +43,20 @@ public:
   DECL_GFX_ENV_LIVE("MOZ_DEBUG_SHADERS", DebugShaders);
 
   // Disabling context sharing in GLContextProviderGLX
   DECL_GFX_ENV_ONCE("MOZ_DISABLE_CONTEXT_SHARING_GLX", DisableContextSharingGlx);
 
   // Disabling the crash guard in DriverCrashGuard
   DECL_GFX_ENV_ONCE("MOZ_DISABLE_CRASH_GUARD", DisableCrashGuard);
 
+  // We force present to work around some Windows bugs - disable that if this
+  // environment variable is set.
+  DECL_GFX_ENV_ONCE("MOZ_DISABLE_FORCE_PRESENT", DisableForcePresent);
+
   // Together with paint dumping, only when MOZ_DUMP_PAINTING is defined.
   // Dumping compositor textures is broken pretty badly. For example,
   // on Linux it crashes TextureHost::GetAsSurface() returns null.
   // Expect to have to fix things like this if you turn it on.
   // Meanwhile, content-side texture dumping
   // (conditioned on DebugDumpPainting()) is a good replacement.
   DECL_GFX_ENV_ONCE("MOZ_DUMP_COMPOSITOR_TEXTURES", DumpCompositorTextures);
 
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -372,16 +372,17 @@ gfxWindowsPlatform::gfxWindowsPlatform()
   , mDeviceLock("gfxWindowsPlatform.mDeviceLock")
   , mIsWARP(false)
   , mHasDeviceReset(false)
   , mHasFakeDeviceReset(false)
   , mCompositorD3D11TextureSharingWorks(false)
   , mAcceleration(FeatureStatus::Unused)
   , mD3D11Status(FeatureStatus::Unused)
   , mD2D1Status(FeatureStatus::Unused)
+  , mHasD3D9DeviceReset(false)
 {
     mUseClearTypeForDownloadableFonts = UNINITIALIZED_VALUE;
     mUseClearTypeAlways = UNINITIALIZED_VALUE;
 
     /* 
      * Initialize COM 
      */ 
     CoInitialize(nullptr); 
@@ -478,16 +479,17 @@ gfxWindowsPlatform::HandleDeviceReset()
   // Remove devices and adapters.
   ResetD3D11Devices();
   mAdapter = nullptr;
 
   // Reset local state. Note: we leave feature status variables as-is. They
   // will be recomputed by InitializeDevices().
   mHasDeviceReset = false;
   mHasFakeDeviceReset = false;
+  mHasD3D9DeviceReset = false;
   mCompositorD3D11TextureSharingWorks = false;
   mDeviceResetReason = DeviceResetReason::OK;
 
   imgLoader::Singleton()->ClearCache(true);
   imgLoader::Singleton()->ClearCache(false);
   gfxAlphaBoxBlur::ShutdownBlurCache();
 
   // Since we got a device reset, we must ask the parent process for an updated
@@ -991,16 +993,19 @@ gfxWindowsPlatform::DidRenderingDeviceRe
     }
   }
   if (mD3D11ContentDevice) {
     HRESULT hr = mD3D11ContentDevice->GetDeviceRemovedReason();
     if (IsDeviceReset(hr, aResetReason)) {
       return true;
     }
   }
+  if (mHasD3D9DeviceReset) {
+    return true;
+  }
   if (XRE_IsParentProcess() && gfxPrefs::DeviceResetForTesting()) {
     TestDeviceReset((DeviceResetReason)gfxPrefs::DeviceResetForTesting());
     if (aResetReason) {
       *aResetReason = mDeviceResetReason;
     }
     gfxPrefs::SetDeviceResetForTesting(0);
     return true;
   }
@@ -1376,43 +1381,52 @@ gfxWindowsPlatform::SetupClearTypeParams
             getter_AddRefs(mRenderingParams[TEXT_RENDERING_GDI_CLASSIC]));
     }
 }
 
 void
 gfxWindowsPlatform::OnDeviceManagerDestroy(DeviceManagerD3D9* aDeviceManager)
 {
   if (aDeviceManager == mDeviceManager) {
+    MutexAutoLock lock(mDeviceLock);
     mDeviceManager = nullptr;
   }
 }
 
 IDirect3DDevice9*
 gfxWindowsPlatform::GetD3D9Device()
 {
-  DeviceManagerD3D9* manager = GetD3D9DeviceManager();
+  RefPtr<DeviceManagerD3D9> manager = GetD3D9DeviceManager();
   return manager ? manager->device() : nullptr;
 }
 
-DeviceManagerD3D9*
+void
+gfxWindowsPlatform::D3D9DeviceReset() {
+  mHasD3D9DeviceReset = true;
+}
+
+already_AddRefed<DeviceManagerD3D9>
 gfxWindowsPlatform::GetD3D9DeviceManager()
 {
   // We should only create the d3d9 device on the compositor thread
   // or we don't have a compositor thread.
+  RefPtr<DeviceManagerD3D9> result;
   if (!mDeviceManager &&
       (!gfxPlatform::UsesOffMainThreadCompositing() ||
        CompositorBridgeParent::IsInCompositorThread())) {
     mDeviceManager = new DeviceManagerD3D9();
     if (!mDeviceManager->Init()) {
       gfxCriticalError() << "[D3D9] Could not Initialize the DeviceManagerD3D9";
       mDeviceManager = nullptr;
     }
   }
 
-  return mDeviceManager;
+  MutexAutoLock lock(mDeviceLock);
+  result = mDeviceManager;
+  return result.forget();
 }
 
 bool
 gfxWindowsPlatform::GetD3D11Device(RefPtr<ID3D11Device>* aOutDevice)
 {
   MutexAutoLock lock(mDeviceLock);
   *aOutDevice = mD3D11Device;
   return !!mD3D11Device;
@@ -2512,18 +2526,21 @@ gfxWindowsPlatform::InitializeD2D()
   }
 
   // Using Direct2D depends on DWrite support.
   if (!mDWriteFactory && !InitDWriteSupport()) {
     mD2D1Status = FeatureStatus::Failed;
     return;
   }
 
-  mD2D1Status = FeatureStatus::Available;
-  Factory::SetDirect3D11Device(mD3D11ContentDevice);
+  // Verify that Direct2D device creation succeeded.
+  if (!Factory::SetDirect3D11Device(mD3D11ContentDevice)) {
+    mD2D1Status = FeatureStatus::Failed;
+    return;
+  }
 
   d2d1_1.SetSuccessful();
 
   mD2D1Status = FeatureStatus::Available;
 }
 
 bool
 gfxWindowsPlatform::CreateD3D11DecoderDeviceHelper(
--- a/gfx/thebes/gfxWindowsPlatform.h
+++ b/gfx/thebes/gfxWindowsPlatform.h
@@ -205,18 +205,19 @@ public:
     IDWriteRenderingParams *GetRenderingParams(TextRenderingMode aRenderMode)
     { return mRenderingParams[aRenderMode]; }
 
     bool GetD3D11Device(RefPtr<ID3D11Device>* aOutDevice);
     bool GetD3D11DeviceForCurrentThread(RefPtr<ID3D11Device>* aOutDevice);
     bool GetD3D11ImageBridgeDevice(RefPtr<ID3D11Device>* aOutDevice);
 
     void OnDeviceManagerDestroy(mozilla::layers::DeviceManagerD3D9* aDeviceManager);
-    mozilla::layers::DeviceManagerD3D9* GetD3D9DeviceManager();
+    already_AddRefed<mozilla::layers::DeviceManagerD3D9> GetD3D9DeviceManager();
     IDirect3DDevice9* GetD3D9Device();
+    void D3D9DeviceReset();
     ID3D11Device *GetD3D11ContentDevice();
 
     // Create a D3D11 device to be used for DXVA decoding.
     already_AddRefed<ID3D11Device> CreateD3D11DecoderDevice();
     bool CreateD3D11DecoderDeviceHelper(
       IDXGIAdapter1* aAdapter, RefPtr<ID3D11Device>& aDevice,
       HRESULT& aResOut);
 
@@ -328,16 +329,17 @@ private:
     RefPtr<ID3D11Device> mD3D11Device;
     RefPtr<ID3D11Device> mD3D11ContentDevice;
     RefPtr<ID3D11Device> mD3D11ImageBridgeDevice;
     RefPtr<mozilla::layers::DeviceManagerD3D9> mDeviceManager;
     bool mIsWARP;
     bool mHasDeviceReset;
     bool mHasFakeDeviceReset;
     bool mCompositorD3D11TextureSharingWorks;
+    mozilla::Atomic<bool> mHasD3D9DeviceReset;
     DeviceResetReason mDeviceResetReason;
 
     RefPtr<mozilla::layers::ReadbackManagerD3D11> mD3D11ReadbackManager;
 
     // These should not be accessed directly. Use the Get[Feature]Status
     // accessors instead.
     mozilla::gfx::FeatureStatus mAcceleration;
     mozilla::gfx::FeatureStatus mD3D11Status;
--- a/hal/gonk/UeventPoller.cpp
+++ b/hal/gonk/UeventPoller.cpp
@@ -242,18 +242,18 @@ public:
       ShutdownNetlinkPoller* shutdownPoller = new ShutdownNetlinkPoller();
 
       nsCOMPtr<nsIRunnable> 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)));
+      MOZ_ALWAYS_SUCCEEDS(
+        NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL));
     }
   }
 private:
   ShutdownNetlinkPoller() = default;
   static void ShutdownUeventIOThread()
   {
     MonitorAutoLock l(*sMonitor);
     ShutdownUevent(); // Must run on the IO thread.
--- a/ipc/chromium/moz.build
+++ b/ipc/chromium/moz.build
@@ -4,67 +4,62 @@
 # 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/.
 
 libevent_path_prefix = 'src/third_party'
 include(libevent_path_prefix + '/libeventcommon.mozbuild')
 
 UNIFIED_SOURCES += [
     'src/base/at_exit.cc',
-    'src/base/base_switches.cc',
     'src/base/command_line.cc',
     'src/base/file_path.cc',
     'src/base/file_util.cc',
     'src/base/histogram.cc',
     'src/base/lock.cc',
     'src/base/logging.cc',
     'src/base/message_loop.cc',
     'src/base/message_pump_default.cc',
     'src/base/non_thread_safe.cc',
     'src/base/pickle.cc',
     'src/base/rand_util.cc',
     'src/base/revocable_store.cc',
     'src/base/string_piece.cc',
     'src/base/string_util.cc',
     'src/base/thread.cc',
-    'src/base/thread_collision_warner.cc',
     'src/base/time.cc',
     'src/base/timer.cc',
     'src/base/tracked.cc',
     'src/base/tracked_objects.cc',
     'src/chrome/common/child_process.cc',
     'src/chrome/common/child_process_host.cc',
     'src/chrome/common/child_process_info.cc',
     'src/chrome/common/child_thread.cc',
     'src/chrome/common/chrome_switches.cc',
-    'src/chrome/common/env_vars.cc',
     'src/chrome/common/ipc_channel.cc',
     'src/chrome/common/ipc_channel_proxy.cc',
     'src/chrome/common/ipc_message.cc',
     'src/chrome/common/ipc_sync_channel.cc',
     'src/chrome/common/ipc_sync_message.cc',
     'src/chrome/common/message_router.cc',
     'src/chrome/common/notification_service.cc',
 ]
 
 if os_win:
     SOURCES += [
         'src/base/condition_variable_win.cc',
         'src/base/cpu.cc',
         'src/base/file_util_win.cc',
-        'src/base/idle_timer.cc',
         'src/base/lock_impl_win.cc',
         'src/base/message_pump_win.cc',
         'src/base/object_watcher.cc',
         'src/base/platform_file_win.cc',
         'src/base/platform_thread_win.cc',
         'src/base/process_util_win.cc',
         'src/base/process_win.cc',
         'src/base/rand_util_win.cc',
-        'src/base/registry.cc',
         'src/base/shared_memory_win.cc',
         'src/base/sys_info_win.cc',
         'src/base/sys_string_conversions_win.cc',
         'src/base/thread_local_storage_win.cc',
         'src/base/thread_local_win.cc',
         'src/base/time_win.cc',
         'src/base/waitable_event_watcher_win.cc',
         'src/base/waitable_event_win.cc',
@@ -99,17 +94,16 @@ if os_posix:
         'src/chrome/common/ipc_channel_posix.cc',
         'src/chrome/common/process_watcher_posix_sigchld.cc',
     ]
 
 if os_macosx:
     UNIFIED_SOURCES += [
         'src/base/chrome_application_mac.mm',
         'src/base/file_util_mac.mm',
-        'src/base/idle_timer.cc',
         'src/base/mac_util.mm',
         'src/base/message_pump_mac.mm',
         'src/base/process_util_mac.mm',
         'src/base/scoped_nsautorelease_pool.mm',
         'src/base/sys_info_mac.cc',
         'src/base/sys_string_conversions_mac.mm',
         'src/base/time_mac.cc',
         'src/chrome/common/mach_ipc_mac.mm',
@@ -134,17 +128,16 @@ if os_bsd:
     else:
         SOURCES += [
             'src/base/process_util_bsd.cc'
         ]
 
 if os_linux:
     SOURCES += [
         'src/base/atomicops_internals_x86_gcc.cc',
-        'src/base/idle_timer_none.cc',
         'src/base/process_util_linux.cc',
         'src/base/time_posix.cc',
     ]
     if CONFIG['OS_TARGET'] == 'Android':
         UNIFIED_SOURCES += [
             'src/base/message_pump_android.cc',
         ]
         DEFINES['ANDROID'] = True
deleted file mode 100644
--- a/ipc/chromium/src/base/base_switches.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/base_switches.h"
-
-namespace switches {
-
-// If the program includes chrome/common/debug_on_start.h, the process will
-// start the JIT system-registered debugger on itself and will wait for 60
-// seconds for the debugger to attach to itself. Then a break point will be hit.
-const wchar_t kDebugOnStart[]                  = L"debug-on-start";
-
-// Will wait for 60 seconds for a debugger to come to attach to the process.
-const wchar_t kWaitForDebugger[]               = L"wait-for-debugger";
-
-// Suppresses all error dialogs when present.
-const wchar_t kNoErrorDialogs[]                = L"noerrdialogs";
-
-// Disables the crash reporting.
-const wchar_t kDisableBreakpad[]               = L"disable-breakpad";
-
-// Generates full memory crash dump.
-const wchar_t kFullMemoryCrashReport[]         = L"full-memory-crash-report";
-
-// The value of this switch determines whether the process is started as a
-// renderer or plugin host.  If it's empty, it's the browser.
-const wchar_t kProcessType[]                   = L"type";
-
-// Enable DCHECKs in release mode.
-const wchar_t kEnableDCHECK[]                  = L"enable-dcheck";
-
-// Refuse to make HTTP connections and refuse to accept certificate errors.
-// For more information about the design of this feature, please see
-//
-//   ForceHTTPS: Protecting High-Security Web Sites from Network Attacks
-//   Collin Jackson and Adam Barth
-//   In Proc. of the 17th International World Wide Web Conference (WWW 2008)
-//
-// Available at http://www.adambarth.com/papers/2008/jackson-barth.pdf
-const wchar_t kForceHTTPS[]                    = L"force-https";
-
-}  // namespace switches
deleted file mode 100644
--- a/ipc/chromium/src/base/base_switches.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Defines all the "base" command-line switches.
-
-#ifndef BASE_BASE_SWITCHES_H_
-#define BASE_BASE_SWITCHES_H_
-
-#if defined(COMPILER_MSVC)
-#include <string.h>
-#endif
-
-namespace switches {
-
-extern const wchar_t kDebugOnStart[];
-extern const wchar_t kWaitForDebugger[];
-extern const wchar_t kDisableBreakpad[];
-extern const wchar_t kFullMemoryCrashReport[];
-extern const wchar_t kNoErrorDialogs[];
-extern const wchar_t kProcessType[];
-extern const wchar_t kEnableDCHECK[];
-extern const wchar_t kForceHTTPS[];
-
-}  // namespace switches
-
-#endif  // BASE_BASE_SWITCHES_H_
deleted file mode 100644
--- a/ipc/chromium/src/base/idle_timer.cc
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/idle_timer.h"
-
-// We may not want to port idle_timer to Linux, but we have implemented it
-// anyway.  Define this to 1 to enable the Linux idle timer and then add the
-// libs that need to be linked (Xss).
-#define ENABLE_XSS_SUPPORT 0
-
-#if defined(OS_MACOSX)
-#include <ApplicationServices/ApplicationServices.h>
-#endif
-
-#if defined(OS_LINUX) && ENABLE_XSS_SUPPORT
-// We may not want to port idle_timer to Linux, but we have implemented it
-// anyway.  Remove the 0 above if we want it.
-#include <gdk/gdkx.h>
-#include <X11/extensions/scrnsaver.h>
-#include "base/thread_local.h"
-#endif
-
-#include "base/message_loop.h"
-#include "base/time.h"
-
-namespace base {
-
-#if defined(OS_WIN)
-bool OSIdleTimeSource(int32_t *milliseconds_interval_since_last_event) {
-  LASTINPUTINFO lastInputInfo;
-  lastInputInfo.cbSize = sizeof(lastInputInfo);
-  if (GetLastInputInfo(&lastInputInfo) == 0) {
-    return false;
-  }
-  int32_t last_input_time = lastInputInfo.dwTime;
-
-  // Note: On Windows GetLastInputInfo returns a 32bit value which rolls over
-  // ~49days.
-  int32_t current_time = GetTickCount();
-  int32_t delta = current_time - last_input_time;
-  // delta will go negative if we've been idle for 2GB of ticks.
-  if (delta < 0)
-    delta = -delta;
-  *milliseconds_interval_since_last_event = delta;
-  return true;
-}
-#elif defined(OS_MACOSX)
-bool OSIdleTimeSource(int32_t *milliseconds_interval_since_last_event) {
-  *milliseconds_interval_since_last_event =
-      CGEventSourceSecondsSinceLastEventType(
-          kCGEventSourceStateCombinedSessionState,
-          kCGAnyInputEventType) * 1000.0;
-  return true;
-}
-#elif defined(OS_LINUX) && ENABLE_XSS_SUPPORT
-class IdleState {
- public:
-  IdleState() {
-    int event_base, error_base;
-    have_idle_info_ = XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base,
-                                                 &error_base);
-    if (have_idle_info_)
-      idle_info_.Set(XScreenSaverAllocInfo());
-  }
-
-  ~IdleState() {
-    if (idle_info_.Get()) {
-      XFree(idle_info_.Get());
-      idle_info_.~ThreadLocalPointer();
-    }
-  }
-
-  int32_t IdleTime() {
-    if (have_idle_info_ && idle_info_.Get()) {
-      XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
-                            idle_info_.Get());
-      return idle_info_.Get()->idle;
-    }
-    return -1;
-  }
-
- private:
-  bool have_idle_info_;
-  ThreadLocalPointer<XScreenSaverInfo> idle_info_;
-
-  DISALLOW_COPY_AND_ASSIGN(IdleState);
-};
-
-bool OSIdleTimeSource(int32_t* milliseconds_interval_since_last_event) {
-  static IdleState state;
-  int32_t idle_time = state.IdleTime();
-  if (0 < idle_time) {
-    *milliseconds_interval_since_last_event = idle_time;
-    return true;
-  }
-  return false;
-}
-#endif
-
-IdleTimer::IdleTimer(TimeDelta idle_time, bool repeat)
-    : idle_interval_(idle_time),
-      repeat_(repeat),
-      idle_time_source_(OSIdleTimeSource) {
-  DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()) <<
-      "Requires a thread that processes Windows UI events";
-}
-
-IdleTimer::~IdleTimer() {
-  Stop();
-}
-
-void IdleTimer::Start() {
-  StartTimer();
-}
-
-void IdleTimer::Stop() {
-  timer_.Stop();
-}
-
-void IdleTimer::Run() {
-  // Verify we can fire the idle timer.
-  if (TimeUntilIdle().InMilliseconds() <= 0) {
-    OnIdle();
-    last_time_fired_ = Time::Now();
-  }
-  Stop();
-  StartTimer();  // Restart the timer for next run.
-}
-
-void IdleTimer::StartTimer() {
-  DCHECK(!timer_.IsRunning());
-  TimeDelta delay = TimeUntilIdle();
-  if (delay.InMilliseconds() < 0)
-    delay = TimeDelta();
-  timer_.Start(delay, this, &IdleTimer::Run);
-}
-
-TimeDelta IdleTimer::CurrentIdleTime() {
-  int32_t interval = 0;
-  if (idle_time_source_(&interval)) {
-    return TimeDelta::FromMilliseconds(interval);
-  }
-  NOTREACHED();
-  return TimeDelta::FromMilliseconds(0);
-}
-
-TimeDelta IdleTimer::TimeUntilIdle() {
-  TimeDelta time_since_last_fire = Time::Now() - last_time_fired_;
-  TimeDelta current_idle_time = CurrentIdleTime();
-  if (current_idle_time > time_since_last_fire) {
-    if (repeat_)
-      return idle_interval_ - time_since_last_fire;
-    return idle_interval_;
-  }
-  return idle_interval_ - current_idle_time;
-}
-
-}  // namespace base
deleted file mode 100644
--- a/ipc/chromium/src/base/idle_timer.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// IdleTimer is a recurring Timer which runs only when the system is idle.
-// System Idle time is defined as not having any user keyboard or mouse
-// activity for some period of time.  Because the timer is user dependant, it
-// is possible for the timer to never fire.
-//
-// Usage should be for low-priority work, and may look like this:
-//
-//   class MyIdleTimer : public IdleTimer {
-//    public:
-//     // This timer will run repeatedly after 5 seconds of idle time
-//     MyIdleTimer() : IdleTimer(TimeDelta::FromSeconds(5), true) {};
-//     virtual void OnIdle() { do something };
-//   }
-//
-//   MyIdleTimer *timer = new MyIdleTimer();
-//   timer->Start();
-//
-//   // As with all Timers, the caller must dispose the object.
-//   delete timer;  // Will Stop the timer and cleanup.
-//
-// NOTE: An IdleTimer can only be used on a thread that processes UI events.
-// Such a thread should be running a MessageLoopForUI.
-
-#ifndef BASE_IDLE_TIMER_H_
-#define BASE_IDLE_TIMER_H_
-
-#if defined(OS_WIN)
-#include <windows.h>
-#endif
-
-#include "base/basictypes.h"
-#include "base/task.h"
-#include "base/timer.h"
-
-namespace base {
-
-// Function prototype - Get the number of milliseconds that the user has been
-// idle.
-typedef bool (*IdleTimeSource)(int32_t *milliseconds_interval_since_last_event);
-
-class IdleTimer {
- public:
-  // Create an IdleTimer.
-  // idle_time: idle time required before this timer can run.
-  // repeat: true if the timer should fire multiple times per idle,
-  //         false to fire once per idle.
-  IdleTimer(TimeDelta idle_time, bool repeat);
-
-  // On destruction, the IdleTimer will Stop itself.
-  virtual ~IdleTimer();
-
-  // Start the IdleTimer.
-  void Start();
-
-  // Stop the IdleTimer.
-  void Stop();
-
-  // The method to run when the timer elapses.
-  virtual void OnIdle() = 0;
-
- protected:
-  // Override the IdleTimeSource.
-  void set_idle_time_source(IdleTimeSource idle_time_source) {
-    idle_time_source_ = idle_time_source;
-  }
-
- private:
-  // Called when timer_ expires.
-  void Run();
-
-  // Start the timer.
-  void StartTimer();
-
-  // Gets the number of milliseconds since the last input event.
-  TimeDelta CurrentIdleTime();
-
-  // Compute time until idle.  Returns 0 if we are now idle.
-  TimeDelta TimeUntilIdle();
-
-  TimeDelta idle_interval_;
-  bool repeat_;
-  Time last_time_fired_;  // The last time the idle timer fired.
-                          // will be 0 until the timer fires the first time.
-  OneShotTimer<IdleTimer> timer_;
-
-  IdleTimeSource idle_time_source_;
-
-  DISALLOW_COPY_AND_ASSIGN(IdleTimer);
-};
-
-}  // namespace base
-
-#endif  // BASE_IDLE_TIMER_H_
deleted file mode 100644
--- a/ipc/chromium/src/base/idle_timer_none.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// A stub implementation of IdleTimer used to provide symbols needed by Chrome.
-// It's unclear whether we need the idle timer in the linux port, so we're
-// leaving it unported for now.
-
-#include "base/idle_timer.h"
-
-namespace base {
-
-IdleTimer::IdleTimer(TimeDelta idle_time, bool repeat) {
-}
-
-IdleTimer::~IdleTimer() {
-}
-
-void IdleTimer::Start() {
-}
-
-void IdleTimer::Stop() {
-}
-
-}  // namespace base
deleted file mode 100644
--- a/ipc/chromium/src/base/linux_util.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_LINUX_UTIL_H__
-#define BASE_LINUX_UTIL_H__
-
-#include <stdint.h>
-
-namespace base {
-
-// Makes a copy of |pixels| with the ordering changed from BGRA to RGBA.
-// The caller is responsible for free()ing the data. If |stride| is 0,
-// it's assumed to be 4 * |width|.
-uint8_t* BGRAToRGBA(const uint8_t* pixels, int width, int height, int stride);
-
-}  // namespace base
-
-#endif  // BASE_LINUX_UTIL_H__
--- a/ipc/chromium/src/base/message_loop.cc
+++ b/ipc/chromium/src/base/message_loop.cc
@@ -101,17 +101,17 @@ MessageLoop::MessageLoop(Type type)
 #endif  // OS_WIN
       transient_hang_timeout_(0),
       permanent_hang_timeout_(0),
       next_sequence_num_(0) {
   DCHECK(!current()) << "should only have one message loop per thread";
   get_tls_ptr().Set(this);
 
   switch (type_) {
-  case TYPE_MOZILLA_UI:
+  case TYPE_MOZILLA_PARENT:
     pump_ = new mozilla::ipc::MessagePump();
     return;
   case TYPE_MOZILLA_CHILD:
     pump_ = new mozilla::ipc::MessagePumpForChildProcess();
     // There is a MessageLoop Run call from XRE_InitChildProcess
     // and another one from MessagePumpForChildProcess. The one
     // from MessagePumpForChildProcess becomes the base, so we need
     // to set run_depth_base_ to 2 or we'll never be able to process
--- a/ipc/chromium/src/base/message_loop.h
+++ b/ipc/chromium/src/base/message_loop.h
@@ -194,34 +194,34 @@ public:
   // TYPE_IO
   //   This type of ML also supports asynchronous IO.  See also
   //   MessageLoopForIO.
   //
   // TYPE_MOZILLA_CHILD
   //   This type of ML is used in Mozilla child processes which initialize
   //   XPCOM and use the gecko event loop.
   //
-  // TYPE_MOZILLA_UI
+  // TYPE_MOZILLA_PARENT
   //   This type of ML is used in Mozilla parent processes which initialize
   //   XPCOM and use the gecko event loop.
   //
   // TYPE_MOZILLA_NONMAINTHREAD
   //   This type of ML is used in Mozilla parent processes which initialize
   //   XPCOM and use the nsThread event loop.
   //
   // TYPE_MOZILLA_NONMAINUITHREAD
   //   This type of ML is used in Mozilla processes which initialize XPCOM
   //   and use TYPE_UI loop logic.
   //
   enum Type {
     TYPE_DEFAULT,
     TYPE_UI,
     TYPE_IO,
     TYPE_MOZILLA_CHILD,
-    TYPE_MOZILLA_UI,
+    TYPE_MOZILLA_PARENT,
     TYPE_MOZILLA_NONMAINTHREAD,
     TYPE_MOZILLA_NONMAINUITHREAD
   };
 
   // Normally, it is not necessary to instantiate a MessageLoop.  Instead, it
   // is typical to make use of the current thread's MessageLoop instance.
   explicit MessageLoop(Type type = TYPE_DEFAULT);
   ~MessageLoop();
@@ -468,17 +468,17 @@ class MessageLoopForUI : public MessageL
 
   // Returns the MessageLoopForUI of the current thread.
   static MessageLoopForUI* current() {
     MessageLoop* loop = MessageLoop::current();
     if (!loop)
       return NULL;
     Type type = loop->type();
     DCHECK(type == MessageLoop::TYPE_UI ||
-           type == MessageLoop::TYPE_MOZILLA_UI ||
+           type == MessageLoop::TYPE_MOZILLA_PARENT ||
            type == MessageLoop::TYPE_MOZILLA_CHILD);
     return static_cast<MessageLoopForUI*>(loop);
   }
 
 #if defined(OS_WIN)
   typedef base::MessagePumpWin::Dispatcher Dispatcher;
   typedef base::MessagePumpWin::Observer Observer;
 
--- a/ipc/chromium/src/base/process_util_linux.cc
+++ b/ipc/chromium/src/base/process_util_linux.cc
@@ -12,17 +12,16 @@
 #include <unistd.h>
 #include <string>
 #include <sys/types.h>
 #include <sys/wait.h>
 
 #include "base/eintr_wrapper.h"
 #include "base/file_util.h"
 #include "base/logging.h"
-#include "base/string_tokenizer.h"
 #include "base/string_util.h"
 #include "nsLiteralString.h"
 #include "mozilla/UniquePtr.h"
 
 #include "prenv.h"
 #include "prmem.h"
 
 #ifdef MOZ_B2G_LOADER
deleted file mode 100644
--- a/ipc/chromium/src/base/registry.cc
+++ /dev/null
@@ -1,417 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-// All Rights Reserved.
-
-#include "base/registry.h"
-
-#include <assert.h>
-#include <shlwapi.h>
-#include <windows.h>
-
-#pragma comment(lib, "shlwapi.lib")  // for SHDeleteKey
-
-// local types (see the same declarations in the header file)
-#define tchar TCHAR
-#define CTP const tchar*
-#define tstr std::basic_string<tchar>
-
-//
-// RegistryValueIterator
-//
-
-RegistryValueIterator::RegistryValueIterator(HKEY root_key,
-                                             LPCTSTR folder_key) {
-  LONG result = RegOpenKeyEx(root_key, folder_key, 0, KEY_READ, &key_);
-  if (result != ERROR_SUCCESS) {
-    key_ = NULL;
-  } else {
-    DWORD count = 0;
-    result = ::RegQueryInfoKey(key_, NULL, 0, NULL, NULL, NULL, NULL, &count,
-                               NULL, NULL, NULL, NULL);
-
-    if (result != ERROR_SUCCESS) {
-      ::RegCloseKey(key_);
-      key_ = NULL;
-    } else {
-      index_ = count - 1;
-    }
-  }
-
-  Read();
-}
-
-RegistryValueIterator::~RegistryValueIterator() {
-  if (key_)
-    ::RegCloseKey(key_);
-}
-
-bool RegistryValueIterator::Valid() const {
-  // true while the iterator is valid
-  return key_ != NULL && index_ >= 0;
-}
-
-void RegistryValueIterator::operator ++ () {
-  // advance to the next entry in the folder
-  --index_;
-  Read();
-}
-
-bool RegistryValueIterator::Read() {
-  if (Valid()) {
-    DWORD ncount = sizeof(name_)/sizeof(*name_);
-    value_size_ = sizeof(value_);
-    LRESULT r = ::RegEnumValue(key_, index_, name_, &ncount, NULL, &type_,
-                               reinterpret_cast<BYTE*>(value_), &value_size_);
-    if (ERROR_SUCCESS == r)
-      return true;
-  }
-
-  name_[0] = '\0';
-  value_[0] = '\0';
-  value_size_ = 0;
-  return false;
-}
-
-DWORD RegistryValueIterator::ValueCount() const {
-
-  DWORD count = 0;
-  HRESULT result = ::RegQueryInfoKey(key_, NULL, 0, NULL, NULL, NULL, NULL,
-                                     &count, NULL, NULL, NULL, NULL);
-
-  if (result != ERROR_SUCCESS)
-    return 0;
-
-  return count;
-}
-
-//
-// RegistryKeyIterator
-//
-
-RegistryKeyIterator::RegistryKeyIterator(HKEY root_key,
-                                         LPCTSTR folder_key) {
-  LONG result = RegOpenKeyEx(root_key, folder_key, 0, KEY_READ, &key_);
-  if (result != ERROR_SUCCESS) {
-    key_ = NULL;
-  } else {
-    DWORD count = 0;
-    HRESULT result = ::RegQueryInfoKey(key_, NULL, 0, NULL, &count, NULL, NULL,
-                                       NULL, NULL, NULL, NULL, NULL);
-
-    if (result != ERROR_SUCCESS) {
-      ::RegCloseKey(key_);
-      key_ = NULL;
-    } else {
-      index_ = count - 1;
-    }
-  }
-
-  Read();
-}
-
-RegistryKeyIterator::~RegistryKeyIterator() {
-  if (key_)
-    ::RegCloseKey(key_);
-}
-
-bool RegistryKeyIterator::Valid() const {
-  // true while the iterator is valid
-  return key_ != NULL && index_ >= 0;
-}
-
-void RegistryKeyIterator::operator ++ () {
-  // advance to the next entry in the folder
-  --index_;
-  Read();
-}
-
-bool RegistryKeyIterator::Read() {
-  if (Valid()) {
-    DWORD ncount = sizeof(name_)/sizeof(*name_);
-    FILETIME written;
-    LRESULT r = ::RegEnumKeyEx(key_, index_, name_, &ncount, NULL, NULL,
-                               NULL, &written);
-    if (ERROR_SUCCESS == r)
-      return true;
-  }
-
-  name_[0] = '\0';
-  return false;
-}
-
-DWORD RegistryKeyIterator::SubkeyCount() const {
-
-  DWORD count = 0;
-  HRESULT result = ::RegQueryInfoKey(key_, NULL, 0, NULL, &count, NULL, NULL,
-                                     NULL, NULL, NULL, NULL, NULL);
-
-  if (result != ERROR_SUCCESS)
-    return 0;
-
-  return count;
-}
-
-//
-// RegKey
-//
-
-RegKey::RegKey(HKEY rootkey, const tchar* subkey, REGSAM access)
-  : key_(NULL), watch_event_(0) {
-  if (rootkey) {
-    if (access & (KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_CREATE_LINK))
-      this->Create(rootkey, subkey, access);
-    else
-      this->Open(rootkey, subkey, access);
-  }
-  else assert(!subkey);
-}
-
-void RegKey::Close() {
-  StopWatching();
-  if (key_) {
-    ::RegCloseKey(key_);
-    key_ = NULL;
-  }
-}
-
-bool RegKey::Create(HKEY rootkey, const tchar* subkey, REGSAM access) {
-  DWORD disposition_value;
-  return CreateWithDisposition(rootkey, subkey, &disposition_value, access);
-}
-
-bool RegKey::CreateWithDisposition(HKEY rootkey, const tchar* subkey,
-                                   DWORD* disposition, REGSAM access) {
-  assert(rootkey && subkey && access && disposition);
-  this->Close();
-
-  LONG const result = RegCreateKeyEx(rootkey,
-                                     subkey,
-                                     0,
-                                     NULL,
-                                     REG_OPTION_NON_VOLATILE,
-                                     access,
-                                     NULL,
-                                     &key_,
-                                     disposition );
-  if (result != ERROR_SUCCESS) {
-    key_ = NULL;
-    return false;
-  }
-  else return true;
-}
-
-bool RegKey::Open(HKEY rootkey, const tchar* subkey, REGSAM access) {
-  assert(rootkey && subkey && access);
-  this->Close();
-
-  LONG const result = RegOpenKeyEx(rootkey, subkey, 0,
-                                   access, &key_ );
-  if (result != ERROR_SUCCESS) {
-    key_ = NULL;
-    return false;
-  }
-  else return true;
-}
-
-bool RegKey::CreateKey(const tchar* name, REGSAM access) {
-  assert(name && access);
-
-  HKEY subkey = NULL;
-  LONG const result = RegCreateKeyEx(key_, name, 0, NULL,
-                                     REG_OPTION_NON_VOLATILE,
-                                     access, NULL, &subkey, NULL);
-  this->Close();
-
-  key_ = subkey;
-  return (result == ERROR_SUCCESS);
-}
-
-bool RegKey::OpenKey(const tchar* name, REGSAM access) {
-  assert(name && access);
-
-  HKEY subkey = NULL;
-  LONG const result = RegOpenKeyEx(key_, name, 0, access, &subkey);
-
-  this->Close();
-
-  key_ = subkey;
-  return (result == ERROR_SUCCESS);
-}
-
-DWORD RegKey::ValueCount() {
-  DWORD count = 0;
-  HRESULT const result = ::RegQueryInfoKey(key_, NULL, 0, NULL, NULL, NULL,
-                                     NULL, &count, NULL, NULL, NULL, NULL);
-  return (result != ERROR_SUCCESS) ? 0 : count;
-}
-
-bool RegKey::ReadName(int index, tstr* name) {
-  tchar buf[256];
-  DWORD bufsize = sizeof(buf)/sizeof(*buf);
-  LRESULT r = ::RegEnumValue(key_, index, buf, &bufsize, NULL, NULL,
-                             NULL, NULL);
-  if (r != ERROR_SUCCESS)
-    return false;
-  if (name)
-    *name = buf;
-  return true;
-}
-
-bool RegKey::ValueExists(const tchar* name) {
-  if (!key_) return false;
-  const HRESULT result = RegQueryValueEx(key_, name, 0, NULL, NULL, NULL);
-  return (result == ERROR_SUCCESS);
-}
-
-bool RegKey::ReadValue(const tchar* name, void* data,
-                       DWORD* dsize, DWORD* dtype) {
-  if (!key_) return false;
-  HRESULT const result = RegQueryValueEx(key_, name, 0, dtype,
-                                         reinterpret_cast<LPBYTE>(data),
-                                         dsize);
-  return (result == ERROR_SUCCESS);
-}
-
-bool RegKey::ReadValue(const tchar* name, tstr * value) {
-  assert(value);
-  static const size_t kMaxStringLength = 1024;  // This is after expansion.
-  // Use the one of the other forms of ReadValue if 1024 is too small for you.
-  TCHAR raw_value[kMaxStringLength];
-  DWORD type = REG_SZ, size = sizeof(raw_value);
-  if (this->ReadValue(name, raw_value, &size, &type)) {
-    if (type == REG_SZ) {
-      *value = raw_value;
-    } else if (type == REG_EXPAND_SZ) {
-      TCHAR expanded[kMaxStringLength];
-      size = ExpandEnvironmentStrings(raw_value, expanded, kMaxStringLength);
-      // Success: returns the number of TCHARs copied
-      // Fail: buffer too small, returns the size required
-      // Fail: other, returns 0
-      if (size == 0 || size > kMaxStringLength)
-        return false;
-      *value = expanded;
-    } else {
-      // Not a string. Oops.
-      return false;
-    }
-    return true;
-  }
-  else return false;
-}
-
-bool RegKey::ReadValueDW(const tchar* name, DWORD * value) {
-  assert(value);
-  DWORD type = REG_DWORD, size = sizeof(DWORD), result = 0;
-  if (this->ReadValue(name, &result, &size, &type)
-     && (type == REG_DWORD || type == REG_BINARY)
-     && size == sizeof(DWORD)) {
-    *value = result;
-    return true;
-  }
-  else return false;
-}
-
-bool RegKey::WriteValue(const tchar* name,
-                        const void * data,
-                        DWORD dsize,
-                        DWORD dtype) {
-  assert(data);
-  if (!key_) return false;
-  HRESULT const result = RegSetValueEx(
-      key_,
-      name,
-      0,
-      dtype,
-      reinterpret_cast<LPBYTE>(const_cast<void*>(data)),
-      dsize);
-  return (result == ERROR_SUCCESS);
-}
-
-bool RegKey::WriteValue(const tchar * name, const tchar * value) {
-  return this->WriteValue(name, value,
-    static_cast<DWORD>(sizeof(*value) * (_tcslen(value) + 1)), REG_SZ);
-}
-
-bool RegKey::WriteValue(const tchar * name, DWORD value) {
-  return this->WriteValue(name, &value,
-    static_cast<DWORD>(sizeof(value)), REG_DWORD);
-}
-
-bool RegKey::DeleteKey(const tchar * name) {
-  if (!key_) return false;
-  return (ERROR_SUCCESS == SHDeleteKey(key_, name));
-}
-
-
-bool RegKey::DeleteValue(const tchar * value_name) {
-  assert(value_name);
-  HRESULT const result = RegDeleteValue(key_, value_name);
-  return (result == ERROR_SUCCESS);
-}
-
-bool RegKey::StartWatching() {
-  if (!watch_event_)
-    watch_event_ = CreateEvent(NULL, TRUE, FALSE, NULL);
-
-  DWORD filter = REG_NOTIFY_CHANGE_NAME |
-                 REG_NOTIFY_CHANGE_ATTRIBUTES |
-                 REG_NOTIFY_CHANGE_LAST_SET |
-                 REG_NOTIFY_CHANGE_SECURITY;
-
-  // Watch the registry key for a change of value.
-  HRESULT result = RegNotifyChangeKeyValue(key_, TRUE, filter,
-                                           watch_event_, TRUE);
-  if (SUCCEEDED(result)) {
-    return true;
-  } else {
-    CloseHandle(watch_event_);
-    watch_event_ = 0;
-    return false;
-  }
-}
-
-bool RegKey::StopWatching() {
-  if (watch_event_) {
-    CloseHandle(watch_event_);
-    watch_event_ = 0;
-    return true;
-  }
-  return false;
-}
-
-bool RegKey::HasChanged() {
-  if (watch_event_) {
-    if (WaitForSingleObject(watch_event_, 0) == WAIT_OBJECT_0) {
-      StartWatching();
-      return true;
-    }
-  }
-  return false;
-}
-
-// Register a COM object with the most usual properties.
-bool RegisterCOMServer(const tchar* guid,
-                       const tchar* name,
-                       const tchar* path) {
-  RegKey key(HKEY_CLASSES_ROOT, _T("CLSID"), KEY_WRITE);
-  key.CreateKey(guid, KEY_WRITE);
-  key.WriteValue(NULL, name);
-  key.CreateKey(_T("InprocServer32"), KEY_WRITE);
-  key.WriteValue(NULL, path);
-  key.WriteValue(_T("ThreadingModel"), _T("Apartment"));
-  return true;
-}
-
-bool RegisterCOMServer(const tchar* guid, const tchar* name, HINSTANCE module) {
-  tchar module_path[MAX_PATH];
-  ::GetModuleFileName(module, module_path, MAX_PATH);
-  _tcslwr_s(module_path, MAX_PATH);
-  return RegisterCOMServer(guid, name, module_path);
-}
-
-bool UnregisterCOMServer(const tchar* guid) {
-  RegKey key(HKEY_CLASSES_ROOT, _T("CLSID"), KEY_WRITE);
-  key.DeleteKey(guid);
-  return true;
-}
deleted file mode 100644
--- a/ipc/chromium/src/base/registry.h
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-// All Rights Reserved.
-
-#ifndef BASE_REGISTRY_H__
-#define BASE_REGISTRY_H__
-
-#include <windows.h>
-#include <tchar.h>
-#include <shlwapi.h>
-#include <string>
-
-// The shared file uses a bunch of header files that define types that we don't.
-// To avoid changing much code from the standard version, and also to avoid
-// polluting our namespace with extra types we don't want, we define these types
-// here with the preprocessor and undefine them at the end of the file.
-#define tchar TCHAR
-#define CTP const tchar*
-#define tstr std::basic_string<tchar>
-
-// RegKey
-// Utility class to read from and manipulate the registry.
-// Registry vocabulary primer: a "key" is like a folder, in which there
-// are "values", which are <name,data> pairs, with an associated data type.
-
-class RegKey {
- public:
-  RegKey(HKEY rootkey = NULL, CTP subkey = NULL, REGSAM access = KEY_READ);
-    // start there
-
-  ~RegKey() { this->Close(); }
-
-  bool Create(HKEY rootkey, CTP subkey, REGSAM access = KEY_READ);
-
-  bool CreateWithDisposition(HKEY rootkey, CTP subkey, DWORD* disposition,
-                             REGSAM access = KEY_READ);
-
-  bool Open(HKEY rootkey, CTP subkey, REGSAM access = KEY_READ);
-
-  // Create a subkey (or open if exists)
-  bool CreateKey(CTP name, REGSAM access);
-
-  // Open a subkey
-  bool OpenKey(CTP name, REGSAM access);
-
-  // all done, eh?
-  void Close();
-
-  DWORD ValueCount();  // Count of the number of value extant
-
-  bool ReadName(int index, tstr* name);  // Determine the Nth value's name
-
-  // True while the key is valid
-  bool Valid() const { return NULL != key_; }
-
-  // Kill key and everything that liveth below it; please be careful out there
-  bool DeleteKey(CTP name);
-
-  // Delete a single value within the key
-  bool DeleteValue(CTP name);
-
-  bool ValueExists(CTP name);
-  bool ReadValue(CTP name, void * data, DWORD * dsize, DWORD * dtype = NULL);
-  bool ReadValue(CTP name, tstr * value);
-  bool ReadValueDW(CTP name, DWORD * value);  // Named to differ from tstr*
-
-  bool WriteValue(CTP name, const void * data, DWORD dsize,
-                  DWORD dtype = REG_BINARY);
-  bool WriteValue(CTP name, CTP value);
-  bool WriteValue(CTP name, DWORD value);
-
-  // StartWatching()
-  //   Start watching the key to see if any of its values have changed.
-  //   The key must have been opened with the KEY_NOTIFY access
-  //   privelege.
-  bool StartWatching();
-
-  // HasChanged()
-  //   If StartWatching hasn't been called, always returns false.
-  //   Otherwise, returns true if anything under the key has changed.
-  //   This can't be const because the watch_event_ may be refreshed.
-  bool HasChanged();
-
-  // StopWatching()
-  //   Will automatically be called by destructor if not manually called
-  //   beforehand.  Returns true if it was watching, false otherwise.
-  bool StopWatching();
-
-  inline bool IsWatching() const { return watch_event_ != 0; }
-  HANDLE watch_event() const { return watch_event_; }
-  HKEY Handle() const { return key_; }
-
- private:
-  HKEY  key_;    // the registry key being iterated
-  HANDLE watch_event_;
-};
-
-
-// Standalone registry functions -- sorta deprecated, they now map to
-// using RegKey
-
-
-// Add a raw data to the registry -- you can pass NULL for the data if
-// you just want to create a key
-inline bool AddToRegistry(HKEY root_key, CTP key, CTP value_name,
-                          void const * data, DWORD dsize,
-                          DWORD dtype = REG_BINARY) {
-  return RegKey(root_key, key, KEY_WRITE).WriteValue(value_name, data, dsize,
-                                                     dtype);
-}
-
-// Convenience routine to add a string value to the registry
-inline bool AddToRegistry(HKEY root_key, CTP key, CTP value_name, CTP value) {
-  return AddToRegistry(root_key, key, value_name, value,
-                       sizeof(*value) * (lstrlen(value) + 1), REG_SZ);
-}
-
-// Read raw data from the registry -- pass something as the dtype
-// parameter if you care to learn what type the value was stored as
-inline bool ReadFromRegistry(HKEY root_key, CTP key, CTP value_name,
-                             void* data, DWORD* dsize, DWORD* dtype = NULL) {
-  return RegKey(root_key, key).ReadValue(value_name, data, dsize, dtype);
-}
-
-
-// Delete a value or a key from the registry
-inline bool DeleteFromRegistry(HKEY root_key, CTP subkey, CTP value_name) {
-  if (value_name)
-    return ERROR_SUCCESS == ::SHDeleteValue(root_key, subkey, value_name);
-  else
-    return ERROR_SUCCESS == ::SHDeleteKey(root_key, subkey);
-}
-
-
-
-// delete a key and all subkeys from the registry
-inline bool DeleteKeyFromRegistry(HKEY root_key, CTP key_path, CTP key_name) {
-  RegKey key;
-  return key.Open(root_key, key_path, KEY_WRITE)
-      && key.DeleteKey(key_name);
-}
-
-
-// Iterates the entries found in a particular folder on the registry.
-// For this application I happen to know I wont need data size larger
-// than MAX_PATH, but in real life this wouldn't neccessarily be
-// adequate.
-class RegistryValueIterator {
- public:
-  // Specify a key in construction
-  RegistryValueIterator(HKEY root_key, LPCTSTR folder_key);
-
-  ~RegistryValueIterator();
-
-  DWORD ValueCount() const;  // count of the number of subkeys extant
-
-  bool Valid() const;  // true while the iterator is valid
-
-  void operator++();  // advance to the next entry in the folder
-
-  // The pointers returned by these functions are statics owned by the
-  // Name and Value functions
-  CTP Name() const { return name_; }
-  CTP Value() const { return value_; }
-  DWORD ValueSize() const { return value_size_; }
-  DWORD Type() const { return type_; }
-
-  int Index() const { return index_; }
-
- private:
-  bool Read();   // read in the current values
-
-  HKEY  key_;    // the registry key being iterated
-  int   index_;  // current index of the iteration
-
-  // Current values
-  TCHAR name_[MAX_PATH];
-  TCHAR value_[MAX_PATH];
-  DWORD value_size_;
-  DWORD type_;
-};
-
-
-class RegistryKeyIterator {
- public:
-  // Specify a parent key in construction
-  RegistryKeyIterator(HKEY root_key, LPCTSTR folder_key);
-
-  ~RegistryKeyIterator();
-
-  DWORD SubkeyCount() const;  // count of the number of subkeys extant
-
-  bool Valid() const;  // true while the iterator is valid
-
-  void operator++();  // advance to the next entry in the folder
-
-  // The pointer returned by Name() is a static owned by the function
-  CTP Name() const { return name_; }
-
-  int Index() const { return index_; }
-
- private:
-  bool Read();   // read in the current values
-
-  HKEY  key_;    // the registry key being iterated
-  int   index_;  // current index of the iteration
-
-  // Current values
-  TCHAR name_[MAX_PATH];
-};
-
-
-// Register a COM object with the most usual properties.
-bool RegisterCOMServer(const tchar* guid, const tchar* name,
-                       const tchar* modulepath);
-bool RegisterCOMServer(const tchar* guid, const tchar* name, HINSTANCE module);
-bool UnregisterCOMServer(const tchar* guid);
-
-// undo the local types defined above
-#undef tchar
-#undef CTP
-#undef tstr
-
-#endif  // BASE_REGISTRY_H__
deleted file mode 100644
--- a/ipc/chromium/src/base/string_tokenizer.h
+++ /dev/null
@@ -1,202 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_STRING_TOKENIZER_H_
-#define BASE_STRING_TOKENIZER_H_
-
-#include <string>
-
-// StringTokenizerT is a simple string tokenizer class.  It works like an
-// iterator that with each step (see the Advance method) updates members that
-// refer to the next token in the input string.  The user may optionally
-// configure the tokenizer to return delimiters.
-//
-//
-// EXAMPLE 1:
-//
-//   StringTokenizer t("this is a test", " ");
-//   while (t.GetNext()) {
-//     printf("%s\n", t.token().c_str());
-//   }
-//
-// Output:
-//
-//   this
-//   is
-//   a
-//   test
-//
-//
-// EXAMPLE 2:
-//
-//   StringTokenizer t("no-cache=\"foo, bar\", private", ", ");
-//   t.set_quote_chars("\"");
-//   while (t.GetNext()) {
-//     printf("%s\n", t.token().c_str());
-//   }
-//
-// Output:
-//
-//   no-cache="foo, bar"
-//   private
-//
-//
-// EXAMPLE 3:
-//
-//   bool next_is_option = false, next_is_value = false;
-//   std::string input = "text/html; charset=UTF-8; foo=bar";
-//   StringTokenizer t(input, "; =");
-//   t.set_options(StringTokenizer::RETURN_DELIMS);
-//   while (t.GetNext()) {
-//     if (t.token_is_delim()) {
-//       switch (*t.token_begin()) {
-//         case ';':
-//           next_is_option = true;
-//           break;
-//         case '=':
-//           next_is_value = true;
-//           break;
-//       }
-//     } else {
-//       const char* label;
-//       if (next_is_option) {
-//         label = "option-name";
-//         next_is_option = false;
-//       } else if (next_is_value) {
-//         label = "option-value";
-//         next_is_value = false;
-//       } else {
-//         label = "mime-type";
-//       }
-//       printf("%s: %s\n", label, t.token().c_str());
-//     }
-//   }
-//
-//
-template <class str, class const_iterator>
-class StringTokenizerT {
- public:
-  typedef typename str::value_type char_type;
-
-  // Options that may be pass to set_options()
-  enum {
-    // Specifies the delimiters should be returned as tokens
-    RETURN_DELIMS = 1 << 0,
-  };
-
-  StringTokenizerT(const str& string,
-                   const str& delims) {
-    Init(string.begin(), string.end(), delims);
-  }
-
-  StringTokenizerT(const_iterator string_begin,
-                   const_iterator string_end,
-                   const str& delims) {
-    Init(string_begin, string_end, delims);
-  }
-
-  // Set the options for this tokenizer.  By default, this is 0.
-  void set_options(int options) { options_ = options; }
-
-  // Set the characters to regard as quotes.  By default, this is empty.  When
-  // a quote char is encountered, the tokenizer will switch into a mode where
-  // it ignores delimiters that it finds.  It switches out of this mode once it
-  // finds another instance of the quote char.  If a backslash is encountered
-  // within a quoted string, then the next character is skipped.
-  void set_quote_chars(const str& quotes) { quotes_ = quotes; }
-
-  // Call this method to advance the tokenizer to the next delimiter.  This
-  // returns false if the tokenizer is complete.  This method must be called
-  // before calling any of the token* methods.
-  bool GetNext() {
-    AdvanceState state;
-    token_is_delim_ = false;
-    for (;;) {
-      token_begin_ = token_end_;
-      if (token_end_ == end_)
-        return false;
-      ++token_end_;
-      if (AdvanceOne(&state, *token_begin_))
-        break;
-      if (options_ & RETURN_DELIMS) {
-        token_is_delim_ = true;
-        return true;
-      }
-      // else skip over delim
-    }
-    while (token_end_ != end_ && AdvanceOne(&state, *token_end_))
-      ++token_end_;
-    return true;
-  }
-
-  // Returns true if token is a delimiter.  When the tokenizer is constructed
-  // with the RETURN_DELIMS option, this method can be used to check if the
-  // returned token is actually a delimiter.
-  bool token_is_delim() const { return token_is_delim_; }
-
-  // If GetNext() returned true, then these methods may be used to read the
-  // value of the token.
-  const_iterator token_begin() const { return token_begin_; }
-  const_iterator token_end() const { return token_end_; }
-  str token() const { return str(token_begin_, token_end_); }
-
- private:
-  void Init(const_iterator string_begin,
-            const_iterator string_end,
-            const str& delims) {
-    token_end_ = string_begin;
-    end_ = string_end;
-    delims_ = delims;
-    options_ = 0;
-  }
-
-  bool IsDelim(char_type c) const {
-    return delims_.find(c) != str::npos;
-  }
-
-  bool IsQuote(char_type c) const {
-    return quotes_.find(c) != str::npos;
-  }
-
-  struct AdvanceState {
-    bool in_quote;
-    bool in_escape;
-    char_type quote_char;
-    AdvanceState() : in_quote(false), in_escape(false) {}
-  };
-
-  // Returns true if a delimiter was not hit.
-  bool AdvanceOne(AdvanceState* state, char_type c) {
-    if (state->in_quote) {
-      if (state->in_escape) {
-        state->in_escape = false;
-      } else if (c == '\\') {
-        state->in_escape = true;
-      } else if (c == state->quote_char) {
-        state->in_quote = false;
-      }
-    } else {
-      if (IsDelim(c))
-        return false;
-      state->in_quote = IsQuote(state->quote_char = c);
-    }
-    return true;
-  }
-
-  const_iterator token_begin_;
-  const_iterator token_end_;
-  const_iterator end_;
-  str delims_;
-  str quotes_;
-  int options_;
-  bool token_is_delim_;
-};
-
-typedef StringTokenizerT<std::string, std::string::const_iterator>
-    StringTokenizer;
-typedef StringTokenizerT<std::wstring, std::wstring::const_iterator>
-    WStringTokenizer;
-typedef StringTokenizerT<std::string, const char*> CStringTokenizer;
-
-#endif  // BASE_STRING_TOKENIZER_H_
--- a/ipc/chromium/src/base/sys_string_conversions.h
+++ b/ipc/chromium/src/base/sys_string_conversions.h
@@ -23,23 +23,11 @@ std::string SysWideToUTF8(const std::wst
 std::wstring SysUTF8ToWide(const StringPiece& utf8);
 
 // Converts between wide and the system multi-byte representations of a string.
 // DANGER: This will lose information and can change (on Windows, this can
 // change between reboots).
 std::string SysWideToNativeMB(const std::wstring& wide);
 std::wstring SysNativeMBToWide(const StringPiece& native_mb);
 
-// Windows-specific ------------------------------------------------------------
-
-#if defined(OS_WIN)
-
-// Converts between 8-bit and wide strings, using the given code page. The
-// code page identifier is one accepted by the Windows function
-// MultiByteToWideChar().
-std::wstring SysMultiByteToWide(const StringPiece& mb, uint32_t code_page);
-std::string SysWideToMultiByte(const std::wstring& wide, uint32_t code_page);
-
-#endif  // defined(OS_WIN)
-
 }  // namespace base
 
 #endif  // BASE_SYS_STRING_CONVERSIONS_H_
--- a/ipc/chromium/src/base/sys_string_conversions_win.cc
+++ b/ipc/chromium/src/base/sys_string_conversions_win.cc
@@ -6,34 +6,16 @@
 
 #include <windows.h>
 
 #include "base/string_piece.h"
 
 namespace base {
 
 // Do not assert in this function since it is used by the asssertion code!
-std::string SysWideToUTF8(const std::wstring& wide) {
-  return SysWideToMultiByte(wide, CP_UTF8);
-}
-
-// Do not assert in this function since it is used by the asssertion code!
-std::wstring SysUTF8ToWide(const StringPiece& utf8) {
-  return SysMultiByteToWide(utf8, CP_UTF8);
-}
-
-std::string SysWideToNativeMB(const std::wstring& wide) {
-  return SysWideToMultiByte(wide, CP_ACP);
-}
-
-std::wstring SysNativeMBToWide(const StringPiece& native_mb) {
-  return SysMultiByteToWide(native_mb, CP_ACP);
-}
-
-// Do not assert in this function since it is used by the asssertion code!
 std::wstring SysMultiByteToWide(const StringPiece& mb, uint32_t code_page) {
   if (mb.empty())
     return std::wstring();
 
   int mb_length = static_cast<int>(mb.length());
   // Compute the length of the buffer.
   int charcount = MultiByteToWideChar(code_page, 0,
                                       mb.data(), mb_length, NULL, 0);
@@ -62,9 +44,27 @@ std::string SysWideToMultiByte(const std
   std::string mb;
   mb.resize(charcount);
   WideCharToMultiByte(code_page, 0, wide.data(), wide_length,
                       &mb[0], charcount, NULL, NULL);
 
   return mb;
 }
 
+// Do not assert in this function since it is used by the asssertion code!
+std::string SysWideToUTF8(const std::wstring& wide) {
+  return SysWideToMultiByte(wide, CP_UTF8);
+}
+
+// Do not assert in this function since it is used by the asssertion code!
+std::wstring SysUTF8ToWide(const StringPiece& utf8) {
+  return SysMultiByteToWide(utf8, CP_UTF8);
+}
+
+std::string SysWideToNativeMB(const std::wstring& wide) {
+  return SysWideToMultiByte(wide, CP_ACP);
+}
+
+std::wstring SysNativeMBToWide(const StringPiece& native_mb) {
+  return SysMultiByteToWide(native_mb, CP_ACP);
+}
+
 }  // namespace base
deleted file mode 100644
--- a/ipc/chromium/src/base/thread_collision_warner.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/thread_collision_warner.h"
-
-#include "base/logging.h"
-#include "base/platform_thread.h"
-
-namespace base {
-
-void DCheckAsserter::warn() {
-  NOTREACHED() << "Thread Collision";
-}
-
-static subtle::Atomic32 CurrentThread() {
-  const PlatformThreadId current_thread_id = PlatformThread::CurrentId();
-  // We need to get the thread id into an atomic data type. This might be a
-  // truncating conversion, but any loss-of-information just increases the
-  // chance of a fault negative, not a false positive.
-  const subtle::Atomic32 atomic_thread_id =
-      static_cast<subtle::Atomic32>(current_thread_id);
-
-  return atomic_thread_id;
-}
-
-void ThreadCollisionWarner::EnterSelf() {
-  // If the active thread is 0 then I'll write the current thread ID
-  // if two or more threads arrive here only one will succeed to
-  // write on valid_thread_id_ the current thread ID.
-  subtle::Atomic32 current_thread_id = CurrentThread();
-
-  int previous_value = subtle::NoBarrier_CompareAndSwap(&valid_thread_id_,
-                                                        0,
-                                                        current_thread_id);
-  if (previous_value != 0 && previous_value != current_thread_id) {
-    // gotcha! a thread is trying to use the same class and that is
-    // not current thread.
-    asserter_->warn();
-  }
-
-  subtle::NoBarrier_AtomicIncrement(&counter_, 1);
-}
-
-void ThreadCollisionWarner::Enter() {
-  subtle::Atomic32 current_thread_id = CurrentThread();
-
-  if (subtle::NoBarrier_CompareAndSwap(&valid_thread_id_,
-                                       0,
-                                       current_thread_id) != 0) {
-    // gotcha! another thread is trying to use the same class.
-    asserter_->warn();
-  }
-
-  subtle::NoBarrier_AtomicIncrement(&counter_, 1);
-}
-
-void ThreadCollisionWarner::Leave() {
-  if (subtle::Barrier_AtomicIncrement(&counter_, -1) == 0) {
-    subtle::NoBarrier_Store(&valid_thread_id_, 0);
-  }
-}
-
-}  // namespace base
deleted file mode 100644
--- a/ipc/chromium/src/base/thread_collision_warner.h
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_THREAD_COLLISION_WARNER_H_
-#define BASE_THREAD_COLLISION_WARNER_H_
-
-#include <memory.h>
-
-#include "base/atomicops.h"
-
-// A helper class alongside macros to be used to verify assumptions about thread
-// safety of a class.
-//
-// Example: Queue implementation non thread-safe but still usable if clients
-//          are synchronized somehow.
-//
-//          In this case the macro DFAKE_SCOPED_LOCK has to be
-//          used, it checks that if a thread is inside the push/pop then
-//          noone else is still inside the pop/push
-//
-// class NonThreadSafeQueue {
-//  public:
-//   ...
-//   void push(int) { DFAKE_SCOPED_LOCK(push_pop_); ... }
-//   int pop() { DFAKE_SCOPED_LOCK(push_pop_); ... }
-//   ...
-//  private:
-//   DFAKE_MUTEX(push_pop_);
-// };
-//
-//
-// Example: Queue implementation non thread-safe but still usable if clients
-//          are synchronized somehow, it calls a method to "protect" from
-//          a "protected" method
-//
-//          In this case the macro DFAKE_SCOPED_RECURSIVE_LOCK
-//          has to be used, it checks that if a thread is inside the push/pop
-//          then noone else is still inside the pop/push
-//
-// class NonThreadSafeQueue {
-//  public:
-//   void push(int) {
-//     DFAKE_SCOPED_LOCK(push_pop_);
-//     ...
-//   }
-//   int pop() {
-//     DFAKE_SCOPED_RECURSIVE_LOCK(push_pop_);
-//     bar();
-//     ...
-//   }
-//   void bar() { DFAKE_SCOPED_RECURSIVE_LOCK(push_pop_); ... }
-//   ...
-//  private:
-//   DFAKE_MUTEX(push_pop_);
-// };
-//
-//
-// Example: Queue implementation not usable even if clients are synchronized,
-//          so only one thread in the class life cycle can use the two members
-//          push/pop.
-//
-//          In this case the macro DFAKE_SCOPED_LOCK_THREAD_LOCKED pins the
-//          specified
-//          critical section the first time a thread enters push or pop, from
-//          that time on only that thread is allowed to execute push or pop.
-//
-// class NonThreadSafeQueue {
-//  public:
-//   ...
-//   void push(int) { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... }
-//   int pop() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... }
-//   ...
-//  private:
-//   DFAKE_MUTEX(push_pop_);
-// };
-//
-//
-// Example: Class that has to be contructed/destroyed on same thread, it has
-//          a "shareable" method (with external syncronization) and a not
-//          shareable method (even with external synchronization).
-//
-//          In this case 3 Critical sections have to be defined
-//
-// class ExoticClass {
-//  public:
-//   ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... }
-//   ~ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... }
-//
-//   void Shareable() { DFAKE_SCOPED_LOCK(shareable_section_); ... }
-//   void NotShareable() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... }
-//   ...
-//  private:
-//   DFAKE_MUTEX(ctor_dtor_);
-//   DFAKE_MUTEX(shareable_section_);
-// };
-
-
-#if !defined(NDEBUG)
-
-// Defines a class member that acts like a mutex. It is used only as a
-// verification tool.
-#define DFAKE_MUTEX(obj) \
-     mutable base::ThreadCollisionWarner obj;
-// Asserts the call is never called simultaneously in two threads. Used at
-// member function scope.
-#define DFAKE_SCOPED_LOCK(obj) \
-     base::ThreadCollisionWarner::ScopedCheck s_check_##obj(&obj)
-// Asserts the call is never called simultaneously in two threads. Used at
-// member function scope. Same as DFAKE_SCOPED_LOCK but allows recursive locks.
-#define DFAKE_SCOPED_RECURSIVE_LOCK(obj) \
-     base::ThreadCollisionWarner::ScopedRecursiveCheck sr_check_##obj(&obj)
-// Asserts the code is always executed in the same thread.
-#define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) \
-     base::ThreadCollisionWarner::Check check_##obj(&obj)
-
-#else
-
-#define DFAKE_MUTEX(obj)
-#define DFAKE_SCOPED_LOCK(obj) ((void)0)
-#define DFAKE_SCOPED_RECURSIVE_LOCK(obj) ((void)0)
-#define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) ((void)0)
-
-#endif
-
-namespace base {
-
-// The class ThreadCollisionWarner uses an Asserter to notify the collision
-// AsserterBase is the interfaces and DCheckAsserter is the default asserter
-// used. During the unit tests is used another class that doesn't "DCHECK"
-// in case of collision (check thread_collision_warner_unittests.cc)
-struct AsserterBase {
-  virtual ~AsserterBase() {}
-  virtual void warn() = 0;
-};
-
-struct DCheckAsserter : public AsserterBase {
-  virtual ~DCheckAsserter() {}
-  virtual void warn();
-};
-
-class ThreadCollisionWarner {
- public:
-  // The parameter asserter is there only for test purpose
-  explicit ThreadCollisionWarner(AsserterBase* asserter = new DCheckAsserter())
-      : valid_thread_id_(0),
-        counter_(0),
-        asserter_(asserter) {}
-
-  ~ThreadCollisionWarner() {
-    delete asserter_;
-  }
-
-  // This class is meant to be used through the macro
-  // DFAKE_SCOPED_LOCK_THREAD_LOCKED
-  // it doesn't leave the critical section, as opposed to ScopedCheck,
-  // because the critical section being pinned is allowed to be used only
-  // from one thread
-  class Check {
-   public:
-    explicit Check(ThreadCollisionWarner* warner)
-        : warner_(warner) {
-      warner_->EnterSelf();
-    }
-
-    ~Check() {}
-
-   private:
-    ThreadCollisionWarner* warner_;
-
-    DISALLOW_COPY_AND_ASSIGN(Check);
-  };
-
-  // This class is meant to be used through the macro
-  // DFAKE_SCOPED_LOCK
-  class ScopedCheck {
-   public:
-    explicit ScopedCheck(ThreadCollisionWarner* warner)
-        : warner_(warner) {
-      warner_->Enter();
-    }
-
-    ~ScopedCheck() {
-      warner_->Leave();
-    }
-
-   private:
-    ThreadCollisionWarner* warner_;
-
-    DISALLOW_COPY_AND_ASSIGN(ScopedCheck);
-  };
-
-  // This class is meant to be used through the macro
-  // DFAKE_SCOPED_RECURSIVE_LOCK
-  class ScopedRecursiveCheck {
-   public:
-    explicit ScopedRecursiveCheck(ThreadCollisionWarner* warner)
-        : warner_(warner) {
-      warner_->EnterSelf();
-    }
-
-    ~ScopedRecursiveCheck() {
-      warner_->Leave();
-    }
-
-   private:
-    ThreadCollisionWarner* warner_;
-
-    DISALLOW_COPY_AND_ASSIGN(ScopedRecursiveCheck);
-  };
-
- private:
-  // This method stores the current thread identifier and does a DCHECK
-  // if a another thread has already done it, it is safe if same thread
-  // calls this multiple time (recursion allowed).
-  void EnterSelf();
-
-  // Same as EnterSelf but recursion is not allowed.
-  void Enter();
-
-  // Removes the thread_id stored in order to allow other threads to
-  // call EnterSelf or Enter.
-  void Leave();
-
-  // This stores the thread id that is inside the critical section, if the
-  // value is 0 then no thread is inside.
-  volatile subtle::Atomic32 valid_thread_id_;
-
-  // Counter to trace how many time a critical section was "pinned"
-  // (when allowed) in order to unpin it when counter_ reaches 0.
-  volatile subtle::Atomic32 counter_;
-
-  // Here only for class unit tests purpose, during the test I need to not
-  // DCHECK but notify the collision with something else.
-  AsserterBase* asserter_;
-
-  DISALLOW_COPY_AND_ASSIGN(ThreadCollisionWarner);
-};
-
-}  // namespace base
-
-#endif  // BASE_THREAD_COLLISION_WARNER_H_
deleted file mode 100644
--- a/ipc/chromium/src/base/time_format.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Basic time formatting methods.  These methods use the current locale
-// formatting for displaying the time.
-
-#ifndef BASE_TIME_FORMAT_H_
-#define BASE_TIME_FORMAT_H_
-
-#include <string>
-
-namespace base {
-
-class Time;
-
-// Returns the time of day, e.g., "3:07 PM".
-std::wstring TimeFormatTimeOfDay(const Time& time);
-
-// Returns a shortened date, e.g. "Nov 7, 2007"
-std::wstring TimeFormatShortDate(const Time& time);
-
-// Returns a numeric date such as 12/13/52.
-std::wstring TimeFormatShortDateNumeric(const Time& time);
-
-// Formats a time in a friendly sentence format, e.g.
-// "Monday, March 6, 2008 2:44:30 PM".
-std::wstring TimeFormatShortDateAndTime(const Time& time);
-
-// Formats a time in a friendly sentence format, e.g.
-// "Monday, March 6, 2008 2:44:30 PM".
-std::wstring TimeFormatFriendlyDateAndTime(const Time& time);
-
-// Formats a time in a friendly sentence format, e.g.
-// "Monday, March 6, 2008".
-std::wstring TimeFormatFriendlyDate(const Time& time);
-
-}  // namespace base
-
-#endif  // BASE_TIME_FORMAT_H_
--- a/ipc/chromium/src/base/win_util.cc
+++ b/ipc/chromium/src/base/win_util.cc
@@ -3,35 +3,22 @@
 // found in the LICENSE file.
 
 #include "base/win_util.h"
 
 #include <map>
 #include <sddl.h>
 
 #include "base/logging.h"
-#include "base/registry.h"
 #include "base/singleton.h"
 #include "base/string_util.h"
 #include "base/tracked.h"
 
 namespace win_util {
 
-bool IsShiftPressed() {
-  return (::GetKeyState(VK_SHIFT) & 0x80) == 0x80;
-}
-
-bool IsCtrlPressed() {
-  return (::GetKeyState(VK_CONTROL) & 0x80) == 0x80;
-}
-
-bool IsAltPressed() {
-  return (::GetKeyState(VK_MENU) & 0x80) == 0x80;
-}
-
 std::wstring FormatMessage(unsigned messageid) {
   wchar_t* string_buffer = NULL;
   unsigned string_length = ::FormatMessage(
       FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
       FORMAT_MESSAGE_IGNORE_INSERTS, NULL, messageid, 0,
       reinterpret_cast<wchar_t *>(&string_buffer), 0, NULL);
 
   std::wstring formatted_string;
@@ -45,30 +32,8 @@ std::wstring FormatMessage(unsigned mess
   return formatted_string;
 }
 
 std::wstring FormatLastWin32Error() {
   return FormatMessage(GetLastError());
 }
 
 }  // namespace win_util
-
-#ifdef _MSC_VER
-//
-// If the ASSERT below fails, please install Visual Studio 2005 Service Pack 1.
-//
-extern char VisualStudio2005ServicePack1Detection[10];
-COMPILE_ASSERT(sizeof(&VisualStudio2005ServicePack1Detection) == sizeof(void*),
-               VS2005SP1Detect);
-//
-// Chrome requires at least Service Pack 1 for Visual Studio 2005.
-//
-#endif  // _MSC_VER
-
-#if 0
-#error You must install the Windows 2008 or Vista Software Development Kit and \
-set it as your default include path to build this library. You can grab it by \
-searching for "download windows sdk 2008" in your favorite web search engine.  \
-Also make sure you register the SDK with Visual Studio, by selecting \
-"Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \
-menu (see Start - All Programs - Microsoft Windows SDK - \
-Visual Studio Registration).
-#endif
--- a/ipc/chromium/src/base/win_util.h
+++ b/ipc/chromium/src/base/win_util.h
@@ -9,27 +9,14 @@
 #include <aclapi.h>
 
 #include <string>
 
 #include "base/tracked.h"
 
 namespace win_util {
 
-// Returns true if the shift key is currently pressed.
-bool IsShiftPressed();
-
-// Returns true if the ctrl key is currently pressed.
-bool IsCtrlPressed();
-
-// Returns true if the alt key is currently pressed.
-bool IsAltPressed();
-
-// Use the Win32 API FormatMessage() function to generate a string, using
-// Windows's default Message Compiled resources; ignoring the inserts.
-std::wstring FormatMessage(unsigned messageid);
-
 // Uses the last Win32 error to generate a human readable message string.
 std::wstring FormatLastWin32Error();
 
 }  // namespace win_util
 
 #endif  // BASE_WIN_UTIL_H__
--- a/ipc/chromium/src/chrome/common/chrome_switches.cc
+++ b/ipc/chromium/src/chrome/common/chrome_switches.cc
@@ -1,439 +1,16 @@
 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
 #include "chrome/common/chrome_switches.h"
 
-#include "base/base_switches.h"
-
 namespace switches {
 
 // Can't find the switch you are looking for? try looking in
 // base/base_switches.cc instead.
 
-// Suppresses hang monitor dialogs in renderer processes.
-const wchar_t kDisableHangMonitor[]            = L"disable-hang-monitor";
-
-// Completely disables UMA metrics system.
-const wchar_t kDisableMetrics[]                = L"disable-metrics";
-
-// Enables the recording of metrics reports but disables reporting.
-// In contrast to kDisableMetrics, this executes all the code that a normal
-// client would use for reporting, except the report is dropped rather than sent
-// to the server. This is useful for finding issues in the metrics code during
-// UI and performance tests.
-const wchar_t kMetricsRecordingOnly[]          = L"metrics-recording-only";
-
-// Causes the browser process to throw an assertion on startup.
-const wchar_t kBrowserAssertTest[]             = L"assert-test";
-
-// Causes the renderer process to throw an assertion on launch.
-const wchar_t kRendererAssertTest[]            = L"renderer-assert-test";
-
-// Causes the browser process to crash on startup.
-const wchar_t kBrowserCrashTest[]              = L"crash-test";
-
-// Causes the renderer process to crash on launch.
-const wchar_t kRendererCrashTest[]             = L"renderer-crash-test";
-
-// Causes the renderer process to display a dialog on launch.
-const wchar_t kRendererStartupDialog[]         = L"renderer-startup-dialog";
-
-// Causes the plugin process to display a dialog on launch.
-const wchar_t kPluginStartupDialog[]           = L"plugin-startup-dialog";
-
-// Specifies a command that should be used to launch the plugin process.  Useful
-// for running the plugin process through purify or quantify.  Ex:
-//   --plugin-launcher="path\to\purify /Run=yes"
-const wchar_t kPluginLauncher[]                = L"plugin-launcher";
-
 // The value of this switch tells the child process which
 // IPC channel the browser expects to use to communicate with it.
 const wchar_t kProcessChannelID[]              = L"channel";
 
-// The value of this switch tells the app to listen for and broadcast
-// testing-related messages on IPC channel with the given ID.
-const wchar_t kTestingChannelID[]              = L"testing-channel";
-
-// The value of this switch specifies which page will be displayed
-// in newly-opened tabs.  We need this for testing purposes so