merge m-c -> oak
authorNick Alexander <nalexander@mozilla.com>
Mon, 23 Oct 2017 08:40:48 -0700
changeset 688878 d75176907522dc76957a419688e27ecd93f9da40
parent 688877 e462e8a395d5b0868bf62f04fd1743e08c3d1a6d (current diff)
parent 684703 d49501f258b105c5e2dcd0a59896ec1ceabf726b (diff)
child 688879 3d365d178c385149ac97f6c1d1585794f4edb08a
push id86883
push usernalexander@mozilla.com
push dateMon, 30 Oct 2017 21:34:53 +0000
milestone58.0a1
merge m-c -> oak MozReview-Commit-ID: JeDmXqssLXr
.cron.yml
browser/base/content/browser.js
browser/confvars.sh
browser/locales/en-US/chrome/browser/browser.dtd
browser/locales/en-US/chrome/browser/browser.properties
browser/themes/shared/customizableui/panelUI.inc.css
browser/themes/shared/notification-icons.inc.css
devtools/shim/aboutdevtools/images/feature-scratchpad.svg
devtools/shim/aboutdevtools/images/feature-style-editor.svg
devtools/shim/aboutdevtools/images/feature-web-audio.svg
editor/txtsvc/nsTSAtomList.h
ipc/glue/GeckoChildProcessHost.cpp
mobile/android/app/build.gradle
mobile/android/app/local.properties
security/manager/ssl/nsSmartCardMonitor.cpp
security/manager/ssl/nsSmartCardMonitor.h
security/manager/ssl/tests/unit/test_pkcs11_insert_remove.js
security/manager/ssl/tests/unit/test_pkcs11_no_events_after_removal.js
security/pkix/test/lib/pkixtestutil.cpp
services/common/blocklist-updater.js
taskcluster/ci/test/misc.yml
taskcluster/ci/test/test-sets.yml
taskcluster/taskgraph/transforms/tests.py
testing/mozharness/configs/builds/branch_specifics.py
toolkit/components/places/tests/migration/places_v10.sqlite
toolkit/components/places/tests/migration/places_v11.sqlite
toolkit/components/places/tests/migration/places_v17.sqlite
toolkit/components/places/tests/migration/places_v19.sqlite
toolkit/components/places/tests/migration/places_v21.sqlite
toolkit/components/places/tests/migration/places_v22.sqlite
toolkit/components/places/tests/migration/places_v23.sqlite
toolkit/components/places/tests/migration/places_v24.sqlite
toolkit/components/places/tests/migration/places_v25.sqlite
toolkit/components/places/tests/migration/places_v26.sqlite
toolkit/components/places/tests/migration/places_v27.sqlite
toolkit/components/places/tests/migration/places_v28.sqlite
toolkit/components/places/tests/migration/places_v29.sqlite
toolkit/components/places/tests/migration/places_v30.sqlite
toolkit/components/places/tests/migration/places_v32.sqlite
toolkit/components/places/tests/migration/places_v33.sqlite
toolkit/components/places/tests/migration/places_v37.sqlite
toolkit/components/places/tests/migration/places_v39.sqlite
toolkit/components/places/tests/migration/places_v40.sqlite
toolkit/components/places/tests/migration/places_v6.sqlite
toolkit/components/places/tests/migration/test_current_from_v11.js
toolkit/components/places/tests/migration/test_current_from_v19.js
toolkit/components/places/tests/migration/test_current_from_v24.js
toolkit/components/places/tests/migration/test_current_from_v25.js
toolkit/components/places/tests/migration/test_current_from_v26.js
toolkit/components/places/tests/migration/test_current_from_v27.js
toolkit/components/places/tests/migration/test_current_from_v6.js
toolkit/components/telemetry/Histograms.json
toolkit/mozapps/installer/packager.mk
xpcom/io/nsDirectoryService.cpp
--- a/.cron.yml
+++ b/.cron.yml
@@ -111,11 +111,9 @@ jobs:
           treeherder-symbol: Nfile
           target-tasks-method: file_update
       run-on-projects:
           - mozilla-central
       when:
           by-project:
               # No default branch
               mozilla-central:
-                  # Buildbot start time is 10:02am UTC, until we are able to
-                  # disable buildbot scheduling, use +12h
-                  - {hour: 22, minute: 0}
+                  - {hour: 10, minute: 0}
--- a/.hgignore
+++ b/.hgignore
@@ -140,16 +140,19 @@ GPATH
 ^testing/talos/talos/tests/tp5n
 ^testing/talos/talos/tests/devtools/damp.manifest.develop
 ^talos-venv
 ^py3venv
 ^testing/talos/talos/mitmproxy/mitmdump
 ^testing/talos/talos/mitmproxy/mitmproxy
 ^testing/talos/talos/mitmproxy/mitmweb
 
+# Ignore toolchains.json created by tooltool.
+^toolchains\.json
+
 # Ignore files created when running a reftest.
 ^lextab.py$
 
 # tup database
 ^\.tup
 
 # Ignore sync tps logs and reports
 tps\.log
--- a/accessible/ipc/win/PlatformChild.cpp
+++ b/accessible/ipc/win/PlatformChild.cpp
@@ -1,47 +1,52 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* 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 "mozilla/a11y/AccessibleHandler.h"
 #include "mozilla/a11y/Compatibility.h"
 #include "mozilla/a11y/PlatformChild.h"
 #include "mozilla/mscom/EnsureMTA.h"
 #include "mozilla/mscom/InterceptorLog.h"
 
 #include "Accessible2.h"
 #include "Accessible2_2.h"
 #include "AccessibleHypertext2.h"
+#include "AccessibleTable2.h"
 #include "AccessibleTableCell.h"
 
 #include "AccessibleHypertext2_i.c"
 
 namespace mozilla {
 namespace a11y {
 
 /**
  * Unfortunately the COM interceptor does not intrinsically handle array
  * outparams. Instead we manually define the relevant metadata here, and
  * register it in a call to mozilla::mscom::RegisterArrayData.
  * @see mozilla::mscom::ArrayData
  */
 static const mozilla::mscom::ArrayData sPlatformChildArrayData[] = {
   {IID_IEnumVARIANT, 3, 1, VT_DISPATCH, IID_IDispatch, 2},
   {IID_IAccessible2, 30, 1, VT_UNKNOWN | VT_BYREF, IID_IAccessibleRelation, 2},
-  {IID_IAccessibleRelation, 7, 1, VT_UNKNOWN | VT_BYREF, IID_IUnknown, 2},
-  {IID_IAccessible2_2, 48, 2, VT_UNKNOWN | VT_BYREF, IID_IUnknown, 3,
+  {IID_IAccessibleRelation, 7, 1, VT_UNKNOWN | VT_BYREF, NEWEST_IA2_IID, 2},
+  {IID_IAccessible2_2, 48, 2, VT_UNKNOWN | VT_BYREF, NEWEST_IA2_IID, 3,
    mozilla::mscom::ArrayData::Flag::eAllocatedByServer},
-  {IID_IAccessibleTableCell, 4, 0, VT_UNKNOWN | VT_BYREF, IID_IUnknown, 1,
+  {IID_IAccessibleTableCell, 4, 0, VT_UNKNOWN | VT_BYREF, NEWEST_IA2_IID, 1,
    mozilla::mscom::ArrayData::Flag::eAllocatedByServer},
-  {IID_IAccessibleTableCell, 7, 0, VT_UNKNOWN | VT_BYREF, IID_IUnknown, 1,
+  {IID_IAccessibleTableCell, 7, 0, VT_UNKNOWN | VT_BYREF, NEWEST_IA2_IID, 1,
    mozilla::mscom::ArrayData::Flag::eAllocatedByServer},
-  {IID_IAccessibleHypertext2, 25, 0, VT_UNKNOWN | VT_BYREF, IID_IUnknown, 1,
-   mozilla::mscom::ArrayData::Flag::eAllocatedByServer}
+  {IID_IAccessibleHypertext2, 25, 0, VT_UNKNOWN | VT_BYREF,
+   IID_IAccessibleHyperlink, 1,
+   mozilla::mscom::ArrayData::Flag::eAllocatedByServer},
+  {IID_IAccessibleTable2, 12, 0, VT_UNKNOWN | VT_BYREF,
+   NEWEST_IA2_IID, 1, mozilla::mscom::ArrayData::Flag::eAllocatedByServer}
 };
 
 // Type libraries are thread-neutral, so we can register those from any
 // apartment. OTOH, proxies must be registered from within the apartment where
 // we intend to instantiate them. Therefore RegisterProxy() must be called
 // via EnsureMTA.
 PlatformChild::PlatformChild()
   : mAccTypelib(mozilla::mscom::RegisterTypelib(L"oleacc.dll",
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -584,61 +584,33 @@ function findChildShell(aDocument, aDocS
     docShell = findChildShell(aDocument, docShell, aSoughtURI);
     if (docShell)
       return docShell;
   }
   return null;
 }
 
 var gPopupBlockerObserver = {
-  _reportButton: null,
-
-  onReportButtonMousedown(aEvent) {
-    // The button is part of the textbox that is considered the popup's anchor,
-    // thus consumeoutsideclicks="false" is ignored. Moreover On OS X the popup
-    // is hidden well before mousedown gets dispatched.
-    // Thus, if the popup is open and the user clicks on the button, it gets
-    // hidden before mousedown, and may then be unexpectedly reopened by click.
-    // To avoid this, we check if mousedown is in the same tick as popupHidden,
-    // and, in such a case, we don't handle the click event.
-    // Note we can't just openPopup in mousedown, cause this popup is shared by
-    // multiple anchors, and we could end up opening it just before the other
-    // anchor tries to hide it.
-    if (aEvent.button != 0 || aEvent.target != this._reportButton || this.isPopupHidingTick)
-      return;
-
-    this._reportButton.addEventListener("click", event => {
-      document.getElementById("blockedPopupOptions")
-              .openPopup(event.target, "after_end", 0, 2, false, false, event);
-    }, { once: true });
-  },
-
   handleEvent(aEvent) {
     if (aEvent.originalTarget != gBrowser.selectedBrowser)
       return;
 
-    if (!this._reportButton)
-      this._reportButton = document.getElementById("page-report-button");
+    gIdentityHandler.refreshIdentityBlock();
 
     if (!gBrowser.selectedBrowser.blockedPopups ||
         !gBrowser.selectedBrowser.blockedPopups.length) {
-      // Hide the icon in the location bar (if the location bar exists)
-      this._reportButton.hidden = true;
-
       // Hide the notification box (if it's visible).
       let notificationBox = gBrowser.getNotificationBox();
       let notification = notificationBox.getNotificationWithValue("popup-blocked");
       if (notification) {
         notificationBox.removeNotification(notification, false);
       }
       return;
     }
 
-    this._reportButton.hidden = false;
-
     // Only show the notification again if we've not already shown it. Since
     // notifications are per-browser, we don't need to worry about re-adding
     // it.
     if (!gBrowser.selectedBrowser.blockedPopups.reported) {
       if (gPrefService.getBoolPref("privacy.popups.showBrowserMessage")) {
         var brandBundle = document.getElementById("bundle_brand");
         var brandShortName = brandBundle.getString("brandShortName");
         var popupCount = gBrowser.selectedBrowser.blockedPopups.length;
@@ -728,22 +700,17 @@ var gPopupBlockerObserver = {
     if (PrivateBrowsingUtils.isWindowPrivate(window))
       blockedPopupAllowSite.setAttribute("disabled", "true");
     else
       blockedPopupAllowSite.removeAttribute("disabled");
 
     let blockedPopupDontShowMessage = document.getElementById("blockedPopupDontShowMessage");
     let showMessage = gPrefService.getBoolPref("privacy.popups.showBrowserMessage");
     blockedPopupDontShowMessage.setAttribute("checked", !showMessage);
-    if (aEvent.target.anchorNode.id == "page-report-button") {
-      aEvent.target.anchorNode.setAttribute("open", "true");
-      blockedPopupDontShowMessage.setAttribute("label", gNavigatorBundle.getString("popupWarningDontShowFromLocationbar"));
-    } else {
-      blockedPopupDontShowMessage.setAttribute("label", gNavigatorBundle.getString("popupWarningDontShowFromMessage"));
-    }
+    blockedPopupDontShowMessage.setAttribute("label", gNavigatorBundle.getString("popupWarningDontShowFromMessage"));
 
     let blockedPopupsSeparator =
         document.getElementById("blockedPopupsSeparator");
     blockedPopupsSeparator.setAttribute("hidden", true);
 
     gBrowser.selectedBrowser.retrieveListOfBlockedPopups().then(blockedPopups => {
       let foundUsablePopupURI = false;
       if (blockedPopups) {
@@ -788,23 +755,16 @@ var gPopupBlockerObserver = {
       // Show the separator if we added any
       // showable popup addresses to the menu.
       if (foundUsablePopupURI)
         blockedPopupsSeparator.removeAttribute("hidden");
     }, null);
   },
 
   onPopupHiding(aEvent) {
-    if (aEvent.target.anchorNode.id == "page-report-button") {
-      aEvent.target.anchorNode.removeAttribute("open");
-
-      this.isPopupHidingTick = true;
-      setTimeout(() => this.isPopupHidingTick = false, 0);
-    }
-
     let item = aEvent.target.lastChild;
     while (item && item.getAttribute("observes") != "blockedPopupsSeparator") {
       let next = item.previousSibling;
       item.remove();
       item = next;
     }
   },
 
@@ -7658,16 +7618,24 @@ var gIdentityHandler = {
         hasGrantedPermissions = true;
       }
     }
 
     if (hasGrantedPermissions) {
       this._identityBox.classList.add("grantedPermissions");
     }
 
+    // Show blocked popup icon in the identity-box if popups are blocked
+    // irrespective of popup permission capability value.
+    if (gBrowser.selectedBrowser.blockedPopups &&
+        gBrowser.selectedBrowser.blockedPopups.length) {
+      let icon = permissionAnchors.popup;
+      icon.setAttribute("showing", "true");
+    }
+
     // Push the appropriate strings out to the UI
     this._connectionIcon.setAttribute("tooltiptext", tooltip);
 
     if (this._isExtensionPage) {
       let extensionName = extensionNameFromURI(this._uri);
       this._extensionIcon.setAttribute("tooltiptext",
         gNavigatorBundle.getFormattedString("identity.extension.tooltip", [extensionName]));
     }
@@ -8008,19 +7976,41 @@ var gIdentityHandler = {
               state: SitePermissions.ALLOW,
               scope: SitePermissions.SCOPE_REQUEST,
               inUse: true,
             });
           }
         }
       }
     }
+
+    let hasBlockedPopupIndicator = false;
     for (let permission of permissions) {
       let item = this._createPermissionItem(permission);
       this._permissionList.appendChild(item);
+
+      if (permission.id == "popup" &&
+          gBrowser.selectedBrowser.blockedPopups &&
+          gBrowser.selectedBrowser.blockedPopups.length) {
+        this._createBlockedPopupIndicator();
+        hasBlockedPopupIndicator = true;
+      }
+    }
+
+    if (gBrowser.selectedBrowser.blockedPopups &&
+        gBrowser.selectedBrowser.blockedPopups.length &&
+        !hasBlockedPopupIndicator) {
+      let permission = {
+        id: "popup",
+        state: SitePermissions.UNKNOWN,
+        scope: SitePermissions.SCOPE_PERSISTENT,
+      };
+      let item = this._createPermissionItem(permission);
+      this._permissionList.appendChild(item);
+      this._createBlockedPopupIndicator();
     }
 
     // Show a placeholder text if there's no permission and no reload hint.
     if (!this._permissionList.hasChildNodes() &&
         this._permissionReloadHint.hasAttribute("hidden")) {
       this._permissionEmptyHint.removeAttribute("hidden");
     } else {
       this._permissionEmptyHint.setAttribute("hidden", "true");
@@ -8040,16 +8030,51 @@ var gIdentityHandler = {
       classes += " in-use";
     img.setAttribute("class", classes);
 
     let nameLabel = document.createElement("label");
     nameLabel.setAttribute("flex", "1");
     nameLabel.setAttribute("class", "identity-popup-permission-label");
     nameLabel.textContent = SitePermissions.getPermissionLabel(aPermission.id);
 
+    if (aPermission.id == "popup") {
+      let menulist = document.createElement("menulist");
+      let menupopup = document.createElement("menupopup");
+      let block = document.createElement("vbox");
+      block.setAttribute("id", "identity-popup-popup-container");
+      menulist.setAttribute("class", "identity-popup-popup-menulist");
+      menulist.setAttribute("id", "identity-popup-popup-menulist");
+
+      for (let state of SitePermissions.getAvailableStates(aPermission.id)) {
+        let menuitem = document.createElement("menuitem");
+        if (state == SitePermissions.getDefault(aPermission.id)) {
+          menuitem.setAttribute("value", 0);
+        } else {
+          menuitem.setAttribute("value", state);
+        }
+        menuitem.setAttribute("label", SitePermissions.getMultichoiceStateLabel(state));
+        menupopup.appendChild(menuitem);
+      }
+
+      menulist.appendChild(menupopup);
+      menulist.setAttribute("value", aPermission.state);
+
+      // Avoiding listening to the "select" event on purpose. See Bug 1404262.
+      menulist.addEventListener("command", () => {
+        SitePermissions.set(gBrowser.currentURI, "popup", menulist.selectedItem.value);
+      });
+
+      container.appendChild(img);
+      container.appendChild(nameLabel);
+      container.appendChild(menulist);
+      block.appendChild(container);
+
+      return block;
+    }
+
     let stateLabel = document.createElement("label");
     stateLabel.setAttribute("flex", "1");
     stateLabel.setAttribute("class", "identity-popup-permission-state-label");
     let {state, scope} = aPermission;
     // If the user did not permanently allow this device but it is currently
     // used, set the variables to display a "temporarily allowed" info.
     if (state != SitePermissions.ALLOW && aPermission.inUse) {
       state = SitePermissions.ALLOW;
@@ -8121,17 +8146,46 @@ var gIdentityHandler = {
     });
 
     container.appendChild(img);
     container.appendChild(nameLabel);
     container.appendChild(stateLabel);
     container.appendChild(button);
 
     return container;
-  }
+  },
+
+  _createBlockedPopupIndicator() {
+    let indicator = document.createElement("hbox");
+    indicator.setAttribute("class", "identity-popup-permission-item");
+    indicator.setAttribute("align", "center");
+    indicator.setAttribute("id", "blocked-popup-indicator-item");
+
+    let icon = document.createElement("image");
+    icon.setAttribute("class", "popup-subitem identity-popup-permission-icon");
+
+    let text = document.createElement("label");
+    text.setAttribute("flex", "1");
+    text.setAttribute("class", "identity-popup-permission-label text-link");
+
+    let popupCount = gBrowser.selectedBrowser.blockedPopups.length;
+    let messageBase = gNavigatorBundle.getString("popupShowBlockedPopupsIndicatorText");
+    let message = PluralForm.get(popupCount, messageBase)
+                                 .replace("#1", popupCount);
+    text.setAttribute("value", message);
+
+    text.addEventListener("click", () => {
+      gPopupBlockerObserver.showAllBlockedPopups(gBrowser.selectedBrowser);
+    });
+
+    indicator.appendChild(icon);
+    indicator.appendChild(text);
+
+    document.getElementById("identity-popup-popup-container").appendChild(indicator);
+  },
 };
 
 /**
  * Fired on the "marionette-remote-control" system notification,
  * indicating if the browser session is under remote control.
  */
 const gRemoteControl = {
   observe(subject, topic, data) {
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -153,17 +153,17 @@
 
     <!-- for url bar autocomplete -->
     <panel type="autocomplete-richlistbox"
            id="PopupAutoCompleteRichResult"
            noautofocus="true"
            hidden="true"
            flip="none"
            level="parent"
-           overflowpadding="30" />
+           overflowpadding="15" />
 
    <!-- for date/time picker. consumeoutsideclicks is set to never, so that
         clicks on the anchored input box are never consumed. -->
     <panel id="DateTimePickerPanel"
            type="arrow"
            hidden="true"
            orient="vertical"
            noautofocus="true"
@@ -805,16 +805,18 @@
                   <image data-permission-id="indexedDB" class="blocked-permission-icon indexedDB-icon" role="button"
                          tooltiptext="&urlbar.indexedDBBlocked.tooltip;"/>
                   <image data-permission-id="microphone" class="blocked-permission-icon microphone-icon" role="button"
                          tooltiptext="&urlbar.microphoneBlocked.tooltip;"/>
                   <image data-permission-id="screen" class="blocked-permission-icon screen-icon" role="button"
                          tooltiptext="&urlbar.screenBlocked.tooltip;"/>
                   <image data-permission-id="persistent-storage" class="blocked-permission-icon persistent-storage-icon" role="button"
                          tooltiptext="&urlbar.persistentStorageBlocked.tooltip;"/>
+                  <image data-permission-id="popup" class="blocked-permission-icon popup-icon" role="button"
+                         tooltiptext="&urlbar.popupBlocked.tooltip;"/>
                 </box>
                 <box id="notification-popup-box"
                      hidden="true"
                      onmouseover="document.getElementById('identity-box').classList.add('no-hover');"
                      onmouseout="document.getElementById('identity-box').classList.remove('no-hover');"
                      align="center">
                   <image id="default-notification-icon" class="notification-anchor-icon" role="button"
                          tooltiptext="&urlbar.defaultNotificationAnchor.tooltip;"/>
@@ -865,22 +867,16 @@
                 <label id="switchtab" class="urlbar-display urlbar-display-switchtab" value="&urlbar.switchToTab.label;"/>
                 <label id="extension" class="urlbar-display urlbar-display-extension" value="&urlbar.extension.label;"/>
               </box>
               <hbox id="page-action-buttons">
                 <hbox id="userContext-icons" hidden="true">
                   <label id="userContext-label"/>
                   <image id="userContext-indicator"/>
                 </hbox>
-                <image id="page-report-button"
-                       class="urlbar-icon urlbar-page-action"
-                       role="button"
-                       hidden="true"
-                       tooltiptext="&pageReportIcon.tooltip;"
-                       onmousedown="gPopupBlockerObserver.onReportButtonMousedown(event);"/>
                 <image id="reader-mode-button"
                        class="urlbar-icon urlbar-page-action"
                        role="button"
                        hidden="true"
                        onclick="ReaderParent.buttonClick(event);"/>
                 <toolbarbutton id="urlbar-zoom-button"
                        onclick="FullZoom.reset();"
                        tooltip="dynamic-shortcut-tooltip"
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -13,17 +13,17 @@
 
   <binding id="tabbrowser">
     <resources>
       <stylesheet src="chrome://browser/content/tabbrowser.css"/>
     </resources>
 
     <content>
       <xul:tabbox anonid="tabbox" class="tabbrowser-tabbox"
-                  flex="1" eventnode="document" xbl:inherits="handleCtrlPageUpDown,tabcontainer"
+                  flex="1" eventnode="document" xbl:inherits="tabcontainer"
                   onselect="if (event.target.localName == 'tabpanels') this.parentNode.updateCurrentBrowser();">
         <xul:tabpanels flex="1" class="plain" selectedIndex="0" anonid="panelcontainer">
           <xul:notificationbox flex="1" notificationside="top">
             <xul:hbox flex="1" class="browserSidebarContainer">
               <xul:vbox flex="1" class="browserContainer">
                 <xul:stack flex="1" class="browserStack" anonid="browserStack">
                   <xul:browser anonid="initialBrowser" type="content" message="true" messagemanagergroup="browsers"
                                primary="true" blank="true"
@@ -1005,24 +1005,24 @@
             let loadingPrincipal = aLoadingPrincipal ||
                                    Services.scriptSecurityManager.getSystemPrincipal();
             let requestContextID = aRequestContextID || 0;
             let sizedIconUrl = browser.mIconURL || "";
             if (sizedIconUrl != aTab.getAttribute("image")) {
               if (sizedIconUrl) {
                 if (!browser.mIconLoadingPrincipal ||
                     !browser.mIconLoadingPrincipal.equals(loadingPrincipal)) {
-                  aTab.setAttribute("iconLoadingPrincipal",
+                  aTab.setAttribute("iconloadingprincipal",
                     this.serializationHelper.serializeToString(loadingPrincipal));
                   aTab.setAttribute("requestcontextid", requestContextID);
                   browser.mIconLoadingPrincipal = loadingPrincipal;
                 }
                 aTab.setAttribute("image", sizedIconUrl);
               } else {
-                aTab.removeAttribute("iconLoadingPrincipal");
+                aTab.removeAttribute("iconloadingprincipal");
                 delete browser.mIconLoadingPrincipal;
                 aTab.removeAttribute("image");
               }
               this._tabAttrModified(aTab, ["image"]);
             }
 
             this._callProgressListeners(browser, "onLinkIconAvailable", [browser.mIconURL]);
           ]]>
@@ -1620,16 +1620,25 @@
                 // At this point, we now have a URI.
                 // Let's try to unescape it using a character set
                 // in case the URI is not ASCII.
                 try {
                   var characterSet = browser.characterSet;
                   const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
                                                  .getService(Components.interfaces.nsITextToSubURI);
                   title = textToSubURI.unEscapeNonAsciiURI(characterSet, title);
+                  // If it's a long data: URI that uses base64 encoding, truncate to
+                  // a reasonable length rather than trying to display the entire thing.
+                  // We can't shorten arbitrary URIs like this, as bidi etc might mean
+                  // we need the trailing characters for display. But a base64-encoded
+                  // data-URI is plain ASCII, so this is OK for tab-title display.
+                  // (See bug 1408854.)
+                  if (title.length > 500 && title.match(/^data:[^,]+;base64,/)) {
+                    title = title.substring(0, 500) + "\u2026";
+                  }
                 } catch (ex) { /* Do nothing. */ }
               } else {
                 // Still no title? Fall back to our untitled string.
                 title = gTabBrowserBundle.GetStringFromName("tabs.emptyTabTitle");
               }
             }
 
             return this._setTabLabel(aTab, title, { isContentTitle });
@@ -7755,17 +7764,17 @@
                   anonid="tab-loading-burst"
                   class="tab-loading-burst"/>
         <xul:hbox xbl:inherits="pinned,selected=visuallyselected,titlechanged,attention"
                   class="tab-content" align="center">
           <xul:hbox xbl:inherits="fadein,pinned,busy,progress,selected=visuallyselected"
                     anonid="tab-throbber"
                     class="tab-throbber"
                     layer="true"/>
-          <xul:image xbl:inherits="src=image,loadingprincipal=iconLoadingPrincipal,requestcontextid,fadein,pinned,selected=visuallyselected,busy,crashed,sharing"
+          <xul:image xbl:inherits="src=image,loadingprincipal=iconloadingprincipal,requestcontextid,fadein,pinned,selected=visuallyselected,busy,crashed,sharing"
                      anonid="tab-icon-image"
                      class="tab-icon-image"
                      validate="never"
                      role="presentation"/>
           <xul:image xbl:inherits="sharing,selected=visuallyselected,pinned"
                      anonid="sharing-icon"
                      class="tab-sharing-icon-overlay"
                      role="presentation"/>
@@ -8244,18 +8253,20 @@
         <parameter name="aMenuitem"/>
         <parameter name="aTab"/>
         <body><![CDATA[
           aMenuitem.setAttribute("label", aTab.label);
           aMenuitem.setAttribute("crop", "end");
 
           if (aTab.hasAttribute("busy")) {
             aMenuitem.setAttribute("busy", aTab.getAttribute("busy"));
+            aMenuitem.removeAttribute("iconloadingprincipal");
             aMenuitem.removeAttribute("image");
           } else {
+            aMenuitem.setAttribute("iconloadingprincipal", aTab.getAttribute("iconloadingprincipal"));
             aMenuitem.setAttribute("image", aTab.getAttribute("image"));
             aMenuitem.removeAttribute("busy");
           }
 
           if (aTab.hasAttribute("pending"))
             aMenuitem.setAttribute("pending", aTab.getAttribute("pending"));
           else
             aMenuitem.removeAttribute("pending");
--- a/browser/base/content/test/popups/browser.ini
+++ b/browser/base/content/test/popups/browser.ini
@@ -5,8 +5,12 @@ support-files =
   popup_blocker_a.html
   popup_blocker_b.html
 skip-if = (os == 'linux') || (e10s && debug) # Frequent bug 1081925 and bug 1125520 failures
 [browser_popup_frames.js]
 support-files =
   popup_blocker.html
   popup_blocker_a.html
   popup_blocker_b.html
+[browser_popup_blocker_identity_block.js]
+support-files =
+  popup_blocker2.html
+  popup_blocker_a.html
--- a/browser/base/content/test/popups/browser_popup_blocker.js
+++ b/browser/base/content/test/popups/browser_popup_blocker.js
@@ -71,26 +71,8 @@ add_task(async function test_opening_blo
   gBrowser.removeTab(tab);
   for (let popup of popupTabs) {
     gBrowser.removeTab(popup);
   }
   clearAllPermissionsByPrefix("popup");
   // Ensure the menu closes.
   menu.hidePopup();
 });
-
-add_task(async function check_icon_hides() {
-  // Enable the popup blocker.
-  await SpecialPowers.pushPrefEnv({set: [["dom.disable_open_during_load", true]]});
-
-  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, baseURL + "popup_blocker.html");
-
-  let button = document.getElementById("page-report-button");
-  await BrowserTestUtils.waitForCondition(() =>
-    gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked"));
-  ok(!button.hidden, "Button should be visible");
-
-  let otherPageLoaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
-  openLinkIn(baseURL, "current", {});
-  await otherPageLoaded;
-  ok(button.hidden, "Button should have hidden again after another page loaded.");
-  await BrowserTestUtils.removeTab(tab);
-});
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/popups/browser_popup_blocker_identity_block.js
@@ -0,0 +1,167 @@
+"use strict";
+
+/* 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/. */
+
+Components.utils.import("resource:///modules/SitePermissions.jsm");
+Components.utils.import("resource://gre/modules/Services.jsm");
+
+const baseURL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://example.com");
+const URL = baseURL + "popup_blocker2.html";
+const URI = Services.io.newURI(URL);
+
+function openIdentityPopup() {
+  let promise = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
+  gIdentityHandler._identityBox.click();
+  return promise;
+}
+
+function closeIdentityPopup() {
+  let promise = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popuphidden");
+  gIdentityHandler._identityPopup.hidePopup();
+  return promise;
+}
+
+add_task(async function enable_popup_blocker() {
+  // Enable popup blocker.
+  await SpecialPowers.pushPrefEnv({set: [["dom.disable_open_during_load", true]]});
+  await SpecialPowers.pushPrefEnv({set: [["dom.disable_open_click_delay", 0]]});
+});
+
+add_task(async function check_blocked_popup_indicator() {
+  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
+
+  // Blocked popup indicator should not exist in the identity popup when there are no blocked popups.
+  await openIdentityPopup();
+  Assert.equal(document.getElementById("blocked-popup-indicator-item"), null);
+  await closeIdentityPopup();
+
+  // Blocked popup notification icon should be hidden in the identity block when no popups are blocked.
+  let icon = gIdentityHandler._identityBox
+      .querySelector(".blocked-permission-icon[data-permission-id='popup']");
+  Assert.equal(icon.hasAttribute("showing"), false);
+
+  await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => {
+    let open = content.document.getElementById("pop");
+    open.click();
+  });
+
+  // Wait for popup block.
+  await BrowserTestUtils.waitForCondition(() =>
+    gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked"));
+
+  // Check if blocked popup indicator text is visible in the identity popup. It should be visible.
+  document.getElementById("identity-icon").click();
+  await openIdentityPopup();
+  await BrowserTestUtils.waitForCondition(() => document.getElementById("blocked-popup-indicator-item") !== null);
+  await closeIdentityPopup();
+
+  // Check if blocked popup icon is visible in the identity block.
+  Assert.equal(icon.getAttribute("showing"), "true");
+
+  gBrowser.removeTab(tab);
+});
+
+// Check if clicking on "Show blocked popups" shows blocked popups.
+add_task(async function check_popup_showing() {
+  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
+
+  await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => {
+    let open = content.document.getElementById("pop");
+    open.click();
+  });
+
+  // Wait for popup block.
+  await BrowserTestUtils.waitForCondition(() =>
+    gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked"));
+
+  // Store the popup that opens in this array.
+  let popup;
+  function onTabOpen(event) {
+    popup = event.target;
+  }
+  gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen);
+
+  // Open identity popup and click on "Show blocked popups".
+  await openIdentityPopup();
+  let e = document.getElementById("blocked-popup-indicator-item");
+  let text = e.getElementsByTagName("label")[0];
+  text.click();
+
+  await BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabOpen");
+  await BrowserTestUtils.waitForCondition(() =>
+    popup.linkedBrowser.currentURI.spec != "about:blank");
+
+  gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen);
+
+  ok(popup.linkedBrowser.currentURI.spec.endsWith("popup_blocker_a.html"), "Popup a");
+
+  gBrowser.removeTab(popup);
+  gBrowser.removeTab(tab);
+});
+
+// Test if changing menulist values of blocked popup indicator changes permission state and popup behavior.
+add_task(async function check_permission_state_change() {
+  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
+
+  // Initially the permission state is BLOCK for popups (set by the prefs).
+  let state = SitePermissions.get(URI, "popup", gBrowser).state;
+  Assert.equal(state, SitePermissions.BLOCK);
+
+  await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => {
+    let open = content.document.getElementById("pop");
+    open.click();
+  });
+
+  // Wait for popup block.
+  await BrowserTestUtils.waitForCondition(() =>
+    gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked"));
+
+  // Open identity popup and change permission state to allow.
+  await openIdentityPopup();
+  let menulist = document.getElementById("identity-popup-popup-menulist");
+  let menuitem = menulist.getElementsByTagName("menuitem")[0];
+  menuitem.click();
+  await closeIdentityPopup();
+
+  state = SitePermissions.get(URI, "popup", gBrowser).state;
+  Assert.equal(state, SitePermissions.ALLOW);
+
+  // Store the popup that opens in this array.
+  let popup;
+  function onTabOpen(event) {
+    popup = event.target;
+  }
+  gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen);
+
+  // Check if a popup opens.
+  await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => {
+    let open = content.document.getElementById("pop");
+    open.click();
+  });
+
+  await BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabOpen");
+  await BrowserTestUtils.waitForCondition(() =>
+    popup.linkedBrowser.currentURI.spec != "about:blank");
+
+  gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen);
+
+  ok(popup.linkedBrowser.currentURI.spec.endsWith("popup_blocker_a.html"), "Popup a");
+
+  gBrowser.removeTab(popup);
+
+  // Open identity popup and change permission state to block.
+  await openIdentityPopup();
+  menulist = document.getElementById("identity-popup-popup-menulist");
+  menuitem = menulist.getElementsByTagName("menuitem")[1];
+  menuitem.click();
+  await closeIdentityPopup();
+
+  // Clicking on the "Block" menuitem should remove the permission object(same behavior as UNKNOWN state).
+  // We have already confirmed that popups are blocked when the permission state is BLOCK.
+  state = SitePermissions.get(URI, "popup", gBrowser).state;
+  Assert.equal(state, SitePermissions.BLOCK);
+
+  gBrowser.removeTab(tab);
+});
--- a/browser/base/content/test/popups/browser_popup_frames.js
+++ b/browser/base/content/test/popups/browser_popup_frames.js
@@ -19,69 +19,59 @@ add_task(async function test_opening_blo
   });
 
   // Wait for the popup-blocked notification.
   let notification;
   await BrowserTestUtils.waitForCondition(() =>
     notification = gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked"));
 
   ok(notification, "Should have notification.");
-  ok(!document.getElementById("page-report-button").hidden,
-     "URL bar popup indicator should not be hidden");
 
   await ContentTask.spawn(tab.linkedBrowser, baseURL, async function(uri) {
     let iframe = content.document.createElement("iframe");
     iframe.src = uri;
     let pageHideHappened = ContentTaskUtils.waitForEvent(this, "pagehide", true);
     content.document.body.appendChild(iframe);
     await pageHideHappened;
   });
 
   notification = gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked");
   ok(notification, "Should still have notification");
-  ok(!document.getElementById("page-report-button").hidden,
-     "URL bar popup indicator should still be visible");
 
   // Now navigate the subframe.
   await ContentTask.spawn(tab.linkedBrowser, null, async function() {
     let pageHideHappened = ContentTaskUtils.waitForEvent(this, "pagehide", true);
     content.document.getElementById("popupframe").contentDocument.location.href = "about:blank";
     await pageHideHappened;
   });
 
   await BrowserTestUtils.waitForCondition(() =>
     !gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked"));
   ok(!gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked"),
      "Should no longer have notification");
-  ok(document.getElementById("page-report-button").hidden,
-     "URL bar popup indicator should be hidden");
 
   // Remove the frame and add another one:
   await ContentTask.spawn(tab.linkedBrowser, baseURL + "popup_blocker.html", uri => {
     content.document.getElementById("popupframe").remove();
     let iframe = content.document.createElement("iframe");
     iframe.id = "popupframe";
     iframe.src = uri;
     content.document.body.appendChild(iframe);
   });
 
   // Wait for the popup-blocked notification.
   await BrowserTestUtils.waitForCondition(() =>
     notification = gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked"));
 
   ok(notification, "Should have notification.");
-  ok(!document.getElementById("page-report-button").hidden,
-     "URL bar popup indicator should not be hidden");
 
   await ContentTask.spawn(tab.linkedBrowser, null, () => {
     content.document.getElementById("popupframe").remove();
   });
 
   await BrowserTestUtils.waitForCondition(() =>
     !gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked"));
   ok(!gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked"),
      "Should no longer have notification");
-  ok(document.getElementById("page-report-button").hidden,
-     "URL bar popup indicator should be hidden");
 
   await BrowserTestUtils.removeTab(tab);
 });
 
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/popups/popup_blocker2.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="UTF-8">
+    <title>Page creating a popup</title>
+  </head>
+  <body>
+    <button id="pop" onclick='window.setTimeout(() => {window.open("popup_blocker_a.html", "a");}, 10);'>Open Popup</button>
+  </body>
+</html>
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -1803,16 +1803,56 @@ file, You can obtain one at http://mozil
         </getter>
         <setter>
           <![CDATA[
             return this._maxResults = parseInt(val);
           ]]>
         </setter>
       </property>
 
+      <!-- This is set either to undefined or to a new object containing
+           { start, end } margin values in pixels. These are used to align the
+           results to the input field. -->
+      <property name="margins"
+                onget="return this._margins;">
+        <setter>
+          <![CDATA[
+          if (val == this._margins) {
+            return val;
+          }
+
+          if (val && this._margins && val.start == this._margins.start &&
+                                      val.end == this._margins.end) {
+            return val;
+          }
+
+          this._margins = val;
+
+          if (val) {
+            let paddingInCSS =
+                3   // .autocomplete-richlistbox padding-left/right
+              + 6   // .ac-site-icon margin-inline-start
+              + 16  // .ac-site-icon width
+              + 6;  // .ac-site-icon margin-inline-end
+            let actualVal = Math.round(val.start) - paddingInCSS;
+            let actualValEnd = Math.round(val.end);
+            this.style.setProperty("--item-padding-start", actualVal + "px");
+            this.style.setProperty("--item-padding-end", actualValEnd + "px");
+          } else {
+            this.style.removeProperty("--item-padding-start");
+            this.style.removeProperty("--item-padding-end");
+          }
+          for (let item of this.richlistbox.childNodes) {
+            item.handleOverUnderflow();
+          }
+          return val;
+          ]]>
+        </setter>
+      </property>
+
       <method name="openAutocompletePopup">
         <parameter name="aInput"/>
         <parameter name="aElement"/>
         <body>
           <![CDATA[
           // initially the panel is hidden
           // to avoid impacting startup / new window performance
           aInput.popup.hidden = false;
@@ -1857,38 +1897,50 @@ file, You can obtain one at http://mozil
             let offset = documentRect.left - elementRect.left;
             this.style.marginLeft = offset + "px";
           }
 
           // Keep the popup items' site icons aligned with the urlbar's identity
           // icon if it's not too far from the edge of the window.  We define
           // "too far" as "more than 30% of the window's width AND more than
           // 250px".  Do this *before* adding any items because when the new
-          // value of siteIconStart is different from the previous value, over-
+          // value of the margins are different from the previous value, over-
           // and underflow must be handled for each item already in the popup.
           let boundToCheck = popupDirection == "rtl" ? "right" : "left";
           let inputRect = this.DOMWindowUtils.getBoundsWithoutFlushing(aInput);
           let startOffset = Math.abs(inputRect[boundToCheck] - documentRect[boundToCheck]);
           let alignSiteIcons = startOffset / width <= 0.3 || startOffset <= 250;
           if (alignSiteIcons) {
+            // Calculate the end margin if we have a start margin.
+            let boundToCheckEnd = popupDirection == "rtl" ? "left" : "right";
+            let endOffset = Math.abs(inputRect[boundToCheckEnd] -
+                                     documentRect[boundToCheckEnd]);
+            if (endOffset > startOffset * 2) {
+              // Provide more space when aligning would result in an unbalanced
+              // margin. This allows the location bar to be moved to the start
+              // of the navigation toolbar to reclaim space for results.
+              endOffset = startOffset;
+            }
             let identityIcon = document.getElementById("identity-icon");
             let identityRect =
               this.DOMWindowUtils.getBoundsWithoutFlushing(identityIcon);
             if (popupDirection == "rtl") {
-              this.siteIconStart = documentRect.right - identityRect.right;
+              this.margins = { start: documentRect.right - identityRect.right,
+                               end: endOffset };
             } else {
-              this.siteIconStart = identityRect.left;
+              this.margins = { start: identityRect.left,
+                               end: endOffset };
             }
           } else {
             // Reset the alignment so that the site icons are positioned
             // according to whatever's in the CSS.
-            this.siteIconStart = undefined;
+            this.margins = undefined;
           }
 
-          // Now that siteIconStart has been set, start adding items (via
+          // Now that the margins have been set, start adding items (via
           // _invalidate).
           this.mInput = aInput;
           aInput.controller.setInitiallySelectedIndex(this._isFirstResultHeuristic ? 0 : -1);
           this.view = aInput.controller.QueryInterface(Components.interfaces.nsITreeView);
           this._invalidate();
 
           try {
             let whichNotification = aInput.whichSearchSuggestionsNotification;
@@ -1922,19 +1974,19 @@ file, You can obtain one at http://mozil
       </method>
 
       <method name="_showSearchSuggestionsNotification">
         <parameter name="whichNotification"/>
         <parameter name="popupDirection"/>
         <body>
           <![CDATA[
           if (whichNotification == "opt-out") {
-            if (this.siteIconStart) {
+            if (this.margins) {
               this.searchSuggestionsNotification.style.paddingInlineStart =
-                this.siteIconStart + "px";
+                this.margins.start + "px";
             } else {
               this.searchSuggestionsNotification.style.removeProperty("padding-inline-start");
             }
 
             // We want to animate the opt-out hint only once.
             if (!this._firstSearchSuggestionsNotification) {
               this._firstSearchSuggestionsNotification = true;
               this.searchSuggestionsNotification.setAttribute("animate", "true");
--- a/browser/components/extensions/test/xpcshell/test_ext_pkcs11_management.js
+++ b/browser/components/extensions/test/xpcshell/test_ext_pkcs11_management.js
@@ -97,16 +97,17 @@ add_task(async function test_pkcs11() {
       browser.test.assertFalse(isInstalled, "PKCS#11 module is not installed before we install it");
       await browser.pkcs11.installModule("testmodule", 0);
       isInstalled = await browser.pkcs11.isModuleInstalled("testmodule");
       browser.test.assertTrue(isInstalled, "PKCS#11 module is installed after we install it");
       let slots = await browser.pkcs11.getModuleSlots("testmodule");
       browser.test.assertEq("Test PKCS11 Slot", slots[0].name, "The first slot name matches the expected name");
       browser.test.assertEq("Test PKCS11 Slot 二", slots[1].name, "The second slot name matches the expected name");
       browser.test.assertTrue(slots[1].token, "The second slot has a token");
+      browser.test.assertFalse(slots[2].token, "The third slot has no token");
       browser.test.assertEq("Test PKCS11 Tokeñ 2 Label", slots[1].token.name, "The token name matches the expected name");
       browser.test.assertEq("Test PKCS11 Manufacturer ID", slots[1].token.manufacturer, "The token manufacturer matches the expected manufacturer");
       browser.test.assertEq("0.0", slots[1].token.HWVersion, "The token hardware version matches the expected version");
       browser.test.assertEq("0.0", slots[1].token.FWVersion, "The token firmware version matches the expected version");
       browser.test.assertEq("", slots[1].token.serial, "The token has no serial number");
       browser.test.assertFalse(slots[1].token.isLoggedIn, "The token is not logged in");
       await browser.pkcs11.uninstallModule("testmodule");
       isInstalled = await browser.pkcs11.isModuleInstalled("testmodule");
--- a/browser/components/originattributes/test/browser/browser_favicon_firstParty.js
+++ b/browser/components/originattributes/test/browser/browser_favicon_firstParty.js
@@ -1,16 +1,20 @@
 /**
  * Bug 1277803 - A test case for testing favicon loading across different first party domains.
  */
 
 const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
 
 Cu.import("resource://gre/modules/PlacesUtils.jsm");
 
+let EventUtils = {};
+Services.scriptloader.loadSubScript(
+  "chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
+
 const FIRST_PARTY_ONE = "example.com";
 const FIRST_PARTY_TWO = "example.org";
 const THIRD_PARTY = "mochi.test:8888";
 
 const TEST_SITE_ONE = "http://" + FIRST_PARTY_ONE;
 const TEST_SITE_TWO = "http://" + FIRST_PARTY_TWO;
 const THIRD_PARTY_SITE = "http://" + THIRD_PARTY;
 const TEST_DIRECTORY = "/browser/browser/components/originattributes/test/browser/";
@@ -47,19 +51,20 @@ function clearAllPlacesFavicons() {
       }
     };
 
     Services.obs.addObserver(observer, "places-favicons-expired");
     faviconService.expireAllFavicons();
   });
 }
 
-function observeFavicon(aFirstPartyDomain, aExpectedCookie, aPageURI) {
+function observeFavicon(aFirstPartyDomain, aExpectedCookie, aPageURI, aOnlyXUL) {
   let faviconReqXUL = false;
-  let faviconReqPlaces = false;
+  // If aOnlyXUL is true, we only care about the favicon request from XUL.
+  let faviconReqPlaces = aOnlyXUL === true;
   let expectedPrincipal = Services.scriptSecurityManager
                                   .createCodebasePrincipal(aPageURI, { firstPartyDomain: aFirstPartyDomain });
 
   return new Promise(resolve => {
     let observer = {
       observe(aSubject, aTopic, aData) {
         // Make sure that the topic is 'http-on-modify-request'.
         if (aTopic === "http-on-modify-request") {
@@ -239,16 +244,95 @@ async function doTest(aTestPage, aExpect
   tabInfo = await openTab(TEST_SITE_TWO + aTestPage);
 
   // Waiting until favicon requests are all made.
   await promiseObserveFavicon;
 
   await BrowserTestUtils.removeTab(tabInfo.tab);
 }
 
+async function doTestForAllTabsFavicon(aTestPage, aExpectedCookies, aIsThirdParty) {
+  let firstPageURI = makeURI(TEST_SITE_ONE + aTestPage);
+  let secondPageURI = makeURI(TEST_SITE_TWO + aTestPage);
+  let faviconURI = aIsThirdParty ? THIRD_PARTY_SITE + FAVICON_URI :
+                                   TEST_SITE_ONE + FAVICON_URI;
+
+  // Set the 'overflow' attribute to make allTabs button available.
+  let tabBrowser = document.getElementById("tabbrowser-tabs");
+  let allTabsBtn = document.getElementById("alltabs-button");
+  tabBrowser.setAttribute("overflow", true);
+
+  // Start to observe the event of that the favicon has been fully loaded.
+  let promiseFaviconLoaded = waitOnFaviconLoaded(faviconURI);
+
+  // Open the tab for the first site.
+  let tabInfo = await openTab(TEST_SITE_ONE + aTestPage);
+
+  // Waiting until the favicon loaded.
+  await promiseFaviconLoaded;
+
+  // We need to clear the image cache here for making sure the network request will
+  // be made for the favicon of allTabs menuitem.
+  clearAllImageCaches();
+
+  // Start to observe the allTabs favicon requests earlier in case we miss it.
+  let promiseObserveFavicon = observeFavicon(FIRST_PARTY_ONE, aExpectedCookies[0],
+                                             firstPageURI, true);
+
+  // Make the popup of allTabs showing up and trigger the loading of the favicon.
+  let allTabsPopupShownPromise = BrowserTestUtils.waitForEvent(allTabsBtn, "popupshown");
+  EventUtils.synthesizeMouseAtCenter(allTabsBtn, {});
+  await promiseObserveFavicon;
+  await allTabsPopupShownPromise;
+
+  // Close the popup of allTabs and wait until it's done.
+  let allTabsPopupHiddenPromise = BrowserTestUtils.waitForEvent(allTabsBtn, "popuphidden");
+  EventUtils.synthesizeMouseAtCenter(allTabsBtn, {});
+  await allTabsPopupHiddenPromise;
+
+  // Close the tab.
+  await BrowserTestUtils.removeTab(tabInfo.tab);
+
+  faviconURI = aIsThirdParty ? THIRD_PARTY_SITE + FAVICON_URI :
+                               TEST_SITE_TWO + FAVICON_URI;
+
+  // Start to observe the event of that favicon has been fully loaded.
+  promiseFaviconLoaded = waitOnFaviconLoaded(faviconURI);
+
+  // Open the tab for the second site.
+  tabInfo = await openTab(TEST_SITE_TWO + aTestPage);
+
+  // Wait until the favicon is fully loaded.
+  await promiseFaviconLoaded;
+
+  // Clear the image cache for the favicon of the second site.
+  clearAllImageCaches();
+
+  // Start to observe the allTabs favicon requests earlier in case we miss it.
+  promiseObserveFavicon = observeFavicon(FIRST_PARTY_TWO, aExpectedCookies[1],
+                                         secondPageURI, true);
+
+  // Make the popup of allTabs showing up again.
+  allTabsPopupShownPromise = BrowserTestUtils.waitForEvent(allTabsBtn, "popupshown");
+  EventUtils.synthesizeMouseAtCenter(allTabsBtn, {});
+  await promiseObserveFavicon;
+  await allTabsPopupShownPromise;
+
+  // Close the popup of allTabs and wait until it's done.
+  allTabsPopupHiddenPromise = BrowserTestUtils.waitForEvent(allTabsBtn, "popuphidden");
+  EventUtils.synthesizeMouseAtCenter(allTabsBtn, {});
+  await allTabsPopupHiddenPromise;
+
+  // Close the tab.
+  await BrowserTestUtils.removeTab(tabInfo.tab);
+
+  // Reset the 'overflow' attribute to make the allTabs button hidden again.
+  tabBrowser.removeAttribute("overflow");
+}
+
 add_task(async function setup() {
   // Make sure first party isolation is enabled.
   await SpecialPowers.pushPrefEnv({"set": [
       ["privacy.firstparty.isolate", true]
   ]});
 });
 
 // A clean up function to prevent affecting other tests.
@@ -277,16 +361,36 @@ add_task(async function test_favicon_fir
     if (testThirdParty) {
       await doTest(TEST_THIRD_PARTY_PAGE, cookies, THIRD_PARTY_SITE + FAVICON_URI);
     } else {
       await doTest(TEST_PAGE, cookies, TEST_SITE_ONE + FAVICON_URI);
     }
   }
 });
 
+add_task(async function test_allTabs_favicon_firstParty() {
+  for (let testThirdParty of [false, true]) {
+    // Clear all image caches and network caches before running the test.
+    clearAllImageCaches();
+
+    Services.cache2.clear();
+
+    // Clear Places favicon caches.
+    await clearAllPlacesFavicons();
+
+    let cookies = await generateCookies(testThirdParty);
+
+    if (testThirdParty) {
+      await doTestForAllTabsFavicon(TEST_THIRD_PARTY_PAGE, cookies, testThirdParty);
+    } else {
+      await doTestForAllTabsFavicon(TEST_PAGE, cookies, testThirdParty);
+    }
+  }
+});
+
 add_task(async function test_favicon_cache_firstParty() {
   // Clear all image caches and network caches before running the test.
   clearAllImageCaches();
 
   Services.cache2.clear();
 
   // Start to observer the event of that favicon has been fully loaded and cached.
   let promiseForFaviconLoaded = waitOnFaviconLoaded(THIRD_PARTY_SITE + TEST_FAVICON_CACHE_URI);
--- a/browser/components/originattributes/test/browser/browser_favicon_userContextId.js
+++ b/browser/components/originattributes/test/browser/browser_favicon_userContextId.js
@@ -2,16 +2,20 @@
  * Bug 1277803 - A test caes for testing favicon loading across different userContextId.
  */
 
 const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
 
 XPCOMUtils.defineLazyModuleGetter(this, "Promise",
   "resource://gre/modules/Promise.jsm");
 
+let EventUtils = {};
+Services.scriptloader.loadSubScript(
+  "chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
+
 const TEST_SITE = "http://example.net";
 const TEST_THIRD_PARTY_SITE = "http://mochi.test:8888";
 
 const TEST_PAGE = TEST_SITE + "/browser/browser/components/originattributes/" +
                   "test/browser/file_favicon.html";
 const FAVICON_URI = TEST_SITE + "/browser/browser/components/originattributes/" +
                     "test/browser/file_favicon.png";
 const TEST_THIRD_PARTY_PAGE = "http://example.com/browser/browser/components/" +
@@ -47,18 +51,18 @@ function clearAllPlacesFavicons() {
       }
     };
 
     Services.obs.addObserver(observer, "places-favicons-expired");
     faviconService.expireAllFavicons();
   });
 }
 
-function FaviconObserver(aUserContextId, aExpectedCookie, aPageURI, aFaviconURL) {
-  this.reset(aUserContextId, aExpectedCookie, aPageURI, aFaviconURL);
+function FaviconObserver(aUserContextId, aExpectedCookie, aPageURI, aFaviconURL, aOnlyXUL) {
+  this.reset(aUserContextId, aExpectedCookie, aPageURI, aFaviconURL, aOnlyXUL);
 }
 
 FaviconObserver.prototype = {
   observe(aSubject, aTopic, aData) {
     // Make sure that the topic is 'http-on-modify-request'.
     if (aTopic === "http-on-modify-request") {
       // We check the userContextId for the originAttributes of the loading
       // channel. All requests for the favicon should contain the correct
@@ -103,23 +107,24 @@ FaviconObserver.prototype = {
       ok(false, "Received unexpected topic: ", aTopic);
     }
 
     if (this._faviconReqXUL && this._faviconReqPlaces) {
       this._faviconLoaded.resolve();
     }
   },
 
-  reset(aUserContextId, aExpectedCookie, aPageURI, aFaviconURL) {
+  reset(aUserContextId, aExpectedCookie, aPageURI, aFaviconURL, aOnlyXUL) {
     this._curUserContextId = aUserContextId;
     this._expectedCookie = aExpectedCookie;
     this._expectedPrincipal = Services.scriptSecurityManager
                                       .createCodebasePrincipal(aPageURI, { userContextId: aUserContextId });
     this._faviconReqXUL = false;
-    this._faviconReqPlaces = false;
+    // If aOnlyXUL is true, we only care about the favicon request from XUL.
+    this._faviconReqPlaces = aOnlyXUL === true;
     this._faviconURL = aFaviconURL;
     this._faviconLoaded = new Promise.defer();
   },
 
   get promise() {
     return this._faviconLoaded.promise;
   }
 };
@@ -196,16 +201,97 @@ async function doTest(aTestPage, aFavico
   // Waiting for favicon requests are all made.
   await observer.promise;
 
   Services.obs.removeObserver(observer, "http-on-modify-request");
 
   await BrowserTestUtils.removeTab(tabInfo.tab);
 }
 
+async function doTestForAllTabsFavicon(aTestPage, aFaviconHost, aFaviconURL) {
+  let cookies = await generateCookies(aFaviconHost);
+  let pageURI = makeURI(aTestPage);
+
+  // Set the 'overflow' attribute to make allTabs button available.
+  let tabBrowser = document.getElementById("tabbrowser-tabs");
+  let allTabsBtn = document.getElementById("alltabs-button");
+  tabBrowser.setAttribute("overflow", true);
+
+  // Create the observer object for observing request channels of the personal
+  // container.
+  let observer = new FaviconObserver(USER_CONTEXT_ID_PERSONAL, cookies[0], pageURI, aFaviconURL, true);
+
+  // Add the observer earlier in case we miss it.
+  let promiseWaitOnFaviconLoaded = waitOnFaviconLoaded(aFaviconURL);
+
+  // Open the tab with the personal container.
+  let tabInfo = await openTabInUserContext(aTestPage, USER_CONTEXT_ID_PERSONAL);
+
+  // Waiting for favicon loaded.
+  await promiseWaitOnFaviconLoaded;
+
+  // We need to clear the image cache here for making sure the network request will
+  // be made for the favicon of allTabs menuitem.
+  clearAllImageCaches();
+
+  // Add the observer for listening favicon requests.
+  Services.obs.addObserver(observer, "http-on-modify-request");
+
+  // Make the popup of allTabs showing up and trigger the loading of the favicon.
+  let allTabsPopupShownPromise = BrowserTestUtils.waitForEvent(allTabsBtn, "popupshown");
+  EventUtils.synthesizeMouseAtCenter(allTabsBtn, {});
+  await observer.promise;
+  await allTabsPopupShownPromise;
+
+  // Close the popup of allTabs and wait until it's done.
+  let allTabsPopupHiddenPromise = BrowserTestUtils.waitForEvent(allTabsBtn, "popuphidden");
+  EventUtils.synthesizeMouseAtCenter(allTabsBtn, {});
+  await allTabsPopupHiddenPromise;
+
+  // Remove the observer for not receiving the favicon requests for opening a tab
+  // since we want to focus on the favicon of allTabs menu here.
+  Services.obs.removeObserver(observer, "http-on-modify-request");
+
+  // Close the tab.
+  await BrowserTestUtils.removeTab(tabInfo.tab);
+
+  // Open the tab under the work container and wait until the favicon is loaded.
+  promiseWaitOnFaviconLoaded = waitOnFaviconLoaded(aFaviconURL);
+  tabInfo = await openTabInUserContext(aTestPage, USER_CONTEXT_ID_WORK);
+  await promiseWaitOnFaviconLoaded;
+
+  // Clear the image cache again.
+  clearAllImageCaches();
+
+  // Reset the observer for observing requests for the work container.
+  observer.reset(USER_CONTEXT_ID_WORK, cookies[1], pageURI, aFaviconURL, true);
+
+  // Add the observer back for listening the favicon requests for allTabs menuitem.
+  Services.obs.addObserver(observer, "http-on-modify-request");
+
+  // Make the popup of allTabs showing up again.
+  allTabsPopupShownPromise = BrowserTestUtils.waitForEvent(allTabsBtn, "popupshown");
+  EventUtils.synthesizeMouseAtCenter(allTabsBtn, {});
+  await observer.promise;
+  await allTabsPopupShownPromise;
+
+  // Close the popup of allTabs and wait until it's done.
+  allTabsPopupHiddenPromise = BrowserTestUtils.waitForEvent(allTabsBtn, "popuphidden");
+  EventUtils.synthesizeMouseAtCenter(allTabsBtn, {});
+  await allTabsPopupHiddenPromise;
+
+  Services.obs.removeObserver(observer, "http-on-modify-request");
+
+  // Close the tab.
+  await BrowserTestUtils.removeTab(tabInfo.tab);
+
+  // Reset the 'overflow' attribute to make the allTabs button hidden again.
+  tabBrowser.removeAttribute("overflow");
+}
+
 add_task(async function setup() {
   // Make sure userContext is enabled.
   await SpecialPowers.pushPrefEnv({"set": [
       ["privacy.userContext.enabled", true]
   ]});
 });
 
 // A clean up function to prevent affecting other tests.
@@ -242,8 +328,34 @@ add_task(async function test_thirdPartyF
   // Clear all network caches.
   Services.cache2.clear();
 
   // Clear Places favicon caches.
   await clearAllPlacesFavicons();
 
   await doTest(TEST_THIRD_PARTY_PAGE, TEST_THIRD_PARTY_SITE, THIRD_PARTY_FAVICON_URI);
 });
+
+add_task(async function test_allTabs_favicon_userContextId() {
+  // Clear all image caches before running the test.
+  clearAllImageCaches();
+
+  // Clear all network caches.
+  Services.cache2.clear();
+
+  // Clear Places favicon caches.
+  await clearAllPlacesFavicons();
+
+  await doTestForAllTabsFavicon(TEST_PAGE, TEST_SITE, FAVICON_URI);
+});
+
+add_task(async function test_allTabs_thirdPartyFavicon_userContextId() {
+  // Clear all image caches before running the test.
+  clearAllImageCaches();
+
+  // Clear all network caches.
+  Services.cache2.clear();
+
+  // Clear Places favicon caches.
+  await clearAllPlacesFavicons();
+
+  await doTestForAllTabsFavicon(TEST_THIRD_PARTY_PAGE, TEST_THIRD_PARTY_SITE, THIRD_PARTY_FAVICON_URI);
+});
--- a/browser/components/places/content/moveBookmarks.js
+++ b/browser/components/places/content/moveBookmarks.js
@@ -42,17 +42,17 @@ var gMoveBookmarksDialog = {
         let txn = new PlacesAggregatedTransaction("Move Items", transactions);
         PlacesUtils.transactionManager.doTransaction(txn);
       }
       return;
     }
 
     // Async transactions must do the move in the caller to avoid going out of
     // scope whilst the dialog is still closing.
-    window.arguments[0].moveToGuid = selectedNode.bookmarkGuid;
+    window.arguments[0].moveToGuid = PlacesUtils.getConcreteItemGuid(selectedNode);
   },
 
   newFolder: function MBD_newFolder() {
     // The command is disabled when the tree is not focused
     this.foldersTree.focus();
     goDoCommand("placesCmd_new:folder");
   }
 };
--- a/browser/components/places/tests/browser/browser_bookmarkProperties_addFolderDefaultButton.js
+++ b/browser/components/places/tests/browser/browser_bookmarkProperties_addFolderDefaultButton.js
@@ -25,17 +25,17 @@ add_task(async function() {
     // are inserted at the index of the currently selected item, the new folder
     // will be inserted at index 0.
     await withBookmarksDialog(
       false,
       function openDialog() {
         tree.controller.doCommand("placesCmd_new:folder");
       },
       async function test(dialogWin) {
-        let promiseTitleChangeNotification = promiseBookmarksNotification(
+        let promiseTitleChangeNotification = PlacesTestUtils.waitForNotification(
           "onItemChanged", (itemId, prop, isAnno, val) => prop == "title" && val == "n");
 
         fillBookmarkTextField("editBMPanel_namePicker", "n", dialogWin, false);
 
         // Confirm and close the dialog.
         EventUtils.synthesizeKey("VK_RETURN", {}, dialogWin);
         await promiseTitleChangeNotification;
 
--- a/browser/components/places/tests/browser/browser_bookmarkProperties_addLivemark.js
+++ b/browser/components/places/tests/browser/browser_bookmarkProperties_addLivemark.js
@@ -9,17 +9,17 @@ add_task(async function() {
 
     await withBookmarksDialog(
       true,
       function openDialog() {
         PlacesCommandHook.addLiveBookmark("http://livemark.com/",
                                           "livemark", "description");
       },
       async function test(dialogWin) {
-        let promiseTitleChangeNotification = promiseBookmarksNotification(
+        let promiseTitleChangeNotification = PlacesTestUtils.waitForNotification(
           "onItemChanged", (unused, prop, isAnno, val) => prop == "title" && val == "modified");
 
         fillBookmarkTextField("editBMPanel_namePicker", "modified", dialogWin);
 
         await promiseTitleChangeNotification;
 
         let bookmark = await PlacesUtils.bookmarks.fetch({
           parentGuid: PlacesUtils.bookmarks.toolbarGuid,
--- a/browser/components/places/tests/browser/browser_bookmarkProperties_bookmarkAllTabs.js
+++ b/browser/components/places/tests/browser/browser_bookmarkProperties_bookmarkAllTabs.js
@@ -24,17 +24,17 @@ add_task(async function() {
       let acceptBtn = dialog.document.documentElement.getButton("accept");
       ok(!acceptBtn.disabled, "Accept button is enabled");
 
       let namepicker = dialog.document.getElementById("editBMPanel_namePicker");
       Assert.ok(!namepicker.readOnly, "Name field is writable");
       let folderName = dialog.document.getElementById("stringBundle").getString("bookmarkAllTabsDefault");
       Assert.equal(namepicker.value, folderName, "Name field is correct.");
 
-      let promiseTitleChange = promiseBookmarksNotification(
+      let promiseTitleChange = PlacesTestUtils.waitForNotification(
         "onItemChanged", (id, prop, isAnno, val) => prop == "title" && val == "folder");
       fillBookmarkTextField("editBMPanel_namePicker", "folder", dialog);
       await promiseTitleChange;
     },
     dialog => {
       let savedItemId = dialog.gEditItemOverlay.itemId;
       ok(savedItemId > 0, "Found the itemId");
       return PlacesTestUtils.waitForNotification("onItemRemoved",
--- a/browser/components/places/tests/browser/browser_bookmarkProperties_cancel.js
+++ b/browser/components/places/tests/browser/browser_bookmarkProperties_cancel.js
@@ -94,17 +94,17 @@ add_task(async function test_cancel_with
       function openDialog() {
         tree.controller.doCommand("placesCmd_show:info");
       },
       async function test(dialogWin) {
         let acceptButton = dialogWin.document.documentElement.getButton("accept");
         await BrowserTestUtils.waitForCondition(() => !acceptButton.disabled,
           "The accept button should be enabled");
 
-        let promiseTitleChangeNotification = promiseBookmarksNotification(
+        let promiseTitleChangeNotification = PlacesTestUtils.waitForNotification(
           "onItemChanged", (itemId, prop, isAnno, val) => prop == "title" && val == "n");
 
         fillBookmarkTextField("editBMPanel_namePicker", "n", dialogWin);
 
         // The dialog is instant apply.
         await promiseTitleChangeNotification;
 
         // Ensure that the addition really is finished before we hit cancel.
--- a/browser/components/places/tests/browser/browser_library_batch_delete.js
+++ b/browser/components/places/tests/browser/browser_library_batch_delete.js
@@ -52,17 +52,17 @@ add_task(async function test_create_and_
   Assert.equal(unsortedNode.childCount, 2, "Unsorted node has 2 children");
   let folderNode = unsortedNode.getChild(0);
   Assert.equal(folderNode.title, "deleteme", "Folder found in unsorted bookmarks");
   // Check delete command is available.
   PO._places.selectNode(folderNode);
   Assert.equal(PO._places.selectedNode.title, "deleteme", "Folder node selected");
   Assert.ok(PO._places.controller.isCommandEnabled("cmd_delete"),
      "Delete command is enabled");
-  let promiseItemRemovedNotification = promiseBookmarksNotification(
+  let promiseItemRemovedNotification = PlacesTestUtils.waitForNotification(
     "onItemRemoved", (itemId, parentId, index, type, uri, guid) => guid == folderNode.bookmarkGuid);
   // Execute the delete command and check bookmark has been removed.
   PO._places.controller.doCommand("cmd_delete");
 
   await promiseItemRemovedNotification;
 
   Assert.ok(!(await PlacesUtils.bookmarks.fetch({url: testURI})),
     "Bookmark has been correctly removed");
--- a/browser/components/places/tests/browser/browser_library_commands.js
+++ b/browser/components/places/tests/browser/browser_library_commands.js
@@ -54,18 +54,18 @@ add_task(async function test_date_contai
   ok(PO._places.controller.isCommandEnabled("cmd_copy"),
      "Copy command is enabled");
   ok(!PO._places.controller.isCommandEnabled("cmd_cut"),
      "Cut command is disabled");
   ok(PO._places.controller.isCommandEnabled("cmd_delete"),
      "Delete command is enabled");
 
   // Execute the delete command and check visit has been removed.
-  let promiseURIRemoved = promiseHistoryNotification("onDeleteURI",
-                                                     v => TEST_URI.equals(v));
+  let promiseURIRemoved = PlacesTestUtils.waitForNotification(
+    "onDeleteURI", v => TEST_URI.equals(v), "history");
   PO._places.controller.doCommand("cmd_delete");
   await promiseURIRemoved;
 
   // Test live update of "History" query.
   is(historyNode.childCount, 0, "History node has no more children");
 
   historyNode.containerOpen = false;
 
@@ -119,18 +119,18 @@ add_task(async function test_query_on_to
   ok(PO._places.controller.isCommandEnabled("cmd_copy"),
      "Copy command is enabled");
   ok(PO._places.controller.isCommandEnabled("cmd_cut"),
      "Cut command is enabled");
   ok(PO._places.controller.isCommandEnabled("cmd_delete"),
      "Delete command is enabled");
 
   // Execute the delete command and check bookmark has been removed.
-  let promiseItemRemoved = promiseBookmarksNotification("onItemRemoved",
-                                                        (...args) => query.guid == args[5]);
+  let promiseItemRemoved = PlacesTestUtils.waitForNotification(
+    "onItemRemoved", (...args) => query.guid == args[5]);
   PO._places.controller.doCommand("cmd_delete");
   await promiseItemRemoved;
 
   is((await PlacesUtils.bookmarks.fetch(query.guid)), null,
      "Query node bookmark has been correctly removed");
 
   toolbarNode.containerOpen = false;
 
--- a/browser/components/places/tests/browser/browser_library_move_bookmarks.js
+++ b/browser/components/places/tests/browser/browser_library_move_bookmarks.js
@@ -3,58 +3,73 @@
 /* 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/. */
 
 /**
  *  Test enabled commands in the left pane folder of the Library.
  */
 
-registerCleanupFunction(async function() {
-  await PlacesUtils.bookmarks.eraseEverything();
-  await PlacesTestUtils.clearHistory();
-});
+var bookmarks;
+var testFolder;
+var library;
 
-add_task(async function test_moveBookmarks() {
+add_task(async function setup() {
   let children = [{
     title: "TestFolder",
     type: PlacesUtils.bookmarks.TYPE_FOLDER,
   }];
 
   for (let i = 0; i < 10; i++) {
     children.push({
       title: `test${i}`,
       url: `http://example.com/${i}`,
     });
   }
 
-  let bookmarks = await PlacesUtils.bookmarks.insertTree({
+  bookmarks = await PlacesUtils.bookmarks.insertTree({
     guid: PlacesUtils.bookmarks.unfiledGuid,
     children
   });
 
-  let folderId = await PlacesUtils.promiseItemId(bookmarks[0].guid);
+  testFolder = bookmarks.shift();
+
+  library = await promiseLibrary("UnfiledBookmarks");
+
+  registerCleanupFunction(async function() {
+    library.close();
+
+    await PlacesUtils.bookmarks.eraseEverything();
+    await PlacesTestUtils.clearHistory();
+  });
+});
+
+async function move_bookmarks_to(sourceFolders, folderGuid) {
+  for (let i = 0; i < sourceFolders.length; i++) {
+    sourceFolders[i] = await PlacesUtils.promiseItemId(sourceFolders[i]);
+  }
+
+  library.PlacesOrganizer.selectLeftPaneContainerByHierarchy(sourceFolders);
+
+  let folderId = await PlacesUtils.promiseItemId(folderGuid);
 
   let itemIds = [];
   let promiseMoveNotifications = [];
-  for (let i = 0; i < 10; i++) {
-    // + 1 due to the folder being inserted first.
-    let guid = bookmarks[i + 1].guid;
+  for (let bm of bookmarks) {
+    let guid = bm.guid;
 
     itemIds.push(await PlacesUtils.promiseItemId(guid));
     promiseMoveNotifications.push(PlacesTestUtils.waitForNotification(
       "onItemMoved",
       (itemId, parentId, oldIndex, newParentId, newIndex, itemType, itemGuid,
        oldParentGuid, newParentGuid) =>
-        itemGuid == guid && newParentGuid == bookmarks[0].guid
+        itemGuid == guid && newParentGuid == folderGuid
     ));
   }
 
-  let library = await promiseLibrary("UnfiledBookmarks");
-
   library.ContentTree.view.selectItems(itemIds);
 
   await withBookmarksDialog(
     false,
     () => {
       library.ContentTree.view._controller.doCommand("placesCmd_moveBookmarks");
     },
     async (dialogWin) => {
@@ -69,11 +84,18 @@ add_task(async function test_moveBookmar
       info("Waiting for notifications of moves");
       await Promise.all(promiseMoveNotifications);
       Assert.ok(true, "should have completed all moves successfully");
     },
     null,
     "chrome://browser/content/places/moveBookmarks.xul",
     true
   );
+}
 
-  library.close();
+add_task(async function test_moveBookmarks_to_subfolder() {
+  await move_bookmarks_to([PlacesUtils.bookmarks.unfiledGuid], testFolder.guid);
 });
+
+add_task(async function test_moveBookmarks_to_other_top_level() {
+  await move_bookmarks_to([PlacesUtils.bookmarks.unfiledGuid, testFolder.guid],
+    PlacesUtils.bookmarks.toolbarGuid);
+});
--- a/browser/components/places/tests/browser/browser_toolbar_drop_text.js
+++ b/browser/components/places/tests/browser/browser_toolbar_drop_text.js
@@ -28,17 +28,17 @@ add_task(async function test() {
    *
    * @param aEffect
    *        The effect to use for the drop operation: move, copy, or link.
    * @param aMimeType
    *        The mime type to use for the drop operation.
    */
   let simulateDragDrop = async function(aEffect, aMimeType) {
     const url = "http://www.mozilla.org/D1995729-A152-4e30-8329-469B01F30AA7";
-    let promiseItemAddedNotification = promiseBookmarksNotification(
+    let promiseItemAddedNotification = PlacesTestUtils.waitForNotification(
       "onItemAdded", (itemId, parentId, index, type, uri, guid) => uri.spec == url);
 
     // We use the toolbar as the drag source, as we just need almost any node
     // to simulate the drag. The actual data for the drop is passed via the
     // drag data. Note: The toolbar is used rather than another bookmark node,
     // as we need something that is immovable from a places perspective, as this
     // forces the move into a copy.
     EventUtils.synthesizeDrop(toolbar,
@@ -74,17 +74,17 @@ add_task(async function test() {
       "http://www.mozilla.org/091A88BD-5743-4C16-A005-3D2EA3A3B71E"
     ];
     let data;
     if (aMimeType == "text/x-moz-url")
       data = urls.map(spec => spec + "\n" + spec).join("\n");
     else
       data = urls.join("\n");
 
-    let promiseItemAddedNotification = promiseBookmarksNotification(
+    let promiseItemAddedNotification = PlacesTestUtils.waitForNotification(
       "onItemAdded", (itemId, parentId, index, type, uri, guid) => uri.spec == urls[2]);
 
     // See notes for EventUtils.synthesizeDrop in simulateDragDrop().
     EventUtils.synthesizeDrop(toolbar,
                               placesItems,
                               [[{type: aMimeType,
                                  data}]],
                               aEffect, window);
--- a/browser/components/places/tests/browser/head.js
+++ b/browser/components/places/tests/browser/head.js
@@ -155,61 +155,16 @@ function promiseIsURIVisited(aURI) {
 
     PlacesUtils.asyncHistory.isURIVisited(aURI, function(unused, aIsVisited) {
       resolve(aIsVisited);
     });
 
   });
 }
 
-function promiseBookmarksNotification(notification, conditionFn) {
-  info(`promiseBookmarksNotification: waiting for ${notification}`);
-  return new Promise((resolve) => {
-    let proxifiedObserver = new Proxy({}, {
-      get: (target, name) => {
-        if (name == "QueryInterface")
-          return XPCOMUtils.generateQI([ Ci.nsINavBookmarkObserver ]);
-        info(`promiseBookmarksNotification: got ${name} notification`);
-        if (name == notification)
-          return (...args) => {
-            if (conditionFn.apply(this, args)) {
-              PlacesUtils.bookmarks.removeObserver(proxifiedObserver, false);
-              executeSoon(resolve);
-            } else {
-              info(`promiseBookmarksNotification: skip cause condition doesn't apply to ${JSON.stringify(args)}`);
-            }
-          };
-        return () => {};
-      }
-    });
-    PlacesUtils.bookmarks.addObserver(proxifiedObserver);
-  });
-}
-
-function promiseHistoryNotification(notification, conditionFn) {
-  info(`Waiting for ${notification}`);
-  return new Promise((resolve) => {
-    let proxifiedObserver = new Proxy({}, {
-      get: (target, name) => {
-        if (name == "QueryInterface")
-          return XPCOMUtils.generateQI([ Ci.nsINavHistoryObserver ]);
-        if (name == notification)
-          return (...args) => {
-            if (conditionFn.apply(this, args)) {
-              PlacesUtils.history.removeObserver(proxifiedObserver, false);
-              executeSoon(resolve);
-            }
-          };
-        return () => {};
-      }
-    });
-    PlacesUtils.history.addObserver(proxifiedObserver);
-  });
-}
-
 /**
  * Makes the specified toolbar visible or invisible and returns a Promise object
  * that is resolved when the toolbar has completed any animations associated
  * with hiding or showing the toolbar.
  *
  * Note that this code assumes that changes to a toolbar's visibility trigger
  * a transition on the max-height property of the toolbar element.
  * Changes to this styling could cause the returned Promise object to be
--- a/browser/components/sessionstore/TabAttributes.jsm
+++ b/browser/components/sessionstore/TabAttributes.jsm
@@ -7,22 +7,22 @@
 this.EXPORTED_SYMBOLS = ["TabAttributes"];
 
 // We never want to directly read or write these attributes.
 // 'image' should not be accessed directly but handled by using the
 //         gBrowser.getIcon()/setIcon() methods.
 // 'muted' should not be accessed directly but handled by using the
 //         tab.linkedBrowser.audioMuted/toggleMuteAudio methods.
 // 'pending' is used internal by sessionstore and managed accordingly.
-// 'iconLoadingPrincipal' is same as 'image' that it should be handled by
+// 'iconloadingprincipal' is same as 'image' that it should be handled by
 //                        using the gBrowser.getIcon()/setIcon() methods.
 // 'activemedia-blocked' should not be accessed directly but handled by using
 //                       tab's toggleMuteAudio() or linkedBrowser's methods
 //                       activeMediaBlockStarted()/activeMediaBlockBlockStopped().
-const ATTRIBUTES_TO_SKIP = new Set(["image", "muted", "pending", "iconLoadingPrincipal",
+const ATTRIBUTES_TO_SKIP = new Set(["image", "muted", "pending", "iconloadingprincipal",
                                     "skipbackgroundnotify", "activemedia-blocked"]);
 
 // A set of tab attributes to persist. We will read a given list of tab
 // attributes when collecting tab data and will re-set those attributes when
 // the given tab data is restored to a new tab.
 this.TabAttributes = Object.freeze({
   persist(name) {
     return TabAttributesInternal.persist(name);
--- a/browser/components/sessionstore/test/browser_attributes.js
+++ b/browser/components/sessionstore/test/browser_attributes.js
@@ -25,36 +25,36 @@ add_task(async function test() {
 
   // Because there is debounce logic in ContentLinkHandler.jsm to reduce the
   // favicon loads, we have to wait some time before checking that icon was
   // stored properly.
   await BrowserTestUtils.waitForCondition(() => {
     return gBrowser.getIcon(tab) != null;
   }, "wait for favicon load to finish", 100, 5);
 
-  // Check that the tab has 'image' and 'iconLoadingPrincipal' attributes.
+  // Check that the tab has 'image' and 'iconloadingprincipal' attributes.
   ok(tab.hasAttribute("image"), "tab.image exists");
-  ok(tab.hasAttribute("iconLoadingPrincipal"), "tab.iconLoadingPrincipal exists");
+  ok(tab.hasAttribute("iconloadingprincipal"), "tab.iconloadingprincipal exists");
 
   tab.toggleMuteAudio();
   // Check that the tab has a 'muted' attribute.
   ok(tab.hasAttribute("muted"), "tab.muted exists");
 
   // Pretend to start autoplay media in tab, tab should get the notification.
   tab.linkedBrowser.activeMediaBlockStarted();
   ok(tab.hasAttribute("activemedia-blocked"), "tab.activemedia-blocked exists");
 
   // Make sure we do not persist 'image','muted' and 'activemedia-blocked' attributes.
   ss.persistTabAttribute("image");
   ss.persistTabAttribute("muted");
-  ss.persistTabAttribute("iconLoadingPrincipal");
+  ss.persistTabAttribute("iconloadingprincipal");
   ss.persistTabAttribute("activemedia-blocked");
   let {attributes} = JSON.parse(ss.getTabState(tab));
   ok(!("image" in attributes), "'image' attribute not saved");
-  ok(!("iconLoadingPrincipal" in attributes), "'iconLoadingPrincipal' attribute not saved");
+  ok(!("iconloadingprincipal" in attributes), "'iconloadingprincipal' attribute not saved");
   ok(!("muted" in attributes), "'muted' attribute not saved");
   ok(!("custom" in attributes), "'custom' attribute not saved");
   ok(!("activemedia-blocked" in attributes), "'activemedia-blocked' attribute not saved");
 
   // Test persisting a custom attribute.
   tab.setAttribute("custom", "foobar");
   ss.persistTabAttribute("custom");
 
--- a/browser/components/sessionstore/test/browser_label_and_icon.js
+++ b/browser/components/sessionstore/test/browser_label_and_icon.js
@@ -36,16 +36,16 @@ add_task(async function test_label_and_i
   await promiseTabRestoring(tab);
 
   // Check that label and icon are set for the restoring tab.
   is(gBrowser.getIcon(tab), "chrome://browser/content/robot.ico", "icon is set");
   is(tab.label, "Gort! Klaatu barada nikto!", "label is set");
 
   let serhelper = Cc["@mozilla.org/network/serialization-helper;1"]
                     .getService(Ci.nsISerializationHelper);
-  let serializedPrincipal = tab.getAttribute("iconLoadingPrincipal");
+  let serializedPrincipal = tab.getAttribute("iconloadingprincipal");
   let iconLoadingPrincipal = serhelper.deserializeObject(serializedPrincipal)
                                       .QueryInterface(Ci.nsIPrincipal);
   is(iconLoadingPrincipal.origin, "about:robots", "correct loadingPrincipal used");
 
   // Cleanup.
   await promiseRemoveTab(tab);
 });
--- a/browser/confvars.sh
+++ b/browser/confvars.sh
@@ -15,21 +15,18 @@ fi
 
 if test "$OS_ARCH" = "WINNT"; then
   MOZ_MAINTENANCE_SERVICE=1
   if ! test "$HAVE_64BIT_BUILD"; then
     if test "$MOZ_UPDATE_CHANNEL" = "nightly" -o \
             "$MOZ_UPDATE_CHANNEL" = "nightly-oak" -o \
             "$MOZ_UPDATE_CHANNEL" = "nightly-try" -o \
             "$MOZ_UPDATE_CHANNEL" = "aurora" -o \
-            "$MOZ_UPDATE_CHANNEL" = "aurora-dev" -o \
             "$MOZ_UPDATE_CHANNEL" = "beta" -o \
-            "$MOZ_UPDATE_CHANNEL" = "beta-dev" -o \
-            "$MOZ_UPDATE_CHANNEL" = "release" -o \
-            "$MOZ_UPDATE_CHANNEL" = "release-dev"; then
+            "$MOZ_UPDATE_CHANNEL" = "release"; then
       if ! test "$MOZ_DEBUG"; then
         MOZ_STUB_INSTALLER=1
       fi
     fi
   fi
 fi
 
 if test "$NIGHTLY_BUILD"; then
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -224,16 +224,17 @@ These should match what Safari and other
 
 <!ENTITY urlbar.cameraBlocked.tooltip            "You have blocked your camera for this website.">
 <!ENTITY urlbar.microphoneBlocked.tooltip        "You have blocked your microphone for this website.">
 <!ENTITY urlbar.screenBlocked.tooltip            "You have blocked this website from sharing your screen.">
 <!ENTITY urlbar.geolocationBlocked.tooltip       "You have blocked location information for this website.">
 <!ENTITY urlbar.indexedDBBlocked.tooltip         "You have blocked data storage for this website.">
 <!ENTITY urlbar.webNotificationsBlocked.tooltip  "You have blocked notifications for this website.">
 <!ENTITY urlbar.persistentStorageBlocked.tooltip "You have blocked persistent storage for this website.">
+<!ENTITY urlbar.popupBlocked.tooltip             "You have blocked popups for this website.">
 
 <!ENTITY urlbar.openHistoryPopup.tooltip                "Show history">
 
 <!ENTITY searchItem.title             "Search">
 
 <!-- Toolbar items -->
 <!ENTITY homeButton.label             "Home">
 
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -259,19 +259,23 @@ lwthemeNeedsRestart.accesskey=R
 popupWarning.message=#1 prevented this site from opening a pop-up window.;#1 prevented this site from opening #2 pop-up windows.
 popupWarningButton=Options
 popupWarningButton.accesskey=O
 popupWarningButtonUnix=Preferences
 popupWarningButtonUnix.accesskey=P
 popupAllow=Allow pop-ups for %S
 popupBlock=Block pop-ups for %S
 popupWarningDontShowFromMessage=Don’t show this message when pop-ups are blocked
-popupWarningDontShowFromLocationbar=Don’t show info bar when pop-ups are blocked
 popupShowPopupPrefix=Show ‘%S’
 
+# LOCALIZATION NOTE (popupShowBlockedPopupsIndicatorText): Semicolon seperated list of plural forms.
+# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
+# #1 is the number of pop-ups blocked.
+popupShowBlockedPopupsIndicatorText=Show #1 blocked popup…;Show #1 blocked popups…
+
 # Bad Content Blocker Doorhanger Notification
 # %S is brandShortName
 badContentBlocked.blocked.message=%S is blocking content on this page.
 badContentBlocked.notblocked.message=%S is not blocking any content on this page.
 
 crashedpluginsMessage.title=The %S plugin has crashed.
 crashedpluginsMessage.reloadButton.label=Reload page
 crashedpluginsMessage.reloadButton.accesskey=R
--- a/browser/themes/shared/customizableui/panelUI.inc.css
+++ b/browser/themes/shared/customizableui/panelUI.inc.css
@@ -246,16 +246,24 @@ panelview {
 :root[uidensity=compact] #BMB_bookmarksPopup {
   margin-top: -9px;
 }
 
 :root[uidensity=compact] #TabsToolbar #BMB_bookmarksPopup {
   margin-top: -7px;
 }
 
+#PersonalToolbar #BMB_bookmarksPopup  {
+  margin-top: -2px
+}
+
+:root[uidensity=touch] #PersonalToolbar #BMB_bookmarksPopup {
+  margin-top: -5px;
+}
+
 .panel-subview-body {
   overflow-y: auto;
   overflow-x: hidden;
   -moz-box-flex: 1;
 }
 
 .panel-view-body-unscrollable {
   overflow: hidden;
@@ -1021,34 +1029,37 @@ toolbaritem[cui-areatype="menu-panel"][s
     (e.g. #PanelUI-remotetabs[mainview] #PanelUI-remotetabs-setupsync, etc) may
     need adjusting (see bug 1248506) */
   padding-bottom: 30px;
   padding-top: 15px;
 }
 
 .PanelUI-remotetabs-prefs-button {
   -moz-appearance: none;
-  background-color: #0096dd;
+  background-color: #0060df;
   /* !important for the color as an OSX specific rule when a lightweight theme
      is used for buttons in the toolbox overrides. See bug 1238531 for details */
   color: white !important;
   border-radius: 2px;
   /* If you change the margin or padding below, the min-height of the synced tabs
      panel (e.g. #PanelUI-remotetabs[mainview] #PanelUI-remotetabs-setupsync,
      etc) may need adjusting (see bug 1248506) */
   margin-top: 10px;
   margin-bottom: 10px;
   padding: 8px;
   text-shadow: none;
   min-width: 200px;
 }
 
-.PanelUI-remotetabs-prefs-button:hover,
+.PanelUI-remotetabs-prefs-button:hover {
+  background-color: #003eaa;
+}
+
 .PanelUI-remotetabs-prefs-button:hover:active {
-  background-color: #018acb;
+  background-color: #002275;
 }
 
 .remotetabs-promo-link {
   margin: 0;
 }
 
 .PanelUI-remotetabs-notabsforclient-label {
   color: GrayText;
--- a/browser/themes/shared/jar.inc.mn
+++ b/browser/themes/shared/jar.inc.mn
@@ -74,16 +74,17 @@
   skin/classic/browser/notification-icons/microphone-detailed.svg           (../shared/notification-icons/microphone-detailed.svg)
   skin/classic/browser/notification-icons/microphone.svg                    (../shared/notification-icons/microphone.svg)
   skin/classic/browser/notification-icons/persistent-storage-blocked.svg    (../shared/notification-icons/persistent-storage-blocked.svg)
   skin/classic/browser/notification-icons/persistent-storage.svg            (../shared/notification-icons/persistent-storage.svg)
   skin/classic/browser/notification-icons/plugin-badge.svg                  (../shared/notification-icons/plugin-badge.svg)
   skin/classic/browser/notification-icons/plugin-blocked.svg                (../shared/notification-icons/plugin-blocked.svg)
   skin/classic/browser/notification-icons/plugin.svg                        (../shared/notification-icons/plugin.svg)
   skin/classic/browser/notification-icons/popup.svg                         (../shared/notification-icons/popup.svg)
+  skin/classic/browser/notification-icons/popup-subitem.svg                 (../shared/notification-icons/popup-subitem.svg)
   skin/classic/browser/notification-icons/screen-blocked.svg                (../shared/notification-icons/screen-blocked.svg)
   skin/classic/browser/notification-icons/screen.svg                        (../shared/notification-icons/screen.svg)
   skin/classic/browser/notification-icons/update.svg                        (../shared/notification-icons/update.svg)
 
   skin/classic/browser/tracking-protection-16.svg              (../shared/identity-block/tracking-protection-16.svg)
   skin/classic/browser/newtab/close.png                        (../shared/newtab/close.png)
   skin/classic/browser/newtab/controls.svg                     (../shared/newtab/controls.svg)
   skin/classic/browser/panel-icon-arrow-left.svg               (../shared/panel-icon-arrow-left.svg)
--- a/browser/themes/shared/notification-icons.inc.css
+++ b/browser/themes/shared/notification-icons.inc.css
@@ -150,16 +150,25 @@ html|*#webRTC-previewVideo {
   margin-inline-start: 0;
 }
 
 /* This icon has a block sign in it, so we don't need a blocked version. */
 .popup-icon {
   list-style-image: url("chrome://browser/skin/notification-icons/popup.svg");
 }
 
+.popup-subitem {
+  list-style-image: url("chrome://browser/skin/notification-icons/popup-subitem.svg");
+  margin-inline-start: 30px;
+}
+
+.identity-popup-popup-menulist {
+  width: 72px;
+}
+
 /* EME */
 
 .popup-notification-icon[popupid="drmContentPlaying"],
 .drm-icon {
   list-style-image: url("chrome://browser/skin/drm-icon.svg");
 }
 
 #eme-notification-icon[firstplay=true] {
new file mode 100644
--- /dev/null
+++ b/browser/themes/shared/notification-icons/popup-subitem.svg
@@ -0,0 +1,6 @@
+<!-- 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/. -->
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="context-fill" fill-opacity="context-fill-opacity">
+  <path d="M13.707 7.293l-3-3a1 1 0 0 0-1.414 1.414L10.586 7H6.012A.918.918 0 0 1 5 6V3a1 1 0 0 0-2 0v3a2.916 2.916 0 0 0 3 3h4.586l-1.293 1.293a1 1 0 1 0 1.414 1.414l3-3a1 1 0 0 0 0-1.414z"/>
+</svg>
--- a/browser/themes/shared/urlbar-autocomplete.inc.css
+++ b/browser/themes/shared/urlbar-autocomplete.inc.css
@@ -12,16 +12,21 @@
   padding: 4px 3px;
 }
 
 .autocomplete-richlistitem {
   min-height: 30px;
   font: message-box;
   border-radius: 2px;
   padding-inline-start: var(--item-padding-start);
+  /* For the space after the autocomplete text we have to use a transparent
+     border instead of padding, because the latter would considered part of the
+     scrollable area when generating the overflow events that we use to
+     constrain the autocomplete result item size. */
+  border-inline-end: var(--item-padding-end) solid transparent;
 }
 
 :root[uidensity=touch] .autocomplete-richlistitem {
   min-height: 40px;
 }
 
 .autocomplete-richlistitem:hover,
 treechildren.searchbar-treebody::-moz-tree-row(hover) {
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Tabs.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Tabs.jsm
@@ -140,17 +140,17 @@ function closeAllButOneTab(url = "about:
   let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
   let gBrowser = browserWindow.gBrowser;
   // Close all tabs except the last so we don't quit the browser.
   while (gBrowser.tabs.length > 1)
     gBrowser.removeTab(gBrowser.selectedTab, {animate: false});
   gBrowser.selectedBrowser.loadURI(url);
   if (gBrowser.selectedTab.pinned)
     gBrowser.unpinTab(gBrowser.selectedTab);
-  let newTabButton = browserWindow.document.getAnonymousElementByAttribute(browserWindow.gBrowser.tabContainer, "class", "tabs-newtab-button");
+  let newTabButton = browserWindow.document.getAnonymousElementByAttribute(browserWindow.gBrowser.tabContainer, "class", "tabs-newtab-button toolbarbutton-1");
   hoverTab(newTabButton, false);
 }
 
 function hoverTab(tab, hover = true) {
   const inIDOMUtils = Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
   if (hover) {
     inIDOMUtils.addPseudoClassLock(tab, ":hover");
   } else {
--- a/build/clang-plugin/ArithmeticArgChecker.cpp
+++ b/build/clang-plugin/ArithmeticArgChecker.cpp
@@ -1,16 +1,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 "ArithmeticArgChecker.h"
 #include "CustomMatchers.h"
 
-void ArithmeticArgChecker::registerMatchers(MatchFinder* AstMatcher) {
+void ArithmeticArgChecker::registerMatchers(MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(
       callExpr(allOf(hasDeclaration(noArithmeticExprInArgs()),
                      anyOf(hasDescendant(
                                binaryOperator(
                                    allOf(binaryArithmeticOperator(),
                                          hasLHS(hasDescendant(declRefExpr())),
                                          hasRHS(hasDescendant(declRefExpr()))))
                                    .bind("node")),
@@ -40,19 +40,21 @@ void ArithmeticArgChecker::registerMatch
                                         hasType(builtinType()),
                                         anyOf(hasDescendant(declRefExpr()),
                                               declRefExpr())))))
                               .bind("node")))))
           .bind("call"),
       this);
 }
 
-void ArithmeticArgChecker::check(
-    const MatchFinder::MatchResult &Result) {
-  const char* Error = "cannot pass an arithmetic expression of built-in types to %0";
+void ArithmeticArgChecker::check(const MatchFinder::MatchResult &Result) {
+  const char *Error =
+      "cannot pass an arithmetic expression of built-in types to %0";
   const Expr *Expression = Result.Nodes.getNodeAs<Expr>("node");
   if (const CallExpr *Call = Result.Nodes.getNodeAs<CallExpr>("call")) {
-    diag(Expression->getLocStart(), Error, DiagnosticIDs::Error) << Call->getDirectCallee();
+    diag(Expression->getLocStart(), Error, DiagnosticIDs::Error)
+        << Call->getDirectCallee();
   } else if (const CXXConstructExpr *Ctr =
                  Result.Nodes.getNodeAs<CXXConstructExpr>("call")) {
-    diag(Expression->getLocStart(), Error, DiagnosticIDs::Error) << Ctr->getConstructor();
+    diag(Expression->getLocStart(), Error, DiagnosticIDs::Error)
+        << Ctr->getConstructor();
   }
 }
--- a/build/clang-plugin/ArithmeticArgChecker.h
+++ b/build/clang-plugin/ArithmeticArgChecker.h
@@ -4,16 +4,15 @@
 
 #ifndef ArithmeticArgChecker_h__
 #define ArithmeticArgChecker_h__
 
 #include "plugin.h"
 
 class ArithmeticArgChecker : public BaseCheck {
 public:
-  ArithmeticArgChecker(StringRef CheckName,
-                       ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+  ArithmeticArgChecker(StringRef CheckName, ContextType *Context = nullptr)
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/AssertAssignmentChecker.cpp
+++ b/build/clang-plugin/AssertAssignmentChecker.cpp
@@ -1,23 +1,20 @@
 /* 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 "AssertAssignmentChecker.h"
 #include "CustomMatchers.h"
 
-void AssertAssignmentChecker::registerMatchers(MatchFinder* AstMatcher) {
+void AssertAssignmentChecker::registerMatchers(MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(
-      callExpr(isAssertAssignmentTestFunc()).bind("funcCall"),
-      this);
+      callExpr(isAssertAssignmentTestFunc()).bind("funcCall"), this);
 }
 
-void AssertAssignmentChecker::check(
-    const MatchFinder::MatchResult &Result) {
+void AssertAssignmentChecker::check(const MatchFinder::MatchResult &Result) {
   const CallExpr *FuncCall = Result.Nodes.getNodeAs<CallExpr>("funcCall");
 
   if (FuncCall && hasSideEffectAssignment(FuncCall)) {
-    diag(FuncCall->getLocStart(),
-         "Forbidden assignment in assert expression",
+    diag(FuncCall->getLocStart(), "Forbidden assignment in assert expression",
          DiagnosticIDs::Error);
   }
 }
--- a/build/clang-plugin/AssertAssignmentChecker.h
+++ b/build/clang-plugin/AssertAssignmentChecker.h
@@ -4,16 +4,15 @@
 
 #ifndef AssertAssignmentChecker_h__
 #define AssertAssignmentChecker_h__
 
 #include "plugin.h"
 
 class AssertAssignmentChecker : public BaseCheck {
 public:
-  AssertAssignmentChecker(StringRef CheckName,
-                          ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+  AssertAssignmentChecker(StringRef CheckName, ContextType *Context = nullptr)
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/BaseCheck.h
+++ b/build/clang-plugin/BaseCheck.h
@@ -5,30 +5,30 @@
 #ifndef BaseCheck_h__
 #define BaseCheck_h__
 
 class MozContext {};
 typedef MozContext ContextType;
 
 class BaseCheck : public MatchFinder::MatchCallback {
 public:
-  BaseCheck(StringRef CheckName, ContextType* Context) {}
+  BaseCheck(StringRef CheckName, ContextType *Context) {}
   virtual void registerMatchers(MatchFinder *Finder) {}
-  virtual void registerPPCallbacks(CompilerInstance& CI) {}
+  virtual void registerPPCallbacks(CompilerInstance &CI) {}
   virtual void check(const MatchFinder::MatchResult &Result) {}
   DiagnosticBuilder diag(SourceLocation Loc, StringRef Description,
                          DiagnosticIDs::Level Level = DiagnosticIDs::Warning) {
     DiagnosticsEngine &Diag = Context->getDiagnostics();
     unsigned ID = Diag.getDiagnosticIDs()->getCustomDiagID(Level, Description);
     return Diag.Report(Loc, ID);
   }
 
 private:
   void run(const MatchFinder::MatchResult &Result) override {
     Context = Result.Context;
     check(Result);
   }
 
 private:
-  ASTContext* Context;
+  ASTContext *Context;
 };
 
 #endif
--- a/build/clang-plugin/CanRunScriptChecker.cpp
+++ b/build/clang-plugin/CanRunScriptChecker.cpp
@@ -1,204 +1,195 @@
 /* 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 "CanRunScriptChecker.h"
 #include "CustomMatchers.h"
 
-void CanRunScriptChecker::registerMatchers(MatchFinder* AstMatcher) {
+void CanRunScriptChecker::registerMatchers(MatchFinder *AstMatcher) {
   auto InvalidArg =
       // We want to find any expression,
       ignoreTrivials(expr(
           // which has a refcounted pointer type,
           hasType(pointerType(
               pointee(hasDeclaration(cxxRecordDecl(isRefCounted()))))),
           // and which is not this,
           unless(cxxThisExpr()),
           // and which is not a method call on a smart ptr,
           unless(cxxMemberCallExpr(on(hasType(isSmartPtrToRefCounted())))),
           // and which is not a parameter of the parent function,
           unless(declRefExpr(to(parmVarDecl()))),
           // and which is not a MOZ_KnownLive wrapped value.
-          unless(callExpr(callee(
-            functionDecl(hasName("MOZ_KnownLive"))))),
+          unless(callExpr(callee(functionDecl(hasName("MOZ_KnownLive"))))),
           expr().bind("invalidArg")));
 
-  auto OptionalInvalidExplicitArg =
-      anyOf(
-          // We want to find any argument which is invalid.
-          hasAnyArgument(InvalidArg),
+  auto OptionalInvalidExplicitArg = anyOf(
+      // We want to find any argument which is invalid.
+      hasAnyArgument(InvalidArg),
 
-          // This makes this matcher optional.
-          anything());
+      // This makes this matcher optional.
+      anything());
 
   // Please not that the hasCanRunScriptAnnotation() matchers are not present
   // directly in the cxxMemberCallExpr, callExpr and constructExpr matchers
   // because we check that the corresponding functions can run script later in
   // the checker code.
   AstMatcher->addMatcher(
       expr(
           anyOf(
               // We want to match a method call expression,
               cxxMemberCallExpr(
                   // which optionally has an invalid arg,
                   OptionalInvalidExplicitArg,
                   // or which optionally has an invalid implicit this argument,
                   anyOf(
                       // which derefs into an invalid arg,
                       on(cxxOperatorCallExpr(
-                          anyOf(
-                              hasAnyArgument(InvalidArg),
-                              anything()))),
+                          anyOf(hasAnyArgument(InvalidArg), anything()))),
                       // or is an invalid arg.
                       on(InvalidArg),
 
                       anything()),
                   expr().bind("callExpr")),
               // or a regular call expression,
               callExpr(
                   // which optionally has an invalid arg.
-                  OptionalInvalidExplicitArg,
-                  expr().bind("callExpr")),
+                  OptionalInvalidExplicitArg, expr().bind("callExpr")),
               // or a construct expression,
               cxxConstructExpr(
                   // which optionally has an invalid arg.
-                  OptionalInvalidExplicitArg,
-                  expr().bind("constructExpr"))),
+                  OptionalInvalidExplicitArg, expr().bind("constructExpr"))),
 
           anyOf(
               // We want to match the parent function.
               forFunction(functionDecl().bind("nonCanRunScriptParentFunction")),
 
               // ... optionally.
               anything())),
       this);
 }
 
 void CanRunScriptChecker::onStartOfTranslationUnit() {
   IsFuncSetBuilt = false;
   CanRunScriptFuncs.clear();
 }
 
 namespace {
-  /// This class is a callback used internally to match function declarations
-  /// with the MOZ_CAN_RUN_SCRIPT annotation, adding these functions and all
-  /// the methods they override to the can-run-script function set.
-  class FuncSetCallback : public MatchFinder::MatchCallback {
-  public:
-    FuncSetCallback(std::unordered_set<const FunctionDecl*> &FuncSet)
+/// This class is a callback used internally to match function declarations
+/// with the MOZ_CAN_RUN_SCRIPT annotation, adding these functions and all
+/// the methods they override to the can-run-script function set.
+class FuncSetCallback : public MatchFinder::MatchCallback {
+public:
+  FuncSetCallback(std::unordered_set<const FunctionDecl *> &FuncSet)
       : CanRunScriptFuncs(FuncSet) {}
 
-    void run(const MatchFinder::MatchResult &Result) override;
+  void run(const MatchFinder::MatchResult &Result) override;
 
-  private:
-    /// This method recursively adds all the methods overriden by the given
-    /// paremeter.
-    void addAllOverriddenMethodsRecursively(const CXXMethodDecl* Method);
+private:
+  /// This method recursively adds all the methods overriden by the given
+  /// paremeter.
+  void addAllOverriddenMethodsRecursively(const CXXMethodDecl *Method);
 
-    std::unordered_set<const FunctionDecl*> &CanRunScriptFuncs;
-  };
+  std::unordered_set<const FunctionDecl *> &CanRunScriptFuncs;
+};
 
-  void FuncSetCallback::run(const MatchFinder::MatchResult &Result) {
-    const FunctionDecl* Func =
+void FuncSetCallback::run(const MatchFinder::MatchResult &Result) {
+  const FunctionDecl *Func =
       Result.Nodes.getNodeAs<FunctionDecl>("canRunScriptFunction");
 
-    CanRunScriptFuncs.insert(Func);
+  CanRunScriptFuncs.insert(Func);
 
-    // If this is a method, we check the methods it overrides.
-    if (auto* Method = dyn_cast<CXXMethodDecl>(Func)) {
-      addAllOverriddenMethodsRecursively(Method);
-    }
+  // If this is a method, we check the methods it overrides.
+  if (auto *Method = dyn_cast<CXXMethodDecl>(Func)) {
+    addAllOverriddenMethodsRecursively(Method);
   }
+}
 
-  void FuncSetCallback::addAllOverriddenMethodsRecursively(
-      const CXXMethodDecl* Method) {
-    for (auto OverriddenMethod : Method->overridden_methods()) {
-      CanRunScriptFuncs.insert(OverriddenMethod);
+void FuncSetCallback::addAllOverriddenMethodsRecursively(
+    const CXXMethodDecl *Method) {
+  for (auto OverriddenMethod : Method->overridden_methods()) {
+    CanRunScriptFuncs.insert(OverriddenMethod);
 
-      // If this is not the definition, we also add the definition (if it
-      // exists) to the set.
-      if (!OverriddenMethod->isThisDeclarationADefinition()) {
-        if (auto Def = OverriddenMethod->getDefinition()) {
-          CanRunScriptFuncs.insert(Def);
-        }
+    // If this is not the definition, we also add the definition (if it
+    // exists) to the set.
+    if (!OverriddenMethod->isThisDeclarationADefinition()) {
+      if (auto Def = OverriddenMethod->getDefinition()) {
+        CanRunScriptFuncs.insert(Def);
       }
+    }
 
-      addAllOverriddenMethodsRecursively(OverriddenMethod);
-    }
+    addAllOverriddenMethodsRecursively(OverriddenMethod);
   }
+}
 } // namespace
 
 void CanRunScriptChecker::buildFuncSet(ASTContext *Context) {
   // We create a match finder.
   MatchFinder Finder;
   // We create the callback which will be called when we find a function with
   // a MOZ_CAN_RUN_SCRIPT annotation.
   FuncSetCallback Callback(CanRunScriptFuncs);
   // We add the matcher to the finder, linking it to our callback.
-  Finder.addMatcher(functionDecl(hasCanRunScriptAnnotation())
-                      .bind("canRunScriptFunction"),
-                    &Callback);
+  Finder.addMatcher(
+      functionDecl(hasCanRunScriptAnnotation()).bind("canRunScriptFunction"),
+      &Callback);
 
   // We start the analysis, given the ASTContext our main checker is in.
   Finder.matchAST(*Context);
 }
 
-void CanRunScriptChecker::check(
-    const MatchFinder::MatchResult &Result) {
+void CanRunScriptChecker::check(const MatchFinder::MatchResult &Result) {
 
   // If the set of functions which can run script is not yet built, then build
   // it.
   if (!IsFuncSetBuilt) {
     buildFuncSet(Result.Context);
     IsFuncSetBuilt = true;
   }
 
-  const char* ErrorInvalidArg =
+  const char *ErrorInvalidArg =
       "arguments must all be strong refs or parent parameters when calling a "
       "function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object "
       "argument)";
 
-  const char* ErrorNonCanRunScriptParent =
+  const char *ErrorNonCanRunScriptParent =
       "functions marked as MOZ_CAN_RUN_SCRIPT can only be called from "
       "functions also marked as MOZ_CAN_RUN_SCRIPT";
-  const char* NoteNonCanRunScriptParent =
-      "parent function declared here";
+  const char *NoteNonCanRunScriptParent = "parent function declared here";
 
-  const Expr* InvalidArg = Result.Nodes.getNodeAs<Expr>("invalidArg");
+  const Expr *InvalidArg = Result.Nodes.getNodeAs<Expr>("invalidArg");
 
-  const CallExpr* Call = Result.Nodes.getNodeAs<CallExpr>("callExpr");
+  const CallExpr *Call = Result.Nodes.getNodeAs<CallExpr>("callExpr");
   // If we don't find the FunctionDecl linked to this call or if it's not marked
   // as can-run-script, consider that we didn't find a match.
   if (Call && (!Call->getDirectCallee() ||
-      !CanRunScriptFuncs.count(Call->getDirectCallee()))) {
+               !CanRunScriptFuncs.count(Call->getDirectCallee()))) {
     Call = nullptr;
   }
 
-  const CXXConstructExpr* Construct =
+  const CXXConstructExpr *Construct =
       Result.Nodes.getNodeAs<CXXConstructExpr>("constructExpr");
 
   // If we don't find the CXXConstructorDecl linked to this construct expression
   // or if it's not marked as can-run-script, consider that we didn't find a
   // match.
   if (Construct && (!Construct->getConstructor() ||
-      !CanRunScriptFuncs.count(Construct->getConstructor()))) {
+                    !CanRunScriptFuncs.count(Construct->getConstructor()))) {
     Construct = nullptr;
   }
 
-  const FunctionDecl* ParentFunction =
+  const FunctionDecl *ParentFunction =
       Result.Nodes.getNodeAs<FunctionDecl>("nonCanRunScriptParentFunction");
   // If the parent function can run script, consider that we didn't find a match
   // because we only care about parent functions which can't run script.
   if (ParentFunction && CanRunScriptFuncs.count(ParentFunction)) {
     ParentFunction = nullptr;
   }
 
-
   // Get the call range from either the CallExpr or the ConstructExpr.
   SourceRange CallRange;
   if (Call) {
     CallRange = Call->getSourceRange();
   } else if (Construct) {
     CallRange = Construct->getSourceRange();
   } else {
     // If we have neither a Call nor a Construct, we have nothing do to here.
--- a/build/clang-plugin/CanRunScriptChecker.h
+++ b/build/clang-plugin/CanRunScriptChecker.h
@@ -5,28 +5,27 @@
 #ifndef CanRunScriptChecker_h__
 #define CanRunScriptChecker_h__
 
 #include "plugin.h"
 #include <unordered_set>
 
 class CanRunScriptChecker : public BaseCheck {
 public:
-  CanRunScriptChecker(StringRef CheckName,
-                      ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+  CanRunScriptChecker(StringRef CheckName, ContextType *Context = nullptr)
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 
   // Simply initialize the can-run-script function set at the beginning of each
   // translation unit.
   void onStartOfTranslationUnit() override;
 
 private:
   /// Runs the inner matcher on the AST to find all the can-run-script
   /// functions using custom rules (not only the annotation).
   void buildFuncSet(ASTContext *Context);
 
   bool IsFuncSetBuilt;
-  std::unordered_set<const FunctionDecl*> CanRunScriptFuncs;
+  std::unordered_set<const FunctionDecl *> CanRunScriptFuncs;
 };
 
 #endif
--- a/build/clang-plugin/CustomMatchers.h
+++ b/build/clang-plugin/CustomMatchers.h
@@ -34,17 +34,17 @@ AST_MATCHER(CXXMethodDecl, isLValueRefQu
   return Node.getRefQualifier() == RQ_LValue;
 }
 
 /// This matcher will match rvalue-ref-qualified methods.
 AST_MATCHER(CXXMethodDecl, isRValueRefQualified) {
   return Node.getRefQualifier() == RQ_RValue;
 }
 
-AST_POLYMORPHIC_MATCHER(isFirstParty,                                          \
+AST_POLYMORPHIC_MATCHER(isFirstParty,
                         AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt)) {
   return !inThirdPartyPath(&Node, &Finder->getASTContext()) &&
          !ASTIsInSystemHeader(Finder->getASTContext(), Node);
 }
 
 /// This matcher will match temporary expressions.
 /// We need this matcher for compatibility with clang 3.* (clang 4 and above
 /// insert a MaterializeTemporaryExpr everywhere).
@@ -299,33 +299,33 @@ AST_MATCHER(FunctionDecl, isMozMustRetur
 ///   matches 'return *this'
 ///   but does match 'return > 0'
 AST_MATCHER_P(Stmt, forFunction, internal::Matcher<FunctionDecl>,
               InnerMatcher) {
   const auto &Parents = Finder->getASTContext().getParents(Node);
 
   llvm::SmallVector<ast_type_traits::DynTypedNode, 8> Stack(Parents.begin(),
                                                             Parents.end());
-  while(!Stack.empty()) {
+  while (!Stack.empty()) {
     const auto &CurNode = Stack.back();
     Stack.pop_back();
-    if(const auto *FuncDeclNode = CurNode.get<FunctionDecl>()) {
-      if(InnerMatcher.matches(*FuncDeclNode, Finder, Builder)) {
+    if (const auto *FuncDeclNode = CurNode.get<FunctionDecl>()) {
+      if (InnerMatcher.matches(*FuncDeclNode, Finder, Builder)) {
         return true;
       }
-    } else if(const auto *LambdaExprNode = CurNode.get<LambdaExpr>()) {
-      if(InnerMatcher.matches(*LambdaExprNode->getCallOperator(),
-                              Finder, Builder)) {
+    } else if (const auto *LambdaExprNode = CurNode.get<LambdaExpr>()) {
+      if (InnerMatcher.matches(*LambdaExprNode->getCallOperator(), Finder,
+                               Builder)) {
         return true;
       }
     } else {
-      for(const auto &Parent: Finder->getASTContext().getParents(CurNode))
+      for (const auto &Parent : Finder->getASTContext().getParents(CurNode))
         Stack.push_back(Parent);
     }
   }
   return false;
 }
 #endif
 
-}
-}
+} // namespace ast_matchers
+} // namespace clang
 
 #endif
--- a/build/clang-plugin/CustomTypeAnnotation.cpp
+++ b/build/clang-plugin/CustomTypeAnnotation.cpp
@@ -6,67 +6,62 @@
 #include "Utils.h"
 
 CustomTypeAnnotation StackClass =
     CustomTypeAnnotation("moz_stack_class", "stack");
 CustomTypeAnnotation GlobalClass =
     CustomTypeAnnotation("moz_global_class", "global");
 CustomTypeAnnotation NonHeapClass =
     CustomTypeAnnotation("moz_nonheap_class", "non-heap");
-CustomTypeAnnotation HeapClass =
-    CustomTypeAnnotation("moz_heap_class", "heap");
+CustomTypeAnnotation HeapClass = CustomTypeAnnotation("moz_heap_class", "heap");
 CustomTypeAnnotation NonTemporaryClass =
     CustomTypeAnnotation("moz_non_temporary_class", "non-temporary");
 
-void CustomTypeAnnotation::dumpAnnotationReason(BaseCheck &Check,
-                                                QualType T,
+void CustomTypeAnnotation::dumpAnnotationReason(BaseCheck &Check, QualType T,
                                                 SourceLocation Loc) {
-  const char* Inherits =
+  const char *Inherits =
       "%1 is a %0 type because it inherits from a %0 type %2";
-  const char* Member =
-      "%1 is a %0 type because member %2 is a %0 type %3";
-  const char* Array =
-      "%1 is a %0 type because it is an array of %0 type %2";
-  const char* Templ =
+  const char *Member = "%1 is a %0 type because member %2 is a %0 type %3";
+  const char *Array = "%1 is a %0 type because it is an array of %0 type %2";
+  const char *Templ =
       "%1 is a %0 type because it has a template argument %0 type %2";
-  const char* Implicit =
-      "%1 is a %0 type because %2";
+  const char *Implicit = "%1 is a %0 type because %2";
 
   AnnotationReason Reason = directAnnotationReason(T);
   for (;;) {
     switch (Reason.Kind) {
     case RK_ArrayElement:
       Check.diag(Loc, Array, DiagnosticIDs::Note) << Pretty << T << Reason.Type;
       break;
     case RK_BaseClass: {
       const CXXRecordDecl *Declaration = T->getAsCXXRecordDecl();
       assert(Declaration && "This type should be a C++ class");
 
       Check.diag(Declaration->getLocation(), Inherits, DiagnosticIDs::Note)
-        << Pretty << T << Reason.Type;
+          << Pretty << T << Reason.Type;
       break;
     }
     case RK_Field:
       Check.diag(Reason.Field->getLocation(), Member, DiagnosticIDs::Note)
           << Pretty << T << Reason.Field << Reason.Type;
       break;
     case RK_TemplateInherited: {
       const CXXRecordDecl *Declaration = T->getAsCXXRecordDecl();
       assert(Declaration && "This type should be a C++ class");
 
       Check.diag(Declaration->getLocation(), Templ, DiagnosticIDs::Note)
-        << Pretty << T << Reason.Type;
+          << Pretty << T << Reason.Type;
       break;
     }
     case RK_Implicit: {
       const TagDecl *Declaration = T->getAsTagDecl();
       assert(Declaration && "This type should be a TagDecl");
 
       Check.diag(Declaration->getLocation(), Implicit, DiagnosticIDs::Note)
-        << Pretty << T << Reason.ImplicitReason;
+          << Pretty << T << Reason.ImplicitReason;
       return;
     }
     default:
       // FIXME (bug 1203263): note the original annotation.
       return;
     }
 
     T = Reason.Type;
--- a/build/clang-plugin/CustomTypeAnnotation.h
+++ b/build/clang-plugin/CustomTypeAnnotation.h
@@ -36,22 +36,20 @@ public:
       : Spelling(Spelling), Pretty(Pretty){};
 
   virtual ~CustomTypeAnnotation() {}
 
   // Checks if this custom annotation "effectively affects" the given type.
   bool hasEffectiveAnnotation(QualType T) {
     return directAnnotationReason(T).valid();
   }
-  void dumpAnnotationReason(BaseCheck &Check, QualType T,
-                            SourceLocation Loc);
+  void dumpAnnotationReason(BaseCheck &Check, QualType T, SourceLocation Loc);
 
-  void reportErrorIfPresent(BaseCheck &Check, QualType T,
-                            SourceLocation Loc, const char* Error,
-                            const char* Note) {
+  void reportErrorIfPresent(BaseCheck &Check, QualType T, SourceLocation Loc,
+                            const char *Error, const char *Note) {
     if (hasEffectiveAnnotation(T)) {
       Check.diag(Loc, Error, DiagnosticIDs::Error) << T;
       Check.diag(Loc, Note, DiagnosticIDs::Note);
       dumpAnnotationReason(Check, T, Loc);
     }
   }
 
 private:
--- a/build/clang-plugin/DanglingOnTemporaryChecker.cpp
+++ b/build/clang-plugin/DanglingOnTemporaryChecker.cpp
@@ -37,78 +37,73 @@ void DanglingOnTemporaryChecker::registe
 
           decl().bind("invalidMethodPointer")),
       this);
 
   //////////////////
   // Main checker //
   //////////////////
 
-  auto hasParentCall =
-      hasParent(expr(anyOf(
-          cxxOperatorCallExpr(
-              // If we're in a lamda, we may have an operator call expression
-              // ancestor in the AST, but the temporary we're matching
-              // against is not going to have the same lifetime as the
-              // constructor call.
-              unless(has(expr(ignoreTrivials(lambdaExpr())))),
-              expr().bind("parentOperatorCallExpr")),
-          callExpr(
-              // If we're in a lamda, we may have a call expression
-              // ancestor in the AST, but the temporary we're matching
-              // against is not going to have the same lifetime as the
-              // function call.
-              unless(has(expr(ignoreTrivials(lambdaExpr())))),
-              expr().bind("parentCallExpr")),
-          objcMessageExpr(
-              // If we're in a lamda, we may have an objc message expression
-              // ancestor in the AST, but the temporary we're matching
-              // against is not going to have the same lifetime as the
-              // function call.
-              unless(has(expr(ignoreTrivials(lambdaExpr())))),
-              expr().bind("parentObjCMessageExpr")),
-          cxxConstructExpr(
-              // If we're in a lamda, we may have a construct expression
-              // ancestor in the AST, but the temporary we're matching
-              // against is not going to have the same lifetime as the
-              // constructor call.
-              unless(has(expr(ignoreTrivials(lambdaExpr())))),
-              expr().bind("parentConstructExpr")))));
+  auto hasParentCall = hasParent(expr(
+      anyOf(cxxOperatorCallExpr(
+                // If we're in a lamda, we may have an operator call expression
+                // ancestor in the AST, but the temporary we're matching
+                // against is not going to have the same lifetime as the
+                // constructor call.
+                unless(has(expr(ignoreTrivials(lambdaExpr())))),
+                expr().bind("parentOperatorCallExpr")),
+            callExpr(
+                // If we're in a lamda, we may have a call expression
+                // ancestor in the AST, but the temporary we're matching
+                // against is not going to have the same lifetime as the
+                // function call.
+                unless(has(expr(ignoreTrivials(lambdaExpr())))),
+                expr().bind("parentCallExpr")),
+            objcMessageExpr(
+                // If we're in a lamda, we may have an objc message expression
+                // ancestor in the AST, but the temporary we're matching
+                // against is not going to have the same lifetime as the
+                // function call.
+                unless(has(expr(ignoreTrivials(lambdaExpr())))),
+                expr().bind("parentObjCMessageExpr")),
+            cxxConstructExpr(
+                // If we're in a lamda, we may have a construct expression
+                // ancestor in the AST, but the temporary we're matching
+                // against is not going to have the same lifetime as the
+                // constructor call.
+                unless(has(expr(ignoreTrivials(lambdaExpr())))),
+                expr().bind("parentConstructExpr")))));
 
   AstMatcher->addMatcher(
       // This is a matcher on a method call,
       cxxMemberCallExpr(
           // which is in first party code,
           isFirstParty(),
 
           // and which is performed on a temporary,
-          on(allOf(
-              unless(hasType(pointerType())),
-              isTemporary(),
-              // but which is not `this`.
-              unless(cxxThisExpr()))),
+          on(allOf(unless(hasType(pointerType())), isTemporary(),
+                   // but which is not `this`.
+                   unless(cxxThisExpr()))),
 
           // and which is marked as no dangling on temporaries.
           callee(cxxMethodDecl(noDanglingOnTemporaries())),
 
           expr().bind("memberCallExpr"),
 
           // We optionally match a parent call expression or a parent construct
           // expression because using a temporary inside a call is fine as long
           // as the pointer doesn't escape the function call.
           anyOf(
               // This is the case where the call is the direct parent, so we
               // know that the member call expression is the argument.
               allOf(hasParentCall, expr().bind("parentCallArg")),
 
               // This is the case where the call is not the direct parent, so we
               // get its child to know in which argument tree we are.
-              hasAncestor(expr(
-                  hasParentCall,
-                  expr().bind("parentCallArg"))),
+              hasAncestor(expr(hasParentCall, expr().bind("parentCallArg"))),
               // To make it optional.
               anything())),
       this);
 }
 
 void DanglingOnTemporaryChecker::check(const MatchFinder::MatchResult &Result) {
   ///////////////////////////////////////
   // Quick annotation conflict checker //
@@ -158,51 +153,50 @@ void DanglingOnTemporaryChecker::check(c
       Result.Nodes.getNodeAs<CXXMemberCallExpr>("memberCallExpr");
 
   const CallExpr *ParentCallExpr =
       Result.Nodes.getNodeAs<CallExpr>("parentCallExpr");
   const CXXConstructExpr *ParentConstructExpr =
       Result.Nodes.getNodeAs<CXXConstructExpr>("parentConstructExpr");
   const CXXOperatorCallExpr *ParentOperatorCallExpr =
       Result.Nodes.getNodeAs<CXXOperatorCallExpr>("parentOperatorCallExpr");
-  const Expr *ParentCallArg =
-      Result.Nodes.getNodeAs<Expr>("parentCallArg");
+  const Expr *ParentCallArg = Result.Nodes.getNodeAs<Expr>("parentCallArg");
 
   // Just in case.
   if (!MemberCall) {
     return;
   }
 
   // If we have a parent call, we check whether or not we escape the function
   // being called.
   if (ParentOperatorCallExpr || ParentCallExpr || ParentConstructExpr) {
     // Just in case.
     if (!ParentCallArg) {
       return;
     }
 
     // No default constructor so we can't construct it using if/else.
-    auto FunctionEscapeData
-        = ParentOperatorCallExpr
+    auto FunctionEscapeData =
+        ParentOperatorCallExpr
             ? escapesFunction(ParentCallArg, ParentOperatorCallExpr)
-          : ParentCallExpr
-              ? escapesFunction(ParentCallArg, ParentCallExpr)
-          : escapesFunction(ParentCallArg, ParentConstructExpr);
+            : ParentCallExpr
+                  ? escapesFunction(ParentCallArg, ParentCallExpr)
+                  : escapesFunction(ParentCallArg, ParentConstructExpr);
 
     // If there was an error in the escapesFunction call.
     if (std::error_code ec = FunctionEscapeData.getError()) {
       // FIXME: For now we ignore the variadic case and just consider that the
       // argument doesn't escape the function. Same for the case where we can't
       // find the function declaration or if the function is builtin.
       if (static_cast<EscapesFunctionError>(ec.value()) ==
-          EscapesFunctionError::FunctionIsVariadic ||
+              EscapesFunctionError::FunctionIsVariadic ||
           static_cast<EscapesFunctionError>(ec.value()) ==
-          EscapesFunctionError::FunctionDeclNotFound ||
+              EscapesFunctionError::FunctionDeclNotFound ||
           static_cast<EscapesFunctionError>(ec.value()) ==
-          EscapesFunctionError::FunctionIsBuiltin) {
+              EscapesFunctionError::FunctionIsBuiltin) {
         return;
       }
 
       // We emit the internal checker error and return.
       diag(MemberCall->getExprLoc(),
            std::string(ec.category().name()) + " error: " + ec.message(),
            DiagnosticIDs::Error);
       return;
@@ -253,10 +247,10 @@ void DanglingOnTemporaryChecker::check(c
     diag(EscapeDecl->getLocation(), EscapeDeclNote, DiagnosticIDs::Note)
         << EscapeDeclRange;
   } else {
     // We emit the error diagnostic indicating that we are calling the method
     // temporary.
     diag(MemberCall->getExprLoc(), Error, DiagnosticIDs::Error)
         << MemberCall->getMethodDecl()->getName()
         << MemberCall->getSourceRange();
-    }
+  }
 }
--- a/build/clang-plugin/DiagnosticsMatcher.cpp
+++ b/build/clang-plugin/DiagnosticsMatcher.cpp
@@ -1,17 +1,18 @@
 /* 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 "DiagnosticsMatcher.h"
 
-DiagnosticsMatcher::DiagnosticsMatcher(CompilerInstance& CI) :
-#define CHECK(cls, name) cls ## _(name),
+DiagnosticsMatcher::DiagnosticsMatcher(CompilerInstance &CI)
+    :
+#define CHECK(cls, name) cls##_(name),
 #include "Checks.inc"
 #undef CHECK
-  AstMatcher()
-{
-#define CHECK(cls, name) cls ## _.registerMatchers(&AstMatcher); \
-                         cls ## _.registerPPCallbacks(CI);
+      AstMatcher() {
+#define CHECK(cls, name)                                                       \
+  cls##_.registerMatchers(&AstMatcher);                                        \
+  cls##_.registerPPCallbacks(CI);
 #include "Checks.inc"
 #undef CHECK
 }
--- a/build/clang-plugin/DiagnosticsMatcher.h
+++ b/build/clang-plugin/DiagnosticsMatcher.h
@@ -4,20 +4,20 @@
 
 #ifndef DiagnosticsMatcher_h__
 #define DiagnosticsMatcher_h__
 
 #include "ChecksIncludes.inc"
 
 class DiagnosticsMatcher {
 public:
-  DiagnosticsMatcher(CompilerInstance& CI);
+  DiagnosticsMatcher(CompilerInstance &CI);
 
   ASTConsumerPtr makeASTConsumer() { return AstMatcher.newASTConsumer(); }
 
 private:
-#define CHECK(cls, name) cls cls ## _;
+#define CHECK(cls, name) cls cls##_;
 #include "Checks.inc"
 #undef CHECK
   MatchFinder AstMatcher;
 };
 
 #endif
--- a/build/clang-plugin/ExplicitImplicitChecker.cpp
+++ b/build/clang-plugin/ExplicitImplicitChecker.cpp
@@ -1,31 +1,33 @@
 /* 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 "ExplicitImplicitChecker.h"
 #include "CustomMatchers.h"
 
-void ExplicitImplicitChecker::registerMatchers(MatchFinder* AstMatcher) {
-  AstMatcher->addMatcher(cxxConstructorDecl(isInterestingImplicitCtor(),
-                                            ofClass(allOf(isConcreteClass(),
-                                                          decl().bind("class"))),
-                                            unless(isMarkedImplicit()))
-                            .bind("ctor"),
-                        this);
+void ExplicitImplicitChecker::registerMatchers(MatchFinder *AstMatcher) {
+  AstMatcher->addMatcher(
+      cxxConstructorDecl(
+          isInterestingImplicitCtor(),
+          ofClass(allOf(isConcreteClass(), decl().bind("class"))),
+          unless(isMarkedImplicit()))
+          .bind("ctor"),
+      this);
 }
 
-void ExplicitImplicitChecker::check(
-    const MatchFinder::MatchResult &Result) {
+void ExplicitImplicitChecker::check(const MatchFinder::MatchResult &Result) {
   // We've already checked everything in the matcher, so we just have to report
   // the error.
 
   const CXXConstructorDecl *Ctor =
       Result.Nodes.getNodeAs<CXXConstructorDecl>("ctor");
   const CXXRecordDecl *Declaration =
       Result.Nodes.getNodeAs<CXXRecordDecl>("class");
 
   diag(Ctor->getLocation(), "bad implicit conversion constructor for %0",
-       DiagnosticIDs::Error) << Declaration->getDeclName();
-  diag(Ctor->getLocation(), "consider adding the explicit keyword to the constructor",
+       DiagnosticIDs::Error)
+      << Declaration->getDeclName();
+  diag(Ctor->getLocation(),
+       "consider adding the explicit keyword to the constructor",
        DiagnosticIDs::Note);
 }
--- a/build/clang-plugin/ExplicitImplicitChecker.h
+++ b/build/clang-plugin/ExplicitImplicitChecker.h
@@ -4,16 +4,15 @@
 
 #ifndef ExplicitImplicitChecker_h__
 #define ExplicitImplicitChecker_h__
 
 #include "plugin.h"
 
 class ExplicitImplicitChecker : public BaseCheck {
 public:
-  ExplicitImplicitChecker(StringRef CheckName,
-                          ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+  ExplicitImplicitChecker(StringRef CheckName, ContextType *Context = nullptr)
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/ExplicitOperatorBoolChecker.cpp
+++ b/build/clang-plugin/ExplicitOperatorBoolChecker.cpp
@@ -1,16 +1,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 "ExplicitOperatorBoolChecker.h"
 #include "CustomMatchers.h"
 
-void ExplicitOperatorBoolChecker::registerMatchers(MatchFinder* AstMatcher) {
+void ExplicitOperatorBoolChecker::registerMatchers(MatchFinder *AstMatcher) {
   // Older clang versions such as the ones used on the infra recognize these
   // conversions as 'operator _Bool', but newer clang versions recognize these
   // as 'operator bool'.
   AstMatcher->addMatcher(
       cxxMethodDecl(anyOf(hasName("operator bool"), hasName("operator _Bool")))
           .bind("node"),
       this);
 }
@@ -21,13 +21,15 @@ void ExplicitOperatorBoolChecker::check(
       Result.Nodes.getNodeAs<CXXConversionDecl>("node");
   const CXXRecordDecl *Clazz = Method->getParent();
 
   if (!Method->isExplicitSpecified() &&
       !hasCustomAnnotation(Method, "moz_implicit") &&
       !ASTIsInSystemHeader(Method->getASTContext(), *Method) &&
       isInterestingDeclForImplicitConversion(Method)) {
     diag(Method->getLocStart(), "bad implicit conversion operator for %0",
-         DiagnosticIDs::Error) << Clazz;
+         DiagnosticIDs::Error)
+        << Clazz;
     diag(Method->getLocStart(), "consider adding the explicit keyword to %0",
-         DiagnosticIDs::Note) << "'operator bool'";
+         DiagnosticIDs::Note)
+        << "'operator bool'";
   }
 }
--- a/build/clang-plugin/ExplicitOperatorBoolChecker.h
+++ b/build/clang-plugin/ExplicitOperatorBoolChecker.h
@@ -6,14 +6,14 @@
 #define ExplicitOperatorBoolChecker_h__
 
 #include "plugin.h"
 
 class ExplicitOperatorBoolChecker : public BaseCheck {
 public:
   ExplicitOperatorBoolChecker(StringRef CheckName,
                               ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/KungFuDeathGripChecker.cpp
+++ b/build/clang-plugin/KungFuDeathGripChecker.cpp
@@ -1,26 +1,24 @@
 /* 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 "KungFuDeathGripChecker.h"
 #include "CustomMatchers.h"
 
-void KungFuDeathGripChecker::registerMatchers(MatchFinder* AstMatcher) {
-  AstMatcher->addMatcher(varDecl(hasType(isRefPtr())).bind("decl"),
-                         this);
+void KungFuDeathGripChecker::registerMatchers(MatchFinder *AstMatcher) {
+  AstMatcher->addMatcher(varDecl(hasType(isRefPtr())).bind("decl"), this);
 }
 
-void KungFuDeathGripChecker::check(
-    const MatchFinder::MatchResult &Result) {
-  const char* Error =
-    "Unused \"kungFuDeathGrip\" %0 objects constructed from %1 are prohibited";
-  const char* Note =
-    "Please switch all accesses to this %0 to go through '%1', or explicitly pass '%1' to `mozilla::Unused`";
+void KungFuDeathGripChecker::check(const MatchFinder::MatchResult &Result) {
+  const char *Error = "Unused \"kungFuDeathGrip\" %0 objects constructed from "
+                      "%1 are prohibited";
+  const char *Note = "Please switch all accesses to this %0 to go through "
+                     "'%1', or explicitly pass '%1' to `mozilla::Unused`";
 
   const VarDecl *D = Result.Nodes.getNodeAs<VarDecl>("decl");
   if (D->isReferenced() || !D->hasLocalStorage() || !D->hasInit()) {
     return;
   }
 
   // Not interested in parameters.
   if (isa<ImplicitParamDecl>(D) || isa<ParmVarDecl>(D)) {
@@ -59,40 +57,43 @@ void KungFuDeathGripChecker::check(
   }
 
   // These types are assigned into nsCOMPtr and RefPtr for their side effects,
   // and not as a kungFuDeathGrip. We don't want to consider RefPtr and nsCOMPtr
   // types which are initialized with these types as errors.
   const TagDecl *TD = E->getType()->getAsTagDecl();
   if (TD && TD->getIdentifier()) {
     static const char *IgnoreTypes[] = {
-      "already_AddRefed",
-      "nsGetServiceByCID",
-      "nsGetServiceByCIDWithError",
-      "nsGetServiceByContractID",
-      "nsGetServiceByContractIDWithError",
-      "nsCreateInstanceByCID",
-      "nsCreateInstanceByContractID",
-      "nsCreateInstanceFromFactory",
+        "already_AddRefed",
+        "nsGetServiceByCID",
+        "nsGetServiceByCIDWithError",
+        "nsGetServiceByContractID",
+        "nsGetServiceByContractIDWithError",
+        "nsCreateInstanceByCID",
+        "nsCreateInstanceByContractID",
+        "nsCreateInstanceFromFactory",
     };
 
-    for (uint32_t i = 0; i < sizeof(IgnoreTypes) / sizeof(IgnoreTypes[0]); ++i) {
+    for (uint32_t i = 0; i < sizeof(IgnoreTypes) / sizeof(IgnoreTypes[0]);
+         ++i) {
       if (TD->getName() == IgnoreTypes[i]) {
         return;
       }
     }
   }
 
   // Report the error
   const char *ErrThing;
   const char *NoteThing;
   if (isa<MemberExpr>(E)) {
-    ErrThing  = "members";
+    ErrThing = "members";
     NoteThing = "member";
   } else {
     ErrThing = "temporary values";
     NoteThing = "value";
   }
 
   // We cannot provide the note if we don't have an initializer
-  diag(D->getLocStart(), Error, DiagnosticIDs::Error) << D->getType() << ErrThing;
-  diag(E->getLocStart(), Note, DiagnosticIDs::Note) << NoteThing << getNameChecked(D);
+  diag(D->getLocStart(), Error, DiagnosticIDs::Error)
+      << D->getType() << ErrThing;
+  diag(E->getLocStart(), Note, DiagnosticIDs::Note)
+      << NoteThing << getNameChecked(D);
 }
--- a/build/clang-plugin/KungFuDeathGripChecker.h
+++ b/build/clang-plugin/KungFuDeathGripChecker.h
@@ -4,16 +4,15 @@
 
 #ifndef KungFuDeathGripChecker_h__
 #define KungFuDeathGripChecker_h__
 
 #include "plugin.h"
 
 class KungFuDeathGripChecker : public BaseCheck {
 public:
-  KungFuDeathGripChecker(StringRef CheckName,
-                         ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+  KungFuDeathGripChecker(StringRef CheckName, ContextType *Context = nullptr)
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/MemMoveAnnotation.h
+++ b/build/clang-plugin/MemMoveAnnotation.h
@@ -1,17 +1,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/. */
 
 #ifndef MemMoveAnnotation_h__
 #define MemMoveAnnotation_h__
 
+#include "CustomMatchers.h"
 #include "CustomTypeAnnotation.h"
-#include "CustomMatchers.h"
 #include "Utils.h"
 
 class MemMoveAnnotation final : public CustomTypeAnnotation {
 public:
   MemMoveAnnotation()
       : CustomTypeAnnotation("moz_non_memmovable", "non-memmove()able") {}
 
   virtual ~MemMoveAnnotation() {}
@@ -19,40 +19,29 @@ public:
 protected:
   std::string getImplicitReason(const TagDecl *D) const override {
     // Annotate everything in ::std, with a few exceptions; see bug
     // 1201314 for discussion.
     if (getDeclarationNamespace(D) == "std") {
       // This doesn't check that it's really ::std::pair and not
       // ::std::something_else::pair, but should be good enough.
       StringRef Name = getNameChecked(D);
-      if (Name == "pair" ||
-          Name == "atomic" ||
+      if (Name == "pair" || Name == "atomic" ||
           // libstdc++ specific names
-          Name == "__atomic_base" ||
-          Name == "atomic_bool" ||
+          Name == "__atomic_base" || Name == "atomic_bool" ||
           // MSVCRT specific names
-          Name == "_Atomic_impl" ||
-          Name == "_Atomic_base" ||
-          Name == "_Atomic_bool" ||
-          Name == "_Atomic_char" ||
-          Name == "_Atomic_schar" ||
-          Name == "_Atomic_uchar" ||
-          Name == "_Atomic_char16_t" ||
-          Name == "_Atomic_char32_t" ||
-          Name == "_Atomic_wchar_t" ||
-          Name == "_Atomic_short" ||
-          Name == "_Atomic_ushort" ||
-          Name == "_Atomic_int" ||
-          Name == "_Atomic_uint" ||
-          Name == "_Atomic_long" ||
-          Name == "_Atomic_ulong" ||
-          Name == "_Atomic_llong" ||
-          Name == "_Atomic_ullong" ||
-          Name == "_Atomic_address") {
+          Name == "_Atomic_impl" || Name == "_Atomic_base" ||
+          Name == "_Atomic_bool" || Name == "_Atomic_char" ||
+          Name == "_Atomic_schar" || Name == "_Atomic_uchar" ||
+          Name == "_Atomic_char16_t" || Name == "_Atomic_char32_t" ||
+          Name == "_Atomic_wchar_t" || Name == "_Atomic_short" ||
+          Name == "_Atomic_ushort" || Name == "_Atomic_int" ||
+          Name == "_Atomic_uint" || Name == "_Atomic_long" ||
+          Name == "_Atomic_ulong" || Name == "_Atomic_llong" ||
+          Name == "_Atomic_ullong" || Name == "_Atomic_address") {
         return "";
       }
       return "it is an stl-provided type not guaranteed to be memmove-able";
     }
     return "";
   }
 };
 
--- a/build/clang-plugin/MozCheckAction.cpp
+++ b/build/clang-plugin/MozCheckAction.cpp
@@ -1,22 +1,22 @@
 /* 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 "DiagnosticsMatcher.h"
 #include "plugin.h"
-#include "DiagnosticsMatcher.h"
 #include "clang/Frontend/FrontendPluginRegistry.h"
 
 class MozCheckAction : public PluginASTAction {
 public:
   ASTConsumerPtr CreateASTConsumer(CompilerInstance &CI,
                                    StringRef FileName) override {
-    void* Buffer = CI.getASTContext().Allocate<DiagnosticsMatcher>();
-    auto Matcher = new(Buffer) DiagnosticsMatcher(CI);
+    void *Buffer = CI.getASTContext().Allocate<DiagnosticsMatcher>();
+    auto Matcher = new (Buffer) DiagnosticsMatcher(CI);
     return Matcher->makeASTConsumer();
   }
 
   bool ParseArgs(const CompilerInstance &CI,
                  const std::vector<std::string> &Args) override {
     return true;
   }
 };
--- a/build/clang-plugin/MozillaTidyModule.cpp
+++ b/build/clang-plugin/MozillaTidyModule.cpp
@@ -19,18 +19,18 @@ public:
   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
 #define CHECK(cls, name) CheckFactories.registerCheck<cls>("mozilla-" name);
 #include "Checks.inc"
 #undef CHECK
   }
 };
 
 // Register the MozillaTidyModule using this statically initialized variable.
-static ClangTidyModuleRegistry::Add<MozillaModule> X("mozilla-module",
-                                                     "Adds Mozilla lint checks.");
+static ClangTidyModuleRegistry::Add<MozillaModule>
+    X("mozilla-module", "Adds Mozilla lint checks.");
 
 } // namespace tidy
 } // namespace clang
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the MozillaModule.
 volatile int MozillaModuleAnchorSource = 0;
 
--- a/build/clang-plugin/MustOverrideChecker.cpp
+++ b/build/clang-plugin/MustOverrideChecker.cpp
@@ -1,62 +1,60 @@
 /* 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 "MustOverrideChecker.h"
 #include "CustomMatchers.h"
 
-void MustOverrideChecker::registerMatchers(MatchFinder* AstMatcher) {
+void MustOverrideChecker::registerMatchers(MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(cxxRecordDecl(isDefinition()).bind("class"), this);
 }
 
-void MustOverrideChecker::registerPPCallbacks(CompilerInstance& CI) {
+void MustOverrideChecker::registerPPCallbacks(CompilerInstance &CI) {
   this->CI = &CI;
 }
 
-void MustOverrideChecker::check(
-    const MatchFinder::MatchResult &Result) {
+void MustOverrideChecker::check(const MatchFinder::MatchResult &Result) {
   auto D = Result.Nodes.getNodeAs<CXXRecordDecl>("class");
 
   // Look through all of our immediate bases to find methods that need to be
   // overridden
   typedef std::vector<CXXMethodDecl *> OverridesVector;
   OverridesVector MustOverrides;
-  for (const auto& Base : D->bases()) {
+  for (const auto &Base : D->bases()) {
     // The base is either a class (CXXRecordDecl) or it's a templated class...
     CXXRecordDecl *Parent = Base.getType()
                                 .getDesugaredType(D->getASTContext())
                                 ->getAsCXXRecordDecl();
     // The parent might not be resolved to a type yet. In this case, we can't
     // do any checking here. For complete correctness, we should visit
     // template instantiations, but this case is likely to be rare, so we will
     // ignore it until it becomes important.
     if (!Parent) {
       continue;
     }
     Parent = Parent->getDefinition();
-    for (const auto& M : Parent->methods()) {
+    for (const auto &M : Parent->methods()) {
       if (hasCustomAnnotation(M, "moz_must_override"))
         MustOverrides.push_back(M);
     }
   }
 
-  for (auto& O : MustOverrides) {
+  for (auto &O : MustOverrides) {
     bool Overridden = false;
-    for (const auto& M : D->methods()) {
+    for (const auto &M : D->methods()) {
       // The way that Clang checks if a method M overrides its parent method
       // is if the method has the same name but would not overload.
       if (getNameChecked(M) == getNameChecked(O) &&
           !CI->getSema().IsOverload(M, O, false)) {
         Overridden = true;
         break;
       }
     }
     if (!Overridden) {
-      diag(D->getLocation(), "%0 must override %1",
-           DiagnosticIDs::Error) << D->getDeclName()
-                                 << O->getDeclName();
+      diag(D->getLocation(), "%0 must override %1", DiagnosticIDs::Error)
+          << D->getDeclName() << O->getDeclName();
       diag(O->getLocation(), "function to override is here",
            DiagnosticIDs::Note);
     }
   }
 }
--- a/build/clang-plugin/MustOverrideChecker.h
+++ b/build/clang-plugin/MustOverrideChecker.h
@@ -4,20 +4,19 @@
 
 #ifndef MustOverrideChecker_h__
 #define MustOverrideChecker_h__
 
 #include "plugin.h"
 
 class MustOverrideChecker : public BaseCheck {
 public:
-  MustOverrideChecker(StringRef CheckName,
-                      ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context), CI(nullptr) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
-  void registerPPCallbacks(CompilerInstance& CI) override;
+  MustOverrideChecker(StringRef CheckName, ContextType *Context = nullptr)
+      : BaseCheck(CheckName, Context), CI(nullptr) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
+  void registerPPCallbacks(CompilerInstance &CI) override;
   void check(const MatchFinder::MatchResult &Result) override;
 
 private:
-  const CompilerInstance* CI;
+  const CompilerInstance *CI;
 };
 
 #endif
--- a/build/clang-plugin/MustReturnFromCallerChecker.cpp
+++ b/build/clang-plugin/MustReturnFromCallerChecker.cpp
@@ -1,45 +1,47 @@
 /* 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 "MustReturnFromCallerChecker.h"
 #include "CustomMatchers.h"
 
-void MustReturnFromCallerChecker::registerMatchers(MatchFinder* AstMatcher) {
+void MustReturnFromCallerChecker::registerMatchers(MatchFinder *AstMatcher) {
   // Look for a call to a MOZ_MUST_RETURN_FROM_CALLER function
-  AstMatcher->addMatcher(callExpr(callee(functionDecl(isMozMustReturnFromCaller())),
-                                  anyOf(hasAncestor(lambdaExpr().bind("containing-lambda")),
-                                        hasAncestor(functionDecl().bind("containing-func")))).bind("call"),
-                         this);
+  AstMatcher->addMatcher(
+      callExpr(callee(functionDecl(isMozMustReturnFromCaller())),
+               anyOf(hasAncestor(lambdaExpr().bind("containing-lambda")),
+                     hasAncestor(functionDecl().bind("containing-func"))))
+          .bind("call"),
+      this);
 }
 
 void MustReturnFromCallerChecker::check(
-    const MatchFinder::MatchResult& Result) {
+    const MatchFinder::MatchResult &Result) {
   const auto *ContainingLambda =
-    Result.Nodes.getNodeAs<LambdaExpr>("containing-lambda");
+      Result.Nodes.getNodeAs<LambdaExpr>("containing-lambda");
   const auto *ContainingFunc =
-    Result.Nodes.getNodeAs<FunctionDecl>("containing-func");
+      Result.Nodes.getNodeAs<FunctionDecl>("containing-func");
   const auto *Call = Result.Nodes.getNodeAs<CallExpr>("call");
 
   Stmt *Body = nullptr;
   if (ContainingLambda) {
     Body = ContainingLambda->getBody();
   } else if (ContainingFunc) {
     Body = ContainingFunc->getBody();
   } else {
     return;
   }
   assert(Body && "Should have a body by this point");
 
   // Generate the CFG for the enclosing function or decl.
   CFG::BuildOptions Options;
   std::unique_ptr<CFG> TheCFG =
-    CFG::buildCFG(nullptr, Body, Result.Context, Options);
+      CFG::buildCFG(nullptr, Body, Result.Context, Options);
   if (!TheCFG) {
     return;
   }
 
   // Determine which block in the CFG we want to look at the successors of.
   StmtToBlockMap BlockMap(TheCFG.get(), Result.Context);
   size_t CallIndex;
   const auto *Block = BlockMap.blockContainingStmt(Call, &CallIndex);
@@ -47,20 +49,19 @@ void MustReturnFromCallerChecker::check(
 
   if (!immediatelyReturns(Block, Result.Context, CallIndex + 1)) {
     diag(Call->getLocStart(),
          "You must immediately return after calling this function",
          DiagnosticIDs::Error);
   }
 }
 
-bool
-MustReturnFromCallerChecker::immediatelyReturns(RecurseGuard<const CFGBlock *> Block,
-                                                ASTContext *TheContext,
-                                                size_t FromIdx) {
+bool MustReturnFromCallerChecker::immediatelyReturns(
+    RecurseGuard<const CFGBlock *> Block, ASTContext *TheContext,
+    size_t FromIdx) {
   if (Block.isRepeat()) {
     return false;
   }
 
   for (size_t I = FromIdx; I < Block->size(); ++I) {
     Optional<CFGStmt> S = (*Block)[I].getAs<CFGStmt>();
     if (!S) {
       continue;
@@ -68,27 +69,27 @@ MustReturnFromCallerChecker::immediately
 
     auto AfterTrivials = IgnoreTrivials(S->getStmt());
 
     // If we are looking at a ConstructExpr, a DeclRefExpr or a MemberExpr it's
     // OK to use them after a call to a MOZ_MUST_RETURN_FROM_CALLER function.
     // It is also, of course, OK to look at a ReturnStmt.
     if (isa<ReturnStmt>(AfterTrivials) ||
         isa<CXXConstructExpr>(AfterTrivials) ||
-        isa<DeclRefExpr>(AfterTrivials) ||
-        isa<MemberExpr>(AfterTrivials)) {
+        isa<DeclRefExpr>(AfterTrivials) || isa<MemberExpr>(AfterTrivials)) {
       continue;
     }
 
     // It's also OK to call any function or method which is annotated with
     // MOZ_MAY_CALL_AFTER_MUST_RETURN. We consider all CXXConversionDecls
     // to be MOZ_MAY_CALL_AFTER_MUST_RETURN (like operator T*()).
     if (auto CE = dyn_cast<CallExpr>(AfterTrivials)) {
       auto Callee = CE->getDirectCallee();
-      if (Callee && hasCustomAnnotation(Callee, "moz_may_call_after_must_return")) {
+      if (Callee &&
+          hasCustomAnnotation(Callee, "moz_may_call_after_must_return")) {
         continue;
       }
 
       if (Callee && isa<CXXConversionDecl>(Callee)) {
         continue;
       }
     }
 
--- a/build/clang-plugin/MustReturnFromCallerChecker.h
+++ b/build/clang-plugin/MustReturnFromCallerChecker.h
@@ -1,26 +1,26 @@
 /* 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/. */
 
 #ifndef MustReturnFromCallerChecker_h__
 #define MustReturnFromCallerChecker_h__
 
-#include "plugin.h"
-#include "Utils.h"
 #include "RecurseGuard.h"
 #include "StmtToBlockMap.h"
+#include "Utils.h"
+#include "plugin.h"
 
 class MustReturnFromCallerChecker : public BaseCheck {
 public:
   MustReturnFromCallerChecker(StringRef CheckName,
                               ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
+
 private:
   bool immediatelyReturns(RecurseGuard<const CFGBlock *> Block,
-                          ASTContext *TheContext,
-                          size_t FromIdx);
+                          ASTContext *TheContext, size_t FromIdx);
 };
 
 #endif
--- a/build/clang-plugin/MustUseChecker.cpp
+++ b/build/clang-plugin/MustUseChecker.cpp
@@ -4,33 +4,33 @@
 
 #include "MustUseChecker.h"
 #include "CustomMatchers.h"
 #include "CustomTypeAnnotation.h"
 
 CustomTypeAnnotation MustUse =
     CustomTypeAnnotation("moz_must_use_type", "must-use");
 
-void MustUseChecker::registerMatchers(MatchFinder* AstMatcher) {
+void MustUseChecker::registerMatchers(MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(switchCase().bind("switchcase"), this);
   AstMatcher->addMatcher(compoundStmt().bind("compound"), this);
   AstMatcher->addMatcher(ifStmt().bind("if"), this);
   AstMatcher->addMatcher(whileStmt().bind("while"), this);
   AstMatcher->addMatcher(doStmt().bind("do"), this);
   AstMatcher->addMatcher(forStmt().bind("for"), this);
-  AstMatcher->addMatcher(binaryOperator(binaryCommaOperator()).bind("bin"), this);
+  AstMatcher->addMatcher(binaryOperator(binaryCommaOperator()).bind("bin"),
+                         this);
 }
 
-void MustUseChecker::check(
-    const MatchFinder::MatchResult &Result) {
+void MustUseChecker::check(const MatchFinder::MatchResult &Result) {
   if (auto SC = Result.Nodes.getNodeAs<SwitchCase>("switchcase")) {
     handleUnusedExprResult(SC->getSubStmt());
   }
   if (auto C = Result.Nodes.getNodeAs<CompoundStmt>("compound")) {
-    for (const auto& S : C->body()) {
+    for (const auto &S : C->body()) {
       handleUnusedExprResult(S);
     }
   }
   if (auto IF = Result.Nodes.getNodeAs<IfStmt>("if")) {
     handleUnusedExprResult(IF->getThen());
     handleUnusedExprResult(IF->getElse());
   }
   if (auto W = Result.Nodes.getNodeAs<WhileStmt>("while")) {
@@ -51,13 +51,14 @@ void MustUseChecker::check(
 
 void MustUseChecker::handleUnusedExprResult(const Stmt *Statement) {
   const Expr *E = dyn_cast_or_null<Expr>(Statement);
   if (E) {
     E = E->IgnoreImplicit(); // Ignore ExprWithCleanup etc. implicit wrappers
     QualType T = E->getType();
     if (MustUse.hasEffectiveAnnotation(T) && !isIgnoredExprForMustUse(E)) {
       diag(E->getLocStart(), "Unused value of must-use type %0",
-           DiagnosticIDs::Error) << T;
+           DiagnosticIDs::Error)
+          << T;
       MustUse.dumpAnnotationReason(*this, T, E->getLocStart());
     }
   }
 }
--- a/build/clang-plugin/MustUseChecker.h
+++ b/build/clang-plugin/MustUseChecker.h
@@ -4,19 +4,18 @@
 
 #ifndef MustUseChecker_h__
 #define MustUseChecker_h__
 
 #include "plugin.h"
 
 class MustUseChecker : public BaseCheck {
 public:
-  MustUseChecker(StringRef CheckName,
-                 ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+  MustUseChecker(StringRef CheckName, ContextType *Context = nullptr)
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 
 private:
   void handleUnusedExprResult(const Stmt *Statement);
 };
 
 #endif
--- a/build/clang-plugin/NaNExprChecker.cpp
+++ b/build/clang-plugin/NaNExprChecker.cpp
@@ -1,56 +1,56 @@
 /* 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 "NaNExprChecker.h"
 #include "CustomMatchers.h"
 
-void NaNExprChecker::registerMatchers(MatchFinder* AstMatcher) {
+void NaNExprChecker::registerMatchers(MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(
       binaryOperator(
           allOf(binaryEqualityOperator(),
                 hasLHS(hasIgnoringParenImpCasts(
                     declRefExpr(hasType(qualType((isFloat())))).bind("lhs"))),
                 hasRHS(hasIgnoringParenImpCasts(
                     declRefExpr(hasType(qualType((isFloat())))).bind("rhs"))),
                 unless(anyOf(isInSystemHeader(), isInWhitelistForNaNExpr()))))
           .bind("node"),
       this);
 }
 
-void NaNExprChecker::check(
-    const MatchFinder::MatchResult &Result) {
+void NaNExprChecker::check(const MatchFinder::MatchResult &Result) {
   if (!Result.Context->getLangOpts().CPlusPlus) {
     // mozilla::IsNaN is not usable in C, so there is no point in issuing these
     // warnings.
     return;
   }
 
-  const BinaryOperator *Expression = Result.Nodes.getNodeAs<BinaryOperator>(
-    "node");
+  const BinaryOperator *Expression =
+      Result.Nodes.getNodeAs<BinaryOperator>("node");
   const DeclRefExpr *LHS = Result.Nodes.getNodeAs<DeclRefExpr>("lhs");
   const DeclRefExpr *RHS = Result.Nodes.getNodeAs<DeclRefExpr>("rhs");
-  const ImplicitCastExpr *LHSExpr = dyn_cast<ImplicitCastExpr>(
-    Expression->getLHS());
-  const ImplicitCastExpr *RHSExpr = dyn_cast<ImplicitCastExpr>(
-    Expression->getRHS());
+  const ImplicitCastExpr *LHSExpr =
+      dyn_cast<ImplicitCastExpr>(Expression->getLHS());
+  const ImplicitCastExpr *RHSExpr =
+      dyn_cast<ImplicitCastExpr>(Expression->getRHS());
   // The AST subtree that we are looking for will look like this:
   // -BinaryOperator ==/!=
   //  |-ImplicitCastExpr LValueToRValue
   //  | |-DeclRefExpr
   //  |-ImplicitCastExpr LValueToRValue
   //    |-DeclRefExpr
   // The check below ensures that we are dealing with the correct AST subtree
   // shape, and
   // also that both of the found DeclRefExpr's point to the same declaration.
   if (LHS->getFoundDecl() == RHS->getFoundDecl() && LHSExpr && RHSExpr &&
       std::distance(LHSExpr->child_begin(), LHSExpr->child_end()) == 1 &&
       std::distance(RHSExpr->child_begin(), RHSExpr->child_end()) == 1 &&
       *LHSExpr->child_begin() == LHS && *RHSExpr->child_begin() == RHS) {
-    diag(Expression->getLocStart(), "comparing a floating point value to itself for "
-                                    "NaN checking can lead to incorrect results",
+    diag(Expression->getLocStart(),
+         "comparing a floating point value to itself for "
+         "NaN checking can lead to incorrect results",
          DiagnosticIDs::Error);
     diag(Expression->getLocStart(), "consider using mozilla::IsNaN instead",
          DiagnosticIDs::Note);
   }
 }
--- a/build/clang-plugin/NaNExprChecker.h
+++ b/build/clang-plugin/NaNExprChecker.h
@@ -4,16 +4,15 @@
 
 #ifndef NaNExprChecker_h__
 #define NaNExprChecker_h__
 
 #include "plugin.h"
 
 class NaNExprChecker : public BaseCheck {
 public:
-  NaNExprChecker(StringRef CheckName,
-                 ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+  NaNExprChecker(StringRef CheckName, ContextType *Context = nullptr)
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/NeedsNoVTableTypeChecker.cpp
+++ b/build/clang-plugin/NeedsNoVTableTypeChecker.cpp
@@ -1,40 +1,39 @@
 /* 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 "NeedsNoVTableTypeChecker.h"
 #include "CustomMatchers.h"
 
-void NeedsNoVTableTypeChecker::registerMatchers(MatchFinder* AstMatcher) {
+void NeedsNoVTableTypeChecker::registerMatchers(MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(
       classTemplateSpecializationDecl(
           allOf(hasAnyTemplateArgument(refersToType(hasVTable())),
                 hasNeedsNoVTableTypeAttr()))
           .bind("node"),
       this);
 }
 
-void NeedsNoVTableTypeChecker::check(
-    const MatchFinder::MatchResult &Result) {
+void NeedsNoVTableTypeChecker::check(const MatchFinder::MatchResult &Result) {
   const ClassTemplateSpecializationDecl *Specialization =
       Result.Nodes.getNodeAs<ClassTemplateSpecializationDecl>("node");
 
   // Get the offending template argument
   QualType Offender;
   const TemplateArgumentList &Args =
       Specialization->getTemplateInstantiationArgs();
   for (unsigned i = 0; i < Args.size(); ++i) {
     Offender = Args[i].getAsType();
     if (typeHasVTable(Offender)) {
       break;
     }
   }
 
   diag(Specialization->getLocStart(),
        "%0 cannot be instantiated because %1 has a VTable",
-       DiagnosticIDs::Error) << Specialization
-                             << Offender;
+       DiagnosticIDs::Error)
+      << Specialization << Offender;
   diag(Specialization->getPointOfInstantiation(),
-       "bad instantiation of %0 requested here",
-       DiagnosticIDs::Note)  << Specialization;
+       "bad instantiation of %0 requested here", DiagnosticIDs::Note)
+      << Specialization;
 }
--- a/build/clang-plugin/NeedsNoVTableTypeChecker.h
+++ b/build/clang-plugin/NeedsNoVTableTypeChecker.h
@@ -4,16 +4,15 @@
 
 #ifndef NeedsNoVTableTypeChecker_h__
 #define NeedsNoVTableTypeChecker_h__
 
 #include "plugin.h"
 
 class NeedsNoVTableTypeChecker : public BaseCheck {
 public:
-  NeedsNoVTableTypeChecker(StringRef CheckName,
-                           ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+  NeedsNoVTableTypeChecker(StringRef CheckName, ContextType *Context = nullptr)
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/NoAddRefReleaseOnReturnChecker.cpp
+++ b/build/clang-plugin/NoAddRefReleaseOnReturnChecker.cpp
@@ -1,32 +1,32 @@
 /* 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 "NoAddRefReleaseOnReturnChecker.h"
 #include "CustomMatchers.h"
 
-void NoAddRefReleaseOnReturnChecker::registerMatchers(MatchFinder* AstMatcher) {
+void NoAddRefReleaseOnReturnChecker::registerMatchers(MatchFinder *AstMatcher) {
   // Look for all of the calls to AddRef() or Release()
-  AstMatcher->addMatcher(memberExpr(isAddRefOrRelease(), hasParent(callExpr())).bind("member"),
-                         this);
+  AstMatcher->addMatcher(
+      memberExpr(isAddRefOrRelease(), hasParent(callExpr())).bind("member"),
+      this);
 }
 
 void NoAddRefReleaseOnReturnChecker::check(
     const MatchFinder::MatchResult &Result) {
   const MemberExpr *Member = Result.Nodes.getNodeAs<MemberExpr>("member");
   const Expr *Base = IgnoreTrivials(Member->getBase());
 
   // Check if the call to AddRef() or Release() was made on the result of a call
   // to a MOZ_NO_ADDREF_RELEASE_ON_RETURN function or method.
   if (auto *Call = dyn_cast<CallExpr>(Base)) {
     if (auto *Callee = Call->getDirectCallee()) {
       if (hasCustomAnnotation(Callee, "moz_no_addref_release_on_return")) {
         diag(Call->getLocStart(),
              "%1 cannot be called on the return value of %0",
              DiagnosticIDs::Error)
-          << Callee
-          << dyn_cast<CXXMethodDecl>(Member->getMemberDecl());
+            << Callee << dyn_cast<CXXMethodDecl>(Member->getMemberDecl());
       }
     }
   }
 }
--- a/build/clang-plugin/NoAddRefReleaseOnReturnChecker.h
+++ b/build/clang-plugin/NoAddRefReleaseOnReturnChecker.h
@@ -6,14 +6,14 @@
 #define NoAddRefReleaseOnReturnChecker_h__
 
 #include "plugin.h"
 
 class NoAddRefReleaseOnReturnChecker : public BaseCheck {
 public:
   NoAddRefReleaseOnReturnChecker(StringRef CheckName,
                                  ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/NoAutoTypeChecker.cpp
+++ b/build/clang-plugin/NoAutoTypeChecker.cpp
@@ -1,23 +1,21 @@
 /* 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 "NoAutoTypeChecker.h"
 #include "CustomMatchers.h"
 
-void NoAutoTypeChecker::registerMatchers(MatchFinder* AstMatcher) {
+void NoAutoTypeChecker::registerMatchers(MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(varDecl(hasType(autoNonAutoableType())).bind("node"),
                          this);
 }
 
-void NoAutoTypeChecker::check(
-    const MatchFinder::MatchResult &Result) {
+void NoAutoTypeChecker::check(const MatchFinder::MatchResult &Result) {
   const VarDecl *D = Result.Nodes.getNodeAs<VarDecl>("node");
 
-  diag(D->getLocation(),
-       "Cannot use auto to declare a variable of type %0",
-       DiagnosticIDs::Error) << D->getType();
-  diag(D->getLocation(),
-       "Please write out this type explicitly",
+  diag(D->getLocation(), "Cannot use auto to declare a variable of type %0",
+       DiagnosticIDs::Error)
+      << D->getType();
+  diag(D->getLocation(), "Please write out this type explicitly",
        DiagnosticIDs::Note);
 }
--- a/build/clang-plugin/NoAutoTypeChecker.h
+++ b/build/clang-plugin/NoAutoTypeChecker.h
@@ -4,16 +4,15 @@
 
 #ifndef NoAutoTypeChecker_h__
 #define NoAutoTypeChecker_h__
 
 #include "plugin.h"
 
 class NoAutoTypeChecker : public BaseCheck {
 public:
-  NoAutoTypeChecker(StringRef CheckName,
-                    ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+  NoAutoTypeChecker(StringRef CheckName, ContextType *Context = nullptr)
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/NoDuplicateRefCntMemberChecker.cpp
+++ b/build/clang-plugin/NoDuplicateRefCntMemberChecker.cpp
@@ -1,16 +1,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 "NoDuplicateRefCntMemberChecker.h"
 #include "CustomMatchers.h"
 
-void NoDuplicateRefCntMemberChecker::registerMatchers(MatchFinder* AstMatcher) {
+void NoDuplicateRefCntMemberChecker::registerMatchers(MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(cxxRecordDecl().bind("decl"), this);
 }
 
 void NoDuplicateRefCntMemberChecker::check(
     const MatchFinder::MatchResult &Result) {
   const CXXRecordDecl *D = Result.Nodes.getNodeAs<CXXRecordDecl>("decl");
   const FieldDecl *RefCntMember = getClassRefCntMember(D);
   const FieldDecl *FoundRefCntBase = nullptr;
@@ -29,40 +29,37 @@ void NoDuplicateRefCntMemberChecker::che
   // warn for those which do
   for (auto &Base : D->bases()) {
     // Determine if this base class has an mRefCnt member
     const FieldDecl *BaseRefCntMember = getBaseRefCntMember(Base.getType());
 
     if (BaseRefCntMember) {
       if (RefCntMember) {
         // We have an mRefCnt, and superclass has an mRefCnt
-        const char* Error =
-            "Refcounted record %0 has multiple mRefCnt members";
-        const char* Note1 =
-            "Superclass %0 also has an mRefCnt member";
-        const char* Note2 =
+        const char *Error = "Refcounted record %0 has multiple mRefCnt members";
+        const char *Note1 = "Superclass %0 also has an mRefCnt member";
+        const char *Note2 =
             "Consider using the _INHERITED macros for AddRef and Release here";
 
         diag(D->getLocStart(), Error, DiagnosticIDs::Error) << D;
         diag(BaseRefCntMember->getLocStart(), Note1, DiagnosticIDs::Note)
-          << BaseRefCntMember->getParent();
+            << BaseRefCntMember->getParent();
         diag(RefCntMember->getLocStart(), Note2, DiagnosticIDs::Note);
       }
 
       if (FoundRefCntBase) {
-        const char* Error =
-            "Refcounted record %0 has multiple superclasses with mRefCnt members";
-        const char* Note =
-            "Superclass %0 has an mRefCnt member";
+        const char *Error = "Refcounted record %0 has multiple superclasses "
+                            "with mRefCnt members";
+        const char *Note = "Superclass %0 has an mRefCnt member";
 
         // superclass has mRefCnt, and another superclass also has an mRefCnt
         diag(D->getLocStart(), Error, DiagnosticIDs::Error) << D;
         diag(BaseRefCntMember->getLocStart(), Note, DiagnosticIDs::Note)
-          << BaseRefCntMember->getParent();
+            << BaseRefCntMember->getParent();
         diag(FoundRefCntBase->getLocStart(), Note, DiagnosticIDs::Note)
-          << FoundRefCntBase->getParent();
+            << FoundRefCntBase->getParent();
       }
 
       // Record that we've found a base with a mRefCnt member
       FoundRefCntBase = BaseRefCntMember;
     }
   }
 }
--- a/build/clang-plugin/NoDuplicateRefCntMemberChecker.h
+++ b/build/clang-plugin/NoDuplicateRefCntMemberChecker.h
@@ -6,14 +6,14 @@
 #define NoDuplicateRefCntMemberChecker_h__
 
 #include "plugin.h"
 
 class NoDuplicateRefCntMemberChecker : public BaseCheck {
 public:
   NoDuplicateRefCntMemberChecker(StringRef CheckName,
                                  ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/NoExplicitMoveConstructorChecker.cpp
+++ b/build/clang-plugin/NoExplicitMoveConstructorChecker.cpp
@@ -1,19 +1,19 @@
 /* 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 "NoExplicitMoveConstructorChecker.h"
 #include "CustomMatchers.h"
 
-void NoExplicitMoveConstructorChecker::registerMatchers(MatchFinder* AstMatcher) {
+void NoExplicitMoveConstructorChecker::registerMatchers(
+    MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(
-      cxxConstructorDecl(isExplicitMoveConstructor()).bind("node"),
-      this);
+      cxxConstructorDecl(isExplicitMoveConstructor()).bind("node"), this);
 }
 
 void NoExplicitMoveConstructorChecker::check(
     const MatchFinder::MatchResult &Result) {
   // Everything we needed to know was checked in the matcher - we just report
   // the error here
   const CXXConstructorDecl *D =
       Result.Nodes.getNodeAs<CXXConstructorDecl>("node");
--- a/build/clang-plugin/NoExplicitMoveConstructorChecker.h
+++ b/build/clang-plugin/NoExplicitMoveConstructorChecker.h
@@ -6,14 +6,14 @@
 #define NoExplicitMoveConstructorChecker_h__
 
 #include "plugin.h"
 
 class NoExplicitMoveConstructorChecker : public BaseCheck {
 public:
   NoExplicitMoveConstructorChecker(StringRef CheckName,
                                    ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/NonMemMovableMemberChecker.cpp
+++ b/build/clang-plugin/NonMemMovableMemberChecker.cpp
@@ -2,37 +2,33 @@
  * 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 "NonMemMovableMemberChecker.h"
 #include "CustomMatchers.h"
 
 MemMoveAnnotation NonMemMovable = MemMoveAnnotation();
 
-void NonMemMovableMemberChecker::registerMatchers(MatchFinder* AstMatcher) {
+void NonMemMovableMemberChecker::registerMatchers(MatchFinder *AstMatcher) {
   // Handle non-mem-movable members
-  AstMatcher->addMatcher(
-      cxxRecordDecl(needsMemMovableMembers())
-          .bind("decl"),
-      this);
+  AstMatcher->addMatcher(cxxRecordDecl(needsMemMovableMembers()).bind("decl"),
+                         this);
 }
 
-void NonMemMovableMemberChecker::check(
-    const MatchFinder::MatchResult &Result) {
-  const char* Error =
+void NonMemMovableMemberChecker::check(const MatchFinder::MatchResult &Result) {
+  const char *Error =
       "class %0 cannot have non-memmovable member %1 of type %2";
 
   // Get the specialization
-  const CXXRecordDecl* Declaration =
+  const CXXRecordDecl *Declaration =
       Result.Nodes.getNodeAs<CXXRecordDecl>("decl");
 
   // Report an error for every member which is non-memmovable
   for (const FieldDecl *Field : Declaration->fields()) {
     QualType Type = Field->getType();
     if (NonMemMovable.hasEffectiveAnnotation(Type)) {
       diag(Field->getLocation(), Error, DiagnosticIDs::Error)
-        << Declaration
-        << Field
-        << Type;
-      NonMemMovable.dumpAnnotationReason(*this, Type, Declaration->getLocation());
+          << Declaration << Field << Type;
+      NonMemMovable.dumpAnnotationReason(*this, Type,
+                                         Declaration->getLocation());
     }
   }
 }
--- a/build/clang-plugin/NonMemMovableMemberChecker.h
+++ b/build/clang-plugin/NonMemMovableMemberChecker.h
@@ -6,14 +6,14 @@
 #define NonMemMovableMemberChecker_h__
 
 #include "plugin.h"
 
 class NonMemMovableMemberChecker : public BaseCheck {
 public:
   NonMemMovableMemberChecker(StringRef CheckName,
                              ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/NonMemMovableTemplateArgChecker.cpp
+++ b/build/clang-plugin/NonMemMovableTemplateArgChecker.cpp
@@ -1,46 +1,45 @@
 /* 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 "NonMemMovableTemplateArgChecker.h"
 #include "CustomMatchers.h"
 
-void NonMemMovableTemplateArgChecker::registerMatchers(MatchFinder* AstMatcher) {
+void NonMemMovableTemplateArgChecker::registerMatchers(
+    MatchFinder *AstMatcher) {
   // Handle non-mem-movable template specializations
   AstMatcher->addMatcher(
       classTemplateSpecializationDecl(
           allOf(needsMemMovableTemplateArg(),
                 hasAnyTemplateArgument(refersToType(isNonMemMovable()))))
           .bind("specialization"),
       this);
 }
 
 void NonMemMovableTemplateArgChecker::check(
     const MatchFinder::MatchResult &Result) {
-  const char* Error =
+  const char *Error =
       "Cannot instantiate %0 with non-memmovable template argument %1";
-  const char* Note =
-      "instantiation of %0 requested here";
+  const char *Note = "instantiation of %0 requested here";
 
   // Get the specialization
   const ClassTemplateSpecializationDecl *Specialization =
       Result.Nodes.getNodeAs<ClassTemplateSpecializationDecl>("specialization");
   SourceLocation RequestLoc = Specialization->getPointOfInstantiation();
 
   // Report an error for every template argument which is non-memmovable
   const TemplateArgumentList &Args =
       Specialization->getTemplateInstantiationArgs();
   for (unsigned i = 0; i < Args.size(); ++i) {
     QualType ArgType = Args[i].getAsType();
     if (NonMemMovable.hasEffectiveAnnotation(ArgType)) {
-      diag(Specialization->getLocation(), Error,
-           DiagnosticIDs::Error) << Specialization
-                                 << ArgType;
+      diag(Specialization->getLocation(), Error, DiagnosticIDs::Error)
+          << Specialization << ArgType;
       // XXX It would be really nice if we could get the instantiation stack
       // information
       // from Sema such that we could print a full template instantiation stack,
       // however,
       // it seems as though that information is thrown out by the time we get
       // here so we
       // can only report one level of template specialization (which in many
       // cases won't
--- a/build/clang-plugin/NonMemMovableTemplateArgChecker.h
+++ b/build/clang-plugin/NonMemMovableTemplateArgChecker.h
@@ -6,14 +6,14 @@
 #define NonMemMovableTemplateArgChecker_h__
 
 #include "plugin.h"
 
 class NonMemMovableTemplateArgChecker : public BaseCheck {
 public:
   NonMemMovableTemplateArgChecker(StringRef CheckName,
                                   ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/NonParamInsideFunctionDeclChecker.cpp
+++ b/build/clang-plugin/NonParamInsideFunctionDeclChecker.cpp
@@ -1,19 +1,18 @@
 /* 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 "NonParamInsideFunctionDeclChecker.h"
 #include "CustomMatchers.h"
 
-class NonParamAnnotation : public CustomTypeAnnotation
-{
+class NonParamAnnotation : public CustomTypeAnnotation {
 public:
-  NonParamAnnotation() : CustomTypeAnnotation("moz_non_param", "non-param") {};
+  NonParamAnnotation() : CustomTypeAnnotation("moz_non_param", "non-param"){};
 
 protected:
   // Adding alignas(_) on a struct implicitly marks it as MOZ_NON_PARAM, due to
   // MSVC limitations which prevent passing explcitly aligned types by value as
   // parameters. This overload of hasFakeAnnotation injects fake MOZ_NON_PARAM
   // annotations onto these types.
   std::string getImplicitReason(const TagDecl *D) const override {
     // Check if the decl itself has an AlignedAttr on it.
@@ -23,45 +22,47 @@ protected:
       }
     }
 
     // Check if any of the decl's fields have an AlignedAttr on them.
     if (auto RD = dyn_cast<RecordDecl>(D)) {
       for (auto F : RD->fields()) {
         for (auto A : F->attrs()) {
           if (isa<AlignedAttr>(A)) {
-            return ("member '" + F->getName() + "' has an alignas(_) annotation").str();
+            return ("member '" + F->getName() +
+                    "' has an alignas(_) annotation")
+                .str();
           }
         }
       }
     }
 
     // We don't need to check the types of fields, as the CustomTypeAnnotation
     // infrastructure will handle that for us.
     return "";
   }
 };
 NonParamAnnotation NonParam;
 
-void NonParamInsideFunctionDeclChecker::registerMatchers(MatchFinder* AstMatcher) {
+void NonParamInsideFunctionDeclChecker::registerMatchers(
+    MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(
-      functionDecl(anyOf(allOf(isDefinition(),
-                               hasAncestor(classTemplateSpecializationDecl()
-                                               .bind("spec"))),
-                         isDefinition()))
+      functionDecl(
+          anyOf(allOf(isDefinition(),
+                      hasAncestor(
+                          classTemplateSpecializationDecl().bind("spec"))),
+                isDefinition()))
           .bind("func"),
       this);
-  AstMatcher->addMatcher(
-      lambdaExpr().bind("lambda"),
-      this);
+  AstMatcher->addMatcher(lambdaExpr().bind("lambda"), this);
 }
 
 void NonParamInsideFunctionDeclChecker::check(
     const MatchFinder::MatchResult &Result) {
-  static DenseSet<const FunctionDecl*> CheckedFunctionDecls;
+  static DenseSet<const FunctionDecl *> CheckedFunctionDecls;
 
   const FunctionDecl *func = Result.Nodes.getNodeAs<FunctionDecl>("func");
   if (!func) {
     const LambdaExpr *lambda = Result.Nodes.getNodeAs<LambdaExpr>("lambda");
     if (lambda) {
       func = lambda->getCallOperator();
     }
   }
@@ -93,23 +94,24 @@ void NonParamInsideFunctionDeclChecker::
 
   const ClassTemplateSpecializationDecl *Spec =
       Result.Nodes.getNodeAs<ClassTemplateSpecializationDecl>("spec");
 
   for (ParmVarDecl *p : func->parameters()) {
     QualType T = p->getType().withoutLocalFastQualifiers();
     if (NonParam.hasEffectiveAnnotation(T)) {
       diag(p->getLocation(), "Type %0 must not be used as parameter",
-           DiagnosticIDs::Error) << T;
-      diag(p->getLocation(), "Please consider passing a const reference instead",
+           DiagnosticIDs::Error)
+          << T;
+      diag(p->getLocation(),
+           "Please consider passing a const reference instead",
            DiagnosticIDs::Note);
 
       if (Spec) {
         diag(Spec->getPointOfInstantiation(),
-             "The bad argument was passed to %0 here",
-             DiagnosticIDs::Note)
-          << Spec->getSpecializedTemplate();
+             "The bad argument was passed to %0 here", DiagnosticIDs::Note)
+            << Spec->getSpecializedTemplate();
       }
 
       NonParam.dumpAnnotationReason(*this, T, p->getLocation());
     }
   }
 }
--- a/build/clang-plugin/NonParamInsideFunctionDeclChecker.h
+++ b/build/clang-plugin/NonParamInsideFunctionDeclChecker.h
@@ -6,14 +6,14 @@
 #define NonParamInsideFunctionDeclChecker_h__
 
 #include "plugin.h"
 
 class NonParamInsideFunctionDeclChecker : public BaseCheck {
 public:
   NonParamInsideFunctionDeclChecker(StringRef CheckName,
                                     ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/OverrideBaseCallChecker.cpp
+++ b/build/clang-plugin/OverrideBaseCallChecker.cpp
@@ -1,95 +1,93 @@
 /* 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 "OverrideBaseCallChecker.h"
 #include "CustomMatchers.h"
 
-void OverrideBaseCallChecker::registerMatchers(MatchFinder* AstMatcher) {
-  AstMatcher->addMatcher(cxxRecordDecl(hasBaseClasses()).bind("class"),
-      this);
+void OverrideBaseCallChecker::registerMatchers(MatchFinder *AstMatcher) {
+  AstMatcher->addMatcher(cxxRecordDecl(hasBaseClasses()).bind("class"), this);
 }
 
 bool OverrideBaseCallChecker::isRequiredBaseMethod(
     const CXXMethodDecl *Method) {
   return hasCustomAnnotation(Method, "moz_required_base_method");
 }
 
 void OverrideBaseCallChecker::evaluateExpression(
-    const Stmt *StmtExpr, std::list<const CXXMethodDecl*> &MethodList) {
+    const Stmt *StmtExpr, std::list<const CXXMethodDecl *> &MethodList) {
   // Continue while we have methods in our list
   if (!MethodList.size()) {
     return;
   }
 
   if (auto MemberFuncCall = dyn_cast<CXXMemberCallExpr>(StmtExpr)) {
-    if (auto Method = dyn_cast<CXXMethodDecl>(
-        MemberFuncCall->getDirectCallee())) {
+    if (auto Method =
+            dyn_cast<CXXMethodDecl>(MemberFuncCall->getDirectCallee())) {
       findBaseMethodCall(Method, MethodList);
     }
   }
 
   for (auto S : StmtExpr->children()) {
     if (S) {
       evaluateExpression(S, MethodList);
     }
   }
 }
 
 void OverrideBaseCallChecker::getRequiredBaseMethod(
     const CXXMethodDecl *Method,
-    std::list<const CXXMethodDecl*>& MethodsList) {
+    std::list<const CXXMethodDecl *> &MethodsList) {
 
   if (isRequiredBaseMethod(Method)) {
     MethodsList.push_back(Method);
   } else {
     // Loop through all it's base methods.
     for (auto BaseMethod = Method->begin_overridden_methods();
-        BaseMethod != Method->end_overridden_methods(); BaseMethod++) {
+         BaseMethod != Method->end_overridden_methods(); BaseMethod++) {
       getRequiredBaseMethod(*BaseMethod, MethodsList);
     }
   }
 }
 
 void OverrideBaseCallChecker::findBaseMethodCall(
-    const CXXMethodDecl* Method,
-    std::list<const CXXMethodDecl*>& MethodsList) {
+    const CXXMethodDecl *Method,
+    std::list<const CXXMethodDecl *> &MethodsList) {
 
   MethodsList.remove(Method);
   // Loop also through all it's base methods;
   for (auto BaseMethod = Method->begin_overridden_methods();
-      BaseMethod != Method->end_overridden_methods(); BaseMethod++) {
+       BaseMethod != Method->end_overridden_methods(); BaseMethod++) {
     findBaseMethodCall(*BaseMethod, MethodsList);
   }
 }
 
-void OverrideBaseCallChecker::check(
-    const MatchFinder::MatchResult &Result) {
-  const char* Error =
+void OverrideBaseCallChecker::check(const MatchFinder::MatchResult &Result) {
+  const char *Error =
       "Method %0 must be called in all overrides, but is not called in "
       "this override defined for class %1";
   const CXXRecordDecl *Decl = Result.Nodes.getNodeAs<CXXRecordDecl>("class");
 
   // Loop through the methods and look for the ones that are overridden.
   for (auto Method : Decl->methods()) {
     // If this method doesn't override other methods or it doesn't have a body,
     // continue to the next declaration.
     if (!Method->size_overridden_methods() || !Method->hasBody()) {
       continue;
     }
 
     // Preferred the usage of list instead of vector in order to avoid
     // calling erase-remove when deleting items
-    std::list<const CXXMethodDecl*> MethodsList;
+    std::list<const CXXMethodDecl *> MethodsList;
     // For each overridden method push it to a list if it meets our
     // criteria
     for (auto BaseMethod = Method->begin_overridden_methods();
-        BaseMethod != Method->end_overridden_methods(); BaseMethod++) {
+         BaseMethod != Method->end_overridden_methods(); BaseMethod++) {
       getRequiredBaseMethod(*BaseMethod, MethodsList);
     }
 
     // If no method has been found then no annotation was used
     // so checking is not needed
     if (!MethodsList.size()) {
       continue;
     }
@@ -100,13 +98,12 @@ void OverrideBaseCallChecker::check(
 
     // If list is not empty pop up errors
     for (auto BaseMethod : MethodsList) {
       std::string QualName;
       raw_string_ostream OS(QualName);
       BaseMethod->printQualifiedName(OS);
 
       diag(Method->getLocation(), Error, DiagnosticIDs::Error)
-          << OS.str()
-          << Decl->getName();
+          << OS.str() << Decl->getName();
     }
   }
 }
--- a/build/clang-plugin/OverrideBaseCallChecker.h
+++ b/build/clang-plugin/OverrideBaseCallChecker.h
@@ -4,24 +4,24 @@
 
 #ifndef OverrideBaseCallChecker_h__
 #define OverrideBaseCallChecker_h__
 
 #include "plugin.h"
 
 class OverrideBaseCallChecker : public BaseCheck {
 public:
-  OverrideBaseCallChecker(StringRef CheckName,
-                          ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+  OverrideBaseCallChecker(StringRef CheckName, ContextType *Context = nullptr)
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
+
 private:
   void evaluateExpression(const Stmt *StmtExpr,
-      std::list<const CXXMethodDecl*> &MethodList);
-  void getRequiredBaseMethod(const CXXMethodDecl* Method,
-      std::list<const CXXMethodDecl*>& MethodsList);
-  void findBaseMethodCall(const CXXMethodDecl* Method,
-      std::list<const CXXMethodDecl*>& MethodsList);
+                          std::list<const CXXMethodDecl *> &MethodList);
+  void getRequiredBaseMethod(const CXXMethodDecl *Method,
+                             std::list<const CXXMethodDecl *> &MethodsList);
+  void findBaseMethodCall(const CXXMethodDecl *Method,
+                          std::list<const CXXMethodDecl *> &MethodsList);
   bool isRequiredBaseMethod(const CXXMethodDecl *Method);
 };
 
 #endif
--- a/build/clang-plugin/OverrideBaseCallUsageChecker.cpp
+++ b/build/clang-plugin/OverrideBaseCallUsageChecker.cpp
@@ -1,21 +1,21 @@
 /* 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 "OverrideBaseCallUsageChecker.h"
 #include "CustomMatchers.h"
 
-void OverrideBaseCallUsageChecker::registerMatchers(MatchFinder* AstMatcher) {
+void OverrideBaseCallUsageChecker::registerMatchers(MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(
       cxxMethodDecl(isNonVirtual(), isRequiredBaseMethod()).bind("method"),
       this);
 }
 
 void OverrideBaseCallUsageChecker::check(
     const MatchFinder::MatchResult &Result) {
-  const char* Error =
+  const char *Error =
       "MOZ_REQUIRED_BASE_METHOD can be used only on virtual methods";
   const CXXMethodDecl *Method = Result.Nodes.getNodeAs<CXXMethodDecl>("method");
 
   diag(Method->getLocation(), Error, DiagnosticIDs::Error);
 }
--- a/build/clang-plugin/OverrideBaseCallUsageChecker.h
+++ b/build/clang-plugin/OverrideBaseCallUsageChecker.h
@@ -10,14 +10,14 @@
 /*
  *  This is a companion checker for OverrideBaseCallChecker that rejects
  *  the usage of MOZ_REQUIRED_BASE_METHOD on non-virtual base methods.
  */
 class OverrideBaseCallUsageChecker : public BaseCheck {
 public:
   OverrideBaseCallUsageChecker(StringRef CheckName = "override-base-call-usage",
                                ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/RecurseGuard.h
+++ b/build/clang-plugin/RecurseGuard.h
@@ -12,52 +12,45 @@
 //
 // Constructing a RecurseGuard sets up a shared backing store which tracks the
 // currently observed objects. Whenever recursing, use RecurseGuard.recurse(T)
 // to construct another RecurseGuard with the same backing store.
 //
 // The RecurseGuard object will unregister its object when it is destroyed, and
 // has a method `isRepeat()` which will return `true` if the item was already
 // seen.
-template<typename T>
-class RecurseGuard {
+template <typename T> class RecurseGuard {
 public:
   RecurseGuard(T Thing) : Thing(Thing), Set(new DenseSet<T>()), Repeat(false) {
     Set->insert(Thing);
   }
-  RecurseGuard(T Thing, std::shared_ptr<DenseSet<T>>& Set)
-    : Thing(Thing), Set(Set), Repeat(false) {
+  RecurseGuard(T Thing, std::shared_ptr<DenseSet<T>> &Set)
+      : Thing(Thing), Set(Set), Repeat(false) {
     Repeat = !Set->insert(Thing).second;
   }
   RecurseGuard(const RecurseGuard &) = delete;
-  RecurseGuard(RecurseGuard && Other)
-    : Thing(Other.Thing), Set(Other.Set), Repeat(Other.Repeat) {
+  RecurseGuard(RecurseGuard &&Other)
+      : Thing(Other.Thing), Set(Other.Set), Repeat(Other.Repeat) {
     Other.Repeat = true;
   }
   ~RecurseGuard() {
     if (!Repeat) {
       Set->erase(Thing);
     }
   }
 
   bool isRepeat() { return Repeat; }
 
   T get() { return Thing; }
 
-  operator T() {
-    return Thing;
-  }
+  operator T() { return Thing; }
 
-  T operator ->() {
-    return Thing;
-  }
+  T operator->() { return Thing; }
 
-  RecurseGuard recurse(T NewThing) {
-    return RecurseGuard(NewThing, Set);
-  }
+  RecurseGuard recurse(T NewThing) { return RecurseGuard(NewThing, Set); }
 
 private:
   T Thing;
   std::shared_ptr<DenseSet<T>> Set;
   bool Repeat;
 };
 
 #endif // RecurseGuard_h__
--- a/build/clang-plugin/RefCountedCopyConstructorChecker.cpp
+++ b/build/clang-plugin/RefCountedCopyConstructorChecker.cpp
@@ -1,34 +1,34 @@
 /* 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 "RefCountedCopyConstructorChecker.h"
 #include "CustomMatchers.h"
 
-void RefCountedCopyConstructorChecker::registerMatchers(MatchFinder* AstMatcher) {
+void RefCountedCopyConstructorChecker::registerMatchers(
+    MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(
       cxxConstructExpr(
           hasDeclaration(cxxConstructorDecl(isCompilerProvidedCopyConstructor(),
                                             ofClass(hasRefCntMember()))))
           .bind("node"),
       this);
 }
 
 void RefCountedCopyConstructorChecker::check(
     const MatchFinder::MatchResult &Result) {
-  const char* Error =
+  const char *Error =
       "Invalid use of compiler-provided copy constructor on refcounted type";
-  const char* Note =
-      "The default copy constructor also copies the "
-      "default mRefCnt property, leading to reference "
-      "count imbalance issues. Please provide your own "
-      "copy constructor which only copies the fields which "
-      "need to be copied";
+  const char *Note = "The default copy constructor also copies the "
+                     "default mRefCnt property, leading to reference "
+                     "count imbalance issues. Please provide your own "
+                     "copy constructor which only copies the fields which "
+                     "need to be copied";
 
   // Everything we needed to know was checked in the matcher - we just report
   // the error here
   const CXXConstructExpr *E = Result.Nodes.getNodeAs<CXXConstructExpr>("node");
 
   diag(E->getLocation(), Error, DiagnosticIDs::Error);
   diag(E->getLocation(), Note, DiagnosticIDs::Note);
 }
--- a/build/clang-plugin/RefCountedCopyConstructorChecker.h
+++ b/build/clang-plugin/RefCountedCopyConstructorChecker.h
@@ -6,14 +6,14 @@
 #define RefCountedCopyConstructorChecker_h__
 
 #include "plugin.h"
 
 class RefCountedCopyConstructorChecker : public BaseCheck {
 public:
   RefCountedCopyConstructorChecker(StringRef CheckName,
                                    ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/RefCountedInsideLambdaChecker.cpp
+++ b/build/clang-plugin/RefCountedInsideLambdaChecker.cpp
@@ -2,54 +2,53 @@
  * 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 "RefCountedInsideLambdaChecker.h"
 #include "CustomMatchers.h"
 
 RefCountedMap RefCountedClasses;
 
-void RefCountedInsideLambdaChecker::registerMatchers(MatchFinder* AstMatcher) {
+void RefCountedInsideLambdaChecker::registerMatchers(MatchFinder *AstMatcher) {
   // We want to reject any code which captures a pointer to an object of a
   // refcounted type, and then lets that value escape. As a primitive analysis,
   // we reject any occurances of the lambda as a template parameter to a class
   // (which could allow it to escape), as well as any presence of such a lambda
   // in a return value (either from lambdas, or in c++14, auto functions).
   //
   // We check these lambdas' capture lists for raw pointers to refcounted types.
+  AstMatcher->addMatcher(functionDecl(returns(recordType(hasDeclaration(
+                             cxxRecordDecl(isLambdaDecl()).bind("decl"))))),
+                         this);
+  AstMatcher->addMatcher(lambdaExpr().bind("lambdaExpr"), this);
   AstMatcher->addMatcher(
-      functionDecl(returns(recordType(hasDeclaration(cxxRecordDecl(
-        isLambdaDecl()).bind("decl"))))),
-      this);
-  AstMatcher->addMatcher(lambdaExpr().bind("lambdaExpr"),
-      this);
-  AstMatcher->addMatcher(
-      classTemplateSpecializationDecl(hasAnyTemplateArgument(refersToType(
-        recordType(hasDeclaration(cxxRecordDecl(
-          isLambdaDecl()).bind("decl")))))),
+      classTemplateSpecializationDecl(
+          hasAnyTemplateArgument(refersToType(recordType(
+              hasDeclaration(cxxRecordDecl(isLambdaDecl()).bind("decl")))))),
       this);
 }
 
 void RefCountedInsideLambdaChecker::emitDiagnostics(SourceLocation Loc,
                                                     StringRef Name,
                                                     QualType Type) {
-  diag(Loc, "Refcounted variable '%0' of type %1 cannot be captured by a lambda",
-       DiagnosticIDs::Error) << Name << Type;
-  diag(Loc, "Please consider using a smart pointer",
-       DiagnosticIDs::Note);
+  diag(Loc,
+       "Refcounted variable '%0' of type %1 cannot be captured by a lambda",
+       DiagnosticIDs::Error)
+      << Name << Type;
+  diag(Loc, "Please consider using a smart pointer", DiagnosticIDs::Note);
 }
 
 void RefCountedInsideLambdaChecker::check(
     const MatchFinder::MatchResult &Result) {
-  static DenseSet<const CXXRecordDecl*> CheckedDecls;
+  static DenseSet<const CXXRecordDecl *> CheckedDecls;
 
   const CXXRecordDecl *Lambda = Result.Nodes.getNodeAs<CXXRecordDecl>("decl");
 
   if (const LambdaExpr *OuterLambda =
-    Result.Nodes.getNodeAs<LambdaExpr>("lambdaExpr")) {
+          Result.Nodes.getNodeAs<LambdaExpr>("lambdaExpr")) {
     const CXXMethodDecl *OpCall = OuterLambda->getCallOperator();
     QualType ReturnTy = OpCall->getReturnType();
     if (const CXXRecordDecl *Record = ReturnTy->getAsCXXRecordDecl()) {
       Lambda = Record;
     }
   }
 
   if (!Lambda || !Lambda->isLambda()) {
@@ -59,29 +58,30 @@ void RefCountedInsideLambdaChecker::chec
   // Don't report errors on the same declarations more than once.
   if (CheckedDecls.count(Lambda)) {
     return;
   }
   CheckedDecls.insert(Lambda);
 
   bool StrongRefToThisCaptured = false;
 
-  for (const LambdaCapture& Capture : Lambda->captures()) {
+  for (const LambdaCapture &Capture : Lambda->captures()) {
     // Check if any of the captures are ByRef. If they are, we have nothing to
-    // report, as it's OK to capture raw pointers to refcounted objects so long as
-    // the Lambda doesn't escape the current scope, which is required by ByRef
-    // captures already.
+    // report, as it's OK to capture raw pointers to refcounted objects so long
+    // as the Lambda doesn't escape the current scope, which is required by
+    // ByRef captures already.
     if (Capture.getCaptureKind() == LCK_ByRef) {
       return;
     }
 
-    // Check if this capture is byvalue, and captures a strong reference to this.
-    // XXX: Do we want to make sure that this type which we are capturing is a "Smart Pointer" somehow?
-    if (!StrongRefToThisCaptured &&
-        Capture.capturesVariable() &&
+    // Check if this capture is byvalue, and captures a strong reference to
+    // this.
+    // XXX: Do we want to make sure that this type which we are capturing is a
+    // "Smart Pointer" somehow?
+    if (!StrongRefToThisCaptured && Capture.capturesVariable() &&
         Capture.getCaptureKind() == LCK_ByCopy) {
       const VarDecl *Var = Capture.getCapturedVar();
       if (Var->hasInit()) {
         const Stmt *Init = Var->getInit();
 
         // Ignore single argument constructors, and trivial nodes.
         while (true) {
           auto NewInit = IgnoreTrivials(Init);
@@ -98,52 +98,55 @@ void RefCountedInsideLambdaChecker::chec
 
         if (isa<CXXThisExpr>(Init)) {
           StrongRefToThisCaptured = true;
         }
       }
     }
   }
 
-  // Now we can go through and produce errors for any captured variables or this pointers.
-  for (const LambdaCapture& Capture : Lambda->captures()) {
+  // Now we can go through and produce errors for any captured variables or this
+  // pointers.
+  for (const LambdaCapture &Capture : Lambda->captures()) {
     if (Capture.capturesVariable()) {
       QualType Pointee = Capture.getCapturedVar()->getType()->getPointeeType();
 
       if (!Pointee.isNull() && isClassRefCounted(Pointee)) {
-        emitDiagnostics(Capture.getLocation(), Capture.getCapturedVar()->getName(), Pointee);
+        emitDiagnostics(Capture.getLocation(),
+                        Capture.getCapturedVar()->getName(), Pointee);
         return;
       }
     }
 
     // The situation with captures of `this` is more complex. All captures of
     // `this` look the same-ish (they are LCK_This). We want to complain about
     // captures of `this` where `this` is a refcounted type, and the capture is
     // actually used in the body of the lambda (if the capture isn't used, then
     // we don't care, because it's only being captured in order to give access
     // to private methods).
     //
     // In addition, we don't complain about this, even if it is used, if it was
     // captured implicitly when the LambdaCaptureDefault was LCD_ByRef, as that
     // expresses the intent that the lambda won't leave the enclosing scope.
     bool ImplicitByRefDefaultedCapture =
-      Capture.isImplicit() && Lambda->getLambdaCaptureDefault() == LCD_ByRef;
-    if (Capture.capturesThis() &&
-        !ImplicitByRefDefaultedCapture &&
+        Capture.isImplicit() && Lambda->getLambdaCaptureDefault() == LCD_ByRef;
+    if (Capture.capturesThis() && !ImplicitByRefDefaultedCapture &&
         !StrongRefToThisCaptured) {
       ThisVisitor V(*this);
-      bool NotAborted = V.TraverseDecl(const_cast<CXXMethodDecl *>(Lambda->getLambdaCallOperator()));
+      bool NotAborted = V.TraverseDecl(
+          const_cast<CXXMethodDecl *>(Lambda->getLambdaCallOperator()));
       if (!NotAborted) {
         return;
       }
     }
   }
 }
 
-bool RefCountedInsideLambdaChecker::ThisVisitor::VisitCXXThisExpr(CXXThisExpr *This) {
+bool RefCountedInsideLambdaChecker::ThisVisitor::VisitCXXThisExpr(
+    CXXThisExpr *This) {
   QualType Pointee = This->getType()->getPointeeType();
   if (!Pointee.isNull() && isClassRefCounted(Pointee)) {
     Checker.emitDiagnostics(This->getLocStart(), "this", Pointee);
     return false;
   }
 
   return true;
 }
--- a/build/clang-plugin/RefCountedInsideLambdaChecker.h
+++ b/build/clang-plugin/RefCountedInsideLambdaChecker.h
@@ -6,27 +6,28 @@
 #define RefCountedInsideLambdaChecker_h__
 
 #include "plugin.h"
 
 class RefCountedInsideLambdaChecker : public BaseCheck {
 public:
   RefCountedInsideLambdaChecker(StringRef CheckName,
                                 ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 
   void emitDiagnostics(SourceLocation Loc, StringRef Name, QualType Type);
 
 private:
   class ThisVisitor : public RecursiveASTVisitor<ThisVisitor> {
   public:
-    explicit ThisVisitor(RefCountedInsideLambdaChecker& Checker)
-      : Checker(Checker) {}
+    explicit ThisVisitor(RefCountedInsideLambdaChecker &Checker)
+        : Checker(Checker) {}
 
     bool VisitCXXThisExpr(CXXThisExpr *This);
+
   private:
-    RefCountedInsideLambdaChecker& Checker;
+    RefCountedInsideLambdaChecker &Checker;
   };
 };
 
 #endif
--- a/build/clang-plugin/ScopeChecker.cpp
+++ b/build/clang-plugin/ScopeChecker.cpp
@@ -1,22 +1,21 @@
 /* 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 "ScopeChecker.h"
 #include "CustomMatchers.h"
 
-void ScopeChecker::registerMatchers(MatchFinder* AstMatcher) {
+void ScopeChecker::registerMatchers(MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(varDecl().bind("node"), this);
   AstMatcher->addMatcher(cxxNewExpr().bind("node"), this);
   AstMatcher->addMatcher(materializeTemporaryExpr().bind("node"), this);
   AstMatcher->addMatcher(
-      callExpr(callee(functionDecl(heapAllocator()))).bind("node"),
-      this);
+      callExpr(callee(functionDecl(heapAllocator()))).bind("node"), this);
   AstMatcher->addMatcher(parmVarDecl().bind("parm_vardecl"), this);
 }
 
 // These enum variants determine whether an allocation has occured in the code.
 enum AllocationVariety {
   AV_None,
   AV_Global,
   AV_Automatic,
@@ -26,18 +25,17 @@ enum AllocationVariety {
 
 // XXX Currently the Decl* in the AutomaticTemporaryMap is unused, but it
 // probably will be used at some point in the future, in order to produce better
 // error messages.
 typedef DenseMap<const MaterializeTemporaryExpr *, const Decl *>
     AutomaticTemporaryMap;
 AutomaticTemporaryMap AutomaticTemporaries;
 
-void ScopeChecker::check(
-    const MatchFinder::MatchResult &Result) {
+void ScopeChecker::check(const MatchFinder::MatchResult &Result) {
   // There are a variety of different reasons why something could be allocated
   AllocationVariety Variety = AV_None;
   SourceLocation Loc;
   QualType T;
 
   if (const ParmVarDecl *D =
           Result.Nodes.getNodeAs<ParmVarDecl>("parm_vardecl")) {
     if (D->hasUnparsedDefaultArg() || D->hasUninstantiatedDefaultArg()) {
@@ -115,35 +113,27 @@ void ScopeChecker::check(
       // This will always allocate on the heap, as the heapAllocator() check
       // was made in the matcher
       Variety = AV_Heap;
       Loc = E->getLocStart();
     }
   }
 
   // Error messages for incorrect allocations.
-  const char* Stack =
-      "variable of type %0 only valid on the stack";
-  const char* Global =
-      "variable of type %0 only valid as global";
-  const char* Heap =
-      "variable of type %0 only valid on the heap";
-  const char* NonHeap =
-      "variable of type %0 is not valid on the heap";
-  const char* NonTemporary =
-      "variable of type %0 is not valid in a temporary";
+  const char *Stack = "variable of type %0 only valid on the stack";
+  const char *Global = "variable of type %0 only valid as global";
+  const char *Heap = "variable of type %0 only valid on the heap";
+  const char *NonHeap = "variable of type %0 is not valid on the heap";
+  const char *NonTemporary = "variable of type %0 is not valid in a temporary";
 
-  const char* StackNote =
+  const char *StackNote =
       "value incorrectly allocated in an automatic variable";
-  const char* GlobalNote =
-      "value incorrectly allocated in a global variable";
-  const char* HeapNote =
-      "value incorrectly allocated on the heap";
-  const char* TemporaryNote =
-      "value incorrectly allocated in a temporary";
+  const char *GlobalNote = "value incorrectly allocated in a global variable";
+  const char *HeapNote = "value incorrectly allocated on the heap";
+  const char *TemporaryNote = "value incorrectly allocated in a temporary";
 
   // Report errors depending on the annotations on the input types.
   switch (Variety) {
   case AV_None:
     return;
 
   case AV_Global:
     StackClass.reportErrorIfPresent(*this, T, Loc, Stack, GlobalNote);
--- a/build/clang-plugin/ScopeChecker.h
+++ b/build/clang-plugin/ScopeChecker.h
@@ -5,14 +5,14 @@
 #ifndef ScopeChecker_h__
 #define ScopeChecker_h__
 
 #include "plugin.h"
 
 class ScopeChecker : public BaseCheck {
 public:
   ScopeChecker(StringRef CheckName, ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/SprintfLiteralChecker.cpp
+++ b/build/clang-plugin/SprintfLiteralChecker.cpp
@@ -1,40 +1,43 @@
 /* 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 "SprintfLiteralChecker.h"
 #include "CustomMatchers.h"
 
-void SprintfLiteralChecker::registerMatchers(MatchFinder* AstMatcher) {
+void SprintfLiteralChecker::registerMatchers(MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(
-      callExpr(isSnprintfLikeFunc(),
-        allOf(hasArgument(0, ignoringParenImpCasts(declRefExpr().bind("buffer"))),
-                             anyOf(hasArgument(1, sizeOfExpr(hasIgnoringParenImpCasts(declRefExpr().bind("size")))),
-                                   hasArgument(1, integerLiteral().bind("immediate")),
-                                   hasArgument(1, declRefExpr(to(varDecl(hasType(isConstQualified()),
-                                                                         hasInitializer(integerLiteral().bind("constant")))))))))
-        .bind("funcCall"),
-      this
-  );
+      callExpr(
+          isSnprintfLikeFunc(),
+          allOf(hasArgument(
+                    0, ignoringParenImpCasts(declRefExpr().bind("buffer"))),
+                anyOf(hasArgument(1, sizeOfExpr(hasIgnoringParenImpCasts(
+                                         declRefExpr().bind("size")))),
+                      hasArgument(1, integerLiteral().bind("immediate")),
+                      hasArgument(1, declRefExpr(to(varDecl(
+                                         hasType(isConstQualified()),
+                                         hasInitializer(integerLiteral().bind(
+                                             "constant")))))))))
+          .bind("funcCall"),
+      this);
 }
 
-void SprintfLiteralChecker::check(
-    const MatchFinder::MatchResult &Result) {
+void SprintfLiteralChecker::check(const MatchFinder::MatchResult &Result) {
   if (!Result.Context->getLangOpts().CPlusPlus) {
     // SprintfLiteral is not usable in C, so there is no point in issuing these
     // warnings.
     return;
   }
 
-  const char* Error =
-    "Use %1 instead of %0 when writing into a character array.";
-  const char* Note =
-    "This will prevent passing in the wrong size to %0 accidentally.";
+  const char *Error =
+      "Use %1 instead of %0 when writing into a character array.";
+  const char *Note =
+      "This will prevent passing in the wrong size to %0 accidentally.";
 
   const CallExpr *D = Result.Nodes.getNodeAs<CallExpr>("funcCall");
 
   StringRef Name = D->getDirectCallee()->getName();
   const char *Replacement;
   if (Name == "snprintf") {
     Replacement = "SprintfLiteral";
   } else {
@@ -51,27 +54,31 @@ void SprintfLiteralChecker::check(
     }
 
     diag(D->getLocStart(), Error, DiagnosticIDs::Error) << Name << Replacement;
     diag(D->getLocStart(), Note, DiagnosticIDs::Note) << Name;
     return;
   }
 
   const QualType QType = Buffer->getType();
-  const ConstantArrayType *Type = dyn_cast<ConstantArrayType>(QType.getTypePtrOrNull());
+  const ConstantArrayType *Type =
+      dyn_cast<ConstantArrayType>(QType.getTypePtrOrNull());
   if (Type) {
     // Match calls like snprintf(x, 100, ...), where x is int[100];
-    const IntegerLiteral *Literal = Result.Nodes.getNodeAs<IntegerLiteral>("immediate");
+    const IntegerLiteral *Literal =
+        Result.Nodes.getNodeAs<IntegerLiteral>("immediate");
     if (!Literal) {
       // Match calls like: const int y = 100; snprintf(x, y, ...);
       Literal = Result.Nodes.getNodeAs<IntegerLiteral>("constant");
     }
 
-    // We're going to assume here that the bitwidth of both of these values fits within 64 bits.
-    // and zero-extend both values to 64-bits before comparing them.
+    // We're going to assume here that the bitwidth of both of these values fits
+    // within 64 bits. and zero-extend both values to 64-bits before comparing
+    // them.
     uint64_t Size = Type->getSize().getZExtValue();
     uint64_t Lit = Literal->getValue().getZExtValue();
     if (Size <= Lit) {
-      diag(D->getLocStart(), Error, DiagnosticIDs::Error) << Name << Replacement;
+      diag(D->getLocStart(), Error, DiagnosticIDs::Error)
+          << Name << Replacement;
       diag(D->getLocStart(), Note, DiagnosticIDs::Note) << Name;
     }
   }
 }
--- a/build/clang-plugin/SprintfLiteralChecker.h
+++ b/build/clang-plugin/SprintfLiteralChecker.h
@@ -4,16 +4,15 @@
 
 #ifndef SprintfLiteralChecker_h__
 #define SprintfLiteralChecker_h__
 
 #include "plugin.h"
 
 class SprintfLiteralChecker : public BaseCheck {
 public:
-  SprintfLiteralChecker(StringRef CheckName,
-                        ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+  SprintfLiteralChecker(StringRef CheckName, ContextType *Context = nullptr)
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/StmtToBlockMap.h
+++ b/build/clang-plugin/StmtToBlockMap.h
@@ -33,52 +33,56 @@ inline SmallVector<const Stmt *, 1> getP
       Parents = Context->getParents(Node);
       NodesToProcess.append(Parents.begin(), Parents.end());
     }
   }
 
   return Result;
 }
 
-// This class is a modified version of the class from clang-tidy's ExprSequence.cpp
+// This class is a modified version of the class from clang-tidy's
+// ExprSequence.cpp
 //
 // Maps `Stmt`s to the `CFGBlock` that contains them. Some `Stmt`s may be
 // contained in more than one `CFGBlock`; in this case, they are mapped to the
 // innermost block (i.e. the one that is furthest from the root of the tree).
 // An optional outparameter provides the index into the block where the `Stmt`
 // was found.
 class StmtToBlockMap {
 public:
   // Initializes the map for the given `CFG`.
-  StmtToBlockMap(const CFG *TheCFG, ASTContext *TheContext) : Context(TheContext) {
+  StmtToBlockMap(const CFG *TheCFG, ASTContext *TheContext)
+      : Context(TheContext) {
     for (const auto *B : *TheCFG) {
       for (size_t I = 0; I < B->size(); ++I) {
         if (Optional<CFGStmt> S = (*B)[I].getAs<CFGStmt>()) {
           Map[S->getStmt()] = std::make_pair(B, I);
         }
       }
     }
   }
 
   // Returns the block that S is contained in. Some `Stmt`s may be contained
   // in more than one `CFGBlock`; in this case, this function returns the
   // innermost block (i.e. the one that is furthest from the root of the tree).
   //
   // The optional outparameter `Index` is set to the index into the block where
   // the `Stmt` was found.
-  const CFGBlock *blockContainingStmt(const Stmt *S, size_t *Index = nullptr) const {
+  const CFGBlock *blockContainingStmt(const Stmt *S,
+                                      size_t *Index = nullptr) const {
     while (!Map.count(S)) {
       SmallVector<const Stmt *, 1> Parents = getParentStmts(S, Context);
       if (Parents.empty())
         return nullptr;
       S = Parents[0];
     }
 
     const auto &E = Map.lookup(S);
-    if (Index) *Index = E.second;
+    if (Index)
+      *Index = E.second;
     return E.first;
   }
 
 private:
   ASTContext *Context;
 
   llvm::DenseMap<const Stmt *, std::pair<const CFGBlock *, size_t>> Map;
 };
--- a/build/clang-plugin/ThirdPartyPaths.h
+++ b/build/clang-plugin/ThirdPartyPaths.h
@@ -1,13 +1,13 @@
 #ifndef ThirdPartyPaths_h__
 #define ThirdPartyPaths_h__
 
 #include <stdint.h>
 
 // These two values are defined in ThirdPartyPaths.cpp, which is a file
 // generated by ThirdPartyPaths.py.
 
-extern const char* MOZ_THIRD_PARTY_PATHS[];
+extern const char *MOZ_THIRD_PARTY_PATHS[];
 
 extern const uint32_t MOZ_THIRD_PARTY_PATHS_COUNT;
 
 #endif
--- a/build/clang-plugin/TrivialCtorDtorChecker.cpp
+++ b/build/clang-plugin/TrivialCtorDtorChecker.cpp
@@ -1,24 +1,22 @@
 /* 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 "TrivialCtorDtorChecker.h"
 #include "CustomMatchers.h"
 
-void TrivialCtorDtorChecker::registerMatchers(MatchFinder* AstMatcher) {
+void TrivialCtorDtorChecker::registerMatchers(MatchFinder *AstMatcher) {
   AstMatcher->addMatcher(cxxRecordDecl(hasTrivialCtorDtor()).bind("node"),
                          this);
 }
 
-void TrivialCtorDtorChecker::check(
-    const MatchFinder::MatchResult &Result) {
-  const char* Error =
-      "class %0 must have trivial constructors and destructors";
+void TrivialCtorDtorChecker::check(const MatchFinder::MatchResult &Result) {
+  const char *Error = "class %0 must have trivial constructors and destructors";
   const CXXRecordDecl *Node = Result.Nodes.getNodeAs<CXXRecordDecl>("node");
 
   if (!Node->hasDefinition()) {
     return;
   }
 
   // We need to accept non-constexpr trivial constructors as well. This occurs
   // when a struct contains pod members, which will not be initialized. As
--- a/build/clang-plugin/TrivialCtorDtorChecker.h
+++ b/build/clang-plugin/TrivialCtorDtorChecker.h
@@ -4,16 +4,15 @@
 
 #ifndef TrivialCtorDtorChecker_h__
 #define TrivialCtorDtorChecker_h__
 
 #include "plugin.h"
 
 class TrivialCtorDtorChecker : public BaseCheck {
 public:
-  TrivialCtorDtorChecker(StringRef CheckName,
-                         ContextType *Context = nullptr)
-    : BaseCheck(CheckName, Context) {}
-  void registerMatchers(MatchFinder* AstMatcher) override;
+  TrivialCtorDtorChecker(StringRef CheckName, ContextType *Context = nullptr)
+      : BaseCheck(CheckName, Context) {}
+  void registerMatchers(MatchFinder *AstMatcher) override;
   void check(const MatchFinder::MatchResult &Result) override;
 };
 
 #endif
--- a/build/clang-plugin/Utils.h
+++ b/build/clang-plugin/Utils.h
@@ -423,17 +423,17 @@ inline bool inThirdPartyPath(SourceLocat
 inline bool inThirdPartyPath(const Decl *D, ASTContext *context) {
   D = D->getCanonicalDecl();
   SourceLocation Loc = D->getLocation();
   const SourceManager &SM = context->getSourceManager();
 
   return inThirdPartyPath(Loc, SM);
 }
 
-inline CXXRecordDecl* getNonTemplateSpecializedCXXRecordDecl(QualType Q) {
+inline CXXRecordDecl *getNonTemplateSpecializedCXXRecordDecl(QualType Q) {
   auto *D = Q->getAsCXXRecordDecl();
 
   if (!D) {
     auto TemplateQ = Q->getAs<TemplateSpecializationType>();
     if (!TemplateQ) {
       return nullptr;
     }
 
@@ -458,27 +458,27 @@ inline bool inThirdPartyPath(const Decl 
 inline bool inThirdPartyPath(const Stmt *S, ASTContext *context) {
   SourceLocation Loc = S->getLocStart();
   const SourceManager &SM = context->getSourceManager();
 
   return inThirdPartyPath(Loc, SM);
 }
 
 /// Polyfill for CXXOperatorCallExpr::isInfixBinaryOp()
-inline bool isInfixBinaryOp(const CXXOperatorCallExpr* OpCall) {
+inline bool isInfixBinaryOp(const CXXOperatorCallExpr *OpCall) {
 #if CLANG_VERSION_FULL >= 400
   return OpCall->isInfixBinaryOp();
 #else
   // Taken from clang source.
   if (OpCall->getNumArgs() != 2)
-     return false;
+    return false;
 
   switch (OpCall->getOperator()) {
-   case OO_Call: case OO_Subscript:
-     return false;
-   default:
-     return true;
+  case OO_Call:
+  case OO_Subscript:
+    return false;
+  default:
+    return true;
   }
 #endif
 }
 
-
 #endif
--- a/build/clang-plugin/VariableUsageHelpers.cpp
+++ b/build/clang-plugin/VariableUsageHelpers.cpp
@@ -1,33 +1,31 @@
 #include "VariableUsageHelpers.h"
 #include "Utils.h"
 
-std::vector<const Stmt*>
-getUsageAsRvalue(const ValueDecl* ValueDeclaration,
-                 const FunctionDecl* FuncDecl) {
-  std::vector<const Stmt*> UsageStatements;
+std::vector<const Stmt *> getUsageAsRvalue(const ValueDecl *ValueDeclaration,
+                                           const FunctionDecl *FuncDecl) {
+  std::vector<const Stmt *> UsageStatements;
 
   // We check the function declaration has a body.
   auto Body = FuncDecl->getBody();
   if (!Body) {
-    return std::vector<const Stmt*>();
+    return std::vector<const Stmt *>();
   }
 
   // We build a Control Flow Graph (CFG) fron the body of the function
   // declaration.
-  std::unique_ptr<CFG> StatementCFG
-      = CFG::buildCFG(FuncDecl, Body, &FuncDecl->getASTContext(),
-                      CFG::BuildOptions());
+  std::unique_ptr<CFG> StatementCFG = CFG::buildCFG(
+      FuncDecl, Body, &FuncDecl->getASTContext(), CFG::BuildOptions());
 
   // We iterate through all the CFGBlocks, which basically means that we go over
   // all the possible branches of the code and therefore cover all statements.
-  for (auto& Block : *StatementCFG) {
+  for (auto &Block : *StatementCFG) {
     // We iterate through all the statements of the block.
-    for (auto& BlockItem : *Block) {
+    for (auto &BlockItem : *Block) {
       Optional<CFGStmt> CFGStatement = BlockItem.getAs<CFGStmt>();
       if (!CFGStatement) {
         continue;
       }
 
       // FIXME: Right now this function/if chain is very basic and only covers
       // the cases we need for escapesFunction()
       if (auto BinOp = dyn_cast<BinaryOperator>(CFGStatement->getStmt())) {
@@ -45,17 +43,17 @@ getUsageAsRvalue(const ValueDecl* ValueD
 
         if (DeclRef->getDecl() != ValueDeclaration) {
           continue;
         }
       } else if (auto Return = dyn_cast<ReturnStmt>(CFGStatement->getStmt())) {
         // We want our declaration to be used as the expression of the return
         // statement.
         auto DeclRef = dyn_cast_or_null<DeclRefExpr>(
-                            IgnoreTrivials(Return->getRetValue()));
+            IgnoreTrivials(Return->getRetValue()));
         if (!DeclRef) {
           continue;
         }
 
         if (DeclRef->getDecl() != ValueDeclaration) {
           continue;
         }
       } else {
@@ -66,96 +64,89 @@ getUsageAsRvalue(const ValueDecl* ValueD
       UsageStatements.push_back(CFGStatement->getStmt());
     }
   }
 
   return UsageStatements;
 }
 
 // We declare our EscapesFunctionError enum to be an error code enum.
-namespace std
-{
-  template <>
-    struct is_error_code_enum<EscapesFunctionError> : true_type {};
-}
+namespace std {
+template <> struct is_error_code_enum<EscapesFunctionError> : true_type {};
+} // namespace std
 
 // We define the EscapesFunctionErrorCategory which contains the error messages
 // corresponding to each enum variant.
 namespace {
-  struct EscapesFunctionErrorCategory : std::error_category
-  {
-    const char* name() const noexcept override;
-    std::string message(int ev) const override;
-  };
-
-  const char* EscapesFunctionErrorCategory::name() const noexcept
-  {
-    return "escapes function";
-  }
-
-  std::string EscapesFunctionErrorCategory::message(int ev) const
-  {
-    switch (static_cast<EscapesFunctionError>(ev))
-    {
-    case EscapesFunctionError::ConstructorDeclNotFound:
-      return "constructor declaration not found";
+struct EscapesFunctionErrorCategory : std::error_category {
+  const char *name() const noexcept override;
+  std::string message(int ev) const override;
+};
 
-    case EscapesFunctionError::FunctionDeclNotFound:
-      return "function declaration not found";
-
-    case EscapesFunctionError::FunctionIsBuiltin:
-      return "function is builtin";
-
-    case EscapesFunctionError::FunctionIsVariadic:
-      return "function is variadic";
-
-    case EscapesFunctionError::ExprNotInCall:
-      return "expression is not in call";
-
-    case EscapesFunctionError::NoParamForArg:
-      return "no parameter for argument";
-
-    case EscapesFunctionError::ArgAndParamNotPointers:
-      return "argument and parameter are not pointers";
-    }
-  }
-
-  const EscapesFunctionErrorCategory TheEscapesFunctionErrorCategory {};
+const char *EscapesFunctionErrorCategory::name() const noexcept {
+  return "escapes function";
 }
 
-std::error_code make_error_code(EscapesFunctionError e)
-{
+std::string EscapesFunctionErrorCategory::message(int ev) const {
+  switch (static_cast<EscapesFunctionError>(ev)) {
+  case EscapesFunctionError::ConstructorDeclNotFound:
+    return "constructor declaration not found";
+
+  case EscapesFunctionError::FunctionDeclNotFound:
+    return "function declaration not found";
+
+  case EscapesFunctionError::FunctionIsBuiltin:
+    return "function is builtin";
+
+  case EscapesFunctionError::FunctionIsVariadic:
+    return "function is variadic";
+
+  case EscapesFunctionError::ExprNotInCall:
+    return "expression is not in call";
+
+  case EscapesFunctionError::NoParamForArg:
+    return "no parameter for argument";
+
+  case EscapesFunctionError::ArgAndParamNotPointers:
+    return "argument and parameter are not pointers";
+  }
+}
+
+const EscapesFunctionErrorCategory TheEscapesFunctionErrorCategory{};
+} // namespace
+
+std::error_code make_error_code(EscapesFunctionError e) {
   return {static_cast<int>(e), TheEscapesFunctionErrorCategory};
 }
 
-ErrorOr<std::tuple<const Stmt*, const Decl*>>
-escapesFunction(const Expr* Arg, const CXXConstructExpr* Construct) {
+ErrorOr<std::tuple<const Stmt *, const Decl *>>
+escapesFunction(const Expr *Arg, const CXXConstructExpr *Construct) {
   // We get the function declaration corresponding to the call.
   auto CtorDecl = Construct->getConstructor();
   if (!CtorDecl) {
     return EscapesFunctionError::ConstructorDeclNotFound;
   }
 
   return escapesFunction(Arg, CtorDecl, Construct->getArgs(),
                          Construct->getNumArgs());
 }
 
-ErrorOr<std::tuple<const Stmt*, const Decl*>>
-escapesFunction(const Expr* Arg, const CallExpr* Call) {
+ErrorOr<std::tuple<const Stmt *, const Decl *>>
+escapesFunction(const Expr *Arg, const CallExpr *Call) {
   // We get the function declaration corresponding to the call.
   auto FuncDecl = Call->getDirectCallee();
   if (!FuncDecl) {
     return EscapesFunctionError::FunctionDeclNotFound;
   }
 
   return escapesFunction(Arg, FuncDecl, Call->getArgs(), Call->getNumArgs());
 }
 
-ErrorOr<std::tuple<const Stmt*, const Decl*>>
-escapesFunction(const Expr* Arg, const CXXOperatorCallExpr* OpCall) {
+ErrorOr<std::tuple<const Stmt *, const Decl *>>
+escapesFunction(const Expr *Arg, const CXXOperatorCallExpr *OpCall) {
   // We get the function declaration corresponding to the operator call.
   auto FuncDecl = OpCall->getDirectCallee();
   if (!FuncDecl) {
     return EscapesFunctionError::FunctionDeclNotFound;
   }
 
   auto Args = OpCall->getArgs();
   auto NumArgs = OpCall->getNumArgs();
@@ -165,21 +156,21 @@ escapesFunction(const Expr* Arg, const C
   if (isInfixBinaryOp(OpCall) && FuncDecl->getNumParams() == 1) {
     Args++;
     NumArgs--;
   }
 
   return escapesFunction(Arg, FuncDecl, Args, NumArgs);
 }
 
-ErrorOr<std::tuple<const Stmt*, const Decl*>>
-escapesFunction(const Expr* Arg, const FunctionDecl *FuncDecl,
-                const Expr* const* Arguments, unsigned NumArgs) {
+ErrorOr<std::tuple<const Stmt *, const Decl *>>
+escapesFunction(const Expr *Arg, const FunctionDecl *FuncDecl,
+                const Expr *const *Arguments, unsigned NumArgs) {
   if (!NumArgs) {
-    return std::make_tuple((const Stmt*)nullptr, (const Decl*)nullptr);
+    return std::make_tuple((const Stmt *)nullptr, (const Decl *)nullptr);
   }
 
   if (FuncDecl->getBuiltinID() != 0 ||
       ASTIsInSystemHeader(FuncDecl->getASTContext(), *FuncDecl)) {
     return EscapesFunctionError::FunctionIsBuiltin;
   }
 
   // FIXME: should probably be handled at some point, but it's too annoying
@@ -242,38 +233,39 @@ escapesFunction(const Expr* Arg, const F
         //   *param2 = param1;
         // }
         // This should be fixed when we have better/more helper functions to
         // help deal with this kind of lvalue expressions.
         if (!ParamDeclaration->getType()->isReferenceType()) {
           continue;
         }
 
-        return std::make_tuple(Usage, (const Decl*)ParamDeclaration);
+        return std::make_tuple(Usage, (const Decl *)ParamDeclaration);
       } else if (auto VarDeclaration = dyn_cast<VarDecl>(DeclRef->getDecl())) {
         // This is the case where the parameter escapes through a global/static
         // variable.
         if (!VarDeclaration->hasGlobalStorage()) {
           continue;
         }
 
-        return std::make_tuple(Usage, (const Decl*)VarDeclaration);
-      } else if (auto FieldDeclaration = dyn_cast<FieldDecl>(DeclRef->getDecl())) {
+        return std::make_tuple(Usage, (const Decl *)VarDeclaration);
+      } else if (auto FieldDeclaration =
+                     dyn_cast<FieldDecl>(DeclRef->getDecl())) {
         // This is the case where the parameter escapes through a field.
 
-        return std::make_tuple(Usage, (const Decl*)FieldDeclaration);
+        return std::make_tuple(Usage, (const Decl *)FieldDeclaration);
       }
     } else if (isa<ReturnStmt>(Usage)) {
       // This is the case where the parameter escapes through the return value
       // of the function.
-      if (!FuncDecl->getReturnType()->isPointerType()
-          && !FuncDecl->getReturnType()->isReferenceType()) {
+      if (!FuncDecl->getReturnType()->isPointerType() &&
+          !FuncDecl->getReturnType()->isReferenceType()) {
         continue;
       }
 
-      return std::make_tuple(Usage, (const Decl*)FuncDecl);
+      return std::make_tuple(Usage, (const Decl *)FuncDecl);
     }
   }
 
   // No early-return, this means that we haven't found any case of funciton
   // escaping and that therefore the parameter remains in the function scope.
-  return std::make_tuple((const Stmt*)nullptr, (const Decl*)nullptr);
+  return std::make_tuple((const Stmt *)nullptr, (const Decl *)nullptr);
 }
--- a/build/clang-plugin/VariableUsageHelpers.h
+++ b/build/clang-plugin/VariableUsageHelpers.h
@@ -1,27 +1,25 @@
 /* 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/. */
 
-
 #ifndef VariableUsageHelpers_h__
 #define VariableUsageHelpers_h__
 
 #include "plugin.h"
 
 /// Returns a list of the statements where the given declaration is used as an
 /// rvalue (within the provided function).
 ///
 /// WARNING: incomplete behaviour/implementation for general-purpose use outside
 /// of escapesFunction(). This only detects very basic usages (see
 /// implementation for more details).
-std::vector<const Stmt*>
-getUsageAsRvalue(const ValueDecl* ValueDeclaration,
-                 const FunctionDecl* FuncDecl);
+std::vector<const Stmt *> getUsageAsRvalue(const ValueDecl *ValueDeclaration,
+                                           const FunctionDecl *FuncDecl);
 
 /// This is the error enumeration for escapesFunction(), describing all the
 /// possible error cases.
 enum class EscapesFunctionError {
   ConstructorDeclNotFound = 1,
   FunctionDeclNotFound,
   FunctionIsBuiltin,
   FunctionIsVariadic,
@@ -41,25 +39,25 @@ std::error_code make_error_code(EscapesF
 /// function, the tuple will only contain nullptrs.
 /// If the analysis runs into an unexpected error or into an unimplemented
 /// configuration, it will return an error_code of type EscapesFunctionError
 /// representing the precise issue.
 ///
 /// WARNING: incomplete behaviour/implementation for general-purpose use outside
 /// of DanglingOnTemporaryChecker. This only covers a limited set of cases,
 /// mainly in terms of arguments and parameter types.
-ErrorOr<std::tuple<const Stmt*, const Decl*>>
-escapesFunction(const Expr* Arg, const FunctionDecl *FuncDecl,
-                const Expr* const* Arguments, unsigned NumArgs);
+ErrorOr<std::tuple<const Stmt *, const Decl *>>
+escapesFunction(const Expr *Arg, const FunctionDecl *FuncDecl,
+                const Expr *const *Arguments, unsigned NumArgs);
 
 /// Helper function taking a call expression.
-ErrorOr<std::tuple<const Stmt*, const Decl*>>
-escapesFunction(const Expr* Arg, const CallExpr* Call);
+ErrorOr<std::tuple<const Stmt *, const Decl *>>
+escapesFunction(const Expr *Arg, const CallExpr *Call);
 
 /// Helper function taking a construct expression.
-ErrorOr<std::tuple<const Stmt*, const Decl*>>
-escapesFunction(const Expr* Arg, const CXXConstructExpr* Construct);
+ErrorOr<std::tuple<const Stmt *, const Decl *>>
+escapesFunction(const Expr *Arg, const CXXConstructExpr *Construct);
 
 /// Helper function taking an operator call expression.
-ErrorOr<std::tuple<const Stmt*, const Decl*>>
-escapesFunction(const Expr* Arg, const CXXOperatorCallExpr* OpCall);
+ErrorOr<std::tuple<const Stmt *, const Decl *>>
+escapesFunction(const Expr *Arg, const CXXOperatorCallExpr *OpCall);
 
 #endif
--- a/build/clang-plugin/plugin.h
+++ b/build/clang-plugin/plugin.h
@@ -1,30 +1,30 @@
 /* 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/. */
 
 #ifndef plugin_h__
 #define plugin_h__
 
-#include "clang/Analysis/CFG.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Analysis/CFG.h"
 #include "clang/Basic/Version.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/MultiplexConsumer.h"
 #include "clang/Sema/Sema.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
+#include <iterator>
 #include <memory>
-#include <iterator>
 
 #define CLANG_VERSION_FULL (CLANG_VERSION_MAJOR * 100 + CLANG_VERSION_MINOR)
 
 using namespace llvm;
 using namespace clang;
 using namespace clang::ast_matchers;
 
 #if CLANG_VERSION_FULL >= 306
@@ -49,18 +49,18 @@ typedef ASTConsumer *ASTConsumerPtr;
 #else
 // Before clang 3.9 "has" would behave like has(ignoringParenImpCasts(x)),
 // however doing that explicitly would not compile.
 #define hasIgnoringParenImpCasts(x) has(ignoringParenImpCasts(x))
 #endif
 
 #endif
 
-// In order to support running our checks using clang-tidy, we implement a source
-// compatible base check class called BaseCheck, and we use the preprocessor to
-// decide which base class to pick.
+// In order to support running our checks using clang-tidy, we implement a
+// source compatible base check class called BaseCheck, and we use the
+// preprocessor to decide which base class to pick.
 #ifdef CLANG_TIDY
 #include "../ClangTidy.h"
 typedef clang::tidy::ClangTidyCheck BaseCheck;
 typedef clang::tidy::ClangTidyContext ContextType;
 #else
 #include "BaseCheck.h"
 #endif
--- a/build/gyp.mozbuild
+++ b/build/gyp.mozbuild
@@ -55,17 +55,16 @@ gyp_vars.update({
     'use_glib': 1 if CONFIG['GLIB_LIBS'] else 0,
     # bug 1373485 - avoid pkg-config for gtk2 in webrtc
     'use_gtk': 0,
 
      # turn off mandatory use of NEON and instead use NEON detection
     'arm_neon': 0,
     'arm_neon_optional': 1,
 
-    'moz_webrtc_omx': 0,
     'moz_webrtc_mediacodec': 0,
 
     # Turn off multi monitor screen share
     'multi_monitor_screenshare%' : 0,
 
     # (for vp8) chromium sets to 0 also
     'use_temporal_layers': 0,
 
@@ -119,9 +118,9 @@ if CONFIG['INTEL_ARCHITECTURE']:
 
 if CONFIG['MACOS_SDK_DIR']:
     gyp_vars['mac_sdk_path'] = CONFIG['MACOS_SDK_DIR']
 
 if not CONFIG['MOZ_SYSTEM_LIBVPX']:
     gyp_vars['libvpx_dir'] =  '/media/libvpx/libvpx'
 
 if not CONFIG['MOZ_SYSTEM_LIBEVENT']:
-    gyp_vars['libevent_dir'] = '/ipc/chromium/src/third_party/libevent' 
+    gyp_vars['libevent_dir'] = '/ipc/chromium/src/third_party/libevent'
--- a/devtools/client/animationinspector/test/browser_animation_timeline_shows_time_info.js
+++ b/devtools/client/animationinspector/test/browser_animation_timeline_shows_time_info.js
@@ -21,21 +21,21 @@ add_task(function* () {
   // ok. We don't need to test the actual content.
   [...timeBlockNameEls].forEach((el, i) => {
     ok(el.hasAttribute("title"), "The tooltip is defined for animation " + i);
 
     let title = el.getAttribute("title");
     let state = controller.animationPlayers[i].state;
 
     if (state.delay) {
-      ok(title.match(/Delay: [\d.-]+s/), "The tooltip shows the delay");
+      ok(title.match(/Delay: [\d.,-]+s/), "The tooltip shows the delay");
     }
-    ok(title.match(/Duration: [\d.]+s/), "The tooltip shows the duration");
+    ok(title.match(/Duration: [\d.,]+s/), "The tooltip shows the duration");
     if (state.endDelay) {
-      ok(title.match(/End delay: [\d.-]+s/), "The tooltip shows the endDelay");
+      ok(title.match(/End delay: [\d.,-]+s/), "The tooltip shows the endDelay");
     }
     if (state.iterationCount !== 1) {
       ok(title.match(/Repeats: /), "The tooltip shows the iterations");
     } else {
       ok(!title.match(/Repeats: /), "The tooltip doesn't show the iterations");
     }
     if (state.easing && state.easing !== "linear") {
       ok(title.match(/Overall easing: /), "The tooltip shows the easing");
--- a/devtools/client/responsive.html/browser/tunnel.js
+++ b/devtools/client/responsive.html/browser/tunnel.js
@@ -414,18 +414,16 @@ MessageManagerTunnel.prototype = {
     // Messages sent from RemoteFinder.jsm
     "Finder:",
     // Messages sent from InlineSpellChecker.jsm
     "InlineSpellChecker:",
     // Messages sent from pageinfo.js
     "PageInfo:",
     // Messages sent from printUtils.js
     "Printing:",
-    // Messages sent from browser-social.js
-    "Social:",
     "PageMetadata:",
     // Messages sent from viewSourceUtils.js
     "ViewSource:",
   ],
 
   INNER_TO_OUTER_MESSAGE_PREFIXES: [
     // Messages sent to nsContextMenu.js
     "ContextMenu:",
@@ -434,18 +432,16 @@ MessageManagerTunnel.prototype = {
     // Messages sent to findbar.xml
     "Findbar:",
     // Messages sent to RemoteFinder.jsm
     "Finder:",
     // Messages sent to pageinfo.js
     "PageInfo:",
     // Messages sent to printUtils.js
     "Printing:",
-    // Messages sent to browser-social.js
-    "Social:",
     "PageMetadata:",
     // Messages sent to viewSourceUtils.js
     "ViewSource:",
   ],
 
   OUTER_TO_INNER_FRAME_SCRIPTS: [
     // DevTools server for OOP frames
     "resource://devtools/server/child.js"
--- a/devtools/client/shared/test/browser_num-l10n.js
+++ b/devtools/client/shared/test/browser_num-l10n.js
@@ -23,11 +23,19 @@ function test() {
   is(l10n.numberWithDecimals(undefined, 2), "0",
     "`undefined` was properly localized.");
   is(l10n.numberWithDecimals(-1234.56789, 2), "-1,234.57",
     "Negative number was properly localized.");
   is(l10n.numberWithDecimals(1234.56789, 0), "1,235",
     "Number was properly localized with decimals set 0.");
   is(l10n.numberWithDecimals(-1234.56789, 0), "-1,235",
     "Negative number was properly localized with decimals set 0.");
+  is(l10n.numberWithDecimals(12, 2), "12",
+    "The integer was properly localized, without decimals.");
+  is(l10n.numberWithDecimals(-12, 2), "-12",
+    "The negative integer was properly localized, without decimals.");
+  is(l10n.numberWithDecimals(1200, 2), "1,200",
+    "The big integer was properly localized, no decimals but with a separator.");
+  is(l10n.numberWithDecimals(-1200, 2), "-1,200",
+    "The negative big integer was properly localized, no decimals but with a separator.");
 
   finish();
 }
--- a/devtools/client/shared/test/unit/test_parseDeclarations.js
+++ b/devtools/client/shared/test/unit/test_parseDeclarations.js
@@ -360,16 +360,25 @@ const TEST_DATA = [
   },
 
   // Regression test for bug 1297890 - don't paste tokens.
   {
     parseComments: true,
     input: "stroke-dasharray: 1/*ThisIsAComment*/2;",
     expected: [{name: "stroke-dasharray", value: "1 2", priority: "", offsets: [0, 39]}]
   },
+
+  // Regression test for bug 1384463 - don't trim significant
+  // whitespace.
+  {
+    // \u00a0 is non-breaking space.
+    input: "\u00a0vertical-align: top",
+    expected: [{name: "\u00a0vertical-align", value: "top", priority: "",
+                offsets: [0, 20]}]
+  },
 ];
 
 function run_test() {
   run_basic_tests();
   run_comment_tests();
   run_named_tests();
 }
 
--- a/devtools/client/webconsole/new-console-output/actions/filters.js
+++ b/devtools/client/webconsole/new-console-output/actions/filters.js
@@ -39,38 +39,40 @@ function filterToggle(filter) {
 }
 
 function filtersClear() {
   return (dispatch, getState) => {
     dispatch({
       type: FILTERS_CLEAR,
     });
 
-    const filterState = getAllFilters(getState());
+    const filterState = getAllFilters(getState()).toJS();
     for (let filter in filterState) {
       if (filter !== FILTERS.TEXT) {
         Services.prefs.clearUserPref(PREFS.FILTER[filter.toUpperCase()]);
       }
     }
   };
 }
 
 /**
  * Set the default filters to their original values.
  * This is different than filtersClear where we reset
  * all the filters to their original values. Here we want
  * to keep non-default filters the user might have set.
  */
 function defaultFiltersReset() {
   return (dispatch, getState) => {
+    // Get the state before dispatching so the action does not alter prefs reset.
+    const filterState = getAllFilters(getState());
+
     dispatch({
       type: DEFAULT_FILTERS_RESET,
     });
 
-    const filterState = getAllFilters(getState());
     DEFAULT_FILTERS.forEach(filter => {
       if (filterState[filter] === false) {
         Services.prefs.clearUserPref(PREFS.FILTER[filter.toUpperCase()]);
       }
     });
   };
 }
 
--- a/devtools/client/webconsole/new-console-output/components/message-types/ConsoleApiCall.js
+++ b/devtools/client/webconsole/new-console-output/components/message-types/ConsoleApiCall.js
@@ -146,17 +146,22 @@ function formatReps(options = {}) {
         serviceContainer,
         useQuotes: false,
         loadedObjectProperties,
         loadedObjectEntries,
         type,
       }))
       // Interleave spaces.
       .reduce((arr, v, i) => {
-        return i + 1 < parameters.length
+        // We need to interleave a space if we are not on the last element AND
+        // if we are not between 2 messages with user provided style.
+        const needSpace = i + 1 < parameters.length &&
+          (!userProvidedStyles || !userProvidedStyles[i] || !userProvidedStyles[i + 1]);
+
+        return needSpace
           ? arr.concat(v, dom.span({}, " "))
           : arr.concat(v);
       }, [])
   );
 }
 
 module.exports = ConsoleApiCall;
 
--- a/devtools/client/webconsole/new-console-output/test/components/console-api-call.test.js
+++ b/devtools/client/webconsole/new-console-output/test/components/console-api-call.test.js
@@ -215,19 +215,19 @@ describe("ConsoleAPICall component:", ()
 
       expect(wrapper.find(".message-body").text()).toBe("bar");
       expect(wrapper.find(".theme-twisty.open").length).toBe(1);
     });
 
     it("renders group with custom style", () => {
       const message = stubPreparedMessages.get("console.group(%cfoo%cbar)");
       const wrapper = render(ConsoleApiCall({ message, serviceContainer }));
+      expect(wrapper.find(".message-body").text()).toBe("foobar");
 
       const elements = wrapper.find(".objectBox-string");
-      expect(elements.text()).toBe("foobar");
       expect(elements.length).toBe(2);
 
       const firstElementStyle = elements.eq(0).prop("style");
       // Allowed styles are applied accordingly on the first element.
       expect(firstElementStyle.color).toBe(`blue`);
       expect(firstElementStyle["font-size"]).toBe(`1.3em`);
       // Forbidden styles are not applied.
       expect(firstElementStyle["background-image"]).toBe(undefined);
--- a/devtools/client/webconsole/new-console-output/test/components/filter-bar.test.js
+++ b/devtools/client/webconsole/new-console-output/test/components/filter-bar.test.js
@@ -12,22 +12,28 @@ const Provider = createFactory(require("
 const actions = require("devtools/client/webconsole/new-console-output/actions/index");
 const FilterButton = require("devtools/client/webconsole/new-console-output/components/FilterButton");
 const FilterBar = createFactory(require("devtools/client/webconsole/new-console-output/components/FilterBar"));
 const { getAllUi } = require("devtools/client/webconsole/new-console-output/selectors/ui");
 const { getAllFilters } = require("devtools/client/webconsole/new-console-output/selectors/filters");
 const {
   MESSAGES_CLEAR,
   FILTERS,
+  PREFS,
 } = require("devtools/client/webconsole/new-console-output/constants");
 
 const { setupStore } = require("devtools/client/webconsole/new-console-output/test/helpers");
 const serviceContainer = require("devtools/client/webconsole/new-console-output/test/fixtures/serviceContainer");
+const ServicesMock = require("Services");
 
 describe("FilterBar component:", () => {
+  afterEach(() => {
+    ServicesMock.prefs.testHelpers.clearPrefs();
+  });
+
   it("initial render", () => {
     const store = setupStore([]);
 
     const wrapper = render(Provider({store}, FilterBar({ serviceContainer })));
     const toolbar = wrapper.find(
       ".devtools-toolbar.webconsole-filterbar-primary"
     );
 
@@ -185,21 +191,23 @@ describe("FilterBar component:", () => {
     const toolbar = wrapper.find(".webconsole-filterbar-filtered-messages");
     expect(toolbar.exists()).toBeFalsy();
   });
 
   it("displays filter bar when button is clicked", () => {
     const store = setupStore([]);
 
     expect(getAllUi(store.getState()).filterBarVisible).toBe(false);
+    expect(ServicesMock.prefs.getBoolPref(PREFS.UI.FILTER_BAR), false);
 
     const wrapper = mount(Provider({store}, FilterBar({ serviceContainer })));
     wrapper.find(".devtools-filter-icon").simulate("click");
 
     expect(getAllUi(store.getState()).filterBarVisible).toBe(true);
+    expect(ServicesMock.prefs.getBoolPref(PREFS.UI.FILTER_BAR), true);
 
     const secondaryBar = wrapper.find(".webconsole-filterbar-secondary");
     expect(secondaryBar.length).toBe(1);
 
     // Buttons are displayed
     const filterBtn = props => FilterButton(
       Object.assign({}, {
         active: true,
@@ -245,15 +253,17 @@ describe("FilterBar component:", () => {
     wrapper.find(".devtools-plaininput").simulate("input", { target: { value: "a" } });
     expect(store.getState().filters.text).toBe("a");
   });
 
   it("toggles persist logs when checkbox is clicked", () => {
     const store = setupStore([]);
 
     expect(getAllUi(store.getState()).persistLogs).toBe(false);
+    expect(ServicesMock.prefs.getBoolPref(PREFS.UI.PERSIST), false);
 
     const wrapper = mount(Provider({store}, FilterBar({ serviceContainer })));
     wrapper.find(".filter-checkbox input").simulate("change");
 
     expect(getAllUi(store.getState()).persistLogs).toBe(true);
+    expect(ServicesMock.prefs.getBoolPref(PREFS.UI.PERSIST), true);
   });
 });
--- a/devtools/client/webconsole/new-console-output/test/fixtures/Services.js
+++ b/devtools/client/webconsole/new-console-output/test/fixtures/Services.js
@@ -1,30 +1,46 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const { PREFS } = require("devtools/client/webconsole/new-console-output/constants");
+const {
+  DEFAULT_FILTERS_VALUES,
+  FILTERS,
+  PREFS
+} = require("devtools/client/webconsole/new-console-output/constants");
+
+function getDefaultPrefs() {
+  return Object.assign({
+    "devtools.hud.loglimit": 1000,
+    [PREFS.UI.FILTER_BAR]: false,
+    [PREFS.UI.PERSIST]: false,
+  }, Object.entries(PREFS.FILTER).reduce((res, [key, pref]) => {
+    res[pref] = DEFAULT_FILTERS_VALUES[FILTERS[key]];
+    return res;
+  }, {}));
+}
+
+let prefs = Object.assign({}, getDefaultPrefs());
 
 module.exports = {
   prefs: {
-    getIntPref: pref => {
-      switch (pref) {
-        case "devtools.hud.loglimit":
-          return 1000;
-      }
-      return null;
+    getIntPref: pref => prefs[pref],
+    getBoolPref: pref => prefs[pref],
+    setBoolPref: (pref, value) => {
+      prefs[pref] = value;
+    },
+    clearUserPref: (pref) => {
+      prefs[pref] = (getDefaultPrefs())[pref];
     },
-    getBoolPref: pref => {
-      const falsey = [
-        PREFS.FILTER.CSS,
-        PREFS.FILTER.NET,
-        PREFS.FILTER.NETXHR,
-        PREFS.UI.FILTER_BAR,
-        PREFS.UI.PERSIST,
-      ];
-      return !falsey.includes(pref);
-    },
-    setBoolPref: () => {},
-    clearUserPref: () => {},
+    testHelpers: {
+      getAllPrefs: () => prefs,
+      getFiltersPrefs: () => Object.values(PREFS.FILTER).reduce((res, pref) => {
+        res[pref] = prefs[pref];
+        return res;
+      }, {}),
+      clearPrefs: () => {
+        prefs = Object.assign({}, getDefaultPrefs());
+      }
+    }
   }
 };
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
@@ -462,16 +462,14 @@ skip-if = true #	Bug 1405650
 # old console skip-if = (os == 'win' && bits == 64) # Bug 1390001
 [browser_webconsole_variables_view_dont_sort_non_sortable_classes_properties.js]
 skip-if = true #	Bug 1403196
 [browser_webconsole_variables_view_while_debugging.js]
 skip-if = true #	Bug 1403200
 [browser_webconsole_variables_view_while_debugging_and_inspecting.js]
 skip-if = true #	Bug 1403205
 [browser_webconsole_view_source.js]
-skip-if = true #	Bug 1405652
-# old console skip-if = (os == 'win' && bits == 64) # Bug 1390001
 [browser_webconsole_violation.js]
 skip-if = true #	Bug 1405245
 # old console skip-if = e10s && (os == 'win') # Bug 1264955
 [browser_webconsole_warn_about_replaced_api.js]
 [browser_webconsole_websocket.js]
 skip-if = true # Bug 1408950
\ No newline at end of file
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_view_source.js
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_view_source.js
@@ -6,47 +6,25 @@
 // Tests that source URLs in the Web Console can be clicked to display the
 // standard View Source window. As JS exceptions and console.log() messages always
 // have their locations opened in Debugger, we need to test a security message in
 // order to have it opened in the standard View Source window.
 
 "use strict";
 
 const TEST_URI = "https://example.com/browser/devtools/client/webconsole/" +
-                 "test/test-mixedcontent-securityerrors.html";
-
-add_task(function* () {
-  yield actuallyTest();
-});
+                 "new-console-output/test/mochitest/test-mixedcontent-securityerrors.html";
 
-add_task(function* () {
-  Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false);
-  yield actuallyTest();
-  Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
-});
-
-var actuallyTest = Task.async(function*() {
-  yield loadTab(TEST_URI);
-  let hud = yield openConsole(null);
+add_task(async function () {
+  let hud = await openNewTabAndConsole(TEST_URI);
   info("console opened");
 
-  let [result] = yield waitForMessages({
-    webconsole: hud,
-    messages: [{
-      text: "Blocked loading mixed active content",
-      category: CATEGORY_SECURITY,
-      severity: SEVERITY_ERROR,
-    }],
-  });
-
-  let msg = [...result.matched][0];
+  let msg = await waitFor(() => findMessage(hud, "Blocked loading mixed active content"));
   ok(msg, "error message");
   let locationNode = msg.querySelector(".message-location .frame-link-filename");
   ok(locationNode, "location node");
 
-  let onTabOpen = waitForTab();
-
-  EventUtils.sendMouseEvent({ type: "click" }, locationNode);
+  let onTabOpen = BrowserTestUtils.waitForNewTab(gBrowser, null, true);
 
-  let tab = yield onTabOpen;
+  locationNode.click();
+  let tab = await onTabOpen;
   ok(true, "the view source tab was opened in response to clicking the location node");
-  gBrowser.removeTab(tab);
 });
--- a/devtools/client/webconsole/new-console-output/test/store/filters.test.js
+++ b/devtools/client/webconsole/new-console-output/test/store/filters.test.js
@@ -6,19 +6,20 @@
 const expect = require("expect");
 
 const actions = require("devtools/client/webconsole/new-console-output/actions/index");
 const { messageAdd } = require("devtools/client/webconsole/new-console-output/actions/index");
 const { ConsoleCommand } = require("devtools/client/webconsole/new-console-output/types");
 const { getVisibleMessages } = require("devtools/client/webconsole/new-console-output/selectors/messages");
 const { getAllFilters } = require("devtools/client/webconsole/new-console-output/selectors/filters");
 const { setupStore } = require("devtools/client/webconsole/new-console-output/test/helpers");
-const { FILTERS } = require("devtools/client/webconsole/new-console-output/constants");
+const { FILTERS, PREFS } = require("devtools/client/webconsole/new-console-output/constants");
 const { stubPackets } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
 const { stubPreparedMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
+const ServicesMock = require("Services");
 
 describe("Filtering", () => {
   let store;
   let numMessages;
   // Number of messages in prepareBaseStore which are not filtered out, i.e. Evaluation
   // Results, console commands and console.groups .
   const numUnfilterableMessages = 3;
 
@@ -210,41 +211,62 @@ describe("Clear filters", () => {
     store.dispatch(actions.filterToggle(FILTERS.CSS));
     store.dispatch(actions.filterToggle(FILTERS.NET));
     store.dispatch(actions.filterToggle(FILTERS.NETXHR));
     store.dispatch(actions.filterTextSet("foobar"));
 
     let filters = getAllFilters(store.getState());
     expect(filters.toJS()).toEqual({
       // default
-      "warn": true,
-      "log": true,
-      "info": true,
-      "debug": true,
-      "css": true,
+      [FILTERS.WARN]: true,
+      [FILTERS.LOG]: true,
+      [FILTERS.INFO]: true,
+      [FILTERS.DEBUG]: true,
       // changed
-      "error": false,
-      "net": true,
-      "netxhr": true,
-      "text": "foobar",
+      [FILTERS.ERROR]: false,
+      [FILTERS.CSS]: true,
+      [FILTERS.NET]: true,
+      [FILTERS.NETXHR]: true,
+      [FILTERS.TEXT]: "foobar",
+    });
+    expect(ServicesMock.prefs.testHelpers.getFiltersPrefs()).toEqual({
+      [PREFS.FILTER.WARN]: true,
+      [PREFS.FILTER.LOG]: true,
+      [PREFS.FILTER.INFO]: true,
+      [PREFS.FILTER.DEBUG]: true,
+      [PREFS.FILTER.ERROR]: false,
+      [PREFS.FILTER.CSS]: true,
+      [PREFS.FILTER.NET]: true,
+      [PREFS.FILTER.NETXHR]: true,
     });
 
     store.dispatch(actions.filtersClear());
 
     filters = getAllFilters(store.getState());
     expect(filters.toJS()).toEqual({
-      "css": false,
-      "debug": true,
-      "error": true,
-      "info": true,
-      "log": true,
-      "net": false,
-      "netxhr": false,
-      "warn": true,
-      "text": "",
+      [FILTERS.CSS]: false,
+      [FILTERS.DEBUG]: true,
+      [FILTERS.ERROR]: true,
+      [FILTERS.INFO]: true,
+      [FILTERS.LOG]: true,
+      [FILTERS.NET]: false,
+      [FILTERS.NETXHR]: false,
+      [FILTERS.WARN]: true,
+      [FILTERS.TEXT]: "",
+    });
+
+    expect(ServicesMock.prefs.testHelpers.getFiltersPrefs()).toEqual({
+      [PREFS.FILTER.CSS]: false,
+      [PREFS.FILTER.DEBUG]: true,
+      [PREFS.FILTER.ERROR]: true,
+      [PREFS.FILTER.INFO]: true,
+      [PREFS.FILTER.LOG]: true,
+      [PREFS.FILTER.NET]: false,
+      [PREFS.FILTER.NETXHR]: false,
+      [PREFS.FILTER.WARN]: true,
     });
   });
 });
 
 describe("Resets filters", () => {
   it("resets default filters value to their original one.", () => {
     const store = setupStore([]);
 
@@ -254,43 +276,65 @@ describe("Resets filters", () => {
     store.dispatch(actions.filterToggle(FILTERS.CSS));
     store.dispatch(actions.filterToggle(FILTERS.NET));
     store.dispatch(actions.filterToggle(FILTERS.NETXHR));
     store.dispatch(actions.filterTextSet("foobar"));
 
     let filters = getAllFilters(store.getState());
     expect(filters.toJS()).toEqual({
       // default
-      "warn": true,
-      "info": true,
-      "debug": true,
+      [FILTERS.WARN]: true,
+      [FILTERS.INFO]: true,
+      [FILTERS.DEBUG]: true,
       // changed
-      "error": false,
-      "log": false,
-      "css": true,
-      "net": true,
-      "netxhr": true,
-      "text": "foobar",
+      [FILTERS.ERROR]: false,
+      [FILTERS.LOG]: false,
+      [FILTERS.CSS]: true,
+      [FILTERS.NET]: true,
+      [FILTERS.NETXHR]: true,
+      [FILTERS.TEXT]: "foobar",
+    });
+
+    expect(ServicesMock.prefs.testHelpers.getFiltersPrefs()).toEqual({
+      [PREFS.FILTER.WARN]: true,
+      [PREFS.FILTER.INFO]: true,
+      [PREFS.FILTER.DEBUG]: true,
+      [PREFS.FILTER.ERROR]: false,
+      [PREFS.FILTER.LOG]: false,
+      [PREFS.FILTER.CSS]: true,
+      [PREFS.FILTER.NET]: true,
+      [PREFS.FILTER.NETXHR]: true,
     });
 
     store.dispatch(actions.defaultFiltersReset());
 
     filters = getAllFilters(store.getState());
     expect(filters.toJS()).toEqual({
       // default
-      "error": true,
-      "warn": true,
-      "log": true,
-      "info": true,
-      "debug": true,
-      "text": "",
+      [FILTERS.ERROR]: true,
+      [FILTERS.WARN]: true,
+      [FILTERS.LOG]: true,
+      [FILTERS.INFO]: true,
+      [FILTERS.DEBUG]: true,
+      [FILTERS.TEXT]: "",
       // non-default filters weren't changed
-      "css": true,
-      "net": true,
-      "netxhr": true,
+      [FILTERS.CSS]: true,
+      [FILTERS.NET]: true,
+      [FILTERS.NETXHR]: true,
+    });
+
+    expect(ServicesMock.prefs.testHelpers.getFiltersPrefs()).toEqual({
+      [PREFS.FILTER.ERROR]: true,
+      [PREFS.FILTER.WARN]: true,
+      [PREFS.FILTER.LOG]: true,
+      [PREFS.FILTER.INFO]: true,
+      [PREFS.FILTER.DEBUG]: true,
+      [PREFS.FILTER.CSS]: true,
+      [PREFS.FILTER.NET]: true,
+      [PREFS.FILTER.NETXHR]: true,
     });
   });
 });
 
 function prepareBaseStore() {
   const store = setupStore([
     // Console API
     "console.log('foobar', 'test')",
--- a/devtools/shared/css/parsing-utils.js
+++ b/devtools/shared/css/parsing-utils.js
@@ -245,16 +245,38 @@ function parseCommentDeclarations(isCssP
 function getEmptyDeclaration() {
   return {name: "", value: "", priority: "",
           terminator: "",
           offsets: [undefined, undefined],
           colonOffsets: false};
 }
 
 /**
+ * Like trim, but only trims CSS-allowed whitespace.
+ */
+function cssTrim(str) {
+  let match = /^[ \t\r\n\f]*(.*?)[ \t\r\n\f]*$/.exec(str);
+  if (match) {
+    return match[1];
+  }
+  return str;
+}
+
+/**
+ * Like trimRight, but only trims CSS-allowed whitespace.
+ */
+function cssTrimRight(str) {
+  let match = /^(.*?)[ \t\r\n\f]*$/.exec(str);
+  if (match) {
+    return match[1];
+  }
+  return str;
+}
+
+/**
  * A helper function that does all the parsing work for
  * parseDeclarations.  This is separate because it has some arguments
  * that don't make sense in isolation.
  *
  * The return value and arguments are like parseDeclarations, with
  * these additional arguments.
  *
  * @param {Function} isCssPropertyKnown
@@ -305,17 +327,17 @@ function parseDeclarationsInternal(isCss
                !lastProp.priority && lastProp.colonOffsets[1]) {
       // Whitespace appearing after the ":" is attributed to it.
       lastProp.colonOffsets[1] = token.endOffset;
     }
 
     if (token.tokenType === "symbol" && token.text === ":") {
       if (!lastProp.name) {
         // Set the current declaration name if there's no name yet
-        lastProp.name = current.trim();
+        lastProp.name = cssTrim(current);
         lastProp.colonOffsets = [token.startOffset, token.endOffset];
         current = "";
         hasBang = false;
 
         // When parsing a comment body, if the left-hand-side is not a
         // valid property name, then drop it and stop parsing.
         if (inComment && !commentOverride &&
             !isCssPropertyKnown(lastProp.name)) {
@@ -331,17 +353,17 @@ function parseDeclarationsInternal(isCss
       lastProp.terminator = "";
       // When parsing a comment, if the name hasn't been set, then we
       // have probably just seen an ordinary semicolon used in text,
       // so drop this and stop parsing.
       if (inComment && !lastProp.name) {
         current = "";
         break;
       }
-      lastProp.value = current.trim();
+      lastProp.value = cssTrim(current);
       current = "";
       hasBang = false;
       declarations.push(getEmptyDeclaration());
       lastProp = declarations[declarations.length - 1];
     } else if (token.tokenType === "ident") {
       if (token.text === "important" && hasBang) {
         lastProp.priority = "important";
         hasBang = false;
@@ -379,21 +401,21 @@ function parseDeclarationsInternal(isCss
   }
 
   // Handle whatever trailing properties or values might still be there
   if (current) {
     if (!lastProp.name) {
       // Ignore this case in comments.
       if (!inComment) {
         // Trailing property found, e.g. p1:v1;p2:v2;p3
-        lastProp.name = current.trim();
+        lastProp.name = cssTrim(current);
       }
     } else {
       // Trailing value found, i.e. value without an ending ;
-      lastProp.value = current.trim();
+      lastProp.value = cssTrim(current);
       let terminator = lexer.performEOFFixup("", true);
       lastProp.terminator = terminator + ";";
       // If the input was unterminated, attribute the remainder to
       // this property.  This avoids some bad behavior when rewriting
       // an unterminated comment.
       if (terminator) {
         lastProp.offsets[1] = inputString.length;
       }
@@ -828,17 +850,17 @@ RuleRewriter.prototype = {
                                      decl.colonOffsets[1]);
       this.result += unescapeCSSComment(commentNamePart);
 
       // When uncommenting, we must be sure to sanitize the text, to
       // avoid things like /* decl: }; */, which will be accepted as
       // a property but which would break the entire style sheet.
       let newText = this.inputString.substring(decl.colonOffsets[1],
                                                decl.offsets[1]);
-      newText = unescapeCSSComment(newText).trimRight();
+      newText = cssTrimRight(unescapeCSSComment(newText));
       this.result += this.sanitizeText(newText, index) + ";";
 
       // See if the comment end can be deleted.
       let trailingText = this.inputString.substring(decl.offsets[1]);
       if (EMPTY_COMMENT_END_RX.test(trailingText)) {
         copyOffset = decl.commentOffsets[1];
       } else {
         this.result += " /*";
--- a/devtools/shared/l10n.js
+++ b/devtools/shared/l10n.js
@@ -146,23 +146,24 @@ LocalizationHelper.prototype = {
    * @param number number
    *        The number to convert.
    * @param number decimals [optional]
    *        Total decimals to keep.
    * @return string
    *         The localized number as a string.
    */
   numberWithDecimals: function (number, decimals = 0) {
-    // If this is an integer, don't do anything special.
+    // Do not show decimals for integers.
     if (number === (number|0)) {
-      return number;
+      return getNumberFormatter(0).format(number);
     }
+
     // If this isn't a number (and yes, `isNaN(null)` is false), return zero.
     if (isNaN(number) || number === null) {
-      return "0";
+      return getNumberFormatter(0).format(0);
     }
 
     // Localize the number using a memoized Intl.NumberFormat formatter.
     let localized = getNumberFormatter(decimals).format(number);
 
     // Convert the localized number to a number again.
     let localizedNumber = localized * 1;
     // Check if this number is now equal to an integer.
--- a/devtools/shim/aboutdevtools/aboutdevtools.css
+++ b/devtools/shim/aboutdevtools/aboutdevtools.css
@@ -1,44 +1,54 @@
+:root {
+  /* Photon color variables used on the aboutdevtools page */
+  --blue-60: #0060df;
+  --blue-70: #003eaa;
+  --blue-80: #002275;
+  --grey-30: #d7d7db;
+  --white: #ffffff;
+}
+
 .box {
-  width: 980px;
+  width: 100vw;
+  max-width: 850px;
   display: flex;
   align-items: center;
   height: 400px;
 }
 
 .wrapper {
   display: flex;
   flex-direction: column;
   position: absolute;
   align-items: center;
   width: 100%;
 }
 
 .left-pane {
   width: 360px;
   background-image: url(images/otter.png);
-  background-size: 100%;
+  background-size: 85%;
   background-position: 50%;
   background-repeat: no-repeat;
   height: 100%;
   flex-shrink: 0;
 }
 
 .message {
   line-height: 1.6em;
 }
 
 .right-pane {
   height: 250px;
 }
 
 .features {
   max-width: 980px;
-  border-top: 1px solid #d7d7db;
+  border-top: 1px solid var(--grey-30);
 }
 
 .features-list {
   display: grid;
   grid-template-columns: repeat(3, 1fr);
   grid-gap: 40px 20px;
   margin: 40px;
   padding: 0;
@@ -48,48 +58,69 @@
   list-style: none;
   text-align: center;
 }
 
 .feature-desc {
   margin: 1em 20px
 }
 
-a {
-  color: #0A84FF;
+.installpage-link {
+  color: var(--blue-60);
 }
 
-h1 {
-  font-size: 36px;
+.installpage-link::after {
+  content: "";
+
+  display: inline-block;
+  height: 16px;
+  width: 16px;
+
+  margin: 0 5px;
+  vertical-align: middle;
+
+  background-image: url(images/external-link.svg);
+  background-repeat: no-repeat;
+  background-size: 16px 16px;
+}
+
+.installpage-title {
+  font-size: 33px;
   margin-top: 16px;
   font-weight: 300;
   line-height: 44px;
 }
 
 .installpage-button {
   display: block;
 
-  margin-top: 2em;
+  margin: 2em 0 0 0;
   padding: 10px 20px;
 
   border: none;
-  border-radius: 3px;
+  border-radius: 2px;
 
   font-size: 15px;
-  font-weight: 600;
+  font-weight: 400;
   line-height: 21px;
 
-  background-color: #0060df;
-  color: #fff;
+  background-color: var(--blue-60);
+  color: var(--white);
   box-shadow: 0 1px 0 rgba(0,0,0,0.23);
   cursor: pointer;
 }
 
 .installpage-button:enabled:hover {
-  background-color: #003eaa
+  background-color: var(--blue-70)
+}
+
+.installpage-button:active,
+.installpage-button:hover:active,
+.installpage-button:enabled:hover:active {
+  background-color: var(--blue-80);
 }
 
 /* Remove light gray outline when clicking on the button */
 .installpage-button::-moz-focus-inner {
   border: 0;
 }
 
 [hidden="true"] {
--- a/devtools/shim/aboutdevtools/aboutdevtools.xhtml
+++ b/devtools/shim/aboutdevtools/aboutdevtools.xhtml
@@ -16,28 +16,28 @@
   <link rel="stylesheet" href="chrome://devtools-shim/content/aboutdevtools/aboutdevtools.css"  type="text/css"/>
   <script type="application/javascript" src="chrome://devtools-shim/content/aboutdevtools/aboutdevtools.js"></script>
 </head>
 <body>
   <div id="install-page" class="wrapper" hidden="true">
     <div class="box">
       <div class="left-pane" />
       <div class="right-pane">
-        <h1 id="common-title" hidden="true">&aboutDevtools.enable.title;</h1>
-        <h1 id="inspect-title" hidden="true">&aboutDevtools.enable.inspectElementTitle;</h1>
+        <h1 class="installpage-title" id="common-title" hidden="true">&aboutDevtools.enable.title;</h1>
+        <h1 class="installpage-title" id="inspect-title" hidden="true">&aboutDevtools.enable.inspectElementTitle;</h1>
 
         <!-- Include all the possible message, hidden by default
              as we can't lazily load localized strings from dtd -->
         <p class="message" id="about-debugging-message" hidden="true">&aboutDevtools.enable.aboutDebuggingMessage;</p>
         <p class="message" id="menu-message" hidden="true">&aboutDevtools.enable.menuMessage;</p>
         <p class="message" id="key-shortcut-message" hidden="true">&aboutDevtools.enable.keyShortcutMessage;</p>
         <p class="message" id="inspect-element-message" hidden="true">&aboutDevtools.enable.inspectElementMessage;</p>
 
         <p class="message">&aboutDevtools.enable.commonMessage;</p>
-        <a href="https://developer.mozilla.org/docs/Tools" target="_blank">&aboutDevtools.enable.learnMoreLink;</a>
+        <a class="installpage-link" href="https://developer.mozilla.org/docs/Tools" target="_blank">&aboutDevtools.enable.learnMoreLink;</a>
         <button class="installpage-button" id="install">&aboutDevtools.enable.installButton;</button>
       </div>
     </div>
   </div>
 
   <!-- This page, hidden by default is displayed once the add-on is installed -->
   <div id="welcome-page" class="wrapper" hidden="true">
     <div class="box">
@@ -98,32 +98,14 @@
           <p class="feature-desc">Unblock bottlenecks, streamline processes, optimize assets.</p>
         </li>
 
         <li class="feature">
           <img class="feature-icon" src="chrome://devtools-shim/content/aboutdevtools/images/feature-memory.svg" alt=""/>
           <h3 class="feature-name">Memory</h3>
           <p class="feature-desc">Find memory leaks and make your application zippy.</p>
         </li>
-
-        <li class="feature">
-          <img class="feature-icon" src="chrome://devtools-shim/content/aboutdevtools/images/feature-web-audio.svg" alt=""/>
-          <h3 class="feature-name">Web Audio</h3>
-          <p class="feature-desc">The only developer tool for inspecting the Web Audio API.</p>
-        </li>
-
-        <li class="feature">
-          <img class="feature-icon" src="chrome://devtools-shim/content/aboutdevtools/images/feature-scratchpad.svg" alt=""/>
-          <h3 class="feature-name">Scratchpad</h3>
-          <p class="feature-desc">Edit, write, run and execute JavaScript in real time.</p>
-        </li>
-
-        <li class="feature">
-          <img class="feature-icon" src="chrome://devtools-shim/content/aboutdevtools/images/feature-style-editor.svg" alt=""/>
-          <h3 class="feature-name">Style Editor</h3>
-          <p class="feature-desc">Edit and manage all your CSS stylesheets in your browser.</p>
-        </li>
       </ul>
     </div>
   </div>
 
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/devtools/shim/aboutdevtools/images/external-link.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
+  <path fill="#003eaa" d="M14.923 1.618A1 1 0 0 0 14 1H9a1 1 0 0 0 0 2h2.586L8.293 6.293a1 1 0 1 0 1.414 1.414L13 4.414V7a1 1 0 0 0 2 0V2a1 1 0 0 0-.077-.382z"/>
+  <path fill="#0060df" d="M14 10a1 1 0 0 0-1 1v2H3V3h2a1 1 0 0 0 0-2H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1z"/>
+</svg>
deleted file mode 100644
--- a/devtools/shim/aboutdevtools/images/feature-scratchpad.svg
+++ /dev/null
@@ -1,1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="222" height="122" viewBox="0 0 222 122"><defs><filter id="a" filterUnits="userSpaceOnUse" x="53.5" y="11.8" width="114" height="106.4"><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"/></filter></defs><mask maskUnits="userSpaceOnUse" x="53.5" y="11.8" width="114" height="106.4" id="b"><path fill="#FFF" d="M167.5 11.8v106.3h-114V11.8z" filter="url(#a)"/></mask><path mask="url(#b)" fill="#306EFD" d="M67.4 14.7c-6 0-11 4.9-11 11v78.6c0 6 4.9 11 11 11h86.2c6 0 11-4.9 11-11V25.6c0-6-4.9-11-11-11H67.4zm86.2 103.4H67.4c-7.7 0-13.9-6.2-13.9-13.9V25.6c0-7.7 6.2-13.9 13.9-13.9h86.2c7.7 0 13.9 6.2 13.9 13.9v78.6c0 7.7-6.2 13.9-13.9 13.9z"/><path fill="#0022A9" d="M132 23.4h2.9V3.5H132m16.2 19.9h2.9V3.5h-2.9m-31.8 19.9h2.9V3.5h-2.9m-15.7 19.9h2.9V3.5h-2.9M85.1 23.4H88V3.5h-2.9M69.4 23.4h3V3.5h-3"/><path fill="#4DE5FF" d="M77.8 41.3h66.6v-2.9H77.8m0 20.2h66.6v-2.9H77.8m0 20.2h66.6V73H77.8m48 20.2h18.6v-2.9h-18.6m-48 2.9h48v-2.9h-48"/></svg>
deleted file mode 100644
--- a/devtools/shim/aboutdevtools/images/feature-style-editor.svg
+++ /dev/null
@@ -1,1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="222" height="122" viewBox="0 0 222 122"><path fill="#306EFD" d="M53.5 27.5v89.6h90.3V50h-3.1v64H56.6V30.7h69.7v-3.2"/><path fill="#4DE5FF" d="M120.6 94.1H76.7V50.5H103v3.2H79.9v37.2h37.6V73.3h3.1"/><path fill="#0022A9" d="M96.6 80.8c-1.2 0-2.3-.4-3-1.1-1.1-1.2-1.4-3.1-.6-5.6l3.6-17 35.9-36.2 2.2 2.2-35.2 35.5-3.4 16.2c-.5 1.8-.3 2.5-.2 2.6.1.2.9.3 2.5-.1l16.7-3L150 39l2.2 2.2-35.6 36-17.5 3.2c-.9.2-1.7.4-2.5.4"/><path fill="#306EFD" d="M168.5 14.2c0-2.2-.8-4.3-2.4-5.8l-1-1c-3.2-3.2-8.4-3.2-11.5 0l-16.3 16L126.1 12l-2.2 2.2L159 49.7l2.2-2.2L150 36.2 166.1 20c1.5-1.6 2.4-3.6 2.4-5.8zm-4.6 3.5L147.8 34l-8.3-8.4 16.3-16c2-2 5.2-2 7.1 0l1 1c1 1 1.5 2.2 1.5 3.6-.1 1.3-.6 2.6-1.5 3.5z"/></svg>
deleted file mode 100644
--- a/devtools/shim/aboutdevtools/images/feature-web-audio.svg
+++ /dev/null
@@ -1,1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="222" height="122" viewBox="0 0 222 122"><path fill="#306EFD" d="M130.7 103.3H36.5c-5.2 0-9.5-4.3-9.5-9.5V4.4h145.5v44.9h-2.8V7.2h-140v86.6c0 3.7 3 6.7 6.7 6.7h94.2v2.8z"/><path fill="#306EFD" d="M28.4 30h142.7v-2.8H28.4M43 17.2c0 2-1.6 3.5-3.5 3.5-2 0-3.5-1.6-3.5-3.5s1.6-3.5 3.5-3.5c1.9-.1 3.5 1.5 3.5 3.5M54.8 17.2c0 2-1.6 3.5-3.5 3.5-2 0-3.5-1.6-3.5-3.5s1.6-3.5 3.5-3.5c1.9-.1 3.5 1.5 3.5 3.5M66.7 17.2c0 2-1.6 3.5-3.5 3.5-2 0-3.5-1.6-3.5-3.5s1.6-3.5 3.5-3.5c1.9-.1 3.5 1.5 3.5 3.5M39.4 49.4h47v-2.7h-47M39.4 78.5h47v-2.7h-47M93.8 49.4h18.5v-2.7H93.8M39.4 64h61.9v-2.8H39.4"/><path fill="#0022A9" d="M158.6 49.8c-18 0-32.7 14.6-32.7 32.6s14.7 32.6 32.7 32.6 32.7-14.6 32.7-32.6-14.7-32.6-32.7-32.6m0 68c-19.6 0-35.5-15.9-35.5-35.4s16-35.4 35.5-35.4 35.5 15.9 35.5 35.4-15.9 35.4-35.5 35.4"/><path fill="#4DE5FF" d="M183 93.8c-3.4 0-4.6-5.2-5.9-11.2-.6-2.7-2-9-3.2-9-1.2 0-2.6 6.3-3.2 9-1.4 6-2.5 11.1-5.9 11.1-3.4 0-4.6-5.2-5.9-11.1-.6-2.7-2-9-3.2-9-1.2 0-2.6 6.3-3.2 9-1.4 6-2.5 11.1-5.9 11.1s-4.6-5.2-5.9-11.2c-.6-2.7-2-9-3.2-9v-2.8c3.4 0 4.6 5.2 5.9 11.1.6 2.7 2 9 3.2 9 1.2 0 2.6-6.3 3.2-9 1.4-6 2.5-11.1 5.9-11.1 3.4 0 4.6 5.2 5.9 11.1.6 2.7 2 9 3.2 9 1.2 0 2.6-6.3 3.2-9 1.4-6 2.5-11.2 5.9-11.2s4.6 5.2 5.9 11.1c.6 2.7 2 9 3.2 9v3.1z"/></svg>
--- a/devtools/shim/aboutdevtools/tmp-locale/aboutdevtools.dtd
+++ b/devtools/shim/aboutdevtools/tmp-locale/aboutdevtools.dtd
@@ -2,23 +2,23 @@
    - 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/. -->
 
 <!ENTITY  aboutDevtools.headTitle "About Developer Tools">
 <!ENTITY  aboutDevtools.enable.title "Enable Firefox Developer Tools">
 <!ENTITY  aboutDevtools.enable.inspectElementTitle "Enable Firefox Developer Tools to use Inspect Element">
 
 <!ENTITY  aboutDevtools.enable.aboutDebuggingMessage
-          "Develop and debug WebExtensions, web workers, service workers and more with the Firefox DevTools.">
+          "Develop and debug WebExtensions, web workers, service workers and more with Firefox DevTools.">
 <!ENTITY  aboutDevtools.enable.inspectElementMessage
           "Examine and edit HTML and CSS with the DevTools Inspector.">
 <!ENTITY  aboutDevtools.enable.keyShortcutMessage
-          "You activated a Developer Tool shortcut. If that was a mistake, you can close this tab.">
+          "You activated a Developer Tools shortcut. If that was a mistake, you can close this tab.">
 <!ENTITY  aboutDevtools.enable.menuMessage
           "Examine, edit and debug HTML, CSS, and JavaScript with tools like Inspector and Debugger.">
 
 <!ENTITY  aboutDevtools.enable.commonMessage
           "As of Firefox 58, Developer Tools are disabled by default to give you more control over your browser.">
 
 <!ENTITY  aboutDevtools.enable.learnMoreLink "Learn more about DevTools">
 <!ENTITY  aboutDevtools.enable.installButton "Enable Developer Tools">
 <!ENTITY  aboutDevtools.welcome.title "Welcome to Firefox Developer Tools!">
-<!ENTITY  aboutDevtools.welcome.message "You’ve successfully enabled DevTools! To get started explore the Web Developer menu or open the tools with ##INSPECTOR_SHORTCUT##.">
\ No newline at end of file
+<!ENTITY  aboutDevtools.welcome.message "You’ve successfully enabled DevTools! To get started, explore the Web Developer menu or open the tools with ##INSPECTOR_SHORTCUT##.">
\ No newline at end of file
--- a/devtools/shim/jar.mn
+++ b/devtools/shim/jar.mn
@@ -9,22 +9,20 @@ devtools-shim.jar:
     content/aboutdevtools/aboutdevtools.js (aboutdevtools/aboutdevtools.js)
 
     content/aboutdevtools/images/otter.png (aboutdevtools/images/otter.png)
 
     # Temporary localisation file, move back to devtools/shim/locales/en-US when ready for localization
     # See https://bugzilla.mozilla.org/show_bug.cgi?id=1408369
     content/aboutdevtools/tmp-locale/aboutdevtools.dtd (aboutdevtools/tmp-locale/aboutdevtools.dtd)
 
+    content/aboutdevtools/images/external-link.svg (aboutdevtools/images/external-link.svg)
     content/aboutdevtools/images/feature-inspector.svg (aboutdevtools/images/feature-inspector.svg)
     content/aboutdevtools/images/feature-console.svg (aboutdevtools/images/feature-console.svg)
     content/aboutdevtools/images/feature-debugger.svg (aboutdevtools/images/feature-debugger.svg)
     content/aboutdevtools/images/feature-network.svg (aboutdevtools/images/feature-network.svg)
     content/aboutdevtools/images/feature-memory.svg (aboutdevtools/images/feature-memory.svg)
     content/aboutdevtools/images/feature-visual-editing.svg (aboutdevtools/images/feature-visual-editing.svg)
     content/aboutdevtools/images/feature-responsive-mode.svg (aboutdevtools/images/feature-responsive-mode.svg)
     content/aboutdevtools/images/feature-storage.svg (aboutdevtools/images/feature-storage.svg)
     content/aboutdevtools/images/feature-performance.svg (aboutdevtools/images/feature-performance.svg)
-    content/aboutdevtools/images/feature-style-editor.svg (aboutdevtools/images/feature-style-editor.svg)
-    content/aboutdevtools/images/feature-web-audio.svg (aboutdevtools/images/feature-web-audio.svg)
-    content/aboutdevtools/images/feature-scratchpad.svg (aboutdevtools/images/feature-scratchpad.svg)
 
     content/DevToolsShim.jsm  (DevToolsShim.jsm)
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -866,16 +866,19 @@ nsDocShell::nsDocShell()
   }
 #endif
 }
 
 nsDocShell::~nsDocShell()
 {
   MOZ_ASSERT(!mObserved);
 
+  // Avoid notifying observers while we're in the dtor.
+  mIsBeingDestroyed = true;
+
   Destroy();
 
   nsCOMPtr<nsISHistoryInternal> shPrivate(do_QueryInterface(mSessionHistory));
   if (shPrivate) {
     shPrivate->SetRootDocShell(nullptr);
   }
 
   if (--gDocShellCount == 0) {
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -120,33 +120,35 @@ KeyframeEffectReadOnly::NotifyAnimationT
   // the compositor and hence they won't have their compositor status
   // updated. As a result, we need to make sure we clear their compositor
   // status here.
   bool isRelevant = mAnimation && mAnimation->IsRelevant();
   if (!isRelevant) {
     ResetIsRunningOnCompositor();
   }
 
-  // Detect changes to "in effect" status since we need to recalculate the
-  // animation cascade for this element whenever that changes.
-  bool inEffect = IsInEffect();
-  if (inEffect != mInEffectOnLastAnimationTimingUpdate) {
-    MarkCascadeNeedsUpdate();
-    mInEffectOnLastAnimationTimingUpdate = inEffect;
-  }
-
   // Request restyle if necessary.
   if (mAnimation && !mProperties.IsEmpty() && HasComputedTimingChanged()) {
     EffectCompositor::RestyleType restyleType =
       CanThrottle() ?
       EffectCompositor::RestyleType::Throttled :
       EffectCompositor::RestyleType::Standard;
     RequestRestyle(restyleType);
   }
 
+  // Detect changes to "in effect" status since we need to recalculate the
+  // animation cascade for this element whenever that changes.
+  // Note that updating mInEffectOnLastAnimationTimingUpdate has to be done
+  // after above CanThrottle() call since the function uses the flag inside it.
+  bool inEffect = IsInEffect();
+  if (inEffect != mInEffectOnLastAnimationTimingUpdate) {
+    MarkCascadeNeedsUpdate();
+    mInEffectOnLastAnimationTimingUpdate = inEffect;
+  }
+
   // If we're no longer "in effect", our ComposeStyle method will never be
   // called and we will never have a chance to update mProgressOnLastCompose
   // and mCurrentIterationOnLastCompose.
   // We clear them here to ensure that if we later become "in effect" we will
   // request a restyle (above).
   if (!inEffect) {
      mProgressOnLastCompose.SetNull();
      mCurrentIterationOnLastCompose = 0;
@@ -968,16 +970,21 @@ KeyframeEffectReadOnly::UpdateTargetRegi
              "Out of date Animation::IsRelevant value");
 
   if (isRelevant && !mInEffectSet) {
     EffectSet* effectSet =
       EffectSet::GetOrCreateEffectSet(mTarget->mElement, mTarget->mPseudoType);
     effectSet->AddEffect(*this);
     mInEffectSet = true;
     UpdateEffectSet(effectSet);
+    nsIFrame* f = mTarget->mElement->GetPrimaryFrame();
+    while (f) {
+      f->MarkNeedsDisplayItemRebuild();
+      f = f->GetNextContinuation();
+    }
   } else if (!isRelevant && mInEffectSet) {
     UnregisterTarget();
   }
 }
 
 void
 KeyframeEffectReadOnly::UnregisterTarget()
 {
@@ -992,16 +999,21 @@ KeyframeEffectReadOnly::UnregisterTarget
   mInEffectSet = false;
   if (effectSet) {
     effectSet->RemoveEffect(*this);
 
     if (effectSet->IsEmpty()) {
       EffectSet::DestroyEffectSet(mTarget->mElement, mTarget->mPseudoType);
     }
   }
+  nsIFrame* f = mTarget->mElement->GetPrimaryFrame();
+  while (f) {
+    f->MarkNeedsDisplayItemRebuild();
+    f = f->GetNextContinuation();
+  }
 }
 
 void
 KeyframeEffectReadOnly::RequestRestyle(
   EffectCompositor::RestyleType aRestyleType)
 {
    if (!mTarget) {
     return;
@@ -1370,19 +1382,20 @@ KeyframeEffectReadOnly::CanThrottle() co
     // a) No target element
     // b) The target element has no frame, e.g. because it is in a display:none
     //    subtree.
     // In either case we can throttle the animation because there is no
     // need to update on the main thread.
     return true;
   }
 
-  // We can throttle the animation if the animation is paint only and
-  // the target frame is out of view or the document is in background tabs.
-  if (CanIgnoreIfNotVisible()) {
+  // Unless we are newly in-effect, we can throttle the animation if the
+  // animation is paint only and the target frame is out of view or the document
+  // is in background tabs.
+  if (mInEffectOnLastAnimationTimingUpdate && CanIgnoreIfNotVisible()) {
     nsIPresShell* presShell = GetPresShell();
     if ((presShell && !presShell->IsActive()) ||
         frame->IsScrolledOutOfView()) {
       return true;
     }
   }
 
   // First we need to check layer generation and transform overflow
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -22,17 +22,17 @@
 #include "nsContentUtils.h" // For GetContextForContent
 #include "nsCSSParser.h"
 #include "nsCSSPropertyIDSet.h"
 #include "nsCSSProps.h"
 #include "nsCSSPseudoElements.h" // For CSSPseudoElementType
 #include "nsIScriptError.h"
 #include "nsStyleContext.h"
 #include "nsTArray.h"
-#include <algorithm> // For std::stable_sort
+#include <algorithm> // For std::stable_sort, std::min
 
 namespace mozilla {
 
 // ------------------------------------------------------------------
 //
 // Internal data types
 //
 // ------------------------------------------------------------------
@@ -1387,40 +1387,26 @@ GetKeyframeListFromPropertyIndexedKeyfra
   // get its explicit dictionary members.
   dom::binding_detail::FastBasePropertyIndexedKeyframe keyframeDict;
   if (!keyframeDict.Init(aCx, aValue, "BasePropertyIndexedKeyframe argument",
                          false)) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
 
-  Maybe<dom::CompositeOperation> composite;
-  if (keyframeDict.mComposite.WasPassed()) {
-    composite.emplace(keyframeDict.mComposite.Value());
-  }
-
   // Get all the property--value-list pairs off the object.
   JS::Rooted<JSObject*> object(aCx, &aValue.toObject());
   nsTArray<PropertyValuesPair> propertyValuesPairs;
   if (!GetPropertyValuesPairs(aCx, object, ListAllowance::eAllow,
                               aDocument->GetStyleBackendType(),
                               propertyValuesPairs)) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
 
-  // Parse the easing property. We need to do this after reading off the
-  // property values since this is conceptually a separate step that happens
-  // after the WebIDL-like processing.
-  Maybe<ComputedTimingFunction> easing =
-    TimingParams::ParseEasing(keyframeDict.mEasing, aDocument, aRv);
-  if (aRv.Failed()) {
-    return;
-  }
-
   // Create a set of keyframes for each property.
   nsCSSParser parser(aDocument->CSSLoader());
   nsClassHashtable<nsFloatHashKey, Keyframe> processedKeyframes;
   for (const PropertyValuesPair& pair : propertyValuesPairs) {
     size_t count = pair.mValues.Length();
     if (count == 0) {
       // No animation values for this property.
       continue;
@@ -1439,18 +1425,16 @@ GetKeyframeListFromPropertyIndexedKeyfra
     size_t i = 0;
 
     for (const nsString& stringValue : pair.mValues) {
       // For single-valued lists, the single value should be added to a
       // keyframe with offset 1.
       double offset = n ? i++ / double(n) : 1;
       Keyframe* keyframe = processedKeyframes.LookupOrAdd(offset);
       if (keyframe->mPropertyValues.IsEmpty()) {
-        keyframe->mTimingFunction = easing;
-        keyframe->mComposite = composite;
         keyframe->mComputedOffset = offset;
       }
 
       Maybe<PropertyValuePair> valuePair =
         MakePropertyValuePair(pair.mProperty, stringValue, parser, aDocument);
       if (!valuePair) {
         continue;
       }
@@ -1459,16 +1443,134 @@ GetKeyframeListFromPropertyIndexedKeyfra
   }
 
   aResult.SetCapacity(processedKeyframes.Count());
   for (auto iter = processedKeyframes.Iter(); !iter.Done(); iter.Next()) {
     aResult.AppendElement(Move(*iter.UserData()));
   }
 
   aResult.Sort(ComputedOffsetComparator());
+
+  // Fill in any specified offsets
+  //
+  // This corresponds to step 5, "Otherwise," branch, substeps 5-6 of
+  // https://w3c.github.io/web-animations/#processing-a-keyframes-argument
+  const FallibleTArray<Nullable<double>>* offsets = nullptr;
+  AutoTArray<Nullable<double>, 1> singleOffset;
+  auto& offset = keyframeDict.mOffset;
+  if (offset.IsDouble()) {
+    singleOffset.AppendElement(offset.GetAsDouble());
+    // dom::Sequence is a fallible but AutoTArray is infallible and we need to
+    // point to one or the other. Fortunately, fallible and infallible array
+    // types can be implicitly converted provided they are const.
+    const FallibleTArray<Nullable<double>>& asFallibleArray = singleOffset;
+    offsets = &asFallibleArray;
+  } else if (offset.IsDoubleOrNullSequence()) {
+    offsets = &offset.GetAsDoubleOrNullSequence();
+  }
+  // If offset.IsNull() is true, then we want to leave the mOffset member of
+  // each keyframe with its initialized value of null. By leaving |offsets|
+  // as nullptr here, we skip updating mOffset below.
+
+  size_t offsetsToFill =
+    offsets ? std::min(offsets->Length(), aResult.Length()) : 0;
+  for (size_t i = 0; i < offsetsToFill; i++) {
+    if (!offsets->ElementAt(i).IsNull()) {
+      aResult[i].mOffset.emplace(offsets->ElementAt(i).Value());
+    }
+  }
+
+  // Check that the keyframes are loosely sorted and that any specified offsets
+  // are between 0.0 and 1.0 inclusive.
+  //
+  // This corresponds to steps 6-7 of
+  // https://w3c.github.io/web-animations/#processing-a-keyframes-argument
+  //
+  // In the spec, TypeErrors arising from invalid offsets and easings are thrown
+  // at the end of the procedure since it assumes we initially store easing
+  // values as strings and then later parse them.
+  //
+  // However, we will parse easing members immediately when we process them
+  // below. In order to maintain the relative order in which TypeErrors are
+  // thrown according to the spec, namely exceptions arising from invalid
+  // offsets are thrown before exceptions arising from invalid easings, we check
+  // the offsets here.
+  if (!HasValidOffsets(aResult)) {
+    aRv.ThrowTypeError<dom::MSG_INVALID_KEYFRAME_OFFSETS>();
+    aResult.Clear();
+    return;
+  }
+
+  // Fill in any easings.
+  //
+  // This corresponds to step 5, "Otherwise," branch, substeps 7-11 of
+  // https://w3c.github.io/web-animations/#processing-a-keyframes-argument
+  FallibleTArray<Maybe<ComputedTimingFunction>> easings;
+  auto parseAndAppendEasing = [&](const nsString& easingString,
+                                  ErrorResult& aRv) {
+    auto easing = TimingParams::ParseEasing(easingString, aDocument, aRv);
+    if (!aRv.Failed() && !easings.AppendElement(Move(easing), fallible)) {
+      aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
+    }
+  };
+
+  auto& easing = keyframeDict.mEasing;
+  if (easing.IsString()) {
+    parseAndAppendEasing(easing.GetAsString(), aRv);
+    if (aRv.Failed()) {
+      aResult.Clear();
+      return;
+    }
+  } else {
+    for (const nsString& easingString : easing.GetAsStringSequence()) {
+      parseAndAppendEasing(easingString, aRv);
+      if (aRv.Failed()) {
+        aResult.Clear();
+        return;
+      }
+    }
+  }
+
+  // If |easings| is empty, then we are supposed to fill it in with the value
+  // "linear" and then repeat the list as necessary.
+  //
+  // However, for Keyframe.mTimingFunction we represent "linear" as a None
+  // value. Since we have not assigned 'mTimingFunction' for any of the
+  // keyframes in |aResult| they will already have their initial None value
+  // (i.e. linear). As a result, if |easings| is empty, we don't need to do
+  // anything.
+  if (!easings.IsEmpty()) {
+    for (size_t i = 0; i < aResult.Length(); i++) {
+      aResult[i].mTimingFunction = easings[i % easings.Length()];
+    }
+  }
+
+  // Fill in any composite operations.
+  //
+  // This corresponds to step 5, "Otherwise," branch, substep 12 of
+  // https://w3c.github.io/web-animations/#processing-a-keyframes-argument
+  const FallibleTArray<dom::CompositeOperation>* compositeOps;
+  AutoTArray<dom::CompositeOperation, 1> singleCompositeOp;
+  auto& composite = keyframeDict.mComposite;
+  if (composite.IsCompositeOperation()) {
+    singleCompositeOp.AppendElement(composite.GetAsCompositeOperation());
+    const FallibleTArray<dom::CompositeOperation>& asFallibleArray =
+      singleCompositeOp;
+    compositeOps = &asFallibleArray;
+  } else {
+    compositeOps = &composite.GetAsCompositeOperationSequence();
+  }
+
+  // Fill in and repeat as needed.
+  if (!compositeOps->IsEmpty()) {
+    for (size_t i = 0; i < aResult.Length(); i++) {
+      aResult[i].mComposite.emplace(
+        compositeOps->ElementAt(i % compositeOps->Length()));
+    }
+  }
 }
 
 /**
  * Returns true if the supplied set of keyframes has keyframe values for
  * any property for which it does not also supply a value for the 0% and 100%
  * offsets. In this case we are supposed to synthesize an additive zero value
  * but since we don't support additive animation yet we can't support this
  * case. We try to detect that here so we can throw an exception. The check is
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -4570,16 +4570,17 @@ NoteDirtyElement(Element* aElement, uint
 
   // See the comment in nsIDocument::SetServoRestyleRoot about the !IsElement()
   // check there. Same justification here.
   MOZ_ASSERT(aElement == doc->GetServoRestyleRoot() ||
              !doc->GetServoRestyleRoot()->IsElement() ||
              nsContentUtils::ContentIsFlattenedTreeDescendantOfForStyle(
                aElement, doc->GetServoRestyleRoot()));
   MOZ_ASSERT(aElement == doc->GetServoRestyleRoot() ||
+             !doc->GetServoRestyleRoot()->IsElement() ||
              BitsArePropagated(parent, aBits, doc->GetServoRestyleRoot()));
   MOZ_ASSERT(doc->GetServoRestyleRootDirtyBits() & aBits);
 }
 
 void
 Element::NoteDirtySubtreeForServo()
 {
   MOZ_ASSERT(IsInComposedDoc());
--- a/dom/base/WindowNamedPropertiesHandler.cpp
+++ b/dom/base/WindowNamedPropertiesHandler.cpp
@@ -2,17 +2,16 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "WindowNamedPropertiesHandler.h"
 #include "mozilla/dom/EventTargetBinding.h"
 #include "mozilla/dom/WindowBinding.h"
-#include "mozilla/Preferences.h"
 #include "nsContentUtils.h"
 #include "nsDOMClassInfo.h"
 #include "nsDOMWindowList.h"
 #include "nsGlobalWindow.h"
 #include "nsHTMLDocument.h"
 #include "nsJSUtils.h"
 #include "xpcprivate.h"
 
@@ -233,117 +232,27 @@ bool
 WindowNamedPropertiesHandler::delete_(JSContext* aCx,
                                       JS::Handle<JSObject*> aProxy,
                                       JS::Handle<jsid> aId,
                                       JS::ObjectOpResult &aResult) const
 {
   return aResult.failCantDeleteWindowNamedProperty();
 }
 
-static bool
-IsWebExtensionContentScript(JSContext* aCx)
-{
-  auto* priv = xpc::CompartmentPrivate::Get(JS::CurrentGlobalOrNull(aCx));
-  return priv->isWebExtensionContentScript;
-}
-
-static const int32_t kAlwaysAllowNamedPropertiesObject = 0;
-static const int32_t kDisallowNamedPropertiesObjectForContentScripts = 1;
-static const int32_t kDisallowNamedPropertiesObjectForXrays = 2;
-
-static bool
-AllowNamedPropertiesObject(JSContext* aCx)
-{
-  static int32_t sAllowed;
-  static bool sAllowedCached = false;
-  if (!sAllowedCached) {
-    Preferences::AddIntVarCache(&sAllowed,
-                                "dom.allow_named_properties_object_for_xrays",
-                                kDisallowNamedPropertiesObjectForContentScripts);
-    sAllowedCached = true;
-  }
-
-  if (sAllowed == kDisallowNamedPropertiesObjectForXrays) {
-    return false;
-  }
-
-  if (sAllowed == kAlwaysAllowNamedPropertiesObject) {
-    return true;
-  }
-
-  if (sAllowed == kDisallowNamedPropertiesObjectForContentScripts) {
-    return !IsWebExtensionContentScript(aCx);
-  }
-
-  NS_WARNING("Unknown value for dom.allow_named_properties_object_for_xrays");
-  // Fail open for now.
-  return true;
-}
-
-
-static bool
-ResolveWindowNamedProperty(JSContext* aCx, JS::Handle<JSObject*> aWrapper,
-                           JS::Handle<JSObject*> aObj, JS::Handle<jsid> aId,
-                           JS::MutableHandle<JS::PropertyDescriptor> aDesc)
-{
-  if (!AllowNamedPropertiesObject(aCx)) {
-    return true;
-  }
-
-  {
-    JSAutoCompartment ac(aCx, aObj);
-    if (!js::GetProxyHandler(aObj)->getOwnPropertyDescriptor(aCx, aObj, aId,
-                                                             aDesc)) {
-      return false;
-    }
-  }
-
-  if (aDesc.object()) {
-    aDesc.object().set(aWrapper);
-
-    return JS_WrapPropertyDescriptor(aCx, aDesc);
-  }
-
-  return true;
-}
-
-static bool
-EnumerateWindowNamedProperties(JSContext* aCx, JS::Handle<JSObject*> aWrapper,
-                               JS::Handle<JSObject*> aObj,
-                               JS::AutoIdVector& aProps)
-{
-  if (!AllowNamedPropertiesObject(aCx)) {
-    return true;
-  }
-
-  JSAutoCompartment ac(aCx, aObj);
-  return js::GetProxyHandler(aObj)->ownPropertyKeys(aCx, aObj, aProps);
-}
-
-const NativePropertyHooks sWindowNamedPropertiesNativePropertyHooks[] = { {
-  ResolveWindowNamedProperty,
-  EnumerateWindowNamedProperties,
-  nullptr,
-  { nullptr, nullptr },
-  prototypes::id::_ID_Count,
-  constructors::id::_ID_Count,
-  nullptr
-} };
-
 // Note that this class doesn't need any reserved slots, but SpiderMonkey
 // asserts all proxy classes have at least one reserved slot.
 static const DOMIfaceAndProtoJSClass WindowNamedPropertiesClass = {
   PROXY_CLASS_DEF("WindowProperties",
                   JSCLASS_IS_DOMIFACEANDPROTOJSCLASS |
                   JSCLASS_HAS_RESERVED_SLOTS(1)),
   eNamedPropertiesObject,
   false,
   prototypes::id::_ID_Count,
   0,
-  sWindowNamedPropertiesNativePropertyHooks,
+  &sEmptyNativePropertyHooks,
   "[object WindowProperties]",
   EventTargetBinding::GetProtoObject
 };
 
 // static
 JSObject*
 WindowNamedPropertiesHandler::Create(JSContext* aCx,
                                      JS::Handle<JSObject*> aProto)
--- a/dom/base/nsAtomListUtils.cpp
+++ b/dom/base/nsAtomListUtils.cpp
@@ -9,18 +9,18 @@
  */
 
 #include "nsAtomListUtils.h"
 #include "nsAtom.h"
 #include "nsStaticAtom.h"
 
 /* static */ bool
 nsAtomListUtils::IsMember(nsAtom *aAtom,
-                          const nsStaticAtom* aInfo,
-                          uint32_t aInfoCount)
+                          const nsStaticAtomSetup* aSetup,
+                          uint32_t aCount)
 {
-    for (const nsStaticAtom *info = aInfo, *info_end = aInfo + aInfoCount;
-         info != info_end; ++info) {
-        if (aAtom == *(info->mAtom))
+    for (const nsStaticAtomSetup *setup = aSetup, *setup_end = aSetup + aCount;
+         setup != setup_end; ++setup) {
+        if (aAtom == *(setup->mAtom))
             return true;
     }
     return false;
 }
--- a/dom/base/nsAtomListUtils.h
+++ b/dom/base/nsAtomListUtils.h
@@ -9,18 +9,18 @@
  */
 
 #ifndef nsAtomListUtils_h__
 #define nsAtomListUtils_h__
 
 #include <stdint.h>
 
 class nsAtom;
-struct nsStaticAtom;
+struct nsStaticAtomSetup;
 
 class nsAtomListUtils {
 public:
-    static bool IsMember(nsAtom *aAtom,
-                           const nsStaticAtom* aInfo,
-                           uint32_t aInfoCount);
+  static bool IsMember(nsAtom *aAtom,
+                       const nsStaticAtomSetup* aSetup,
+                       uint32_t aCount);
 };
 
 #endif /* !defined(nsAtomListUtils_h__) */
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -469,16 +469,19 @@ nsDOMWindowUtils::SetDisplayPortForEleme
         nsLayoutUtils::UsesAsyncScrolling(rootScrollFrame))
     {
       // We are setting a root displayport for a document.
       // The pres shell needs a special flag set.
       presShell->SetIgnoreViewportScrolling(true);
     }
   }
 
+  nsLayoutUtils::InvalidateForDisplayPortChange(content, !!currentData,
+    currentData ? currentData->mRect : nsRect(), displayport);
+
   nsIFrame* rootFrame = presShell->FrameManager()->GetRootFrame();
   if (rootFrame) {
     rootFrame->SchedulePaint();
 
     // If we are hiding something that is a display root then send empty paint
     // transaction in order to release retained layers because it won't get
     // any more paint requests when it is hidden.
     if (displayport.IsEmpty() &&
@@ -3157,16 +3160,50 @@ nsDOMWindowUtils::CheckAndClearPaintedSt
     }
   }
 
   *aResult = frame->CheckAndClearPaintedState();
   return NS_OK;
 }
 
 NS_IMETHODIMP
+nsDOMWindowUtils::CheckAndClearDisplayListState(nsIDOMElement* aElement, bool* aResult)
+{
+  if (!aElement) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  nsresult rv;
+  nsCOMPtr<nsIContent> content = do_QueryInterface(aElement, &rv);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  nsIFrame* frame = content->GetPrimaryFrame();
+
+  if (!frame) {
+    *aResult = false;
+    return NS_OK;
+  }
+
+  // Get the outermost frame for the content node, so that we can test
+  // canvasframe invalidations by observing the documentElement.
+  for (;;) {
+    nsIFrame* parentFrame = frame->GetParent();
+    if (parentFrame && parentFrame->GetContent() == content) {
+      frame = parentFrame;
+    } else {
+      break;
+    }
+  }
+
+  *aResult = frame->CheckAndClearDisplayListState();
+  return NS_OK;
+
+}
+
+NS_IMETHODIMP
 nsDOMWindowUtils::IsPartOfOpaqueLayer(nsIDOMElement* aElement, bool* aResult)
 {
   if (!aElement) {
     return NS_ERROR_INVALID_ARG;
   }
 
   nsresult rv;
   nsCOMPtr<nsIContent> content = do_QueryInterface(aElement, &rv);
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -13610,59 +13610,29 @@ nsIDocument::ReportHasScrollLinkedEffect
   }
   mHasScrollLinkedEffect = true;
   nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
                                   NS_LITERAL_CSTRING("Async Pan/Zoom"),
                                   this, nsContentUtils::eLAYOUT_PROPERTIES,
                                   "ScrollLinkedEffectFound2");
 }
 
-#ifdef MOZ_STYLO
-// URL-based blacklist for stylo.
-static bool
-ShouldUseGeckoBackend(nsIURI* aDocumentURI)
-{
-  if (!aDocumentURI) {
-    return false;
-  }
-  bool isScheme = false;
-  if (NS_SUCCEEDED(aDocumentURI->SchemeIs("about", &isScheme))) {
-    nsAutoCString path;
-    aDocumentURI->GetFilePath(path);
-    // about:reader requires support of :scope pseudo-class so we have
-    // to use Gecko backend for now. See bug 1402094.
-    // This should be fixed by bug 1204818.
-    if (path.EqualsLiteral("reader")) {
-      return true;
-    }
-  }
-  return false;
-}
-#endif // MOZ_STYLO
-
 void
 nsIDocument::UpdateStyleBackendType()
 {
   MOZ_ASSERT(mStyleBackendType == StyleBackendType::None,
              "no need to call UpdateStyleBackendType now");
 
   // Assume Gecko by default.
   mStyleBackendType = StyleBackendType::Gecko;
 
 #ifdef MOZ_STYLO
-  if (nsLayoutUtils::StyloEnabled()) {
-    // Disable stylo only for system principal. Other principals aren't
-    // able to use XUL by default, and the back door to enable XUL is
-    // mostly just for testing, which means they don't matter, and we
-    // shouldn't respect them at the same time.
-    if (!nsContentUtils::IsSystemPrincipal(NodePrincipal()) &&
-        !ShouldUseGeckoBackend(mDocumentURI) &&
-        !nsLayoutUtils::IsInStyloBlocklist(NodePrincipal())) {
-      mStyleBackendType = StyleBackendType::Servo;
-    }
+  if (nsLayoutUtils::StyloEnabled() &&
+      nsLayoutUtils::ShouldUseStylo(mDocumentURI, NodePrincipal())) {
+    mStyleBackendType = StyleBackendType::Servo;
   }
 #endif
 }
 
 /**
  * Retrieves the classification of the Flash plugins in the document based on
  * the classification lists. We perform AsyncInitFlashClassification on
  * StartDocumentLoad() and the result may not be initialized when this function
--- a/dom/base/nsGkAtoms.cpp
+++ b/dom/base/nsGkAtoms.cpp
@@ -1,37 +1,30 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
-/*
- * This class wraps up the creation (and destruction) of the standard
- * set of atoms used by gklayout; the atoms are created when gklayout
- * is loaded and they are destroyed when gklayout is unloaded.
- */
-
 #include "nsGkAtoms.h"
 #include "nsStaticAtom.h"
 
 using namespace mozilla;
 
-// define storage for all atoms
-#define GK_ATOM(name_, value_) nsAtom* nsGkAtoms::name_;
+#define GK_ATOM(name_, value_) NS_STATIC_ATOM_DEFN(nsGkAtoms, name_)
 #include "nsGkAtomList.h"
 #undef GK_ATOM
 
-#define GK_ATOM(name_, value_) NS_STATIC_ATOM_BUFFER(name_##_buffer, value_)
+#define GK_ATOM(name_, value_) NS_STATIC_ATOM_BUFFER(name_, value_)
 #include "nsGkAtomList.h"
 #undef GK_ATOM
 
-static const nsStaticAtom GkAtoms_info[] = {
-#define GK_ATOM(name_, value_) NS_STATIC_ATOM(name_##_buffer, &nsGkAtoms::name_),
-#include "nsGkAtomList.h"
-#undef GK_ATOM
+static const nsStaticAtomSetup sGkAtomSetup[] = {
+  #define GK_ATOM(name_, value_) NS_STATIC_ATOM_SETUP(nsGkAtoms, name_)
+  #include "nsGkAtomList.h"
+  #undef GK_ATOM
 };
 
 void nsGkAtoms::AddRefAtoms()
 {
-  NS_RegisterStaticAtoms(GkAtoms_info);
+  NS_RegisterStaticAtoms(sGkAtomSetup);
 }
 
--- a/dom/base/nsGkAtoms.h
+++ b/dom/base/nsGkAtoms.h
@@ -1,35 +1,22 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
-/*
- * This class wraps up the creation (and destruction) of the standard
- * set of atoms used by gklayout; the atoms are created when gklayout
- * is loaded and they are destroyed when gklayout is unloaded.
- */
-
 #ifndef nsGkAtoms_h___
 #define nsGkAtoms_h___
 
-class nsAtom;
+#include "nsStaticAtom.h"
 
-class nsGkAtoms {
+class nsGkAtoms
+{
 public:
-
   static void AddRefAtoms();
 
-  /* Declare all atoms
-
-     The atom names and values are stored in nsGkAtomList.h and
-     are brought to you by the magic of C preprocessing
-
-     Add new atoms to nsGkAtomList and all support logic will be auto-generated
-   */
-#define GK_ATOM(_name, _value) static nsAtom* _name;
-#include "nsGkAtomList.h"
-#undef GK_ATOM
+  #define GK_ATOM(_name, _value) NS_STATIC_ATOM_DECL(_name)
+  #include "nsGkAtomList.h"
+  #undef GK_ATOM
 };
 
 #endif /* nsGkAtoms_h___ */
--- a/dom/base/nsNodeUtils.cpp
+++ b/dom/base/nsNodeUtils.cpp
@@ -623,16 +623,25 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNod
             aNode->OwnerDoc()->RegisterActivityObserver(aNode->AsElement());
           }
           return nullptr;
         }
       }
     }
   }
 
+  if (aNodesWithProperties && aNode->HasProperties()) {
+    bool ok = aNodesWithProperties->AppendObject(aNode);
+    MOZ_RELEASE_ASSERT(ok, "Out of memory");
+    if (aClone) {
+      ok = aNodesWithProperties->AppendObject(clone);
+      MOZ_RELEASE_ASSERT(ok, "Out of memory");
+    }
+  }
+
   if (aDeep && (!aClone || !aNode->IsNodeOfType(nsINode::eATTRIBUTE))) {
     // aNode's children.
     for (nsIContent* cloneChild = aNode->GetFirstChild();
          cloneChild;
          cloneChild = cloneChild->GetNextSibling()) {
       nsCOMPtr<nsINode> child =
         CloneAndAdopt(cloneChild, aClone, true, nodeInfoManager,
                       aReparentScope, aNodesWithProperties, clone,
@@ -682,28 +691,16 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNod
 #ifdef MOZ_XUL
   if (aClone && !aParent && aNode->IsXULElement()) {
     if (!aNode->OwnerDoc()->IsLoadedAsInteractiveData()) {
       clone->SetFlags(NODE_FORCE_XBL_BINDINGS);
     }
   }
 #endif
 
-  if (aNodesWithProperties && aNode->HasProperties()) {
-    bool ok = aNodesWithProperties->AppendObject(aNode);
-    if (aClone) {
-      ok = ok && aNodesWithProperties->AppendObject(clone);
-    }
-
-    if (NS_WARN_IF(!ok)) {
-      aError.Throw(NS_ERROR_OUT_OF_MEMORY);
-      return nullptr;
-    }
-  }
-
   return clone.forget();
 }
 
 
 /* static */
 void
 nsNodeUtils::UnlinkUserData(nsINode *aNode)
 {
--- a/dom/base/nsTreeSanitizer.cpp
+++ b/dom/base/nsTreeSanitizer.cpp
@@ -2,20 +2,22 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsTreeSanitizer.h"
 
 #include "mozilla/ArrayUtils.h"
+#include "mozilla/ServoDeclarationBlock.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/css/Declaration.h"
 #include "mozilla/css/StyleRule.h"
 #include "mozilla/css/Rule.h"
+#include "mozilla/dom/CSSRuleList.h"
 #include "nsCSSParser.h"
 #include "nsCSSPropertyID.h"
 #include "nsUnicharInputStream.h"
 #include "nsIDOMCSSRule.h"
 #include "nsAttrName.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsNetUtil.h"
 #include "nsComponentManagerUtils.h"
@@ -1060,55 +1062,71 @@ nsTreeSanitizer::MustPrune(int32_t aName
   }
   if (nsGkAtoms::style == aLocal) {
     return true;
   }
   return false;
 }
 
 bool
-nsTreeSanitizer::SanitizeStyleDeclaration(mozilla::css::Declaration* aDeclaration,
-                                          nsAutoString& aRuleText)
+nsTreeSanitizer::SanitizeStyleDeclaration(DeclarationBlock* aDeclaration)
 {
-  bool didSanitize = aDeclaration->HasProperty(eCSSProperty__moz_binding);
-  aDeclaration->RemovePropertyByID(eCSSProperty__moz_binding);
-  aDeclaration->ToString(aRuleText);
-  return didSanitize;
+  return aDeclaration->RemovePropertyByID(eCSSProperty__moz_binding);
 }
 
 bool
 nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
                                     nsAString& aSanitized,
                                     nsIDocument* aDocument,
                                     nsIURI* aBaseURI)
 {
   nsresult rv;
   aSanitized.Truncate();
   // aSanitized will hold the permitted CSS text.
   // -moz-binding is blacklisted.
   bool didSanitize = false;
   // Create a sheet to hold the parsed CSS
-  RefPtr<CSSStyleSheet> sheet =
-    new CSSStyleSheet(mozilla::css::eAuthorSheetFeatures,
-                      CORS_NONE, aDocument->GetReferrerPolicy());
+  RefPtr<StyleSheet> sheet;
+  if (aDocument->IsStyledByServo()) {
+    sheet = new ServoStyleSheet(mozilla::css::eAuthorSheetFeatures,
+                                CORS_NONE, aDocument->GetReferrerPolicy(),
+                                SRIMetadata());
+  } else {
+    sheet = new CSSStyleSheet(mozilla::css::eAuthorSheetFeatures,
+                              CORS_NONE, aDocument->GetReferrerPolicy());
+  }
   sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI);
   sheet->SetPrincipal(aDocument->NodePrincipal());
-  // Create the CSS parser, and parse the CSS text.
-  nsCSSParser parser(nullptr, sheet);
-  rv = parser.ParseSheet(aOriginal, aDocument->GetDocumentURI(), aBaseURI,
-                         aDocument->NodePrincipal(), 0);
+  if (aDocument->IsStyledByServo()) {
+    rv = sheet->AsServo()->ParseSheet(
+        aDocument->CSSLoader(), NS_ConvertUTF16toUTF8(aOriginal),
+        aDocument->GetDocumentURI(), aBaseURI, aDocument->NodePrincipal(),
+        0, aDocument->GetCompatibilityMode());
+  } else {
+    // Create the CSS parser, and parse the CSS text.
+    nsCSSParser parser(nullptr, sheet->AsGecko());
+    rv = parser.ParseSheet(aOriginal, aDocument->GetDocumentURI(), aBaseURI,
+                           aDocument->NodePrincipal(), 0);
+  }
   NS_ENSURE_SUCCESS(rv, true);
   // Mark the sheet as complete.
   MOZ_ASSERT(!sheet->IsModified(),
              "should not get marked modified during parsing");
   sheet->SetComplete();
   // Loop through all the rules found in the CSS text
-  int32_t ruleCount = sheet->StyleRuleCount();
-  for (int32_t i = 0; i < ruleCount; ++i) {
-    mozilla::css::Rule* rule = sheet->GetStyleRuleAt(i);
+  ErrorResult err;
+  RefPtr<dom::CSSRuleList> rules =
+    sheet->GetCssRules(*nsContentUtils::GetSystemPrincipal(), err);
+  err.SuppressException();
+  if (!rules) {
+    return true;
+  }
+  uint32_t ruleCount = rules->Length();
+  for (uint32_t i = 0; i < ruleCount; ++i) {
+    mozilla::css::Rule* rule = rules->Item(i);
     if (!rule)
       continue;
     switch (rule->GetType()) {
       default:
         didSanitize = true;
         // Ignore these rule types.
         break;
       case mozilla::css::Rule::NAMESPACE_RULE:
@@ -1122,25 +1140,24 @@ nsTreeSanitizer::SanitizeStyleSheet(cons
             aSanitized.Append(cssText);
           }
         }
         break;
       }
       case mozilla::css::Rule::STYLE_RULE: {
         // For style rules, we will just look for and remove the
         // -moz-binding properties.
-        RefPtr<mozilla::css::StyleRule> styleRule = do_QueryObject(rule);
-        NS_ASSERTION(styleRule, "Must be a style rule");
+        auto styleRule = static_cast<BindingStyleRule*>(rule);
+        DeclarationBlock* styleDecl = styleRule->GetDeclarationBlock();
+        MOZ_ASSERT(styleDecl);
+        if (SanitizeStyleDeclaration(styleDecl)) {
+          didSanitize = true;
+        }
         nsAutoString decl;
-        bool sanitized =
-          SanitizeStyleDeclaration(styleRule->GetDeclaration(), decl);
-        didSanitize = sanitized || didSanitize;
-        if (!sanitized) {
-          styleRule->GetCssText(decl);
-        }
+        styleRule->GetCssText(decl);
         aSanitized.Append(decl);
       }
     }
   }
   return didSanitize;
 }
 
 void
@@ -1155,29 +1172,38 @@ nsTreeSanitizer::SanitizeAttributes(mozi
 
   for (int32_t i = ac - 1; i >= 0; --i) {
     const nsAttrName* attrName = aElement->GetAttrNameAt(i);
     int32_t attrNs = attrName->NamespaceID();
     RefPtr<nsAtom> attrLocal = attrName->LocalName();
 
     if (kNameSpaceID_None == attrNs) {
       if (aAllowStyle && nsGkAtoms::style == attrLocal) {
-        nsCOMPtr<nsIURI> baseURI = aElement->GetBaseURI();
-        nsIDocument* document = aElement->OwnerDoc();
-        // Pass the CSS Loader object to the parser, to allow parser error
-        // reports to include the outer window ID.
-        nsCSSParser parser(document->CSSLoader());
+        RefPtr<DeclarationBlock> decl;
         nsAutoString value;
         aElement->GetAttr(attrNs, attrLocal, value);
-        RefPtr<mozilla::css::Declaration> decl =
-          parser.ParseStyleAttribute(value, document->GetDocumentURI(),
-                                     baseURI, document->NodePrincipal());
+        nsIDocument* document = aElement->OwnerDoc();
+        if (document->IsStyledByServo()) {
+          decl = ServoDeclarationBlock::FromCssText(
+              value,
+              aElement->GetURLDataForStyleAttr(),
+              document->GetCompatibilityMode(),
+              document->CSSLoader());
+        } else {
+          // Pass the CSS Loader object to the parser, to allow parser error
+          // reports to include the outer window ID.
+          nsCSSParser parser(document->CSSLoader());
+          decl = parser.ParseStyleAttribute(value, document->GetDocumentURI(),
+                                            aElement->GetBaseURIForStyleAttr(),
+                                            document->NodePrincipal());
+        }
         if (decl) {
-          nsAutoString cleanValue;
-          if (SanitizeStyleDeclaration(decl, cleanValue)) {
+          if (SanitizeStyleDeclaration(decl)) {
+            nsAutoString cleanValue;
+            decl->ToString(cleanValue);
             aElement->SetAttr(kNameSpaceID_None,
                               nsGkAtoms::style,
                               cleanValue,
                               false);
           }
         }
         continue;
       }
--- a/dom/base/nsTreeSanitizer.h
+++ b/dom/base/nsTreeSanitizer.h
@@ -146,25 +146,22 @@ class MOZ_STACK_CLASS nsTreeSanitizer {
      * @return true if the attribute was removed and false otherwise
      */
     bool SanitizeURL(mozilla::dom::Element* aElement,
                        int32_t aNamespace,
                        nsAtom* aLocalName);
 
     /**
      * Checks a style rule for the presence of the 'binding' CSS property and
-     * removes that property from the rule and reserializes in case the
-     * property was found.
+     * removes that property from the rule.
      *
      * @param aDeclaration The style declaration to check
-     * @param aRuleText the serialized mutated rule if the method returns true
      * @return true if the rule was modified and false otherwise
      */
-    bool SanitizeStyleDeclaration(mozilla::css::Declaration* aDeclaration,
-                                  nsAutoString& aRuleText);
+    bool SanitizeStyleDeclaration(mozilla::DeclarationBlock* aDeclaration);
 
     /**
      * Parses a style sheet and reserializes it with the 'binding' property
      * removed if it was present.
      *
      * @param aOrigin the original style sheet source
      * @param aSanitized the reserialization without 'binding'; only valid if
      *                   this method return true
--- a/dom/base/test/test_bug650776.html
+++ b/dom/base/test/test_bug650776.html
@@ -24,18 +24,18 @@ is(s.sanitize("foo", 0), "<html><head></
 // Scripts get removed
 is(s.sanitize("<script>\u003c/script>", 0), "<html><head></head><body></body></html>", "Wrong sanitizer result 2");
 // Event handlers get removed
 is(s.sanitize("<a onclick='boom()'></a>", 0), "<html><head></head><body><a></a></body></html>", "Wrong sanitizer result 3");
 // By default, styles are removed
 is(s.sanitize("<style>p { color: red; }</style><p style='background-color: blue;'></p>", 0), "<html><head></head><body><p></p></body></html>", "Wrong sanitizer result 4");
 // Can allow styles
 is(s.sanitize("<style>p { color: red; }</style><p style='background-color: blue;'></p>", u.SanitizerAllowStyle), '<html><head><style>p { color: red; }</style></head><body><p style="background-color: blue;"></p></body></html>', "Wrong sanitizer result 5");
-// -moz-binding gets dropped when styles allowed; however, reconstructing the p { ... } part seems broken!
-todo_is(s.sanitize("<style>p { color: red; -moz-binding: url(foo); }</style><p style='background-color: blue; -moz-binding: url(foo);'></p>", u.SanitizerAllowStyle), '<html><head><style>p { color: red; }</style></head><body><p style="background-color: blue;"></p></body></html>', "Wrong sanitizer result 6");
+// -moz-binding gets dropped when styles allowed
+is(s.sanitize("<style>p { color: red; -moz-binding: url(foo); }</style><p style='background-color: blue; -moz-binding: url(foo);'></p>", u.SanitizerAllowStyle), '<html><head><style>p { color: red; }</style></head><body><p style="background-color: blue;"></p></body></html>', "Wrong sanitizer result 6");
 // Various cid: embeds only cases
 is(s.sanitize("<img src='foo.html'>", u.SanitizerCidEmbedsOnly), '<html><head></head><body><img></body></html>', "Wrong sanitizer result 7");
 is(s.sanitize("<img src='cid:foo'>", u.SanitizerCidEmbedsOnly), '<html><head></head><body><img src="cid:foo"></body></html>', "Wrong sanitizer result 8");
 is(s.sanitize("<img src='data:image/png,'>", u.SanitizerCidEmbedsOnly), '<html><head></head><body><img></body></html>', "Wrong sanitizer result 9");
 is(s.sanitize("<img src='http://mochi.test/'>", u.SanitizerCidEmbedsOnly), '<html><head></head><body><img></body></html>', "Wrong sanitizer result 10");
 is(s.sanitize("<a href='http://mochi.test/'></a>", u.SanitizerCidEmbedsOnly), '<html><head></head><body><a href="http://mochi.test/"></a></body></html>', "Wrong sanitizer result 11");
 is(s.sanitize("<body background='http://mochi.test/'>", u.SanitizerCidEmbedsOnly), '<html><head></head><body></body></html>', "Wrong sanitizer result 12");
 is(s.sanitize("<body background='cid:foo'>", u.SanitizerCidEmbedsOnly), '<html><head></head><body background="cid:foo"></body></html>', "Wrong sanitizer result 13");
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -1650,18 +1650,19 @@ XrayResolveOwnProperty(JSContext* cx, JS
 
   DOMObjectType type;
   const NativePropertyHooks *nativePropertyHooks =
     GetNativePropertyHooks(cx, obj, type);
   ResolveOwnProperty resolveOwnProperty =
     nativePropertyHooks->mResolveOwnProperty;
 
   if (type == eNamedPropertiesObject) {
-    // None of these should be cached on the holder, since they're dynamic.
-    return resolveOwnProperty(cx, wrapper, obj, id, desc);
+    MOZ_ASSERT(!resolveOwnProperty,
+               "Shouldn't have any Xray-visible properties");
+    return true;
   }
 
   const NativePropertiesHolder& nativePropertiesHolder =
     nativePropertyHooks->mNativeProperties;
   const NativeProperties* nativeProperties = nullptr;
   const PropertyInfo* found = nullptr;
 
   if ((nativeProperties = nativePropertiesHolder.regular)) {
@@ -1961,17 +1962,19 @@ XrayOwnPropertyKeys(JSContext* cx, JS::H
 {
   DOMObjectType type;
   const NativePropertyHooks* nativePropertyHooks =
     GetNativePropertyHooks(cx, obj, type);
   EnumerateOwnProperties enumerateOwnProperties =
     nativePropertyHooks->mEnumerateOwnProperties;
 
   if (type == eNamedPropertiesObject) {
-    return enumerateOwnProperties(cx, wrapper, obj, props);
+    MOZ_ASSERT(!enumerateOwnProperties,
+               "Shouldn't have any Xray-visible properties");
+    return true;
   }
 
   if (IsInstance(type)) {
     // FIXME https://bugzilla.mozilla.org/show_bug.cgi?id=1071189
     //       Should do something about XBL properties too.
     if (enumerateOwnProperties &&
         !enumerateOwnProperties(cx, wrapper, obj, props)) {
       return false;
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -3435,20 +3435,20 @@ class CGGetNamedPropertiesObjectMethod(C
               $*{getParentProto}
               namedPropertiesObject = ${nativeType}::CreateNamedPropertiesObject(aCx, ${parentProto});
               DebugOnly<const DOMIfaceAndProtoJSClass*> clasp =
                 DOMIfaceAndProtoJSClass::FromJSClass(js::GetObjectClass(namedPropertiesObject));
               MOZ_ASSERT(clasp->mType == eNamedPropertiesObject,
                          "Expected ${nativeType}::CreateNamedPropertiesObject to return a named properties object");
               MOZ_ASSERT(clasp->mNativeHooks,
                          "The named properties object for ${nativeType} should have NativePropertyHooks.");
-              MOZ_ASSERT(clasp->mNativeHooks->mResolveOwnProperty,
-                         "Don't know how to resolve the properties of the named properties object for ${nativeType}.");
-              MOZ_ASSERT(clasp->mNativeHooks->mEnumerateOwnProperties,
-                         "Don't know how to enumerate the properties of the named properties object for ${nativeType}.");
+              MOZ_ASSERT(!clasp->mNativeHooks->mResolveOwnProperty,
+                         "Shouldn't resolve the properties of the named properties object for ${nativeType} for Xrays.");
+              MOZ_ASSERT(!clasp->mNativeHooks->mEnumerateOwnProperties,
+                         "Shouldn't enumerate the properties of the named properties object for ${nativeType} for Xrays.");
             }
             return namedPropertiesObject.get();
             """,
             getParentProto=getParentProto,
             ifaceName=self.descriptor.name,
             parentProto=parentProto,
             nativeType=self.descriptor.nativeType)
 
--- a/dom/bindings/test/test_dom_xrays.html
+++ b/dom/bindings/test/test_dom_xrays.html
@@ -69,29 +69,30 @@ function test()
 
   var eventTargetProto = Object.getPrototypeOf(namedPropertiesObject);
   is(eventTargetProto, win.EventTarget.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
 
   // Xrays need to filter expandos.
   checkWindowXrayProperty(win, "expando", undefined);
   ok(!("expando" in win), "Xrays should filter expandos");
 
-  checkWindowXrayProperty(win, "shadowedIframe", undefined, undefined, doc.getElementById("shadowedIframe").contentWindow);
-  ok("shadowedIframe" in win, "Named properties should be exposed through Xrays");
+  checkWindowXrayProperty(win, "shadowedIframe", undefined);
+  ok(!("shadowedIframe" in win), "Named properties should not be exposed through Xrays");
 
-  // Named properties live on the named properties object for global objects.
-  checkWindowXrayProperty(win, "iframe", undefined, undefined, doc.getElementById("iframe").contentWindow);
-  ok("iframe" in win, "Named properties should be exposed through Xrays");
+  // Named properties live on the named properties object for global objects,
+  // but are not exposed via Xrays.
+  checkWindowXrayProperty(win, "iframe", undefined, undefined, undefined, undefined);
+  ok(!("iframe" in win), "Named properties should not be exposed through Xrays");
 
   // Window properties live on the instance, shadowing the properties of the named property object.
-  checkWindowXrayProperty(win, "document", doc, undefined, doc.getElementById("document").contentWindow);
+  checkWindowXrayProperty(win, "document", doc, undefined, undefined, undefined);
   ok("document" in win, "WebIDL properties should be exposed through Xrays");
 
   // Unforgeable properties live on the instance, shadowing the properties of the named property object.
-  checkWindowXrayProperty(win, "self", win, undefined, doc.getElementById("self").contentWindow);
+  checkWindowXrayProperty(win, "self", win, undefined, undefined, undefined);
   ok("self" in win, "WebIDL properties should be exposed through Xrays");
 
   // Object.prototype is at the end of the prototype chain.
   var obj = win;
   while ((proto = Object.getPrototypeOf(obj))) {
     obj = proto;
   }
   is(obj, win.Object.prototype, "Object.prototype should be at the end of the prototype chain");
--- a/dom/canvas/test/webgl-conf/generated-mochitest.ini
+++ b/dom/canvas/test/webgl-conf/generated-mochitest.ini
@@ -7830,17 +7830,17 @@ fail-if = (os == 'mac' && os_version == 
 [generated/test_conformance__glsl__misc__non-ascii-comments.vert.html]
 [generated/test_conformance__glsl__misc__non-ascii.vert.html]
 [generated/test_conformance__glsl__misc__re-compile-re-link.html]
 fail-if = (os == 'android' && android_version == '10')
 [generated/test_conformance__glsl__misc__sequence-operator-returns-constant.html]
 [generated/test_conformance__glsl__misc__shader-precision-format-obeyed.html]
 [generated/test_conformance__glsl__misc__shader-struct-scope.html]
 [generated/test_conformance__glsl__misc__shader-uniform-packing-restrictions.html]
-skip-if = (os == 'android') || (os == 'win' && os_version == '6.1' && debug)
+skip-if = (os == 'android') || (os == 'win' && os_version == '6.1' && debug) || (os == 'linux' && debug)
 [generated/test_conformance__glsl__misc__shader-varying-packing-restrictions.html]
 [generated/test_conformance__glsl__misc__shader-with-256-character-define.html]
 [generated/test_conformance__glsl__misc__shader-with-256-character-identifier.frag.html]
 [generated/test_conformance__glsl__misc__shader-with-257-character-define.html]
 [generated/test_conformance__glsl__misc__shader-with-257-character-identifier.frag.html]
 [generated/test_conformance__glsl__misc__shader-with-_webgl-identifier.vert.html]
 [generated/test_conformance__glsl__misc__shader-with-arbitrary-indexing.frag.html]
 [generated/test_conformance__glsl__misc__shader-with-arbitrary-indexing.vert.html]
--- a/dom/canvas/test/webgl-conf/mochitest-errata.ini
+++ b/dom/canvas/test/webgl-conf/mochitest-errata.ini
@@ -528,18 +528,18 @@ fail-if = (os == 'android' && android_ve
 skip-if = (os == 'android')
 ####################
 # Timeouts
 [generated/test_conformance__context__context-release-upon-reload.html]
 skip-if = (os == 'android')
 [generated/test_conformance__context__context-release-with-workers.html]
 skip-if = (os == 'android')
 [generated/test_conformance__glsl__misc__shader-uniform-packing-restrictions.html]
-# Frequent timeout on win7 debug.
-skip-if = (os == 'android') || (os == 'win' && os_version == '6.1' && debug)
+# Frequent timeout on win7 and linux debug.
+skip-if = (os == 'android') || (os == 'win' && os_version == '6.1' && debug) || (os == 'linux' && debug)
 [generated/test_conformance__glsl__bugs__complex-glsl-does-not-crash.html]
 skip-if = (os == 'android')
 
 [generated/test_conformance__glsl__misc__shader-with-non-reserved-words.html]
 fail-if = (os == 'android')
 # (TODO) Generates results after calling finish()
 skip-if = 1
 
new file mode 100644
--- /dev/null
+++ b/dom/html/crashtests/978644.xhtml
@@ -0,0 +1,11 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<body onload="document.getElementById('b').appendChild(document.getElementById('v'));">
+
+<fieldset><fieldset id="b"></fieldset></fieldset>
+
+<div id="v"><fieldset><input required="" /><input required="" /></fieldset></div>
+
+</body>
+
+</html>
--- a/dom/html/crashtests/crashtests.list
+++ b/dom/html/crashtests/crashtests.list
@@ -65,16 +65,17 @@ pref(dom.experimental_forms,true) load 8
 load 837033.html
 load 838256-1.html
 load 862084.html
 load 865147.html
 load 877910.html
 load 903106.html
 load 916322-1.html
 load 916322-2.html
+load 978644.xhtml
 load 1032654.html
 load 1141260.html
 load 1228876.html
 load 1230110.html
 load 1237633.html
 load 1281972-1.html
 load 1282894.html
 load 1290904.html
--- a/dom/html/test/test_fullscreen-api.html
+++ b/dom/html/test/test_fullscreen-api.html
@@ -27,16 +27,17 @@ SimpleTest.requestFlakyTimeout("untriage
 // run in an iframe, which by default will not have the allowfullscreen
 // attribute set, so full-screen won't work.
 var gTestWindows = [
   "file_fullscreen-multiple.html",
   "file_fullscreen-rollback.html",
   "file_fullscreen-esc-exit.html",
   "file_fullscreen-denied.html",
   "file_fullscreen-api.html",
+  "file_fullscreen-plugins.html",
   "file_fullscreen-hidden.html",
   "file_fullscreen-svg-element.html",
   "file_fullscreen-navigation.html",
   "file_fullscreen-scrollbar.html",
   "file_fullscreen-selector.html",
   "file_fullscreen-top-layer.html",
   "file_fullscreen-backdrop.html",
   "file_fullscreen-nested.html",
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -1602,16 +1602,22 @@ interface nsIDOMWindowUtils : nsISupport
 
   /**
    * Check if any PaintedLayer painting has been done for this element,
    * clears the painted flags if they have.
    */
   boolean checkAndClearPaintedState(in nsIDOMElement aElement);
 
   /**
+   * Check if any display list building has been done for this element,
+   * clears the display list flags if they have.
+   */
+  boolean checkAndClearDisplayListState(in nsIDOMElement aElement);
+
+  /**
    * Check whether all display items of the primary frame of aElement have been
    * assigned to the same single PaintedLayer in the last paint. If that is the
    * case, returns whether that PaintedLayer is opaque; if it's not the case, an
    * exception is thrown.
    */
   boolean isPartOfOpaqueLayer(in nsIDOMElement aElement);
 
   /**
--- a/dom/interfaces/base/nsITabParent.idl
+++ b/dom/interfaces/base/nsITabParent.idl
@@ -78,19 +78,23 @@ interface nsITabParent : nsISupports
    */
   readonly attribute boolean hasBeforeUnload;
 
   /**
    * Notify APZ to start autoscrolling.
    * (aAnchorX, aAnchorY) are the coordinates of the autoscroll anchor,
    * in CSS coordinates relative to the screen. aScrollId and 
    * aPresShellId identify the scroll frame that content chose to scroll.
+   * Returns whether we were successfully able to notify APZ.
+   * If this function returns true, APZ (which may live in another process)
+   * may still reject the autoscroll, but it's then APZ's reponsibility
+   * to notify content via an "autoscroll-rejected-by-apz" message.
    */
-  void startApzAutoscroll(in float aAnchorX, in float aAnchorY,
-                          in nsViewID aScrollId, in uint32_t aPresShellId);
+  boolean startApzAutoscroll(in float aAnchorX, in float aAnchorY,
+                             in nsViewID aScrollId, in uint32_t aPresShellId);
 
   /**
    * Notify APZ to stop autoscrolling.
    * aScrollId and aPresShellId identify the scroll frame that is being
    * autoscrolled.
    */
   void stopApzAutoscroll(in nsViewID aScrollId, in uint32_t aPresShellId);
 };
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -3463,39 +3463,43 @@ TabParent::StartPersistence(uint64_t aOu
   return manager->AsContentParent()
     ->SendPWebBrowserPersistDocumentConstructor(actor, this, aOuterWindowID)
     ? NS_OK : NS_ERROR_FAILURE;
   // (The actor will be destroyed on constructor failure.)
 }
 
 NS_IMETHODIMP
 TabParent::StartApzAutoscroll(float aAnchorX, float aAnchorY,
-                              nsViewID aScrollId, uint32_t aPresShellId)
+                              nsViewID aScrollId, uint32_t aPresShellId,
+                              bool* aOutRetval)
 {
   if (!AsyncPanZoomEnabled()) {
+    *aOutRetval = false;
     return NS_OK;
   }
 
+  bool success = false;
   if (RenderFrameParent* renderFrame = GetRenderFrame()) {
     uint64_t layersId = renderFrame->GetLayersId();
     if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
       ScrollableLayerGuid guid{layersId, aPresShellId, aScrollId};
 
       // The anchor coordinates that are passed in are relative to the origin
       // of the screen, but we are sending them to APZ which only knows about
       // coordinates relative to the widget, so convert them accordingly.
       CSSPoint anchorCss{aAnchorX, aAnchorY};
       LayoutDeviceIntPoint anchor = RoundedToInt(anchorCss * widget->GetDefaultScale());
       anchor -= widget->WidgetToScreenOffset();
 
-      widget->StartAsyncAutoscroll(
+      success = widget->StartAsyncAutoscroll(
           ViewAs<ScreenPixel>(anchor, PixelCastJustification::LayoutDeviceIsScreenForBounds),
           guid);
     }
   }
+  *aOutRetval = success;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TabParent::StopApzAutoscroll(nsViewID aScrollId, uint32_t aPresShellId)
 {
   if (!AsyncPanZoomEnabled()) {
     return NS_OK;
--- a/dom/manifest/Manifest.jsm
+++ b/dom/manifest/Manifest.jsm
@@ -74,16 +74,27 @@ class Manifest {
     this._browser = browser;
   }
 
   async initialise() {
     this._store = new JSONFile({path: this._path});
     await this._store.load();
   }
 
+  async prefetch(browser) {
+    const manifestData = await ManifestObtainer.browserObtainManifest(browser);
+    const icon = await ManifestIcons.browserFetchIcon(browser, manifestData, 192);
+    const data = {
+      installed: false,
+      manifest: manifestData,
+      cached_icon: icon
+    };
+    return data;
+  }
+
   async install() {
     const manifestData = await ManifestObtainer.browserObtainManifest(this._browser);
     this._store.data = {
       installed: true,
       manifest: manifestData
     };
     Manifests.manifestInstalled(this);
     this._store.saveSoon();
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -89,26 +89,24 @@ CanHandleCodecsType(const MediaContainer
   if (WaveDecoder::IsSupportedType(MediaContainerType(mimeType))) {
     if (WaveDecoder::IsSupportedType(aType)) {
       return CANPLAY_YES;
     }
     // We can only reach this position if a particular codec was requested,
     // ogg is supported and working: the codec must be invalid.
     return CANPLAY_NO;
   }
-#if !defined(MOZ_OMX_WEBM_DECODER)
   if (WebMDecoder::IsSupportedType(mimeType)) {
     if (WebMDecoder::IsSupportedType(aType)) {
       return CANPLAY_YES;
     }
     // We can only reach this position if a particular codec was requested,
     // webm is supported and working: the codec must be invalid.
     return CANPLAY_NO;
   }
-#endif
 #ifdef MOZ_FMP4
   if (MP4Decoder::IsSupportedType(mimeType,
                                   /* DecoderDoctorDiagnostics* */ nullptr)) {
     if (MP4Decoder::IsSupportedType(aType, aDiagnostics)) {
       return CANPLAY_YES;
     }
     // We can only reach this position if a particular codec was requested,
     // fmp4 is supported and working: the codec must be invalid.
@@ -161,21 +159,19 @@ CanHandleMediaType(const MediaContainerT
   if (WaveDecoder::IsSupportedType(mimeType)) {
     return CANPLAY_MAYBE;
   }
 #ifdef MOZ_FMP4
   if (MP4Decoder::IsSupportedType(mimeType, aDiagnostics)) {
     return CANPLAY_MAYBE;
   }
 #endif
-#if !defined(MOZ_OMX_WEBM_DECODER)
   if (WebMDecoder::IsSupportedType(mimeType)) {
     return CANPLAY_MAYBE;
   }
-#endif
   if (MP3Decoder::IsSupportedType(mimeType)) {
     return CANPLAY_MAYBE;
   }
   if (ADTSDecoder::IsSupportedType(mimeType)) {
     return CANPLAY_MAYBE;
   }
   if (FlacDecoder::IsSupportedType(mimeType)) {
     return CANPLAY_MAYBE;
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -232,17 +232,17 @@ public:
   /**
    * this can be in response to our own RemoveListener() (via ::Remove()), or
    * because the DOM GC'd the DOMLocalMediaStream/etc we're attached to.
    */
   void NotifyRemoved();
 
   bool Activated() const
   {
-    return mActivated;
+    return mStream;
   }
 
   bool Stopped() const
   {
     return mStopped;
   }
 
   bool CapturingVideo() const;
@@ -261,20 +261,16 @@ public:
   ApplyConstraintsToTrack(nsPIDOMWindowInner* aWindow,
                           TrackID aTrackID,
                           const dom::MediaTrackConstraints& aConstraints,
                           dom::CallerType aCallerType);
 
   PrincipalHandle GetPrincipalHandle() const;
 
 private:
-  // true after this listener has been Activate()d in a WindowListener.
-  // MainThread only.
-  bool mActivated;
-
   // true after this listener has had all devices stopped. MainThread only.
   bool mStopped;
 
   // true after the stream this listener is listening to has finished in the
   // MediaStreamGraph. MainThread only.
   bool mFinished;
 
   // true after this listener has been removed from its MediaStream.
@@ -3540,18 +3536,17 @@ MediaManager::IsActivelyCapturingOrHasAP
       return false;
     }
   }
   return audio == nsIPermissionManager::ALLOW_ACTION ||
          video == nsIPermissionManager::ALLOW_ACTION;
 }
 
 SourceListener::SourceListener()
-  : mActivated(false)
-  , mStopped(false)
+  : mStopped(false)
   , mFinished(false)
   , mRemoved(false)
   , mAudioStopped(false)
   , mVideoStopped(false)
   , mMainThreadCheck(nullptr)
   , mPrincipalHandle(PRINCIPAL_HANDLE_NONE)
   , mWindowListener(nullptr)
 {}
@@ -3560,17 +3555,17 @@ void
 SourceListener::Register(GetUserMediaWindowListener* aListener)
 {
   LOG(("SourceListener %p registering with window listener %p", this, aListener));
 
   if (mWindowListener) {
     MOZ_ASSERT(false, "Already registered");
     return;
   }
-  if (mActivated) {
+  if (Activated()) {
     MOZ_ASSERT(false, "Already activated");
     return;
   }
   if (!aListener) {
     MOZ_ASSERT(false, "No listener");
     return;
   }
   mPrincipalHandle = aListener->GetPrincipalHandle();
@@ -3581,22 +3576,26 @@ void
 SourceListener::Activate(SourceMediaStream* aStream,
                          AudioDevice* aAudioDevice,
                          VideoDevice* aVideoDevice)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread");
 
   LOG(("SourceListener %p activating audio=%p video=%p", this, aAudioDevice, aVideoDevice));
 
-  if (mActivated) {
+  if (mStopped) {
+    MOZ_ASSERT(false, "Cannot activate stopped source listener");
+    return;
+  }
+
+  if (Activated()) {
     MOZ_ASSERT(false, "Already activated");
     return;
   }
 
-  mActivated = true;
   mMainThreadCheck = GetCurrentVirtualThread();
   mStream = aStream;
   mAudioDevice = aAudioDevice;
   mVideoDevice = aVideoDevice;
   mStream->AddListener(this);
 }
 
 void
@@ -3611,23 +3610,34 @@ SourceListener::Stop()
   LOG(("SourceListener %p stopping", this));
 
   // StopSharing() has some special logic, at least for audio capture.
   // It must be called when all tracks have stopped, before setting mStopped.
   StopSharing();
 
   mStopped = true;
 
+  if (!Activated()) {
+    MOZ_ASSERT(false, "There are no devices or any source stream to stop");
+    return;
+  }
+
   if (mAudioDevice && !mAudioStopped) {
     StopTrack(kAudioTrack);
   }
   if (mVideoDevice && !mVideoStopped) {
     StopTrack(kVideoTrack);
   }
-  RefPtr<SourceMediaStream> source = GetSourceStream();
+
+  RefPtr<SourceMediaStream> source = mStream;
+  if (!source) {
+    MOZ_ASSERT(false, "Can't end tracks. No source stream.");
+    return;
+  }
+
   MediaManager::PostTask(NewTaskFrom([source]() {
     MOZ_ASSERT(MediaManager::IsInMediaThread());
     source->EndAllTrackAndFinish();
   }));
 }
 
 void
 SourceListener::Remove()
@@ -3648,55 +3658,58 @@ SourceListener::Remove()
 }
 
 void
 SourceListener::StopTrack(TrackID aTrackID)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread");
 
   RefPtr<MediaDevice> device;
-  RefPtr<SourceMediaStream> source;
+
+  if (!Activated()) {
+    MOZ_ASSERT(false, "No device to stop");
+    return;
+  }
 
   switch (aTrackID) {
     case kAudioTrack: {
       LOG(("SourceListener %p stopping audio track %d", this, aTrackID));
       if (!mAudioDevice) {
         NS_ASSERTION(false, "Can't stop audio. No device.");
         return;
       }
       if (mAudioStopped) {
         // Audio already stopped
         return;
       }
       device = mAudioDevice;
-      source = GetSourceStream();
       mAudioStopped = true;
       break;
     }
     case kVideoTrack: {
       LOG(("SourceListener %p stopping video track %d", this, aTrackID));
       if (!mVideoDevice) {
         NS_ASSERTION(false, "Can't stop video. No device.");
         return;
       }
       if (mVideoStopped) {
         // Video already stopped
         return;
       }
       device = mVideoDevice;
-      source = GetSourceStream();
       mVideoStopped = true;
       break;
     }
     default: {
       MOZ_ASSERT(false, "Unknown track id");
       return;
     }
   }
 
+  RefPtr<SourceMediaStream> source = mStream;
   MediaManager::PostTask(NewTaskFrom([device, source, aTrackID]() {
     device->GetSource()->Stop(source, aTrackID);
     device->Deallocate();
   }));
 
   if ((!mAudioDevice || mAudioStopped) &&
       (!mVideoDevice || mVideoStopped)) {
     LOG(("SourceListener %p this was the last track stopped", this));
@@ -3743,20 +3756,17 @@ SourceListener::StopSharing()
     mStream->Destroy();
   }
 }
 
 SourceMediaStream*
 SourceListener::GetSourceStream()
 {
   NS_ASSERTION(mStream,"Getting stream from never-activated SourceListener");
-  if (!mStream) {
-    return nullptr;
-  }
-  return mStream->AsSourceStream();
+  return mStream;
 }
 
 void
 SourceListener::GetSettings(dom::MediaTrackSettings& aOutSettings, TrackID aTrackID)
 {
   switch (aTrackID) {
     case kVideoTrack: {
       if (mVideoDevice) {
@@ -3851,76 +3861,76 @@ SourceListener::NotifyFinished()
 
 void
 SourceListener::NotifyRemoved()
 {
   MOZ_ASSERT(NS_IsMainThread());
   LOG(("SourceListener removed, mFinished = %d", (int) mFinished));
   mRemoved = true;
 
-  if (!mFinished) {
+  if (Activated() && !mFinished) {
     NotifyFinished();
   }
 
   mWindowListener = nullptr;
 }
 
 bool
 SourceListener::CapturingVideo() const
 {
   MOZ_ASSERT(NS_IsMainThread());
-  return mActivated && mVideoDevice && !mVideoStopped &&
+  return Activated() && mVideoDevice && !mVideoStopped &&
          !mVideoDevice->GetSource()->IsAvailable() &&
          mVideoDevice->GetMediaSource() == dom::MediaSourceEnum::Camera &&
          (!mVideoDevice->GetSource()->IsFake() ||
           Preferences::GetBool("media.navigator.permission.fake"));
 }
 
 bool
 SourceListener::CapturingAudio() const
 {
   MOZ_ASSERT(NS_IsMainThread());
-  return mActivated && mAudioDevice && !mAudioStopped &&
+  return Activated() && mAudioDevice && !mAudioStopped &&
          !mAudioDevice->GetSource()->IsAvailable() &&
          (!mAudioDevice->GetSource()->IsFake() ||
           Preferences::GetBool("media.navigator.permission.fake"));
 }
 
 bool
 SourceListener::CapturingScreen() const
 {
   MOZ_ASSERT(NS_IsMainThread());
-  return mActivated && mVideoDevice && !mVideoStopped &&
+  return Activated() && mVideoDevice && !mVideoStopped &&
          !mVideoDevice->GetSource()->IsAvailable() &&
          mVideoDevice->GetMediaSource() == dom::MediaSourceEnum::Screen;
 }
 
 bool
 SourceListener::CapturingWindow() const
 {
   MOZ_ASSERT(NS_IsMainThread());
-  return mActivated && mVideoDevice && !mVideoStopped &&
+  return Activated() && mVideoDevice && !mVideoStopped &&
          !mVideoDevice->GetSource()->IsAvailable() &&
          mVideoDevice->GetMediaSource() == dom::MediaSourceEnum::Window;
 }
 
 bool
 SourceListener::CapturingApplication() const
 {
   MOZ_ASSERT(NS_IsMainThread());
-  return mActivated && mVideoDevice && !mVideoStopped &&
+  return Activated() && mVideoDevice && !mVideoStopped &&
          !mVideoDevice->GetSource()->IsAvailable() &&
          mVideoDevice->GetMediaSource() == dom::MediaSourceEnum::Application;
 }
 
 bool
 SourceListener::CapturingBrowser() const
 {
   MOZ_ASSERT(NS_IsMainThread());
-  return mActivated && mVideoDevice && !mVideoStopped &&
+  return Activated() && mVideoDevice && !mVideoStopped &&
          !mVideoDevice->GetSource()->IsAvailable() &&
          mVideoDevice->GetMediaSource() == dom::MediaSourceEnum::Browser;
 }
 
 already_AddRefed<PledgeVoid>
 SourceListener::ApplyConstraintsToTrack(
     nsPIDOMWindowInner* aWindow,
     TrackID aTrackID,
--- a/dom/media/gmp/GMPProcessParent.cpp
+++ b/dom/media/gmp/GMPProcessParent.cpp
@@ -18,17 +18,16 @@
 
 #include <string>
 
 using std::vector;
 using std::string;
 
 using mozilla::gmp::GMPProcessParent;
 using mozilla::ipc::GeckoChildProcessHost;
-using base::ProcessArchitecture;
 
 namespace mozilla {
 namespace gmp {
 
 GMPProcessParent::GMPProcessParent(const std::string& aGMPPath)
 : GeckoChildProcessHost(GeckoProcessType_GMPlugin),
   mGMPPath(aGMPPath)
 {
@@ -73,17 +72,17 @@ GMPProcessParent::Launch(int32_t aTimeou
     mAllowedFilesRead.push_back(wGMPPath + L"\\*");
   }
 
   args.push_back(WideToUTF8(wGMPPath));
 #else
   args.push_back(mGMPPath);
 #endif
 
-  return SyncLaunch(args, aTimeoutMs, base::GetCurrentProcessArchitecture());
+  return SyncLaunch(args, aTimeoutMs);
 }
 
 void
 GMPProcessParent::Delete(nsCOMPtr<nsIRunnable> aCallback)
 {
   mDeletedCallback = aCallback;
   XRE_GetIOMessageLoop()->PostTask(NewNonOwningRunnableMethod(
     "gmp::GMPProcessParent::DoDelete", this, &GMPProcessParent::DoDelete));
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -312,19 +312,16 @@ LOCAL_INCLUDES += [
 if CONFIG['MOZ_WEBRTC']:
     LOCAL_INCLUDES += [
         '/media/webrtc/signaling/src/common',
         '/media/webrtc/trunk',
     ]
 
 DEFINES['MOZILLA_INTERNAL_API'] = True
 
-if CONFIG['ANDROID_VERSION'] > '15':
-    DEFINES['MOZ_OMX_WEBM_DECODER'] = True
-
 if CONFIG['MOZ_ANDROID_HLS_SUPPORT']:
     DEFINES['MOZ_ANDROID_HLS_SUPPORT'] = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 # Suppress some GCC warnings being treated as errors:
 #  - about attributes on forward declarations for types that are already
 #    defined, which complains about an important MOZ_EXPORT for android::AString
--- a/dom/media/test/can_play_type_webm.js
+++ b/dom/media/test/can_play_type_webm.js
@@ -4,41 +4,16 @@ function check_webm(v, enabled) {
   }
 
   // WebM types
   check("video/webm", "maybe");
   check("audio/webm", "maybe");
 
   var video = ['vp8', 'vp8.0', 'vp9', 'vp9.0'];
   var audio = ['vorbis', 'opus'];
-  // Check for FxOS case.
-  // Since we want to use OMX webm HW acceleration to speed up vp8 decoding,
-  // we enabled it after Android version 16(JB) as MOZ_OMX_WEBM_DECODER
-  // defined in moz.build. More information is on Bug 986381.
-  // Currently OMX (KK included) webm decoders can only support vp8 and vorbis,
-  // so only vp8 and vorbis will be tested when OMX webm decoder is enabled.
-  if (navigator.userAgent.indexOf("Mobile") != -1 &&
-      navigator.userAgent.indexOf("Android") == -1) {
-    // See nsSystemInfo.cpp, the getProperty('version') and
-    // getProperty('sdk_version') are different.
-    var androidSDKVer = SpecialPowers.Cc['@mozilla.org/system-info;1']
-                                     .getService(SpecialPowers.Ci.nsIPropertyBag2)
-                                     .getProperty('sdk_version');
-    info("android version:"+androidSDKVer);
-
-    // Since from Android KK, vp9 sw decoder is supported.
-    if (androidSDKVer > 18) {
-      video = ['vp8', 'vp8.0', 'vp9', 'vp9.0'];
-      audio = ['vorbis'];
-    } else if (androidSDKVer > 15) {
-      video = ['vp8', 'vp8.0'];
-      audio = ['vorbis'];
-    }
-
-  }
 
   audio.forEach(function(acodec) {
     check("audio/webm; codecs=" + acodec, "probably");
     check("video/webm; codecs=" + acodec, "probably");
   });
   video.forEach(function(vcodec) {
     check("video/webm; codecs=" + vcodec, "probably");
     audio.forEach(function(acodec) {
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..1f1cade6dc9b6d11fe2bb72b1f48cde393053f56
GIT binary patch
literal 6781
zc$|}Ry}x+AQ(GgW({~{L)X3uWxsk)EsiizMDc7mJk;$pGkx3%BA)S!{1f+ZgeP@@f
z_1)bQyt+lyb7flankE5e2v;m*T{eij7{Zka-VNePS-tT;$1n;;!6+C7qhJ(_f>AIE
zM!_f;1*2dT3=+UN&<+?f0Mzeyn5A`nV>7>#gKxv)oXn)uq}&{ZGDAHBJp%=81)xA~
zVo6bcadsk9Fx>HIZgyF2YEgQsLYWCznTC2uMyf(^Nn%m4LV0RYszPpNUaGpLLQ-jF
zPKiQ(o`P3to`Rvdf{}rtfr6ohm5I5Pk%3ERi<^uCgG*uu%Y4)2ZUQ9?#Y-lvG-OX_
z<zD`Gy7Pz5!W}F|pn-_<>&{+pWGp_~$k^P-*wM(4`@E5{tu-t@EWkqfadV6HtWyk1
zTjw;F=A}GXvZ2voSEED7h8CdTWJ7jAs56bSA-fw{Lhd%Qg{*3nf8!!E(7`?mMgbkc
z|NsBl2igro2FN>aD|L2!-pH`nsk)JYp&>wsVJ@Q<BZC7213O1+Ye#EK2g5P}NllIT
z1N9757jx!2*2I5c|8o98`KIz~-|l~ve!J|5hx-ry2iH&4e~>>{FI44O&rt2~v+=Lz
zzx21N|N4KkZ;=1FZ`!}f^7m|8>Vs>$|2x#G+8?Oj{KNad_P_kU@~hVVVcjz|;(vmD
zTRCTEy7}}3HnUqDs-K@4yKQRm$rqWjc6DX8m#Fh{hJXL$@6BL(<e(*Rp(MwbXH~%6
zSxsWz|9@*%C)67<o|wjO7unBPVxM#<^+>@LorU)nUitE61N(-c90`tvo769!?=QHy
zR3z%rlGzz90{`VN+g`4b>o)TBwwoBDD!7fGr|A0sFR}H1=NkY2lOg|K-tGJUfAhWT
z-&B6x_L+0bu_b&AO?CgfitE-Ki+lE6H?C76(Ag~b`LBPzkpeI3HELo@7U;+S+cN*c
zXUk8~4hMIAKiB&=J$VbGg}}BCSNE;4T*J^1D6r+`wO`50rn>)pz&!Kiq8C0{k*eD=
zc6L|Wtk~HdVq#hU|K&{17~jd}s;at=L(>*GPO}k>SNNJSugK)5llg47Urr96su#>#
zr<%Tbaeb9bXzO|Qo?|5%;%(0vd7nPmyhlhpp)W7u-$VI7w*Oz}|Bu`#y#M#JBkSL|
z<!uXmTczd5&Awi_qMXAv`^|~v{}sQ4|NX!s^G#)%muAYLQx`M~pD~_HzAy1)v(O>d
z242A(QQ!0a3mlp5I%Vno9;W~Qmw)~LKg0e1kHd2sMAoi*Z1a?BiD}rG7Z>fMI+s>X
zJ1-GmQ#m8Vw1Fi<OHjBVH-8RS!cO^ZXMgWsQ=hHmeIVWJp=xlXW=cn-X<<-B&x4I;
zoE$aFd%^?ayDYzCF)aSk$ozs~BQpbo0ILDR0YBTzlfq*XmR$JyUm_|0XM<2q$CdE5
z1Hc6EC_z+NXu)ma-%l%qUN5WL!}z1=%gK2GQtLR@<eF6Jls&Th)sh=2xHpH{FqTj0
zz#jc63Po{K+z;3p`ZXuqpWeRj(b4m)=?o8eO3fpa-8@+s79VM3zrZk&32JkeTlro8
zI}Lud%y!CWDnJ%q;*d^1yXW67|HEtf4F7(%?~qTj*|_aQ;VS2MEIxrZPDp+=JOj=~
z4o99haqn2X515S@3Ss6k>M8$Uz_225*QuQa4VcD#m|HL>ysPnfa_w>Vt0g=?A20y*
z14Du${XqYauOH?U@dB(qsVCDXiy2sU^#5yMTG;kl>**l|diezC5oHZZqXaY|)VI55
Qb0fp{_V101ADcwQ0CJlM?f?J)
--- a/dom/media/test/crashtests/crashtests.list
+++ b/dom/media/test/crashtests/crashtests.list
@@ -88,16 +88,17 @@ load 1185192.html
 load 1257700.html
 load 1270303.html
 load 1304948.html
 load 1319486.html
 load 1368490.html
 load 1291702.html
 load 1378826.html
 load 1384248.html
+load 1393272.webm
 load disconnect-wrong-destination.html
 load analyser-channels-1.html
 load audiocontext-double-suspend.html
 load buffer-source-duration-1.html
 load buffer-source-ended-1.html
 load buffer-source-resampling-start-1.html
 load buffer-source-slow-resampling-1.html
 load doppler-1.html
--- a/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm
+++ b/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm
@@ -12,71 +12,122 @@
 #include "mozilla/dom/nsSynthVoiceRegistry.h"
 #include "mozilla/dom/nsSpeechTask.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Assertions.h"
 #include "OSXSpeechSynthesizerService.h"
 
 #import <Cocoa/Cocoa.h>
 
+@class SpeechDelegate;
+
 // We can escape the default delimiters ("[[" and "]]") by temporarily
 // changing the delimiters just before they appear, and changing them back
 // just after.
 #define DLIM_ESCAPE_START "[[dlim (( ))]]"
 #define DLIM_ESCAPE_END "((dlim [[ ]]))"
 
 using namespace mozilla;
 
 class SpeechTaskCallback final : public nsISpeechTaskCallback
 {
 public:
   SpeechTaskCallback(nsISpeechTask* aTask,
                      NSSpeechSynthesizer* aSynth,
-                     const nsTArray<size_t>& aOffsets)
-    : mTask(aTask)
-    , mSpeechSynthesizer(aSynth)
-    , mOffsets(aOffsets)
-  {
-    mStartingTime = TimeStamp::Now();
-  }
+                     const nsTArray<size_t>& aOffsets);
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(SpeechTaskCallback, nsISpeechTaskCallback)
 
   NS_DECL_NSISPEECHTASKCALLBACK
 
   void OnWillSpeakWord(uint32_t aIndex, uint32_t aLength);
   void OnError(uint32_t aIndex);
   void OnDidFinishSpeaking();
 
 private:
-  virtual ~SpeechTaskCallback()
-  {
-    [mSpeechSynthesizer release];
-  }
+  virtual ~SpeechTaskCallback();
 
   float GetTimeDurationFromStart();
 
   nsCOMPtr<nsISpeechTask> mTask;
   NSSpeechSynthesizer* mSpeechSynthesizer;
+  SpeechDelegate* mDelegate;
   TimeStamp mStartingTime;
   uint32_t mCurrentIndex;
   nsTArray<size_t> mOffsets;
 };
 
+@interface SpeechDelegate : NSObject<NSSpeechSynthesizerDelegate>
+{
+@private
+  SpeechTaskCallback* mCallback;
+}
+
+  - (id)initWithCallback:(SpeechTaskCallback*)aCallback;
+@end
+
+@implementation SpeechDelegate
+- (id)initWithCallback:(SpeechTaskCallback*)aCallback
+{
+  [super init];
+  mCallback = aCallback;
+  return self;
+}
+
+- (void)speechSynthesizer:(NSSpeechSynthesizer *)aSender
+            willSpeakWord:(NSRange)aRange ofString:(NSString*)aString
+{
+  mCallback->OnWillSpeakWord(aRange.location, aRange.length);
+}
+
+- (void)speechSynthesizer:(NSSpeechSynthesizer *)aSender
+        didFinishSpeaking:(BOOL)aFinishedSpeaking
+{
+  mCallback->OnDidFinishSpeaking();
+}
+
+- (void)speechSynthesizer:(NSSpeechSynthesizer*)aSender
+ didEncounterErrorAtIndex:(NSUInteger)aCharacterIndex
+                 ofString:(NSString*)aString
+                  message:(NSString*)aMessage
+{
+  mCallback->OnError(aCharacterIndex);
+}
+@end
+
 NS_IMPL_CYCLE_COLLECTION(SpeechTaskCallback, mTask);
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SpeechTaskCallback)
   NS_INTERFACE_MAP_ENTRY(nsISpeechTaskCallback)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISpeechTaskCallback)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(SpeechTaskCallback)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(SpeechTaskCallback)
 
+SpeechTaskCallback::SpeechTaskCallback(nsISpeechTask* aTask,
+                                       NSSpeechSynthesizer* aSynth,
+                                       const nsTArray<size_t>& aOffsets)
+  : mTask(aTask)
+  , mSpeechSynthesizer(aSynth)
+  , mOffsets(aOffsets)
+{
+  mDelegate = [[SpeechDelegate alloc] initWithCallback:this];
+  [mSpeechSynthesizer setDelegate:mDelegate];
+  mStartingTime = TimeStamp::Now();
+}
+
+SpeechTaskCallback::~SpeechTaskCallback()
+{
+  [mSpeechSynthesizer setDelegate:nil];
+  [mDelegate release];
+  [mSpeechSynthesizer release];
+}
+
 NS_IMETHODIMP
 SpeechTaskCallback::OnCancel()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   [mSpeechSynthesizer stopSpeaking];
   return NS_OK;
 
@@ -161,54 +212,16 @@ void
 SpeechTaskCallback::OnDidFinishSpeaking()
 {
   mTask->DispatchEnd(GetTimeDurationFromStart(), mCurrentIndex);
   // no longer needed
   [mSpeechSynthesizer setDelegate:nil];
   mTask = nullptr;
 }
 
-@interface SpeechDelegate : NSObject<NSSpeechSynthesizerDelegate>
-{
-@private
-  SpeechTaskCallback* mCallback;
-}
-
-  - (id)initWithCallback:(SpeechTaskCallback*)aCallback;
-@end
-
-@implementation SpeechDelegate
-- (id)initWithCallback:(SpeechTaskCallback*)aCallback
-{
-  [super init];
-  mCallback = aCallback;
-  return self;
-}
-
-- (void)speechSynthesizer:(NSSpeechSynthesizer *)aSender
-            willSpeakWord:(NSRange)aRange ofString:(NSString*)aString
-{
-  mCallback->OnWillSpeakWord(aRange.location, aRange.length);
-}
-
-- (void)speechSynthesizer:(NSSpeechSynthesizer *)aSender
-        didFinishSpeaking:(BOOL)aFinishedSpeaking
-{
-  mCallback->OnDidFinishSpeaking();
-}
-
-- (void)speechSynthesizer:(NSSpeechSynthesizer*)aSender
- didEncounterErrorAtIndex:(NSUInteger)aCharacterIndex
-                 ofString:(NSString*)aString
-                  message:(NSString*)aMessage
-{
-  mCallback->OnError(aCharacterIndex);
-}
-@end
-
 namespace mozilla {
 namespace dom {
 
 struct OSXVoice
 {
   OSXVoice() : mIsDefault(false)
   {
   }
@@ -424,20 +437,16 @@ OSXSpeechSynthesizerService::Speak(const
       offsets.AppendElement(i);
     }
   }
 
   RefPtr<SpeechTaskCallback> callback = new SpeechTaskCallback(aTask, synth, offsets);
   nsresult rv = aTask->Setup(callback, 0, 0, 0);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  SpeechDelegate* delegate = [[SpeechDelegate alloc] initWithCallback:callback];
-  [synth setDelegate:delegate];
-  [delegate release ];
-
   NSString* text = nsCocoaUtils::ToNSString(escapedText);
   BOOL success = [synth startSpeakingString:text];
   NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
 
   aTask->DispatchStart();
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
--- a/dom/plugins/base/nsPluginsDirDarwin.cpp
+++ b/dom/plugins/base/nsPluginsDirDarwin.cpp
@@ -60,29 +60,16 @@ static CFBundleRef getPluginBundle(const
       bundle = ::CFBundleCreate(nullptr, bundleURL);
       ::CFRelease(bundleURL);
     }
     ::CFRelease(pathRef);
   }
   return bundle;
 }
 
-static nsresult toCFURLRef(nsIFile* file, CFURLRef& outURL)
-{
-  nsCOMPtr<nsILocalFileMac> lfm = do_QueryInterface(file);
-  if (!lfm)
-    return NS_ERROR_FAILURE;
-  CFURLRef url;
-  nsresult rv = lfm->GetCFURL(&url);
-  if (NS_SUCCEEDED(rv))
-    outURL = url;
-
-  return rv;
-}
-
 bool nsPluginsDir::IsPluginFile(nsIFile* file)
 {
   nsCString fileName;
   file->GetNativeLeafName(fileName);
   /*
    * Don't load the VDP fake plugin, to avoid tripping a bad bug in OS X
    * 10.5.3 (see bug 436575).
    */
@@ -357,72 +344,25 @@ static char* p2cstrdup(StringPtr pstr)
 
 static char* GetNextPluginStringFromHandle(Handle h, short *index)
 {
   char *ret = p2cstrdup((unsigned char*)(*h + *index));
   *index += (ret ? strlen(ret) : 0) + 1;
   return ret;
 }
 
-static bool IsCompatibleArch(nsIFile *file)
-{
-  CFURLRef pluginURL = nullptr;
-  if (NS_FAILED(toCFURLRef(file, pluginURL)))
-    return false;
-
-  bool isPluginFile = false;
-
-  CFBundleRef pluginBundle = ::CFBundleCreate(kCFAllocatorDefault, pluginURL);
-  if (pluginBundle) {
-    UInt32 packageType, packageCreator;
-    ::CFBundleGetPackageInfo(pluginBundle, &packageType, &packageCreator);
-    if (packageType == 'BRPL' || packageType == 'IEPL' || packageType == 'NSPL') {
-      // Get path to plugin as a C string.
-      char executablePath[PATH_MAX];
-      executablePath[0] = '\0';
-      if (!::CFURLGetFileSystemRepresentation(pluginURL, true, (UInt8*)&executablePath, PATH_MAX)) {
-        executablePath[0] = '\0';
-      }
-
-      uint32_t pluginLibArchitectures;
-      nsresult rv = mozilla::ipc::GeckoChildProcessHost::GetArchitecturesForBinary(executablePath, &pluginLibArchitectures);
-      if (NS_FAILED(rv)) {
-        return false;
-      }
-
-      uint32_t supportedArchitectures =
-#ifdef __LP64__
-          mozilla::ipc::GeckoChildProcessHost::GetSupportedArchitecturesForProcessType(GeckoProcessType_Plugin);
-#else
-          base::GetCurrentProcessArchitecture();
-#endif
-
-      // Consider the plugin architecture valid if there is any overlap in the masks.
-      isPluginFile = !!(supportedArchitectures & pluginLibArchitectures);
-    }
-    ::CFRelease(pluginBundle);
-  }
-
-  ::CFRelease(pluginURL);
-  return isPluginFile;
-}
-
 /**
  * Obtains all of the information currently available for this plugin.
  */
 nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
 {
   *outLibrary = nullptr;
 
   nsresult rv = NS_OK;
 
-  if (!IsCompatibleArch(mPlugin)) {
-      return NS_ERROR_FAILURE;
-  }
-
   // clear out the info, except for the first field.
   memset(&info, 0, sizeof(info));
 
   // Try to get a bundle reference.
   nsAutoCString path;
   if (NS_FAILED(rv = mPlugin->GetNativePath(path)))
     return rv;
   CFBundleRef bundle = getPluginBundle(path.get());
--- a/dom/plugins/ipc/PluginProcessParent.cpp
+++ b/dom/plugins/ipc/PluginProcessParent.cpp
@@ -16,17 +16,16 @@
 
 using std::vector;
 using std::string;
 
 using mozilla::ipc::BrowserProcessSubThread;
 using mozilla::ipc::GeckoChildProcessHost;
 using mozilla::plugins::LaunchCompleteTask;
 using mozilla::plugins::PluginProcessParent;
-using base::ProcessArchitecture;
 
 #ifdef XP_WIN
 PluginProcessParent::PidSet* PluginProcessParent::sPidSet = nullptr;
 #endif
 
 PluginProcessParent::PluginProcessParent(const std::string& aPluginFilePath) :
       GeckoChildProcessHost(GeckoProcessType_Plugin)
     , mPluginFilePath(aPluginFilePath)
@@ -59,58 +58,22 @@ PluginProcessParent::Launch(mozilla::Uni
     mSandboxLevel = aSandboxLevel;
 #else
     if (aSandboxLevel != 0) {
         MOZ_ASSERT(false,
                    "Can't enable an NPAPI process sandbox for platform/build.");
     }
 #endif
 
-    ProcessArchitecture currentArchitecture = base::GetCurrentProcessArchitecture();
-    uint32_t containerArchitectures = GetSupportedArchitecturesForProcessType(GeckoProcessType_Plugin);
-
-    uint32_t pluginLibArchitectures = currentArchitecture;
-#ifdef XP_MACOSX
-    nsresult rv = GetArchitecturesForBinary(mPluginFilePath.c_str(), &pluginLibArchitectures);
-    if (NS_FAILED(rv)) {
-        // If the call failed just assume that we want the current architecture.
-        pluginLibArchitectures = currentArchitecture;
-    }
-#endif
-
-    ProcessArchitecture selectedArchitecture = currentArchitecture;
-    if (!(pluginLibArchitectures & containerArchitectures & currentArchitecture)) {
-        // Prefererence in order: x86_64, i386, PPC. The only particularly important thing
-        // about this order is that we'll prefer 64-bit architectures first.
-        if (base::PROCESS_ARCH_X86_64 & pluginLibArchitectures & containerArchitectures) {
-            selectedArchitecture = base::PROCESS_ARCH_X86_64;
-        }
-        else if (base::PROCESS_ARCH_I386 & pluginLibArchitectures & containerArchitectures) {
-            selectedArchitecture = base::PROCESS_ARCH_I386;
-        }
-        else if (base::PROCESS_ARCH_PPC & pluginLibArchitectures & containerArchitectures) {
-            selectedArchitecture = base::PROCESS_ARCH_PPC;
-        }
-        else if (base::PROCESS_ARCH_ARM & pluginLibArchitectures & containerArchitectures) {
-          selectedArchitecture = base::PROCESS_ARCH_ARM;
-        }
-        else if (base::PROCESS_ARCH_MIPS & pluginLibArchitectures & containerArchitectures) {
-          selectedArchitecture = base::PROCESS_ARCH_MIPS;
-        }
-        else {
-            return false;
-        }
-    }
-
     mLaunchCompleteTask = mozilla::Move(aLaunchCompleteTask);
 
     vector<string> args;
     args.push_back(MungePluginDsoPath(mPluginFilePath));
 
-    bool result = AsyncLaunch(args, selectedArchitecture);
+    bool result = AsyncLaunch(args);
     if (!result) {
         mLaunchCompleteTask = nullptr;
     }
     return result;
 }
 
 void
 PluginProcessParent::Delete()
--- a/dom/tests/mochitest/storageevent/interOriginTest2.js
+++ b/dom/tests/mochitest/storageevent/interOriginTest2.js
@@ -26,18 +26,18 @@ function onMessageReceived(event)
       // Just fall through...
 
     // Indication of successfully finished step of a test
     case "perf":
       if (callMasterFrame)
         masterFrame.postMessage("step", "*");
       else if (slaveFrame)
         slaveFrame.postMessage("step", "*");
-      else if (SpecialPowers.wrap(masterFrame).slaveFrame)
-        SpecialPowers.wrap(masterFrame).slaveFrame.postMessage("step", "*");
+      else if (masterFrame.slaveFrame)
+        masterFrame.slaveFrame.postMessage("step", "*");
       callMasterFrame = !callMasterFrame;
       break;
 
     // Indication of all test parts finish (from any of the frames)
     case "done":
       if (testDone)
         break;
 
--- a/dom/u2f/U2F.cpp
+++ b/dom/u2f/U2F.cpp
@@ -422,16 +422,16 @@ U2F::Cancel()
   if (mSignCallback.isSome()) {
     SignResponse response;
     response.mErrorCode.Construct(static_cast<uint32_t>(errorCode));
     ExecuteCallback(response, mSignCallback);
   }
 
   RefPtr<U2FManager> mgr = U2FManager::Get();
   if (mgr) {
-    mgr->Cancel(NS_ERROR_DOM_OPERATION_ERR);
+    mgr->MaybeCancelTransaction(NS_ERROR_DOM_OPERATION_ERR);
   }
 
   mPromiseHolder.DisconnectIfExists();
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/u2f/U2FManager.cpp
+++ b/dom/u2f/U2FManager.cpp
@@ -93,36 +93,59 @@ ConvertNSResultToErrorCode(const nsresul
  **********************************************************************/
 
 U2FManager::U2FManager()
 {
   MOZ_ASSERT(NS_IsMainThread());
 }
 
 void
-U2FManager::MaybeClearTransaction()
+U2FManager::ClearTransaction()
 {
-  mClientData.reset();
-  mInfo.reset();
-  mTransactionPromise.RejectIfExists(ErrorCode::OTHER_ERROR, __func__);
-  if (mCurrentParent) {
-    StopListeningForVisibilityEvents(mCurrentParent, this);
-    mCurrentParent = nullptr;
+  if (!NS_WARN_IF(mTransaction.isNothing())) {
+    StopListeningForVisibilityEvents(mTransaction.ref().mParent, this);
   }
 
+  mTransaction.reset();
+
   if (mChild) {
     RefPtr<U2FTransactionChild> c;
     mChild.swap(c);
     c->Send__delete__(c);
   }
 }
 
+void
+U2FManager::RejectTransaction(const nsresult& aError)
+{
+  if (!NS_WARN_IF(mTransaction.isNothing())) {
+    ErrorCode code = ConvertNSResultToErrorCode(aError);
+    mTransaction.ref().mPromise.Reject(code, __func__);
+  }
+
+  ClearTransaction();
+}
+
+void
+U2FManager::CancelTransaction(const nsresult& aError)
+{
+  if (mChild) {
+    mChild->SendRequestCancel();
+  }
+
+  RejectTransaction(aError);
+}
+
 U2FManager::~U2FManager()
 {
-  MaybeClearTransaction();
+  MOZ_ASSERT(NS_IsMainThread());
+
+  if (mTransaction.isSome()) {
+    RejectTransaction(NS_ERROR_ABORT);
+  }
 }
 
 RefPtr<U2FManager::BackgroundActorPromise>
 U2FManager::GetOrCreateBackgroundActor()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   PBackgroundChild *actor = BackgroundChild::GetForCurrentThread();
@@ -158,277 +181,284 @@ U2FManager::GetOrCreate()
 //static
 U2FManager*
 U2FManager::Get()
 {
   MOZ_ASSERT(NS_IsMainThread());
   return gU2FManager;
 }
 
+//static
 nsresult
-U2FManager::PopulateTransactionInfo(const nsCString& aRpId,
-                      const nsCString& aClientDataJSON,
-                      const uint32_t& aTimeoutMillis,
-                      const nsTArray<WebAuthnScopedCredentialDescriptor>& aList)
+U2FManager::BuildTransactionHashes(const nsCString& aRpId,
+                                   const nsCString& aClientDataJSON,
+                                   /* out */ CryptoBuffer& aRpIdHash,
+                                   /* out */ CryptoBuffer& aClientDataHash)
 {
-  MOZ_ASSERT(mInfo.isNothing());
-
   nsresult srv;
   nsCOMPtr<nsICryptoHash> hashService =
     do_CreateInstance(NS_CRYPTO_HASH_CONTRACTID, &srv);
   if (NS_FAILED(srv)) {
     return srv;
   }
 
-  CryptoBuffer rpIdHash;
-  if (!rpIdHash.SetLength(SHA256_LENGTH, fallible)) {
+  if (!aRpIdHash.SetLength(SHA256_LENGTH, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
-  srv = HashCString(hashService, aRpId, rpIdHash);
+  srv = HashCString(hashService, aRpId, aRpIdHash);
   if (NS_WARN_IF(NS_FAILED(srv))) {
     return NS_ERROR_FAILURE;
   }
 
-  CryptoBuffer clientDataHash;
-  if (!clientDataHash.SetLength(SHA256_LENGTH, fallible)) {
+  if (!aClientDataHash.SetLength(SHA256_LENGTH, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
-  srv = HashCString(hashService, aClientDataJSON, clientDataHash);
+  srv = HashCString(hashService, aClientDataJSON, aClientDataHash);
   if (NS_WARN_IF(NS_FAILED(srv))) {
     return NS_ERROR_FAILURE;
   }
 
   if (MOZ_LOG_TEST(gU2FLog, LogLevel::Debug)) {
     nsString base64;
-    Unused << NS_WARN_IF(NS_FAILED(rpIdHash.ToJwkBase64(base64)));
+    Unused << NS_WARN_IF(NS_FAILED(aRpIdHash.ToJwkBase64(base64)));
 
     MOZ_LOG(gU2FLog, LogLevel::Debug,
             ("dom::U2FManager::RpID: %s", aRpId.get()));
 
     MOZ_LOG(gU2FLog, LogLevel::Debug,
             ("dom::U2FManager::Rp ID Hash (base64): %s",
               NS_ConvertUTF16toUTF8(base64).get()));
 
-    Unused << NS_WARN_IF(NS_FAILED(clientDataHash.ToJwkBase64(base64)));
+    Unused << NS_WARN_IF(NS_FAILED(aClientDataHash.ToJwkBase64(base64)));
 
     MOZ_LOG(gU2FLog, LogLevel::Debug,
             ("dom::U2FManager::Client Data JSON: %s", aClientDataJSON.get()));
 
     MOZ_LOG(gU2FLog, LogLevel::Debug,
             ("dom::U2FManager::Client Data Hash (base64): %s",
               NS_ConvertUTF16toUTF8(base64).get()));
   }
 
-  // Always blank for U2F
-  nsTArray<WebAuthnExtension> extensions;
-
-  WebAuthnTransactionInfo info(rpIdHash,
-                               clientDataHash,
-                               aTimeoutMillis,
-                               aList,
-                               extensions);
-  mInfo = Some(info);
   return NS_OK;
 }
 
-
 already_AddRefed<U2FPromise>
 U2FManager::Register(nsPIDOMWindowInner* aParent, const nsCString& aRpId,
                const nsCString& aClientDataJSON,
                const uint32_t& aTimeoutMillis,
                const nsTArray<WebAuthnScopedCredentialDescriptor>& aExcludeList)
 {
+  MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aParent);
 
-  MaybeClearTransaction();
+  if (mTransaction.isSome()) {
+    CancelTransaction(NS_ERROR_ABORT);
+  }
 
-  if (NS_FAILED(PopulateTransactionInfo(aRpId, aClientDataJSON, aTimeoutMillis,
-                                        aExcludeList))) {
+  CryptoBuffer rpIdHash, clientDataHash;
+  if (NS_FAILED(BuildTransactionHashes(aRpId, aClientDataJSON,
+                                       rpIdHash, clientDataHash))) {
     return U2FPromise::CreateAndReject(ErrorCode::OTHER_ERROR, __func__).forget();
   }
 
   RefPtr<MozPromise<nsresult, nsresult, false>> p = GetOrCreateBackgroundActor();
   p->Then(GetMainThreadSerialEventTarget(), __func__,
           []() {
             U2FManager* mgr = U2FManager::Get();
-            if (mgr && mgr->mChild) {
-              mgr->mChild->SendRequestRegister(mgr->mInfo.ref());
+            if (mgr && mgr->mChild && mgr->mTransaction.isSome()) {
+              mgr->mChild->SendRequestRegister(mgr->mTransaction.ref().mInfo);
             }
           },
           []() {
             // This case can't actually happen, we'll have crashed if the child
             // failed to create.
           });
 
-  // Only store off the promise if we've succeeded in sending the IPC event.
-  RefPtr<U2FPromise> promise = mTransactionPromise.Ensure(__func__);
-  mClientData = Some(aClientDataJSON);
-  mCurrentParent = aParent;
   ListenForVisibilityEvents(aParent, this);
-  return promise.forget();
+
+  // Always blank for U2F
+  nsTArray<WebAuthnExtension> extensions;
+
+  WebAuthnTransactionInfo info(rpIdHash,
+                               clientDataHash,
+                               aTimeoutMillis,
+                               aExcludeList,
+                               extensions);
+
+  MOZ_ASSERT(mTransaction.isNothing());
+  mTransaction = Some(U2FTransaction(aParent, Move(info), aClientDataJSON));
+  return mTransaction.ref().mPromise.Ensure(__func__);
 }
 
 already_AddRefed<U2FPromise>
 U2FManager::Sign(nsPIDOMWindowInner* aParent,
                  const nsCString& aRpId,
                  const nsCString& aClientDataJSON,
                  const uint32_t& aTimeoutMillis,
                  const nsTArray<WebAuthnScopedCredentialDescriptor>& aAllowList)
 {
+  MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aParent);
 
-  MaybeClearTransaction();
+  if (mTransaction.isSome()) {
+    CancelTransaction(NS_ERROR_ABORT);
+  }
 
-  if (NS_FAILED(PopulateTransactionInfo(aRpId, aClientDataJSON, aTimeoutMillis,
-                                        aAllowList))) {
+  CryptoBuffer rpIdHash, clientDataHash;
+  if (NS_FAILED(BuildTransactionHashes(aRpId, aClientDataJSON,
+                                       rpIdHash, clientDataHash))) {
     return U2FPromise::CreateAndReject(ErrorCode::OTHER_ERROR, __func__).forget();
   }
 
   RefPtr<MozPromise<nsresult, nsresult, false>> p = GetOrCreateBackgroundActor();
   p->Then(GetMainThreadSerialEventTarget(), __func__,
           []() {
             U2FManager* mgr = U2FManager::Get();
-            if (mgr && mgr->mChild) {
-              mgr->mChild->SendRequestSign(mgr->mInfo.ref());
+            if (mgr && mgr->mChild && mgr->mTransaction.isSome()) {
+              mgr->mChild->SendRequestSign(mgr->mTransaction.ref().mInfo);
             }
           },
           []() {
             // This case can't actually happen, we'll have crashed if the child
             // failed to create.
           });
 
-  // Only store off the promise if we've succeeded in sending the IPC event.
-  RefPtr<U2FPromise> promise = mTransactionPromise.Ensure(__func__);
-  mClientData = Some(aClientDataJSON);
-  mCurrentParent = aParent;
   ListenForVisibilityEvents(aParent, this);
-  return promise.forget();
+
+  // Always blank for U2F
+  nsTArray<WebAuthnExtension> extensions;
+
+  WebAuthnTransactionInfo info(rpIdHash,
+                               clientDataHash,
+                               aTimeoutMillis,
+                               aAllowList,
+                               extensions);
+
+  MOZ_ASSERT(mTransaction.isNothing());
+  mTransaction = Some(U2FTransaction(aParent, Move(info), aClientDataJSON));
+  return mTransaction.ref().mPromise.Ensure(__func__);
 }
 
 void
 U2FManager::FinishRegister(nsTArray<uint8_t>& aRegBuffer)
 {
-  MOZ_ASSERT(!mTransactionPromise.IsEmpty());
-  MOZ_ASSERT(mInfo.isSome());
+  MOZ_ASSERT(NS_IsMainThread());
+
+  // Check for a valid transaction.
+  if (mTransaction.isNothing()) {
+    return;
+  }
 
   CryptoBuffer clientDataBuf;
-  if (NS_WARN_IF(!clientDataBuf.Assign(mClientData.ref()))) {
-    mTransactionPromise.Reject(ErrorCode::OTHER_ERROR, __func__);
+  if (NS_WARN_IF(!clientDataBuf.Assign(mTransaction.ref().mClientData))) {
+    RejectTransaction(NS_ERROR_ABORT);
     return;
   }
 
   CryptoBuffer regBuf;
   if (NS_WARN_IF(!regBuf.Assign(aRegBuffer))) {
-    mTransactionPromise.Reject(ErrorCode::OTHER_ERROR, __func__);
+    RejectTransaction(NS_ERROR_ABORT);
     return;
   }
 
   nsString clientDataBase64;
   nsString registrationDataBase64;
   nsresult rvClientData = clientDataBuf.ToJwkBase64(clientDataBase64);
   nsresult rvRegistrationData = regBuf.ToJwkBase64(registrationDataBase64);
 
   if (NS_WARN_IF(NS_FAILED(rvClientData)) ||
       NS_WARN_IF(NS_FAILED(rvRegistrationData))) {
-    mTransactionPromise.Reject(ErrorCode::OTHER_ERROR, __func__);
+    RejectTransaction(NS_ERROR_ABORT);
     return;
   }
 
   // Assemble a response object to return
   RegisterResponse response;
   response.mVersion.Construct(kRequiredU2FVersion);
   response.mClientData.Construct(clientDataBase64);
   response.mRegistrationData.Construct(registrationDataBase64);
   response.mErrorCode.Construct(static_cast<uint32_t>(ErrorCode::OK));
 
   nsString responseStr;
   if (NS_WARN_IF(!response.ToJSON(responseStr))) {
-    mTransactionPromise.Reject(ErrorCode::OTHER_ERROR, __func__);
+    RejectTransaction(NS_ERROR_ABORT);
     return;
   }
 
-  mTransactionPromise.Resolve(responseStr, __func__);
-  MaybeClearTransaction();
+  mTransaction.ref().mPromise.Resolve(responseStr, __func__);
+  ClearTransaction();
 }
 
 void
 U2FManager::FinishSign(nsTArray<uint8_t>& aCredentialId,
                        nsTArray<uint8_t>& aSigBuffer)
 {
-  MOZ_ASSERT(!mTransactionPromise.IsEmpty());
-  MOZ_ASSERT(mInfo.isSome());
+  MOZ_ASSERT(NS_IsMainThread());
+
+  // Check for a valid transaction.
+  if (mTransaction.isNothing()) {
+    return;
+  }
 
   CryptoBuffer clientDataBuf;
-  if (NS_WARN_IF(!clientDataBuf.Assign(mClientData.ref()))) {
-    mTransactionPromise.Reject(ErrorCode::OTHER_ERROR, __func__);
+  if (NS_WARN_IF(!clientDataBuf.Assign(mTransaction.ref().mClientData))) {
+    RejectTransaction(NS_ERROR_ABORT);
     return;
   }
 
   CryptoBuffer credBuf;
   if (NS_WARN_IF(!credBuf.Assign(aCredentialId))) {
-    mTransactionPromise.Reject(ErrorCode::OTHER_ERROR, __func__);
+    RejectTransaction(NS_ERROR_ABORT);
     return;
   }
 
   CryptoBuffer sigBuf;
   if (NS_WARN_IF(!sigBuf.Assign(aSigBuffer))) {
-    mTransactionPromise.Reject(ErrorCode::OTHER_ERROR, __func__);
+    RejectTransaction(NS_ERROR_ABORT);
     return;
   }
 
   // Assemble a response object to return
   nsString clientDataBase64;
   nsString signatureDataBase64;
   nsString keyHandleBase64;
   nsresult rvClientData = clientDataBuf.ToJwkBase64(clientDataBase64);
   nsresult rvSignatureData = sigBuf.ToJwkBase64(signatureDataBase64);
   nsresult rvKeyHandle = credBuf.ToJwkBase64(keyHandleBase64);
   if (NS_WARN_IF(NS_FAILED(rvClientData)) ||
       NS_WARN_IF(NS_FAILED(rvSignatureData) ||
       NS_WARN_IF(NS_FAILED(rvKeyHandle)))) {
-    mTransactionPromise.Reject(ErrorCode::OTHER_ERROR, __func__);
+    RejectTransaction(NS_ERROR_ABORT);
     return;
   }
 
   SignResponse response;
   response.mKeyHandle.Construct(keyHandleBase64);
   response.mClientData.Construct(clientDataBase64);
   response.mSignatureData.Construct(signatureDataBase64);
   response.mErrorCode.Construct(static_cast<uint32_t>(ErrorCode::OK));
 
   nsString responseStr;
   if (NS_WARN_IF(!response.ToJSON(responseStr))) {
-    mTransactionPromise.Reject(ErrorCode::OTHER_ERROR, __func__);
+    RejectTransaction(NS_ERROR_ABORT);
     return;
   }
 
-  mTransactionPromise.Resolve(responseStr, __func__);
-  MaybeClearTransaction();
+  mTransaction.ref().mPromise.Resolve(responseStr, __func__);
+  ClearTransaction();
 }
 
 void
 U2FManager::RequestAborted(const nsresult& aError)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  Cancel(aError);
-}
-
-void
-U2FManager::Cancel(const nsresult& aError)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  ErrorCode code = ConvertNSResultToErrorCode(aError);
-
-  if (!mTransactionPromise.IsEmpty()) {
-    mTransactionPromise.RejectIfExists(code, __func__);
+  if (mTransaction.isSome()) {
+    RejectTransaction(aError);
   }
-
-  MaybeClearTransaction();
 }
 
 NS_IMETHODIMP
 U2FManager::HandleEvent(nsIDOMEvent* aEvent)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aEvent);
   MOZ_ASSERT(mChild);
@@ -442,19 +472,17 @@ U2FManager::HandleEvent(nsIDOMEvent* aEv
   nsCOMPtr<nsIDocument> doc =
     do_QueryInterface(aEvent->InternalDOMEvent()->GetTarget());
   MOZ_ASSERT(doc);
 
   if (doc && doc->Hidden()) {
     MOZ_LOG(gU2FManagerLog, LogLevel::Debug,
             ("Visibility change: U2F window is hidden, cancelling job."));
 
-    mChild->SendRequestCancel();
-
-    Cancel(NS_ERROR_DOM_TIMEOUT_ERR);
+    CancelTransaction(NS_ERROR_ABORT);
   }
 
   return NS_OK;
 }
 
 void
 U2FManager::ActorCreated(PBackgroundChild* aActor)
 {
--- a/dom/u2f/U2FManager.h
+++ b/dom/u2f/U2FManager.h
@@ -48,16 +48,41 @@ namespace mozilla {
 namespace dom {
 
 class ArrayBufferViewOrArrayBuffer;
 class OwningArrayBufferViewOrArrayBuffer;
 class Promise;
 class U2FTransactionChild;
 class U2FTransactionInfo;
 
+class U2FTransaction
+{
+public:
+  U2FTransaction(nsPIDOMWindowInner* aParent,
+                 const WebAuthnTransactionInfo&& aInfo,
+                 const nsCString& aClientData)
+    : mParent(aParent)
+    , mInfo(aInfo)
+    , mClientData(aClientData)
+  { }
+
+  // Parent of the context we're running the transaction in.
+  nsCOMPtr<nsPIDOMWindowInner> mParent;
+
+  // JS Promise representing the transaction status.
+  MozPromiseHolder<U2FPromise> mPromise;
+
+  // Holds the parameters of the current transaction, as we need them both
+  // before the transaction request is sent, and on successful return.
+  WebAuthnTransactionInfo mInfo;
+
+  // Client data used to assemble reply objects.
+  nsCString mClientData;
+};
+
 class U2FManager final : public nsIIPCBackgroundChildCreateCallback
                        , public nsIDOMEventListener
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMEVENTLISTENER
   NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
 
@@ -75,50 +100,52 @@ public:
               const uint32_t& aTimeoutMillis,
               const nsTArray<WebAuthnScopedCredentialDescriptor>& aKeyList);
 
   void FinishRegister(nsTArray<uint8_t>& aRegBuffer);
   void FinishSign(nsTArray<uint8_t>& aCredentialId,
                   nsTArray<uint8_t>& aSigBuffer);
   void RequestAborted(const nsresult& aError);
 
-  void Cancel(const nsresult& aError);
+  // XXX This is exposed only until we fix bug 1410346.
+  void MaybeCancelTransaction(const nsresult& aError) {
+    if (mTransaction.isSome()) {
+      CancelTransaction(NS_ERROR_ABORT);
+    }
+  }
 
   void ActorDestroyed();
 
 private:
   U2FManager();
   virtual ~U2FManager();
 
-  void MaybeClearTransaction();
-  nsresult PopulateTransactionInfo(const nsCString& aRpId,
-                    const nsCString& aClientDataJSON,
-                    const uint32_t& aTimeoutMillis,
-                    const nsTArray<WebAuthnScopedCredentialDescriptor>& aList);
+  static nsresult
+  BuildTransactionHashes(const nsCString& aRpId,
+                         const nsCString& aClientDataJSON,
+                         /* out */ CryptoBuffer& aRpIdHash,
+                         /* out */ CryptoBuffer& aClientDataHash);
+
+  // Clears all information we have about the current transaction.
+  void ClearTransaction();
+  // Rejects the current transaction and calls ClearTransaction().
+  void RejectTransaction(const nsresult& aError);
+  // Cancels the current transaction (by sending a Cancel message to the
+  // parent) and rejects it by calling RejectTransaction().
+  void CancelTransaction(const nsresult& aError);
 
   typedef MozPromise<nsresult, nsresult, false> BackgroundActorPromise;
 
   RefPtr<BackgroundActorPromise> GetOrCreateBackgroundActor();
 
-  // Promise representing transaction status.
-  MozPromiseHolder<U2FPromise> mTransactionPromise;
-
   // IPC Channel for the current transaction.
   RefPtr<U2FTransactionChild> mChild;
 
-  // Parent of the context we're currently running the transaction in.
-  nsCOMPtr<nsPIDOMWindowInner> mCurrentParent;
-
-  // Client data, stored on successful transaction creation, so that it can be
-  // used to assemble reply objects.
-  Maybe<nsCString> mClientData;
-
-  // Holds the parameters of the current transaction, as we need them both
-  // before the transaction request is sent, and on successful return.
-  Maybe<WebAuthnTransactionInfo> mInfo;
+  // The current transaction, if any.
+  Maybe<U2FTransaction> mTransaction;
 
   // Promise for dealing with PBackground Actor creation.
   MozPromiseHolder<BackgroundActorPromise> mPBackgroundCreationPromise;
 };
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/webauthn/U2FTokenManager.h
+++ b/dom/webauthn/U2FTokenManager.h
@@ -23,22 +23,16 @@ namespace mozilla {
 namespace dom {
 
 class U2FSoftTokenManager;
 class WebAuthnTransactionParent;
 
 class U2FTokenManager final
 {
 public:
-  enum TransactionType
-  {
-    RegisterTransaction = 0,
-    SignTransaction,
-    NumTransactionTypes
-  };
   NS_INLINE_DECL_REFCOUNTING(U2FTokenManager)
   static U2FTokenManager* Get();
   void Register(PWebAuthnTransactionParent* aTransactionParent,
                 const WebAuthnTransactionInfo& aTransactionInfo);
   void Sign(PWebAuthnTransactionParent* aTransactionParent,
             const WebAuthnTransactionInfo& aTransactionInfo);
   void Cancel(PWebAuthnTransactionParent* aTransactionParent);
   void MaybeClearTransaction(PWebAuthnTransactionParent* aParent);
--- a/dom/webauthn/WebAuthnManager.cpp
+++ b/dom/webauthn/WebAuthnManager.cpp
@@ -662,17 +662,21 @@ WebAuthnManager::Store(nsPIDOMWindowInne
   promise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
   return promise.forget();
 }
 
 void
 WebAuthnManager::FinishMakeCredential(nsTArray<uint8_t>& aRegBuffer)
 {
   MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(mTransaction.isSome());
+
+  // Check for a valid transaction.
+  if (mTransaction.isNothing()) {
+    return;
+  }
 
   CryptoBuffer regData;
   if (NS_WARN_IF(!regData.Assign(aRegBuffer.Elements(), aRegBuffer.Length()))) {
     RejectTransaction(NS_ERROR_OUT_OF_MEMORY);
     return;
   }
 
   mozilla::dom::CryptoBuffer aaguidBuf;
@@ -786,17 +790,21 @@ WebAuthnManager::FinishMakeCredential(ns
   ClearTransaction();
 }
 
 void
 WebAuthnManager::FinishGetAssertion(nsTArray<uint8_t>& aCredentialId,
                                     nsTArray<uint8_t>& aSigBuffer)
 {
   MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(mTransaction.isSome());
+
+  // Check for a valid transaction.
+  if (mTransaction.isNothing()) {
+    return;
+  }
 
   CryptoBuffer tokenSignatureData;
   if (NS_WARN_IF(!tokenSignatureData.Assign(aSigBuffer.Elements(),
                                             aSigBuffer.Length()))) {
     RejectTransaction(NS_ERROR_OUT_OF_MEMORY);
     return;
   }
 
@@ -867,17 +875,19 @@ WebAuthnManager::FinishGetAssertion(nsTA
   ClearTransaction();
 }
 
 void
 WebAuthnManager::RequestAborted(const nsresult& aError)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  RejectTransaction(aError);
+  if (mTransaction.isSome()) {
+    RejectTransaction(aError);
+  }
 }
 
 NS_IMETHODIMP
 WebAuthnManager::HandleEvent(nsIDOMEvent* aEvent)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aEvent);
 
--- a/dom/webidl/BaseKeyframeTypes.webidl
+++ b/dom/webidl/BaseKeyframeTypes.webidl
@@ -15,18 +15,19 @@
 
 enum CompositeOperation { "replace", "add", "accumulate" };
 
 // The following dictionary types are not referred to by other .webidl files,
 // but we use it for manual JS->IDL and IDL->JS conversions in
 // KeyframeEffectReadOnly's implementation.
 
 dictionary BasePropertyIndexedKeyframe {
-  DOMString easing = "linear";
-  CompositeOperation composite;
+  (double? or sequence<double?>) offset = [];
+  (DOMString or sequence<DOMString>) easing = [];
+  (CompositeOperation or sequence<CompositeOperation>) composite = [];
 };
 
 dictionary BaseKeyframe {
   double? offset = null;
   DOMString easing = "linear";
   CompositeOperation composite;
 
   // Non-standard extensions
--- a/dom/workers/WorkerThread.cpp
+++ b/dom/workers/WorkerThread.cpp
@@ -62,18 +62,18 @@ private:
   {
     mWorkerPrivate->AssertIsOnWorkerThread();
   }
 
   NS_DECL_NSITHREADOBSERVER
 };
 
 WorkerThread::WorkerThread()
-  : nsThread(WrapNotNull(new ThreadEventQueue<mozilla::EventQueue>(
-                           MakeUnique<mozilla::EventQueue>())),
+  : nsThread(MakeNotNull<ThreadEventQueue<mozilla::EventQueue>*>(
+               MakeUnique<mozilla::EventQueue>()),
              nsThread::NOT_MAIN_THREAD,
              kWorkerStackSize)
   , mLock("WorkerThread::mLock")
   , mWorkerPrivateCondVar(mLock, "WorkerThread::mWorkerPrivateCondVar")
   , mWorkerPrivate(nullptr)
   , mOtherThreadsDispatchingViaEventTarget(0)
 #ifdef DEBUG
   , mAcceptingNonWorkerRunnables(true)
--- a/dom/xul/crashtests/crashtests.list
+++ b/dom/xul/crashtests/crashtests.list
@@ -8,17 +8,17 @@ load 326644-2.html
 load 326864-1.xul
 load 326875-1.xul
 load 326881-1.xul
 load 329982-1.xhtml
 load 336096-1.xhtml
 load 344215-1.xul
 load 354611-1.html
 load 360078-1.xhtml
-asserts-if(stylo,11-16) load 363791-1.xul # bug 1397644
+load 363791-1.xul
 load 384740-1.xul
 load 384877-1.html
 load 386914-1.html
 load 386947-1.xul
 load 425821-1.xul
 load 428951-1.xul
 load 429085-1.xhtml
 load 431906-1.html
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -91,16 +91,17 @@
 #include "nsIFrame.h"
 #include "nsNodeInfoManager.h"
 #include "nsXBLBinding.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozAutoDocUpdate.h"
 #include "nsIDOMXULCommandEvent.h"
 #include "nsCCUncollectableMarker.h"
 #include "nsICSSDeclaration.h"
+#include "nsLayoutUtils.h"
 
 #include "mozilla/dom/XULElementBinding.h"
 #include "mozilla/dom/BoxObject.h"
 #include "mozilla/dom/HTMLIFrameElement.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
@@ -2326,28 +2327,36 @@ nsXULPrototypeElement::SetAttrAt(uint32_
         // Compute the element's class list
         mAttributes[aPos].mValue.ParseAtomArray(aValue);
 
         return NS_OK;
     } else if (mAttributes[aPos].mName.Equals(nsGkAtoms::style)) {
         mHasStyleAttribute = true;
         // Parse the element's 'style' attribute
 
-        nsCSSParser parser;
-
+        // This is basically duplicating what nsINode::NodePrincipal() does
+        nsIPrincipal* principal =
+          mNodeInfo->NodeInfoManager()->DocumentPrincipal();
         // XXX Get correct Base URI (need GetBaseURI on *prototype* element)
         // TODO: If we implement Content Security Policy for chrome documents
         // as has been discussed, the CSP should be checked here to see if
         // inline styles are allowed to be applied.
-        RefPtr<css::Declaration> declaration =
-          parser.ParseStyleAttribute(aValue, aDocumentURI, aDocumentURI,
-                                     // This is basically duplicating what
-                                     // nsINode::NodePrincipal() does
-                                     mNodeInfo->NodeInfoManager()->
-                                       DocumentPrincipal());
+
+        RefPtr<DeclarationBlock> declaration;
+        if (nsLayoutUtils::StyloEnabled() &&
+            nsLayoutUtils::ShouldUseStylo(aDocumentURI, principal)) {
+          RefPtr<URLExtraData> data =
+            new URLExtraData(aDocumentURI, aDocumentURI, principal);
+          declaration = ServoDeclarationBlock::FromCssText(
+              aValue, data, eCompatibility_FullStandards, nullptr);
+        } else {
+          nsCSSParser parser;
+          declaration = parser.ParseStyleAttribute(aValue, aDocumentURI,
+                                                   aDocumentURI, principal);
+        }
         if (declaration) {
             mAttributes[aPos].mValue.SetTo(declaration.forget(), &aValue);
 
             return NS_OK;
         }
         // Don't abort if parsing failed, it could just be malformed css.
     }
 
new file mode 100644
--- /dev/null
+++ b/editor/libeditor/crashtests/1344097.html
@@ -0,0 +1,20 @@
+<html>
+    <head>
+        <script></script>
+        <script>
+            document.designMode = 'on';
+            o1 = window.getSelection();
+            o2 = document.createElement('code'); 
+            o3 = document.createElement('style');
+            o4 = document.createElement('style');
+            document.head.appendChild(o3);
+            o1.modify("move", "right", "character");
+            document.styleSheets[0].insertRule("* { position: absolute; }", 0);
+            document.head.appendChild(o4);
+            window.resizeTo(1,1);
+            document.documentElement.appendChild(o2);
+            o1.selectAllChildren(o2);
+        </script>
+    </head>
+    <body></body>
+</html>
--- a/editor/libeditor/crashtests/crashtests.list
+++ b/editor/libeditor/crashtests/crashtests.list
@@ -69,16 +69,17 @@ load 1158651.html
 load 1244894.xhtml
 load 1264921.html
 load 1272490.html
 load 1274050.html