Merge mozilla-central to autoland. CLOSED TREE
authorCosmin Sabou <csabou@mozilla.com>
Wed, 09 Jan 2019 12:44:04 +0200
changeset 510118 045c6ce06b3d2251809d6b51dc780ba7d7d9e156
parent 510117 4728285e13e47b9c6dfee5af289c32a6f350a9ae (current diff)
parent 510116 26808f3dc0feb87880648c54ba23495d00457287 (diff)
child 510119 5f5e0f6f9b55d05e0186a647c8f7e2bbe9df25e3
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-central to autoland. CLOSED TREE
--- a/dom/smil/SMILAnimationFunction.cpp
+++ b/dom/smil/SMILAnimationFunction.cpp
@@ -2,22 +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 "SMILAnimationFunction.h"
 
 #include "mozilla/dom/SVGAnimationElement.h"
+#include "mozilla/Move.h"
+#include "mozilla/SMILCSSValueType.h"
+#include "mozilla/SMILNullType.h"
 #include "mozilla/SMILParserUtils.h"
 #include "mozilla/SMILTimedElement.h"
-#include "mozilla/Move.h"
 #include "nsISMILAttr.h"
-#include "SMILCSSValueType.h"
-#include "SMILNullType.h"
 #include "nsAttrValueInlines.h"
 #include "nsGkAtoms.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "nsIContent.h"
 #include "nsContentUtils.h"
 #include "nsReadableUtils.h"
 #include "nsString.h"
--- a/dom/smil/SMILBoolType.h
+++ b/dom/smil/SMILBoolType.h
@@ -3,17 +3,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 MOZILLA_SMILBOOLTYPE_H_
 #define MOZILLA_SMILBOOLTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 namespace mozilla {
 
 class SMILBoolType : public SMILType {
  public:
   // Singleton for nsSMILValue objects to hold onto.
   static SMILBoolType* Singleton() {
     static SMILBoolType sSingleton;
--- a/dom/smil/SMILCSSProperty.cpp
+++ b/dom/smil/SMILCSSProperty.cpp
@@ -6,19 +6,19 @@
 
 /* representation of a SMIL-animatable CSS property on an element */
 
 #include "SMILCSSProperty.h"
 
 #include "mozilla/dom/Element.h"
 #include "mozilla/Move.h"
 #include "mozilla/ServoBindings.h"
+#include "mozilla/SMILCSSValueType.h"
 #include "mozilla/StyleAnimationValue.h"
 #include "nsDOMCSSAttrDeclaration.h"
-#include "SMILCSSValueType.h"
 #include "nsSMILValue.h"
 #include "nsCSSProps.h"
 
 namespace mozilla {
 
 // Class Methods
 SMILCSSProperty::SMILCSSProperty(nsCSSPropertyID aPropID, Element* aElement,
                                  ComputedStyle* aBaseComputedStyle)
--- a/dom/smil/SMILCSSValueType.h
+++ b/dom/smil/SMILCSSValueType.h
@@ -4,20 +4,20 @@
  * 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/. */
 
 /* representation of a value for a SMIL-animated CSS property */
 
 #ifndef NS_SMILCSSVALUETYPE_H_
 #define NS_SMILCSSVALUETYPE_H_
 
-#include "SMILType.h"
+#include "mozilla/Attributes.h"
+#include "mozilla/SMILType.h"
 #include "nsCSSPropertyID.h"
 #include "nsStringFwd.h"
-#include "mozilla/Attributes.h"
 
 namespace mozilla {
 struct AnimationValue;
 class DeclarationBlock;
 namespace dom {
 class Element;
 }  // namespace dom
 
--- a/dom/smil/SMILEnumType.h
+++ b/dom/smil/SMILEnumType.h
@@ -3,17 +3,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 MOZILLA_SMILENUMTYPE_H_
 #define MOZILLA_SMILENUMTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 namespace mozilla {
 
 class SMILEnumType : public SMILType {
  public:
   // Singleton for nsSMILValue objects to hold onto.
   static SMILEnumType* Singleton() {
     static SMILEnumType sSingleton;
--- a/dom/smil/SMILFloatType.h
+++ b/dom/smil/SMILFloatType.h
@@ -3,17 +3,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 NS_SMILFLOATTYPE_H_
 #define NS_SMILFLOATTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 namespace mozilla {
 
 class SMILFloatType : public SMILType {
  public:
   // Singleton for nsSMILValue objects to hold onto.
   static SMILFloatType* Singleton() {
     static SMILFloatType sSingleton;
--- a/dom/smil/SMILIntegerType.h
+++ b/dom/smil/SMILIntegerType.h
@@ -3,17 +3,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 MOZILLA_SMILINTEGERTYPE_H_
 #define MOZILLA_SMILINTEGERTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 namespace mozilla {
 
 class SMILIntegerType : public SMILType {
  public:
   virtual void Init(nsSMILValue& aValue) const override;
   virtual void Destroy(nsSMILValue& aValue) const override;
   virtual nsresult Assign(nsSMILValue& aDest,
--- a/dom/smil/SMILNullType.h
+++ b/dom/smil/SMILNullType.h
@@ -3,17 +3,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 NS_SMILNULLTYPE_H_
 #define NS_SMILNULLTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 namespace mozilla {
 
 class SMILNullType : public SMILType {
  public:
   // Singleton for nsSMILValue objects to hold onto.
   static SMILNullType* Singleton();
 
--- a/dom/smil/SMILStringType.h
+++ b/dom/smil/SMILStringType.h
@@ -3,17 +3,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 MOZILLA_SMILSTRINGTYPE_H_
 #define MOZILLA_SMILSTRINGTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 namespace mozilla {
 
 class SMILStringType : public SMILType {
  public:
   // Singleton for nsSMILValue objects to hold onto.
   static SMILStringType* Singleton() {
     static SMILStringType sSingleton;
--- a/dom/smil/moz.build
+++ b/dom/smil/moz.build
@@ -14,32 +14,32 @@ EXPORTS += [
     'nsSMILInstanceTime.h',
     'nsSMILInterval.h',
     'nsSMILRepeatCount.h',
     'nsSMILTimeValue.h',
     'nsSMILTimeValueSpec.h',
     'nsSMILTimeValueSpecParams.h',
     'nsSMILTypes.h',
     'nsSMILValue.h',
-    'SMILCSSValueType.h',
-    'SMILNullType.h',
-    'SMILType.h',
 ]
 
 EXPORTS.mozilla += [
     'SMILAnimationController.h',
     'SMILAnimationFunction.h',
     'SMILCompositorTable.h',
+    'SMILCSSValueType.h',
     'SMILKeySpline.h',
     'SMILMilestone.h',
+    'SMILNullType.h',
     'SMILParserUtils.h',
     'SMILSetAnimationFunction.h',
     'SMILTargetIdentifier.h',
     'SMILTimeContainer.h',
     'SMILTimedElement.h',
+    'SMILType.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'TimeEvent.h',
 ]
 
 UNIFIED_SOURCES += [
     'nsSMILInstanceTime.cpp',
--- a/dom/smil/nsSMILValue.h
+++ b/dom/smil/nsSMILValue.h
@@ -2,18 +2,18 @@
 /* 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/. */
 
 #ifndef NS_SMILVALUE_H_
 #define NS_SMILVALUE_H_
 
-#include "SMILType.h"
-#include "SMILNullType.h"
+#include "mozilla/SMILNullType.h"
+#include "mozilla/SMILType.h"
 
 /**
  * Although objects of this type are generally only created on the stack and
  * only exist during the taking of a new time sample, that's not always the
  * case. The nsSMILValue objects obtained from attributes' base values are
  * cached so that the SMIL engine can make certain optimizations during a
  * sample if the base value has not changed since the last sample (potentially
  * avoiding recomposing). These nsSMILValue objects typically live much longer
--- a/dom/svg/SVGIntegerPairSMILType.h
+++ b/dom/svg/SVGIntegerPairSMILType.h
@@ -3,17 +3,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 MOZILLA_SVGINTEGERPAIRSMILTYPE_H_
 #define MOZILLA_SVGINTEGERPAIRSMILTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 class nsSMILValue;
 
 namespace mozilla {
 
 class SVGIntegerPairSMILType : public SMILType {
  public:
   // Singleton for nsSMILValue objects to hold onto.
--- a/dom/svg/SVGLengthListSMILType.h
+++ b/dom/svg/SVGLengthListSMILType.h
@@ -3,17 +3,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 MOZILLA_SVGLENGTHLISTSMILTYPE_H_
 #define MOZILLA_SVGLENGTHLISTSMILTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 class nsSMILValue;
 
 namespace mozilla {
 
 ////////////////////////////////////////////////////////////////////////
 // SVGLengthListSMILType
 //
--- a/dom/svg/SVGMotionSMILType.h
+++ b/dom/svg/SVGMotionSMILType.h
@@ -6,17 +6,17 @@
 
 /* implementation of SMILType for use by <animateMotion> element */
 
 #ifndef MOZILLA_SVGMOTIONSMILTYPE_H_
 #define MOZILLA_SVGMOTIONSMILTYPE_H_
 
 #include "mozilla/gfx/2D.h"
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 class nsSMILValue;
 
 namespace mozilla {
 
 /**
  * MotionRotateType: Enum to indicate the type of our "rotate" attribute.
  */
--- a/dom/svg/SVGNumberListSMILType.h
+++ b/dom/svg/SVGNumberListSMILType.h
@@ -3,17 +3,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 MOZILLA_SVGNUMBERLISTSMILTYPE_H_
 #define MOZILLA_SVGNUMBERLISTSMILTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 class nsSMILValue;
 
 namespace mozilla {
 
 ////////////////////////////////////////////////////////////////////////
 // SVGNumberListSMILType
 //
--- a/dom/svg/SVGNumberPairSMILType.h
+++ b/dom/svg/SVGNumberPairSMILType.h
@@ -3,17 +3,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 MOZILLA_SVGNUMBERPAIRSMILTYPE_H_
 #define MOZILLA_SVGNUMBERPAIRSMILTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 class nsSMILValue;
 
 namespace mozilla {
 
 class SVGNumberPairSMILType : public SMILType {
  public:
   // Singleton for nsSMILValue objects to hold onto.
--- a/dom/svg/SVGOrientSMILType.h
+++ b/dom/svg/SVGOrientSMILType.h
@@ -3,17 +3,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 MOZILLA_SVGORIENTSMILTYPE_H_
 #define MOZILLA_SVGORIENTSMILTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 class nsSMILValue;
 
 /**
  * This SMILType class is a special case for the 'orient' attribute on SVG's
  * 'marker' element.
  *
  *   orient = "auto | auto-start-reverse | <angle>"
--- a/dom/svg/SVGPathSegListSMILType.h
+++ b/dom/svg/SVGPathSegListSMILType.h
@@ -3,17 +3,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 MOZILLA_SVGPATHSEGLISTSMILTYPE_H_
 #define MOZILLA_SVGPATHSEGLISTSMILTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 class nsSMILValue;
 
 namespace mozilla {
 
 ////////////////////////////////////////////////////////////////////////
 // SVGPathSegListSMILType
 //
--- a/dom/svg/SVGPointListSMILType.h
+++ b/dom/svg/SVGPointListSMILType.h
@@ -3,17 +3,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 MOZILLA_SVGPOINTLISTSMILTYPE_H_
 #define MOZILLA_SVGPOINTLISTSMILTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 class nsSMILValue;
 
 namespace mozilla {
 
 ////////////////////////////////////////////////////////////////////////
 // SVGPointListSMILType
 //
--- a/dom/svg/SVGTransformListSMILType.h
+++ b/dom/svg/SVGTransformListSMILType.h
@@ -3,17 +3,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 SVGTRANSFORMLISTSMILTYPE_H_
 #define SVGTRANSFORMLISTSMILTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 #include "nsTArray.h"
 
 class nsSMILValue;
 
 namespace mozilla {
 
 class SVGTransform;
 class SVGTransformList;
--- a/dom/svg/SVGViewBoxSMILType.h
+++ b/dom/svg/SVGViewBoxSMILType.h
@@ -3,17 +3,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 MOZILLA_SVGVIEWBOXSMILTYPE_H_
 #define MOZILLA_SVGVIEWBOXSMILTYPE_H_
 
 #include "mozilla/Attributes.h"
-#include "SMILType.h"
+#include "mozilla/SMILType.h"
 
 class nsSMILValue;
 
 namespace mozilla {
 
 class SVGViewBoxSMILType : public SMILType {
  public:
   // Singleton for nsSMILValue objects to hold onto.
--- a/editor/libeditor/EditorEventListener.cpp
+++ b/editor/libeditor/EditorEventListener.cpp
@@ -164,25 +164,22 @@ nsresult EditorEventListener::InstallToE
   //     However, if we do so, all click handlers in any frames and frontend
   //     code need to check if it's editable.  It makes easier create new bugs.
   elmP->AddEventListenerByType(this, NS_LITERAL_STRING("mousedown"),
                                TrustedEventsAtCapture());
   elmP->AddEventListenerByType(this, NS_LITERAL_STRING("mouseup"),
                                TrustedEventsAtCapture());
   elmP->AddEventListenerByType(this, NS_LITERAL_STRING("click"),
                                TrustedEventsAtCapture());
-  // Focus event doesn't bubble so adding the listener to capturing phase.
-  // XXX Should we listen focus/blur events of system group too? Or should
-  //     editor notified focus/blur of the element from nsFocusManager
-  //     directly?  Because if the event propagation is stopped by JS,
-  //     editor cannot initialize selection as expected.
+  // Focus event doesn't bubble so adding the listener to capturing phase as
+  // system event group.
   elmP->AddEventListenerByType(this, NS_LITERAL_STRING("blur"),
-                               TrustedEventsAtCapture());
+                               TrustedEventsAtSystemGroupCapture());
   elmP->AddEventListenerByType(this, NS_LITERAL_STRING("focus"),
-                               TrustedEventsAtCapture());
+                               TrustedEventsAtSystemGroupCapture());
   elmP->AddEventListenerByType(this, NS_LITERAL_STRING("text"),
                                TrustedEventsAtSystemGroupBubble());
   elmP->AddEventListenerByType(this, NS_LITERAL_STRING("compositionstart"),
                                TrustedEventsAtSystemGroupBubble());
   elmP->AddEventListenerByType(this, NS_LITERAL_STRING("compositionend"),
                                TrustedEventsAtSystemGroupBubble());
 
   return NS_OK;
@@ -238,19 +235,19 @@ void EditorEventListener::UninstallFromE
                                   TrustedEventsAtSystemGroupBubble());
   elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("mousedown"),
                                   TrustedEventsAtCapture());
   elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("mouseup"),
                                   TrustedEventsAtCapture());
   elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("click"),
                                   TrustedEventsAtCapture());
   elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("blur"),
-                                  TrustedEventsAtCapture());
+                                  TrustedEventsAtSystemGroupCapture());
   elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("focus"),
-                                  TrustedEventsAtCapture());
+                                  TrustedEventsAtSystemGroupCapture());
   elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("text"),
                                   TrustedEventsAtSystemGroupBubble());
   elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("compositionstart"),
                                   TrustedEventsAtSystemGroupBubble());
   elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("compositionend"),
                                   TrustedEventsAtSystemGroupBubble());
 }
 
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -665,18 +665,17 @@ static inline bool FinalizeTypedArenas(F
       return false;
     }
   }
 
   return true;
 }
 
 /*
- * Finalize the list. On return, |al|'s cursor points to the first non-empty
- * arena in the list (which may be null if all arenas are full).
+ * Finalize the list of areans.
  */
 static bool FinalizeArenas(FreeOp* fop, Arena** src, SortedArenaList& dest,
                            AllocKind thingKind, SliceBudget& budget,
                            ArenaLists::KeepArenasEnum keepArenas) {
   switch (thingKind) {
 #define EXPAND_CASE(allocKind, traceKind, type, sizedType, bgFinal, nursery, \
                     compact)                                                 \
   case AllocKind::allocKind:                                                 \
--- a/layout/base/tests/bug1097242-1.html
+++ b/layout/base/tests/bug1097242-1.html
@@ -1,18 +1,22 @@
 <!DOCTYPE html>
 <html class="reftest-wait">
+  <script src="/tests/SimpleTest/SimpleTest.js"></script>
   <script src="/tests/SimpleTest/EventUtils.js"></script>
   <script>
-    function test() {
-      focus();
-      synthesizeMouseAtCenter(document.querySelector("span"), {});
-    }
     function focused() {
       document.documentElement.removeAttribute("class");
     }
   </script>
-  <body onload="setTimeout(test, 0)">
+  <body>
     <div contenteditable spellcheck="false" onfocus="focused()"
       style="outline: none">foo<span contenteditable=false
       style="-moz-user-select: none">bar</span>baz</div>
+    <script>
+      SimpleTest.waitForFocus(() => {
+        SimpleTest.executeSoon(() => {
+          synthesizeMouseAtCenter(document.querySelector("span"), {});
+        });
+      });
+    </script>
   </body>
 </html>
--- a/layout/base/tests/bug1109968-1.html
+++ b/layout/base/tests/bug1109968-1.html
@@ -1,14 +1,14 @@
 <html class="reftest-wait">
   <head>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
   </head>
   <body onload="start()">
-    <div onfocus="done()" contenteditable>foo<div contenteditable="false"><a href="#">bar</a></div>baz</div>
+    <div onfocus="setTimeout(done, 0)" contenteditable>foo<div contenteditable="false"><a href="#">bar</a></div>baz</div>
     <script>
       var div = document.querySelector("div");
       function start() {
         div.focus();
       }
       function done() {
         var sel = getSelection();
         sel.collapse(div, 0);
--- a/layout/base/tests/bug1109968-2.html
+++ b/layout/base/tests/bug1109968-2.html
@@ -1,14 +1,14 @@
 <html class="reftest-wait">
   <head>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
   </head>
   <body onload="start()">
-    <div onfocus="done()" contenteditable>foo<div contenteditable="false"><img src="image_rgrg-256x256.png" width="10" height="10"></div>bar</div>
+    <div onfocus="setTimeout(done, 0)" contenteditable>foo<div contenteditable="false"><img src="image_rgrg-256x256.png" width="10" height="10"></div>bar</div>
     <script>
       var div = document.querySelector("div");
       function start() {
         div.focus();
       }
       function done() {
         var sel = getSelection();
         sel.collapse(div, 0);
--- a/layout/base/tests/bug1123067-1.html
+++ b/layout/base/tests/bug1123067-1.html
@@ -24,15 +24,15 @@
     </script>
     <style>
         div { -moz-user-select:none; }
         div:focus { outline:1px solid black; }
     </style>
 </head>
 <body>
 
-<div id="test1" contenteditable="true" spellcheck="false" onfocus="test()">This text is NOT selectable.</div>
+<div id="test1" contenteditable="true" spellcheck="false" onfocus="setTimeout(test, 0)">This text is NOT selectable.</div>
 
 <script>
 SimpleTest.waitForFocus(runTests);
 </script>
 </body>
 </html>
--- a/layout/base/tests/bug1123067-ref.html
+++ b/layout/base/tests/bug1123067-ref.html
@@ -19,15 +19,15 @@
         }
     </script>
     <style>
         div:focus { outline:1px solid black; }
     </style>
 </head>
 <body>
 
-<div id="test1" contenteditable="true" spellcheck="false" onfocus="test()">This text is NOT selectable.</div>
+<div id="test1" contenteditable="true" spellcheck="false" onfocus="setTimeout(test, 0)">This text is NOT selectable.</div>
 
 <script>
 SimpleTest.waitForFocus(runTests);
 </script>
 </body>
 </html>
--- a/layout/base/tests/bug1237236-2-ref.html
+++ b/layout/base/tests/bug1237236-2-ref.html
@@ -14,16 +14,16 @@
         function runTests() {
           document.querySelector('pre').focus();
           document.body.offsetHeight;
         }
     </script>
 </head>
 <body>
 
-<pre contenteditable tabindex=1 onfocus="test1()" spellcheck="false">abc
+<pre contenteditable tabindex=1 onfocus="setTimeout(test1, 0)" spellcheck="false">abc
 def</pre>
 
 <script>
 SimpleTest.waitForFocus(runTests);
 </script>
 </body>
 </html>
--- a/layout/base/tests/bug1258308-2-ref.html
+++ b/layout/base/tests/bug1258308-2-ref.html
@@ -14,17 +14,17 @@
         function runTests() {
           document.querySelector('pre').focus();
           document.body.offsetHeight;
         }
     </script>
 </head>
 <body>
 
-<pre contenteditable tabindex=1 onfocus="test1()" spellcheck="false">abc
+<pre contenteditable tabindex=1 onfocus="setTimeout(test1, 0)" spellcheck="false">abc
 def
 ghi</pre>
 
 <script>
 SimpleTest.waitForFocus(runTests);
 </script>
 </body>
 </html>
--- a/layout/base/tests/bug1259949-2-ref.html
+++ b/layout/base/tests/bug1259949-2-ref.html
@@ -14,17 +14,17 @@
         function runTests() {
           document.querySelector('pre').focus();
           document.body.offsetHeight;
         }
     </script>
 </head>
 <body>
 
-<pre contenteditable tabindex=1 onfocus="test1()" spellcheck="false">abcdef
+<pre contenteditable tabindex=1 onfocus="setTimeout(test1, 0)" spellcheck="false">abcdef
 
 </pre>
 
 <script>
 SimpleTest.waitForFocus(runTests);
 </script>
 </body>
 </html>
--- a/layout/base/tests/bug1423331-1.html
+++ b/layout/base/tests/bug1423331-1.html
@@ -12,15 +12,17 @@
 }
 #editable::before {
   content: "Write here";
 }
 </style>
 <div id="editable" contenteditable></div>
 <script>
 SimpleTest.waitForFocus(function() {
-  let div = document.getElementById("editable");
-  synthesizeMouseAtCenter(div, {});
-  synthesizeMouseAtCenter(div, {});
-  document.documentElement.className ="";
+  SimpleTest.executeSoon(() => {
+    let div = document.getElementById("editable");
+    synthesizeMouseAtCenter(div, {});
+    synthesizeMouseAtCenter(div, {});
+    document.documentElement.className ="";
+  });
 });
 </script>
 </html>
--- a/layout/base/tests/bug1423331-2.html
+++ b/layout/base/tests/bug1423331-2.html
@@ -12,16 +12,18 @@
 }
 #editable:empty::before {
   content: "Write here";
 }
 </style>
 <div id="editable" contenteditable></div>
 <script>
 SimpleTest.waitForFocus(function() {
-  let div = document.getElementById("editable");
-  synthesizeMouseAtCenter(div, {});
-  synthesizeMouseAtCenter(div, {});
-  sendString("xxx");
-  document.documentElement.className = "";
+  SimpleTest.executeSoon(() => {
+    let div = document.getElementById("editable");
+    synthesizeMouseAtCenter(div, {});
+    synthesizeMouseAtCenter(div, {});
+    sendString("xxx");
+    document.documentElement.className = "";
+  });
 });
 </script>
 </html>
--- a/layout/base/tests/bug989012-1.html
+++ b/layout/base/tests/bug989012-1.html
@@ -1,15 +1,15 @@
 <html class="reftest-wait">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
   </head>
   <body onload="start()">
-    <div onfocus="done()" contenteditable>foo<img alt="IMAGE">bar</div>
+    <div onfocus="setTimeout(done, 0)" contenteditable>foo<img alt="IMAGE">bar</div>
     <script>
       var div = document.querySelector("div");
       function start() {
         div.focus();
       }
       function done() {
         var sel = getSelection();
         sel.collapse(div, 0);
--- a/layout/base/tests/bug989012-2.html
+++ b/layout/base/tests/bug989012-2.html
@@ -4,17 +4,17 @@
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <style>
       span:before {
         content: "IMAGE";
       }
     </style>
   </head>
   <body onload="start()">
-    <div onfocus="done()" contenteditable>foo<span></span>bar</div>
+    <div onfocus="setTimeout(done, 0)" contenteditable>foo<span></span>bar</div>
     <script>
       var div = document.querySelector("div");
       function start() {
         div.focus();
       }
       function done() {
         var sel = getSelection();
         sel.collapse(div, 0);
--- a/layout/base/tests/bug989012-3.html
+++ b/layout/base/tests/bug989012-3.html
@@ -6,17 +6,17 @@
       img {
         border: solid 1px red;
         mid-width: 1em;
         display: inline-block;
       }
     </style>
   </head>
   <body onload="start()">
-    <div onfocus="done()" contenteditable>foo<img>bar</div>
+    <div onfocus="setTimeout(done, 0)" contenteditable>foo<img>bar</div>
     <script>
       var div = document.querySelector("div");
       function start() {
         div.focus();
       }
       function done() {
         var sel = getSelection();
         sel.collapse(div, 0);
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/input-stoppropagation-ref.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+<script>
+function onLoad() {
+  document.getElementById("input1").focus();
+  synthesizeKey("KEY_Tab");
+  synthesizeKey("KEY_Tab", {shiftKey: true});
+  synthesizeKey("KEY_Tab");
+}
+</script>
+<body onload="onLoad()">
+  <input type="text" id="input1"></input>
+  <input type="text" id="input2"></input>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/input-stoppropagation.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+<script>
+function onLoad() {
+  let input2 = document.getElementById("input2");
+  input2.addEventListener("focus", e => {
+    e.stopImmediatePropagation();
+  });
+  document.getElementById("input1").focus();
+  synthesizeKey("KEY_Tab");
+  synthesizeKey("KEY_Tab", {shiftKey: true});
+  synthesizeKey("KEY_Tab");
+}
+</script>
+<body onload="onLoad()">
+  <input type="text" id="input1"></input>
+  <input type="text" id="input2"></input>
+</body>
+</html>
--- a/layout/base/tests/mochitest.ini
+++ b/layout/base/tests/mochitest.ini
@@ -334,16 +334,18 @@ support-files =
   input-maxlength-ui-valid-change.html
   input-maxlength-valid-before-change.html
   input-maxlength-valid-change.html
   input-minlength-invalid-change.html
   input-minlength-ui-invalid-change.html
   input-minlength-ui-valid-change.html
   input-minlength-valid-before-change.html
   input-minlength-valid-change.html
+  input-stoppropagation.html
+  input-stoppropagation-ref.html
   input-valid-ref.html
   multi-range-script-select.html
   multi-range-script-select-ref.html
   multi-range-user-select.html
   multi-range-user-select-ref.html
   textarea-invalid-ref.html
   textarea-maxlength-invalid-change.html
   textarea-maxlength-ui-invalid-change.html
--- a/layout/base/tests/test_reftests_with_caret.html
+++ b/layout/base/tests/test_reftests_with_caret.html
@@ -143,16 +143,17 @@ var tests = [
     [ 'input-maxlength-invalid-change.html', 'input-invalid-ref.html'] ,
     [ 'input-minlength-valid-before-change.html', 'input-valid-ref.html'] ,
     [ 'input-minlength-valid-change.html', 'input-valid-ref.html'] ,
     [ 'input-minlength-invalid-change.html', 'input-invalid-ref.html'] ,
     [ 'input-maxlength-ui-valid-change.html', 'input-valid-ref.html'] ,
     [ 'input-maxlength-ui-invalid-change.html', 'input-invalid-ref.html'] ,
     [ 'input-minlength-ui-valid-change.html', 'input-valid-ref.html'] ,
     [ 'input-minlength-ui-invalid-change.html', 'input-invalid-ref.html'] ,
+    [ 'input-stoppropagation.html', 'input-stoppropagation-ref.html'] ,
     [ 'textarea-maxlength-valid-before-change.html', 'textarea-valid-ref.html'] ,
     [ 'textarea-maxlength-valid-change.html', 'textarea-valid-ref.html'] ,
     [ 'textarea-maxlength-invalid-change.html', 'textarea-invalid-ref.html'] ,
     [ 'textarea-minlength-valid-before-change.html', 'textarea-valid-ref.html'] ,
     [ 'textarea-minlength-valid-change.html', 'textarea-valid-ref.html'] ,
     [ 'textarea-minlength-invalid-change.html', 'textarea-invalid-ref.html'] ,
     [ 'textarea-maxlength-ui-valid-change.html', 'textarea-valid-ref.html'] ,
     [ 'textarea-maxlength-ui-invalid-change.html', 'textarea-invalid-ref.html'] ,
--- a/layout/style/nsDOMCSSAttrDeclaration.cpp
+++ b/layout/style/nsDOMCSSAttrDeclaration.cpp
@@ -3,25 +3,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/. */
 
 /* DOM object for element.style */
 
 #include "nsDOMCSSAttrDeclaration.h"
 
-#include "mozilla/DeclarationBlock.h"
+#include "mozilla/dom/Document.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/MutationEventBinding.h"
+#include "mozilla/DeclarationBlock.h"
 #include "mozilla/InternalMutationEvent.h"
+#include "mozilla/SMILCSSValueType.h"
 #include "mozAutoDocUpdate.h"
-#include "mozilla/dom/Document.h"
 #include "nsIURI.h"
 #include "nsNodeUtils.h"
-#include "SMILCSSValueType.h"
 #include "nsWrapperCacheInlines.h"
 #include "nsIFrame.h"
 #include "ActiveLayerTracker.h"
 
 using namespace mozilla;
 
 nsDOMCSSAttributeDeclaration::nsDOMCSSAttributeDeclaration(
     dom::Element* aElement, bool aIsSMILOverride)
--- a/netwerk/cache2/CacheFileChunk.cpp
+++ b/netwerk/cache2/CacheFileChunk.cpp
@@ -787,22 +787,27 @@ size_t CacheFileChunk::SizeOfIncludingTh
 
 bool CacheFileChunk::CanAllocate(uint32_t aSize) const {
   if (!mLimitAllocation) {
     return true;
   }
 
   LOG(("CacheFileChunk::CanAllocate() [this=%p, size=%u]", this, aSize));
 
-  uint32_t limit = CacheObserver::MaxDiskChunksMemoryUsage(mIsPriority);
+  int64_t limit = CacheObserver::MaxDiskChunksMemoryUsage(mIsPriority);
   if (limit == 0) {
     return true;
   }
 
-  uint32_t usage = ChunksMemoryUsage();
+  limit <<= 10;
+  if (limit > UINT32_MAX) {
+    limit = UINT32_MAX;
+  }
+
+  int64_t usage = ChunksMemoryUsage();
   if (usage + aSize > limit) {
     LOG(("CacheFileChunk::CanAllocate() - Returning false. [this=%p]", this));
     return false;
   }
 
   return true;
 }
 
--- a/netwerk/cache2/CacheFileIOManager.cpp
+++ b/netwerk/cache2/CacheFileIOManager.cpp
@@ -2005,21 +2005,22 @@ nsresult CacheFileIOManager::WriteIntern
     int64_t freeSpace = -1;
     rv = mCacheDirectory->GetDiskSpaceAvailable(&freeSpace);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       LOG(
           ("CacheFileIOManager::WriteInternal() - GetDiskSpaceAvailable() "
            "failed! [rv=0x%08" PRIx32 "]",
            static_cast<uint32_t>(rv)));
     } else {
+      freeSpace >>= 10;  // bytes to kilobytes
       uint32_t limit = CacheObserver::DiskFreeSpaceHardLimit();
       if (freeSpace - aOffset - aCount + aHandle->mFileSize < limit) {
         LOG(
             ("CacheFileIOManager::WriteInternal() - Low free space, refusing "
-             "to write! [freeSpace=%" PRId64 ", limit=%u]",
+             "to write! [freeSpace=%" PRId64 "kB, limit=%ukB]",
              freeSpace, limit));
         return NS_ERROR_FILE_DISK_FULL;
       }
     }
   }
 
   // Write invalidates the entry by default
   aHandle->mInvalid = true;
@@ -2542,21 +2543,22 @@ nsresult CacheFileIOManager::TruncateSee
     int64_t freeSpace = -1;
     rv = mCacheDirectory->GetDiskSpaceAvailable(&freeSpace);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       LOG(
           ("CacheFileIOManager::TruncateSeekSetEOFInternal() - "
            "GetDiskSpaceAvailable() failed! [rv=0x%08" PRIx32 "]",
            static_cast<uint32_t>(rv)));
     } else {
+      freeSpace >>= 10;  // bytes to kilobytes
       uint32_t limit = CacheObserver::DiskFreeSpaceHardLimit();
       if (freeSpace - aEOFPos + aHandle->mFileSize < limit) {
         LOG(
             ("CacheFileIOManager::TruncateSeekSetEOFInternal() - Low free space"
-             ", refusing to write! [freeSpace=%" PRId64 ", limit=%u]",
+             ", refusing to write! [freeSpace=%" PRId64 "kB, limit=%ukB]",
              freeSpace, limit));
         return NS_ERROR_FILE_DISK_FULL;
       }
     }
   }
 
   // This operation always invalidates the entry
   aHandle->mInvalid = true;
@@ -2722,39 +2724,40 @@ nsresult CacheFileIOManager::EvictIfOver
     freeSpace = -1;
 
     // Do not change smart size.
     LOG(
         ("CacheFileIOManager::EvictIfOverLimitInternal() - "
          "GetDiskSpaceAvailable() failed! [rv=0x%08" PRIx32 "]",
          static_cast<uint32_t>(rv)));
   } else {
+    freeSpace >>= 10;  // bytes to kilobytes
     UpdateSmartCacheSize(freeSpace);
   }
 
   uint32_t cacheUsage;
   rv = CacheIndex::GetCacheSize(&cacheUsage);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  uint32_t cacheLimit = CacheObserver::DiskCacheCapacity() >> 10;
+  uint32_t cacheLimit = CacheObserver::DiskCacheCapacity();
   uint32_t freeSpaceLimit = CacheObserver::DiskFreeSpaceSoftLimit();
 
   if (cacheUsage <= cacheLimit &&
       (freeSpace == -1 || freeSpace >= freeSpaceLimit)) {
     LOG(
         ("CacheFileIOManager::EvictIfOverLimitInternal() - Cache size and free "
          "space in limits. [cacheSize=%ukB, cacheSizeLimit=%ukB, "
-         "freeSpace=%" PRId64 ", freeSpaceLimit=%u]",
+         "freeSpace=%" PRId64 "kB, freeSpaceLimit=%ukB]",
          cacheUsage, cacheLimit, freeSpace, freeSpaceLimit));
     return NS_OK;
   }
 
   LOG(
       ("CacheFileIOManager::EvictIfOverLimitInternal() - Cache size exceeded "
-       "limit. Starting overlimit eviction. [cacheSize=%u, limit=%u]",
+       "limit. Starting overlimit eviction. [cacheSize=%ukB, limit=%ukB]",
        cacheUsage, cacheLimit));
 
   nsCOMPtr<nsIRunnable> ev;
   ev = NewRunnableMethod("net::CacheFileIOManager::OverLimitEvictionInternal",
                          this, &CacheFileIOManager::OverLimitEvictionInternal);
 
   rv = mIOThread->Dispatch(ev, CacheIOThread::EVICT);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -2786,30 +2789,31 @@ nsresult CacheFileIOManager::OverLimitEv
     rv = mCacheDirectory->GetDiskSpaceAvailable(&freeSpace);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       // Do not change smart size.
       LOG(
           ("CacheFileIOManager::EvictIfOverLimitInternal() - "
            "GetDiskSpaceAvailable() failed! [rv=0x%08" PRIx32 "]",
            static_cast<uint32_t>(rv)));
     } else {
+      freeSpace >>= 10;  // bytes to kilobytes
       UpdateSmartCacheSize(freeSpace);
     }
 
     uint32_t cacheUsage;
     rv = CacheIndex::GetCacheSize(&cacheUsage);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    uint32_t cacheLimit = CacheObserver::DiskCacheCapacity() >> 10;
+    uint32_t cacheLimit = CacheObserver::DiskCacheCapacity();
     uint32_t freeSpaceLimit = CacheObserver::DiskFreeSpaceSoftLimit();
 
     if (cacheUsage > cacheLimit) {
       LOG(
           ("CacheFileIOManager::OverLimitEvictionInternal() - Cache size over "
-           "limit. [cacheSize=%u, limit=%u]",
+           "limit. [cacheSize=%ukB, limit=%ukB]",
            cacheUsage, cacheLimit));
 
       // We allow cache size to go over the specified limit. Eviction should
       // keep the size within the limit in a long run, but in case the eviction
       // is too slow, the cache could go way over the limit. To prevent this we
       // set flag mCacheSizeOnHardLimit when the size reaches 105% of the limit
       // and WriteInternal() and TruncateSeekSetEOFInternal() fail to cache
       // additional data.
@@ -2819,23 +2823,23 @@ nsresult CacheFileIOManager::OverLimitEv
              "reached hard limit."));
         mCacheSizeOnHardLimit = true;
       } else {
         mCacheSizeOnHardLimit = false;
       }
     } else if (freeSpace != 1 && freeSpace < freeSpaceLimit) {
       LOG(
           ("CacheFileIOManager::OverLimitEvictionInternal() - Free space under "
-           "limit. [freeSpace=%" PRId64 ", freeSpaceLimit=%u]",
+           "limit. [freeSpace=%" PRId64 "kB, freeSpaceLimit=%ukB]",
            freeSpace, freeSpaceLimit));
     } else {
       LOG(
           ("CacheFileIOManager::OverLimitEvictionInternal() - Cache size and "
            "free space in limits. [cacheSize=%ukB, cacheSizeLimit=%ukB, "
-           "freeSpace=%" PRId64 ", freeSpaceLimit=%u]",
+           "freeSpace=%" PRId64 "kB, freeSpaceLimit=%ukB]",
            cacheUsage, cacheLimit, freeSpace, freeSpaceLimit));
 
       mCacheSizeOnHardLimit = false;
       return NS_OK;
     }
 
     if (CacheIOThread::YieldAndRerun()) {
       LOG(
@@ -4059,17 +4063,17 @@ void CacheFileIOManager::SyncRemoveAllCa
       mTrashDir->GetNativeLeafName(leafName);
       mFailedTrashDirs.AppendElement(leafName);
     }
   }
 }
 
 // Returns default ("smart") size (in KB) of cache, given available disk space
 // (also in KB)
-static uint32_t SmartCacheSize(const uint32_t availKB) {
+static uint32_t SmartCacheSize(const int64_t availKB) {
   uint32_t maxSize;
 
   if (CacheObserver::ClearCacheOnShutdown()) {
     maxSize = kMaxClearOnShutdownCacheSizeKB;
   } else {
     maxSize = kMaxCacheSizeKB;
   }
 
@@ -4140,25 +4144,24 @@ nsresult CacheFileIOManager::UpdateSmart
         ("CacheFileIOManager::UpdateSmartCacheSize() - Cannot get cacheUsage! "
          "[rv=0x%08" PRIx32 "]",
          static_cast<uint32_t>(rv)));
     return rv;
   }
 
   mLastSmartSizeTime = TimeStamp::NowLoRes();
 
-  uint32_t smartSize =
-      SmartCacheSize(static_cast<uint32_t>(aFreeSpace / 1024) + cacheUsage);
-
-  if (smartSize == (CacheObserver::DiskCacheCapacity() >> 10)) {
+  uint32_t smartSize = SmartCacheSize(aFreeSpace + cacheUsage);
+
+  if (smartSize == CacheObserver::DiskCacheCapacity()) {
     // Smart size has not changed.
     return NS_OK;
   }
 
-  CacheObserver::SetDiskCacheCapacity(smartSize << 10);
+  CacheObserver::SetDiskCacheCapacity(smartSize);
 
   return NS_OK;
 }
 
 // Memory reporting
 
 namespace {
 
--- a/netwerk/cache2/CacheObserver.cpp
+++ b/netwerk/cache2/CacheObserver.cpp
@@ -32,17 +32,17 @@ bool CacheObserver::sUseDiskCache = kDef
 static bool const kDefaultUseMemoryCache = true;
 bool CacheObserver::sUseMemoryCache = kDefaultUseMemoryCache;
 
 static uint32_t const kDefaultMetadataMemoryLimit = 250;  // 0.25 MB
 uint32_t CacheObserver::sMetadataMemoryLimit = kDefaultMetadataMemoryLimit;
 
 static int32_t const kDefaultMemoryCacheCapacity = -1;  // autodetect
 int32_t CacheObserver::sMemoryCacheCapacity = kDefaultMemoryCacheCapacity;
-// Cache of the calculated memory capacity based on the system memory size
+// Cache of the calculated memory capacity based on the system memory size in KB
 int32_t CacheObserver::sAutoMemoryCacheCapacity = -1;
 
 static uint32_t const kDefaultDiskCacheCapacity = 250 * 1024;  // 250 MB
 Atomic<uint32_t, Relaxed> CacheObserver::sDiskCacheCapacity(
     kDefaultDiskCacheCapacity);
 
 static uint32_t const kDefaultDiskFreeSpaceSoftLimit = 5 * 1024;  // 5MB
 uint32_t CacheObserver::sDiskFreeSpaceSoftLimit =
@@ -206,17 +206,17 @@ void CacheObserver::AttachToPreferences(
 
   mozilla::Preferences::AddAtomicUintVarCache(
       &sMaxShutdownIOLag, "browser.cache.max_shutdown_io_lag",
       kDefaultMaxShutdownIOLag);
 }
 
 // static
 uint32_t CacheObserver::MemoryCacheCapacity() {
-  if (sMemoryCacheCapacity >= 0) return sMemoryCacheCapacity << 10;
+  if (sMemoryCacheCapacity >= 0) return sMemoryCacheCapacity;
 
   if (sAutoMemoryCacheCapacity != -1) return sAutoMemoryCacheCapacity;
 
   static uint64_t bytes = PR_GetPhysicalMemorySize();
   // If getting the physical memory failed, arbitrarily assume
   // 32 MB of RAM. We use a low default to have a reasonable
   // size on all the devices we support.
   if (bytes == 0) bytes = 32 * 1024 * 1024;
@@ -229,26 +229,26 @@ uint32_t CacheObserver::MemoryCacheCapac
   uint64_t kbytes = bytes >> 10;
   double kBytesD = double(kbytes);
   double x = log(kBytesD) / log(2.0) - 14;
 
   int32_t capacity = 0;
   if (x > 0) {
     capacity = (int32_t)(x * x / 3.0 + x + 2.0 / 3 + 0.1);  // 0.1 for rounding
     if (capacity > 32) capacity = 32;
-    capacity <<= 20;
+    capacity <<= 10;
   }
 
-  // Result is in bytes.
+  // Result is in kilobytes.
   return sAutoMemoryCacheCapacity = capacity;
 }
 
 // static
 void CacheObserver::SetDiskCacheCapacity(uint32_t aCapacity) {
-  sDiskCacheCapacity = aCapacity >> 10;
+  sDiskCacheCapacity = aCapacity;
 
   if (!sSelf) {
     return;
   }
 
   if (NS_IsMainThread()) {
     sSelf->StoreDiskCacheCapacity();
   } else {
@@ -378,20 +378,20 @@ bool CacheObserver::EntryIsTooBig(int64_
   // do not convert to bytes when the limit is -1, which means no limit
   if (preferredLimit > 0) {
     preferredLimit <<= 10;
   }
 
   if (preferredLimit != -1 && aSize > preferredLimit) return true;
 
   // Otherwise (or when in the custom limit), check limit based on the global
-  // limit.  It's 1/8 (>> 3) of the respective capacity.
+  // limit. It's 1/8 of the respective capacity.
   int64_t derivedLimit =
-      aUsingDisk ? (static_cast<int64_t>(DiskCacheCapacity() >> 3))
-                 : (static_cast<int64_t>(MemoryCacheCapacity() >> 3));
+      aUsingDisk ? DiskCacheCapacity() : MemoryCacheCapacity();
+  derivedLimit <<= (10 - 3);
 
   if (aSize > derivedLimit) return true;
 
   return false;
 }
 
 // static
 bool CacheObserver::IsPastShutdownIOLag() {
--- a/netwerk/cache2/CacheObserver.h
+++ b/netwerk/cache2/CacheObserver.h
@@ -22,48 +22,49 @@ class CacheObserver : public nsIObserver
 
   static nsresult Init();
   static nsresult Shutdown();
   static CacheObserver* Self() { return sSelf; }
 
   // Access to preferences
   static bool UseDiskCache() { return sUseDiskCache; }
   static bool UseMemoryCache() { return sUseMemoryCache; }
-  static uint32_t MetadataMemoryLimit()  // result in bytes.
+  static uint32_t MetadataMemoryLimit()  // result in kilobytes.
   {
-    return sMetadataMemoryLimit << 10;
+    return sMetadataMemoryLimit;
   }
-  static uint32_t MemoryCacheCapacity();  // result in bytes.
-  static uint32_t DiskCacheCapacity()     // result in bytes.
+  static uint32_t MemoryCacheCapacity();  // result in kilobytes.
+  static uint32_t DiskCacheCapacity()     // result in kilobytes.
   {
-    return sDiskCacheCapacity << 10;
+    return sDiskCacheCapacity;
   }
-  static void SetDiskCacheCapacity(uint32_t);  // parameter in bytes.
-  static uint32_t DiskFreeSpaceSoftLimit()     // result in bytes.
+  static void SetDiskCacheCapacity(uint32_t);  // parameter in kilobytes.
+  static uint32_t DiskFreeSpaceSoftLimit()     // result in kilobytes.
   {
-    return sDiskFreeSpaceSoftLimit << 10;
+    return sDiskFreeSpaceSoftLimit;
   }
-  static uint32_t DiskFreeSpaceHardLimit()  // result in bytes.
+  static uint32_t DiskFreeSpaceHardLimit()  // result in kilobytes.
   {
-    return sDiskFreeSpaceHardLimit << 10;
+    return sDiskFreeSpaceHardLimit;
   }
   static bool SmartCacheSizeEnabled() { return sSmartCacheSizeEnabled; }
   static uint32_t PreloadChunkCount() { return sPreloadChunkCount; }
-  static uint32_t MaxMemoryEntrySize()  // result in bytes.
+  static uint32_t MaxMemoryEntrySize()  // result in kilobytes.
   {
-    return sMaxMemoryEntrySize << 10;
+    return sMaxMemoryEntrySize;
   }
-  static uint32_t MaxDiskEntrySize()  // result in bytes.
+  static uint32_t MaxDiskEntrySize()  // result in kilobytes.
   {
-    return sMaxDiskEntrySize << 10;
+    return sMaxDiskEntrySize;
   }
-  static uint32_t MaxDiskChunksMemoryUsage(bool aPriority)  // result in bytes.
+  static uint32_t MaxDiskChunksMemoryUsage(
+      bool aPriority)  // result in kilobytes.
   {
-    return aPriority ? sMaxDiskPriorityChunksMemoryUsage << 10
-                     : sMaxDiskChunksMemoryUsage << 10;
+    return aPriority ? sMaxDiskPriorityChunksMemoryUsage
+                     : sMaxDiskChunksMemoryUsage;
   }
   static uint32_t CompressionLevel() { return sCompressionLevel; }
   static uint32_t HalfLifeSeconds() { return sHalfLifeHours * 60.0F * 60.0F; }
   static bool ClearCacheOnShutdown() {
     return sSanitizeOnShutdown && sClearCacheOnShutdown;
   }
   static bool CacheFSReported() { return sCacheFSReported; }
   static void SetCacheFSReported();
--- a/netwerk/cache2/CacheStorageService.cpp
+++ b/netwerk/cache2/CacheStorageService.cpp
@@ -78,25 +78,37 @@ CacheStorageService::MemoryPool::~Memory
   if (mMemorySize != 0) {
     NS_ERROR(
         "Network cache reported memory consumption is not at 0, probably "
         "leaking?");
   }
 }
 
 uint32_t CacheStorageService::MemoryPool::Limit() const {
+  uint32_t limit = 0;
+
   switch (mType) {
     case DISK:
-      return CacheObserver::MetadataMemoryLimit();
+      limit = CacheObserver::MetadataMemoryLimit();
+      break;
     case MEMORY:
-      return CacheObserver::MemoryCacheCapacity();
+      limit = CacheObserver::MemoryCacheCapacity();
+      break;
+    default:
+      MOZ_CRASH("Bad pool type");
   }
 
-  MOZ_CRASH("Bad pool type");
-  return 0;
+  static const uint32_t kMaxLimit = 0x3FFFFF;
+  if (limit > kMaxLimit) {
+    LOG(("  a memory limit (%u) is unexpectedly high, clipping to %u", limit,
+         kMaxLimit));
+    limit = kMaxLimit;
+  }
+
+  return limit << 10;
 }
 
 NS_IMPL_ISUPPORTS(CacheStorageService, nsICacheStorageService,
                   nsIMemoryReporter, nsITimerCallback, nsICacheTesting,
                   nsINamed)
 
 CacheStorageService* CacheStorageService::sSelf = nullptr;
 
@@ -253,19 +265,21 @@ class WalkMemoryCacheRunnable : public W
 
       // Next, we dispatch to the main thread
     } else if (NS_IsMainThread()) {
       LOG(("WalkMemoryCacheRunnable::Run - notifying [this=%p]", this));
 
       if (mNotifyStorage) {
         LOG(("  storage"));
 
+        uint64_t capacity = CacheObserver::MemoryCacheCapacity();
+        capacity <<= 10;  // kilobytes to bytes
+
         // Second, notify overall storage info
-        mCallback->OnCacheStorageInfo(mEntryArray.Length(), mSize,
-                                      CacheObserver::MemoryCacheCapacity(),
+        mCallback->OnCacheStorageInfo(mEntryArray.Length(), mSize, capacity,
                                       nullptr);
         if (!mVisitEntries) return NS_OK;  // done
 
         mNotifyStorage = false;
 
       } else {
         LOG(("  entry [left=%zu, canceled=%d]", mEntryArray.Length(),
              (bool)mCancel));
@@ -453,18 +467,19 @@ class WalkDiskCacheRunnable : public Wal
 
           // Invoke onCacheEntryVisitCompleted on the main thread
           NS_DispatchToMainThread(this);
       }
     } else if (NS_IsMainThread()) {
       if (mNotifyStorage) {
         nsCOMPtr<nsIFile> dir;
         CacheFileIOManager::GetCacheDirectory(getter_AddRefs(dir));
-        mCallback->OnCacheStorageInfo(mCount, mSize,
-                                      CacheObserver::DiskCacheCapacity(), dir);
+        uint64_t capacity = CacheObserver::DiskCacheCapacity();
+        capacity <<= 10;  // kilobytes to bytes
+        mCallback->OnCacheStorageInfo(mCount, mSize, capacity, dir);
         mNotifyStorage = false;
       } else {
         mCallback->OnCacheEntryVisitCompleted();
       }
     } else {
       MOZ_CRASH("Bad thread");
       return NS_ERROR_FAILURE;
     }
--- a/taskcluster/taskgraph/actions/backfill.py
+++ b/taskcluster/taskgraph/actions/backfill.py
@@ -138,17 +138,17 @@ def backfill_action(parameters, graph_co
                         # no --e10s; todo, what about future geckoView?
                         verify_args.remove('--e10s')
 
                     if gpu_required:
                         verify_args.append('--gpu-required')
 
                     if 'testPath' in input:
                         task.task['payload']['env']['MOZHARNESS_TEST_PATHS'] = json.dumps({
-                            task.task['extra']['suite']['flavor']: input['testPath']
+                            task.task['extra']['suite']['flavor']: [input['testPath']]
                         })
 
                     cmd_parts = task.task['payload']['command']
                     keep_args = ['--installer-url', '--download-symbols', '--test-packages-url']
                     cmd_parts = remove_args_from_command(cmd_parts, preamble_length, keep_args)
                     cmd_parts = add_args_to_command(cmd_parts, verify_args)
                     task.task['payload']['command'] = cmd_parts
 
--- a/testing/mozharness/mozharness/mozilla/testing/per_test_base.py
+++ b/testing/mozharness/mozharness/mozilla/testing/per_test_base.py
@@ -236,17 +236,18 @@ class SingleTestMixin(FetchesMixin):
         # FIXME(emilio): Need to update test expectations.
         mozinfo.update({'stylo': True})
         mozinfo.update({'verify': True})
         self.info("Per-test run using mozinfo: %s" % str(mozinfo.info))
 
         changed_files = set()
         if os.environ.get('MOZHARNESS_TEST_PATHS', None) is not None:
             suite_to_paths = json.loads(os.environ['MOZHARNESS_TEST_PATHS'])
-            changed_files |= itertools.chain.from_iterable(suite_to_paths.values())
+            specified_files = itertools.chain.from_iterable(suite_to_paths.values())
+            changed_files.update(specified_files)
             self.info("Per-test run found explicit request in MOZHARNESS_TEST_PATHS:")
             self.info(str(changed_files))
         else:
             # determine which files were changed on this push
             url = '%s/json-automationrelevance/%s' % (repository.rstrip('/'), revision)
             contents = self.retry(get_automationrelevance, attempts=2, sleeptime=10)
             for c in contents['changesets']:
                 self.info(" {cset} {desc}".format(
--- a/xpcom/threads/TimerThread.cpp
+++ b/xpcom/threads/TimerThread.cpp
@@ -12,16 +12,17 @@
 
 #include "nsIObserverService.h"
 #include "nsIServiceManager.h"
 #include "mozilla/Services.h"
 #include "mozilla/ChaosMode.h"
 #include "mozilla/ArenaAllocator.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/BinarySearch.h"
+#include "mozilla/OperatorNewExtensions.h"
 
 #include <math.h>
 
 using namespace mozilla;
 #ifdef MOZ_TASK_TRACER
 #include "GeckoTaskTracerImpl.h"
 using namespace mozilla::tasktracer;
 #endif
@@ -128,58 +129,58 @@ class nsTimerEvent final : public Cancel
     mTimer->Cancel();
     return NS_OK;
   }
 
 #ifdef MOZ_COLLECTING_RUNNABLE_TELEMETRY
   NS_IMETHOD GetName(nsACString& aName) override;
 #endif
 
-  nsTimerEvent()
-      : mozilla::CancelableRunnable("nsTimerEvent"), mTimer(), mGeneration(0) {
+  explicit nsTimerEvent(already_AddRefed<nsTimerImpl> aTimer)
+      : mozilla::CancelableRunnable("nsTimerEvent"),
+        mTimer(aTimer),
+        mGeneration(mTimer->GetGeneration()) {
     // Note: We override operator new for this class, and the override is
     // fallible!
     sAllocatorUsers++;
+
+    if (MOZ_LOG_TEST(GetTimerLog(), LogLevel::Debug)) {
+      mInitTime = TimeStamp::Now();
+    }
   }
 
-  TimeStamp mInitTime;
-
   static void Init();
   static void Shutdown();
   static void DeleteAllocatorIfNeeded();
 
   static void* operator new(size_t aSize) CPP_THROW_NEW {
     return sAllocator->Alloc(aSize);
   }
   void operator delete(void* aPtr) {
     sAllocator->Free(aPtr);
     DeleteAllocatorIfNeeded();
   }
 
   already_AddRefed<nsTimerImpl> ForgetTimer() { return mTimer.forget(); }
 
-  void SetTimer(already_AddRefed<nsTimerImpl> aTimer) {
-    mTimer = aTimer;
-    mGeneration = mTimer->GetGeneration();
-  }
-
  private:
   nsTimerEvent(const nsTimerEvent&) = delete;
   nsTimerEvent& operator=(const nsTimerEvent&) = delete;
   nsTimerEvent& operator=(const nsTimerEvent&&) = delete;
 
   ~nsTimerEvent() {
     MOZ_ASSERT(!sCanDeleteAllocator || sAllocatorUsers > 0,
                "This will result in us attempting to deallocate the "
                "nsTimerEvent allocator twice");
     sAllocatorUsers--;
   }
 
+  TimeStamp mInitTime;
   RefPtr<nsTimerImpl> mTimer;
-  int32_t mGeneration;
+  const int32_t mGeneration;
 
   static TimerEventAllocator* sAllocator;
 
   // Timer thread state may be accessed during GC, so uses of this atomic are
   // not preserved when recording/replaying.
   static Atomic<int32_t, SequentiallyConsistent,
                 recordreplay::Behavior::DontPreserve>
       sAllocatorUsers;
@@ -709,35 +710,31 @@ already_AddRefed<nsTimerImpl> TimerThrea
   // XXX we may want to reuse this nsTimerEvent in the case of repeating timers.
 
   // Since we already addref'd 'timer', we don't need to addref here.
   // We will release either in ~nsTimerEvent(), or pass the reference back to
   // the caller. We need to copy the generation number from this timer into the
   // event, so we can avoid firing a timer that was re-initialized after being
   // canceled.
 
-  RefPtr<nsTimerEvent> event = new nsTimerEvent;
-  if (!event) {
-    return timer.forget();
-  }
-
-  if (MOZ_LOG_TEST(GetTimerLog(), LogLevel::Debug)) {
-    event->mInitTime = TimeStamp::Now();
-  }
-
 #ifdef MOZ_TASK_TRACER
   // During the dispatch of TimerEvent, we overwrite the current TraceInfo
   // partially with the info saved in timer earlier, and restore it back by
   // AutoSaveCurTraceInfo.
   AutoSaveCurTraceInfo saveCurTraceInfo;
   (timer->GetTracedTask()).SetTLSTraceInfo();
 #endif
 
   nsCOMPtr<nsIEventTarget> target = timer->mEventTarget;
-  event->SetTimer(timer.forget());
+
+  void* p = nsTimerEvent::operator new(sizeof(nsTimerEvent));
+  if (!p) {
+    return timer.forget();
+  }
+  RefPtr<nsTimerEvent> event = ::new (KnownNotNull, p) nsTimerEvent(timer.forget());
 
   nsresult rv;
   {
     // We release mMonitor around the Dispatch because if this timer is targeted
     // at the TimerThread we'll deadlock.
     MonitorAutoUnlock unlock(mMonitor);
     rv = target->Dispatch(event, NS_DISPATCH_NORMAL);
   }