merge mozilla-inbound to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 24 Oct 2016 16:55:47 +0200
changeset 428736 c845bfd0accb7e0c29b41713255963b08006e701
parent 428735 08efaee1d568cea9e70c86a7eca49c3c53553ed8 (current diff)
parent 428650 5af7afe20e409bbd68dc5e2cc39d79af87ae3547 (diff)
child 428737 ed4e3959562ad852bcab8c15d7741102d951f57c
child 428745 d6dc1f5435991946aa877bb05402d3de6922ed28
child 428748 f5f40e55b2e8ac2e64e203ac713339f62815c508
child 428920 dfdff86b33a6e02dcc63ffc6277564973988d0dd
child 428924 f23d0fd4ecaa6176269205b63c9ec70f73cd92b7
child 428925 4b3ff9d401a1f854a1c0722aaaeb7d41765299cb
child 428928 6f6fe85de14b4e1adee6488e4b85c9384235d928
child 428929 d9c43a7081901fef7d1e87fe80829d10324bd9d8
child 428935 9c0a1690f5f2acb51da3ac803a2fbc1ed06588b8
child 428945 ad574039717673e99d7607ba4b12fec59cef6e90
child 428946 0a582ed5121974a6f0d577e9bef9f8b851f25691
child 428950 1aa2a14a245bc0bb2a044d951a4c5d274b9d9f13
child 428954 794f0da6479205fa1cfc98e85700579ed31fe4ff
child 428955 39031e4c591fd04eab6f9f68518eba3385eaf1b2
child 428965 9aa3cc7edb1a456ae168c297c84ac832e9536af0
child 428966 42de5eb1c5da74a9a028e298dbf23b52d3af172d
child 428967 047185d03891ffa44e54e5e6f421f04d20fd643c
child 428991 e1d52389c70af17701017488f779c5ddd2ee8882
child 428993 ac11dd40bcbb4289cdec6f4d39cbdc538dd73e35
child 428994 085fcee98cd22e8fae1fab825697554b579a5351
child 428995 9fff9956512481a3bc13dc075156e657fd6e8261
child 429001 b08f28fd06538552d1b7cd08754676083f4de8ce
child 429007 2be1b2858aad36e5ab1303156ced9f6b1aa2ab3a
child 429010 39efdd4a20203df0a6c244ee403309ea41daacd9
child 429011 21deb4e4b43747824a4a8319c54d3887c9efc31f
child 429012 a8446146b7a94ebf9c353aaec0688d1950f482ef
child 429013 2b4eee9d35b3dcda8131da690c584eee9b5f6533
child 429015 05cdce0faac41fa16e869b207978b38301593d28
child 429016 2f557dee1d684f8b6e4f72a0e92bcf4c4cfced8e
child 429017 4d45dc801f5421be6b7a573fb27cbe3b77c6da8f
child 429022 9020d7d653883a674b8564bd5026c18f97a05a49
child 429025 bfb0d55ba0352809277576dd7442a2765bc2a380
child 429052 93e698b89cc5b8bb846775c1354fc62c1fc339c6
child 429058 2bfa8895246f862f3e49c0c9674a8e862137f8a6
child 429059 453c23c7cc09f68ac991912d7556fafe21b7cc5a
child 429062 25ea582e9521860301e3789350397b7a2bfc5be0
child 429132 9fbcae753209f4f23c11f1fe39e91aea91d0e9ee
child 429138 e1704aa30379c855e71599f8985ba38625ea9929
child 429200 6640faec102ae3e767bedf36bbdcaab75ce894c5
child 429214 f5f09614379c5a85ea4a85d5d494e0038f5a685c
child 429218 f6e451a48ef6fe69ec854a2902538af0342f2e51
child 429296 c23b151236505e4351600179b7c6193280ef9c38
child 429312 14e47077be4e0e8c6c897a78ef160968578c5a1e
child 429314 42e6ac1990b36f0d5361b6f8478f44788ddae1cc
child 429318 351fa5832ad4bd1828420a058563c63e1062c089
child 429321 6c9c494de0d8c9f51a9d79589eef968e05ef7e69
child 429322 f4fab6049280aa7217385f4601b4e02608559e7e
child 429396 ac8706417a78c44a7af000ed116bbdd30008c4e6
child 429397 7bf51d704206b3b785f43eceb6c6887f5a6445ce
child 429415 c1eb8c89f5d9094564f5eeb6d618dae0e7395b4d
child 429859 e93d02d2913e008405a1412f6d81a5971d9f50d0
child 429864 67df523192752e348063af79c959be428116b2cf
child 429868 53815e533841173ca0f628604e42bc0138eacf2d
child 429979 c2e6ed56f7ca70c300427a8b74306b5b5a31ca0a
child 429985 c811e33ccb93d344f7696b1da5810325e34d8b75
child 430454 54bf6025ea8e4945038c3a528f6fa353510b4896
child 430791 73682ee01b1fe6899a6053ed40d75120c2691a0a
child 430793 e284f95fa736716160600ece55a535e96970c04f
child 431221 cdb7701264a1b92b8e52e6dfedb15111d1e2bc65
child 431598 5becef7c3e07a936d9893a3b4901f44b2d702dfd
child 435686 fa72e5d9b227e89976c62282a0747a7f0b3db078
child 435760 9f75120397af7fb65fe8c388b55a04dcba100688
child 435761 eb0bfe946282b711f3e752477f63236c1b3110b1
push id33405
push userbcampen@mozilla.com
push dateMon, 24 Oct 2016 15:32:53 +0000
reviewersmerge
milestone52.0a1
merge mozilla-inbound to mozilla-central a=merge
layout/style/ServoBindingHelpers.h
--- a/devtools/shared/security/tests/unit/xpcshell.ini
+++ b/devtools/shared/security/tests/unit/xpcshell.ini
@@ -1,18 +1,12 @@
 [DEFAULT]
 tags = devtools
 head = head_dbg.js
 tail =
 firefox-appdir = browser
-skip-if = toolkit == 'gonk' && debug # Bug 1206586
 
 support-files=
   testactors.js
 
 [test_encryption.js]
-# Failures on B2G emulator debug, B2G emulator-x86-kk
-# See bug 1234972 and bug 1199472
-skip-if = toolkit == 'gonk' && (debug || android_version > '15')
 [test_oob_cert_auth.js]
-# Failures on B2G emulator debug, B2G emulator-x86-kk and Android opt
-# See bug 1141544, bug 1163052, bug 1166032 and bug 1241831
-skip-if = (toolkit == 'gonk' && (debug || android_version > '15')) || (toolkit == 'android' && !debug)
+skip-if = (toolkit == 'android' && !debug) # Bug 1141544: Re-enable when buildbot tests are gone
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -10,27 +10,45 @@
   // For UnrestrictedDoubleOrKeyframeAnimationOptions;
 #include "mozilla/dom/CSSPseudoElement.h"
 #include "mozilla/dom/KeyframeEffectBinding.h"
 #include "mozilla/AnimationUtils.h"
 #include "mozilla/EffectSet.h"
 #include "mozilla/FloatingPoint.h" // For IsFinite
 #include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
 #include "mozilla/KeyframeUtils.h"
+#include "mozilla/ServoBindings.h"
 #include "mozilla/StyleAnimationValue.h"
 #include "Layers.h" // For Layer
 #include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetStyleContextForElement
 #include "nsContentUtils.h"  // nsContentUtils::ReportToConsole
 #include "nsCSSPropertyIDSet.h"
 #include "nsCSSProps.h" // For nsCSSProps::PropHasFlags
 #include "nsCSSPseudoElements.h" // For CSSPseudoElementType
 #include "nsIPresShell.h"
 #include "nsIScriptError.h"
 
 namespace mozilla {
+
+bool
+PropertyValuePair::operator==(const PropertyValuePair& aOther) const
+{
+  if (mProperty != aOther.mProperty || mValue != aOther.mValue) {
+    return false;
+  }
+  if (mServoDeclarationBlock == aOther.mServoDeclarationBlock) {
+    return true;
+  }
+  if (!mServoDeclarationBlock || !aOther.mServoDeclarationBlock) {
+    return false;
+  }
+  return Servo_DeclarationBlock_Equals(mServoDeclarationBlock,
+                                       aOther.mServoDeclarationBlock);
+}
+
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(KeyframeEffectReadOnly,
                                    AnimationEffectReadOnly,
                                    mTarget)
 
 NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(KeyframeEffectReadOnly,
                                                AnimationEffectReadOnly)
--- a/dom/animation/KeyframeEffectReadOnly.h
+++ b/dom/animation/KeyframeEffectReadOnly.h
@@ -15,18 +15,18 @@
 #include "nsWrapperCache.h"
 #include "mozilla/AnimationPerformanceWarning.h"
 #include "mozilla/AnimationTarget.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/ComputedTimingFunction.h"
 #include "mozilla/EffectCompositor.h"
 #include "mozilla/KeyframeEffectParams.h"
 #include "mozilla/LayerAnimationInfo.h" // LayerAnimations::kRecords
-#include "mozilla/ServoBindingHelpers.h" // RawServoDeclarationBlock and
-                                         // associated RefPtrTraits
+#include "mozilla/ServoBindingTypes.h" // RawServoDeclarationBlock and
+                                       // associated RefPtrTraits
 #include "mozilla/StyleAnimationValue.h"
 #include "mozilla/dom/AnimationEffectReadOnly.h"
 #include "mozilla/dom/Element.h"
 
 struct JSContext;
 class JSObject;
 class nsCSSPropertyIDSet;
 class nsIContent;
@@ -64,24 +64,17 @@ struct PropertyValuePair
   // (string).
   nsCSSValue mValue;
 
   // The specified value when using the Servo backend. However, even when
   // using the Servo backend, we still fill in |mValue| in the case where we
   // fail to parse the value since we use it to store the original string.
   RefPtr<RawServoDeclarationBlock> mServoDeclarationBlock;
 
-  bool operator==(const PropertyValuePair& aOther) const {
-    return mProperty == aOther.mProperty &&
-           mValue == aOther.mValue &&
-           !mServoDeclarationBlock == !aOther.mServoDeclarationBlock &&
-           (!mServoDeclarationBlock ||
-            Servo_DeclarationBlock_Equals(mServoDeclarationBlock,
-                                          aOther.mServoDeclarationBlock));
-  }
+  bool operator==(const PropertyValuePair&) const;
 };
 
 /**
  * A single keyframe.
  *
  * This is the canonical form in which keyframe effects are stored and
  * corresponds closely to the type of objects returned via the getKeyframes()
  * API.
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -4,16 +4,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/KeyframeUtils.h"
 
 #include "mozilla/AnimationUtils.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/Move.h"
 #include "mozilla/RangedArray.h"
+#include "mozilla/ServoBindings.h"
 #include "mozilla/StyleAnimationValue.h"
 #include "mozilla/TimingParams.h"
 #include "mozilla/dom/BaseKeyframeTypesBinding.h" // For FastBaseKeyframe etc.
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/KeyframeEffectBinding.h"
 #include "mozilla/dom/KeyframeEffectReadOnly.h" // For PropertyValuesPair etc.
 #include "jsapi.h" // For ForOfIterator etc.
 #include "nsClassHashtable.h"
--- a/dom/base/nsAttrValue.cpp
+++ b/dom/base/nsAttrValue.cpp
@@ -12,17 +12,17 @@
 #include "mozilla/DebugOnly.h"
 #include "mozilla/HashFunctions.h"
 
 #include "nsAttrValue.h"
 #include "nsAttrValueInlines.h"
 #include "nsIAtom.h"
 #include "nsUnicharUtils.h"
 #include "mozilla/MemoryReporting.h"
-#include "mozilla/ServoBindingHelpers.h"
+#include "mozilla/ServoBindingTypes.h"
 #include "mozilla/DeclarationBlockInlines.h"
 #include "nsContentUtils.h"
 #include "nsReadableUtils.h"
 #include "prprf.h"
 #include "nsHTMLCSSStyleSheet.h"
 #include "nsCSSParser.h"
 #include "nsStyledElement.h"
 #include "nsIURI.h"
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -16,16 +16,17 @@
 #include "IndexedDatabaseManager.h"
 #include "js/StructuredClone.h"
 #include "js/Value.h"
 #include "jsapi.h"
 #include "KeyPath.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/AppProcessChecker.h"
 #include "mozilla/AutoRestore.h"
+#include "mozilla/Casting.h"
 #include "mozilla/EndianUtils.h"
 #include "mozilla/LazyIdleThread.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/storage.h"
 #include "mozilla/Unused.h"
@@ -18955,22 +18956,17 @@ DatabaseOperationBase::GetBindingClauseF
   MOZ_ASSERT(!aBindingClause.IsEmpty());
 }
 
 // static
 uint64_t
 DatabaseOperationBase::ReinterpretDoubleAsUInt64(double aDouble)
 {
   // This is a duplicate of the js engine's byte munging in StructuredClone.cpp
-  union {
-    double d;
-    uint64_t u;
-  } pun;
-  pun.d = aDouble;
-  return pun.u;
+  return BitwiseCast<uint64_t>(aDouble);
 }
 
 // static
 template <typename T>
 nsresult
 DatabaseOperationBase::GetStructuredCloneReadInfoFromSource(
                                                  T* aSource,
                                                  uint32_t aDataIndex,
--- a/dom/indexedDB/Key.cpp
+++ b/dom/indexedDB/Key.cpp
@@ -7,16 +7,17 @@
 
 #include "Key.h"
 
 #include <algorithm>
 #include "IndexedDatabaseManager.h"
 #include "js/Date.h"
 #include "js/Value.h"
 #include "jsfriendapi.h"
+#include "mozilla/Casting.h"
 #include "mozilla/EndianUtils.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozIStorageStatement.h"
 #include "mozIStorageValueArray.h"
 #include "nsAlgorithm.h"
 #include "nsJSUtils.h"
 #include "ReportInternalError.h"
 #include "xpcpublic.h"
@@ -589,41 +590,34 @@ Key::DecodeString(const unsigned char*& 
   }
   
   NS_ASSERTION(!size || out == aString.EndReading(),
                "Should have written the whole string");
   
   aPos = iter + 1;
 }
 
-union Float64Union {
-  double d;
-  uint64_t u;
-}; 
-
 void
 Key::EncodeNumber(double aFloat, uint8_t aType)
 {
   // Allocate memory for the new size
   uint32_t oldLen = mBuffer.Length();
   char* buffer;
   if (!mBuffer.GetMutableData(&buffer, oldLen + 1 + sizeof(double))) {
     return;
   }
   buffer += oldLen;
 
   *(buffer++) = aType;
 
-  Float64Union pun;
-  pun.d = aFloat;
+  uint64_t bits = BitwiseCast<uint64_t>(aFloat);
   // Note: The subtraction from 0 below is necessary to fix
   // MSVC build warning C4146 (negating an unsigned value).
-  uint64_t number = pun.u & PR_UINT64(0x8000000000000000) ?
-                    (0 - pun.u) :
-                    (pun.u | PR_UINT64(0x8000000000000000));
+  const uint64_t signbit = FloatingPoint<double>::kSignBit;
+  uint64_t number = bits & signbit ? (0 - bits) : (bits | signbit);
 
   mozilla::BigEndian::writeUint64(buffer, number);
 }
 
 // static
 double
 Key::DecodeNumber(const unsigned char*& aPos, const unsigned char* aEnd)
 {
@@ -633,24 +627,22 @@ Key::DecodeNumber(const unsigned char*& 
   ++aPos;
 
   uint64_t number = 0;
   memcpy(&number, aPos, std::min<size_t>(sizeof(number), aEnd - aPos));
   number = mozilla::NativeEndian::swapFromBigEndian(number);
 
   aPos += sizeof(number);
 
-  Float64Union pun;
   // Note: The subtraction from 0 below is necessary to fix
   // MSVC build warning C4146 (negating an unsigned value).
-  pun.u = number & PR_UINT64(0x8000000000000000) ?
-          (number & ~PR_UINT64(0x8000000000000000)) :
-          (0 - number);
+  const uint64_t signbit = FloatingPoint<double>::kSignBit;
+  uint64_t bits = number & signbit ? (number & ~signbit) : (0 - number);
 
-  return pun.d;
+  return BitwiseCast<double>(bits);
 }
 
 void
 Key::EncodeBinary(JSObject* aObject, bool aIsViewObject, uint8_t aTypeOffset)
 {
   uint8_t* bufferData;
   uint32_t bufferLength;
   bool unused;
--- a/dom/indexedDB/test/unit/test_quotaExceeded_recovery.js
+++ b/dom/indexedDB/test/unit/test_quotaExceeded_recovery.js
@@ -9,26 +9,29 @@ var testGenerator = testSteps();
 
 function testSteps()
 {
   const spec = "http://foo.com";
   const name =
     this.window ? window.location.pathname : "test_quotaExceeded_recovery";
   const objectStoreName = "foo";
 
-  // We want 8 MB database on Android and 32 MB database on other platforms.
-  const groupLimitMB = mozinfo.os == "android" ? 8 : 32;
+  const android = mozinfo.os == "android";
+
+  // We want 512 KB database on Android and 4 MB database on other platforms.
+  const groupLimitKB = android ? 512 : 4096;
 
   // The group limit is calculated as 20% of the global temporary storage limit.
-  const tempStorageLimitKB = groupLimitMB * 5 * 1024;
+  const tempStorageLimitKB = groupLimitKB * 5;
 
-  // Store in 1 MB chunks.
-  const dataSize = 1024 * 1024;
+  // We want 64 KB chunks on Android and 512 KB chunks on other platforms.
+  const dataSizeKB = android ? 64 : 512;
+  const dataSize = dataSizeKB * 1024;
 
-  const maxIter = 10;
+  const maxIter = 5;
 
   for (let blobs of [false, true]) {
     setTemporaryStorageLimit(tempStorageLimitKB);
 
     clearAllDatabases(continueToNextStepSync);
     yield undefined;
 
     info("Opening database");
--- a/editor/libeditor/SetDocumentTitleTransaction.cpp
+++ b/editor/libeditor/SetDocumentTitleTransaction.cpp
@@ -30,17 +30,19 @@ SetDocumentTitleTransaction::SetDocument
 }
 
 NS_IMETHODIMP
 SetDocumentTitleTransaction::Init(nsIHTMLEditor* aEditor,
                                   const nsAString* aValue)
 
 {
   NS_ASSERTION(aEditor && aValue, "null args");
-  if (!aEditor || !aValue) { return NS_ERROR_NULL_POINTER; }
+  if (!aEditor || !aValue) {
+    return NS_ERROR_NULL_POINTER;
+  }
 
   mEditor = aEditor;
   mValue = *aValue;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -62,129 +64,166 @@ SetDocumentTitleTransaction::RedoTransac
   // No extra work required; the DOM changes alone are enough
   return NS_OK;
 }
 
 nsresult
 SetDocumentTitleTransaction::SetDomTitle(const nsAString& aTitle)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
-  NS_ENSURE_TRUE(editor, NS_ERROR_FAILURE);
+  if (NS_WARN_IF(!editor)) {
+    return NS_ERROR_FAILURE;
+  }
+
   nsCOMPtr<nsIDOMDocument> domDoc;
-  nsresult res = editor->GetDocument(getter_AddRefs(domDoc));
-  NS_ENSURE_TRUE(domDoc, NS_ERROR_FAILURE);
+  nsresult rv = editor->GetDocument(getter_AddRefs(domDoc));
+  if (NS_WARN_IF(!domDoc)) {
+    return NS_ERROR_FAILURE;
+  }
 
   nsCOMPtr<nsIDOMNodeList> titleList;
-  res = domDoc->GetElementsByTagName(NS_LITERAL_STRING("title"), getter_AddRefs(titleList));
-  NS_ENSURE_SUCCESS(res, res);
+  rv = domDoc->GetElementsByTagName(NS_LITERAL_STRING("title"),
+                                    getter_AddRefs(titleList));
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
 
   // First assume we will NOT really do anything
   // (transaction will not be pushed on stack)
   mIsTransient = true;
 
-  nsCOMPtr<nsIDOMNode>titleNode;
-  if(titleList)
-  {
-    res = titleList->Item(0, getter_AddRefs(titleNode));
-    NS_ENSURE_SUCCESS(res, res);
-    if (titleNode)
-    {
+  nsCOMPtr<nsIDOMNode> titleNode;
+  if(titleList) {
+    rv = titleList->Item(0, getter_AddRefs(titleNode));
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+
+    if (titleNode) {
       // Delete existing child textnode of title node
       // (Note: all contents under a TITLE node are always in a single text node)
       nsCOMPtr<nsIDOMNode> child;
-      res = titleNode->GetFirstChild(getter_AddRefs(child));
-      if(NS_FAILED(res)) return res;
-      if(child)
-      {
+      rv = titleNode->GetFirstChild(getter_AddRefs(child));
+      if (NS_FAILED(rv)) {
+        return rv;
+      }
+
+      if(child) {
         // Save current text as the undo value
         nsCOMPtr<nsIDOMCharacterData> textNode = do_QueryInterface(child);
-        if(textNode)
-        {
+        if(textNode) {
           textNode->GetData(mUndoValue);
 
           // If title text is identical to what already exists,
           // quit now (mIsTransient is now TRUE)
-          if (mUndoValue == aTitle)
+          if (mUndoValue == aTitle) {
             return NS_OK;
+          }
         }
-        res = editor->DeleteNode(child);
-        if(NS_FAILED(res)) return res;
+        rv = editor->DeleteNode(child);
+        if (NS_WARN_IF(NS_FAILED(rv))) {
+          return rv;
+        }
       }
     }
   }
 
   // We didn't return above, thus we really will be changing the title
   mIsTransient = false;
 
   // Get the <HEAD> node, create a <TITLE> and insert it under the HEAD
   nsCOMPtr<nsIDocument> document = do_QueryInterface(domDoc);
-  NS_ENSURE_STATE(document);
+  if (NS_WARN_IF(!document)) {
+    return NS_ERROR_UNEXPECTED;
+  }
 
-  dom::Element* head = document->GetHeadElement();
-  NS_ENSURE_STATE(head);
+  RefPtr<dom::Element> headElement = document->GetHeadElement();
+  if (NS_WARN_IF(!headElement)) {
+    return NS_ERROR_UNEXPECTED;
+  }
 
-  bool     newTitleNode = false;
+  bool newTitleNode = false;
   uint32_t newTitleIndex = 0;
 
-  if (!titleNode)
-  {
+  if (!titleNode) {
     // Didn't find one above: Create a new one
     nsCOMPtr<nsIDOMElement>titleElement;
-    res = domDoc->CreateElement(NS_LITERAL_STRING("title"), getter_AddRefs(titleElement));
-    NS_ENSURE_SUCCESS(res, res);
-    NS_ENSURE_TRUE(titleElement, NS_ERROR_FAILURE);
+    rv = domDoc->CreateElement(NS_LITERAL_STRING("title"),
+                               getter_AddRefs(titleElement));
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+    if (NS_WARN_IF(!titleElement)) {
+      return NS_ERROR_FAILURE;
+    }
 
     titleNode = do_QueryInterface(titleElement);
     newTitleNode = true;
 
     // Get index so we append new title node after all existing HEAD children.
-    newTitleIndex = head->GetChildCount();
+    newTitleIndex = headElement->GetChildCount();
   }
 
-  // Append a text node under the TITLE
-  //  only if the title text isn't empty
-  if (titleNode && !aTitle.IsEmpty())
-  {
+  // Append a text node under the TITLE only if the title text isn't empty.
+  if (titleNode && !aTitle.IsEmpty()) {
     nsCOMPtr<nsIDOMText> textNode;
-    res = domDoc->CreateTextNode(aTitle, getter_AddRefs(textNode));
-    NS_ENSURE_SUCCESS(res, res);
+    rv = domDoc->CreateTextNode(aTitle, getter_AddRefs(textNode));
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+
     nsCOMPtr<nsIDOMNode> newNode = do_QueryInterface(textNode);
-    NS_ENSURE_TRUE(newNode, NS_ERROR_FAILURE);
+    if (NS_WARN_IF(!newNode)) {
+      return NS_ERROR_FAILURE;
+    }
 
-    if (newTitleNode)
-    {
+    if (newTitleNode) {
       // Not undoable: We will insert newTitleNode below
       nsCOMPtr<nsIDOMNode> resultNode;
-      res = titleNode->AppendChild(newNode, getter_AddRefs(resultNode));
+      rv = titleNode->AppendChild(newNode, getter_AddRefs(resultNode));
+      if (NS_WARN_IF(NS_FAILED(rv))) {
+        return rv;
+      }
+    } else {
+      // This is an undoable transaction
+      rv = editor->InsertNode(newNode, titleNode, 0);
+      if (NS_WARN_IF(NS_FAILED(rv))) {
+        return rv;
+      }
     }
-    else
-    {
-      // This is an undoable transaction
-      res = editor->InsertNode(newNode, titleNode, 0);
-    }
-    NS_ENSURE_SUCCESS(res, res);
+    // Calling AppendChild() or InsertNode() could cause removing the head
+    // element.  So, let's mark it dirty.
+    headElement = nullptr;
   }
 
-  if (newTitleNode)
-  {
+  if (newTitleNode) {
+    if (!headElement) {
+      headElement = document->GetHeadElement();
+      if (NS_WARN_IF(!headElement)) {
+        // XXX Can we return NS_OK when there is no head element?
+        return NS_ERROR_UNEXPECTED;
+      }
+    }
     // Undoable transaction to insert title+text together
-    res = editor->InsertNode(titleNode, head->AsDOMNode(), newTitleIndex);
+    rv = editor->InsertNode(titleNode, headElement->AsDOMNode(), newTitleIndex);
   }
-  return res;
+  return rv;
 }
 
 NS_IMETHODIMP
 SetDocumentTitleTransaction::GetTxnDescription(nsAString& aString)
 {
   aString.AssignLiteral("SetDocumentTitleTransaction: ");
   aString += mValue;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 SetDocumentTitleTransaction::GetIsTransient(bool* aIsTransient)
 {
-  NS_ENSURE_TRUE(aIsTransient, NS_ERROR_NULL_POINTER);
+  if (NS_WARN_IF(!aIsTransient)) {
+    return NS_ERROR_NULL_POINTER;
+  }
   *aIsTransient = mIsTransient;
   return NS_OK;
 }
 
 } // namespace mozilla
--- a/editor/libeditor/tests/chrome.ini
+++ b/editor/libeditor/tests/chrome.ini
@@ -37,10 +37,11 @@ subsuite = clipboard
 [test_bug1250010.html]
 [test_bug1257363.html]
 [test_composition_event_created_in_chrome.html]
 [test_contenteditable_text_input_handling.html]
 [test_dragdrop.html]
 skip-if = buildapp == 'mulet'
 [test_htmleditor_keyevent_handling.html]
 [test_selection_move_commands.xul]
+[test_set_document_title_transaction.html]
 [test_texteditor_keyevent_handling.html]
 skip-if = (debug && os=='win') || (os == 'linux') # Bug 1116205, leaks on windows debug, fails delete key on linux
new file mode 100644
--- /dev/null
+++ b/editor/libeditor/tests/test_set_document_title_transaction.html
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>Test for SetDocumentTitleTransaction</title>
+  <script type="text/javascript"
+          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css"
+          href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+</head>
+<body onload="runTests()">
+<div id="display">
+  <iframe src="data:text/html,<!DOCTYPE html><html><head><title>first title</title></head><body></body></html>"></iframe>
+</div>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+
+<script class="testbody" type="application/javascript">
+function runTests() {
+  var iframe = document.getElementsByTagName("iframe")[0];
+  function isDocumentTitleEquals(aDescription, aExpectedTitle) {
+    is(iframe.contentDocument.title, aExpectedTitle, aDescription + ": document.title should be " + aExpectedTitle);
+    is(iframe.contentDocument.getElementsByTagName("title")[0].textContent, aExpectedTitle, aDescription + ": The text in the title element should be " + aExpectedTitle);
+  }
+
+  isDocumentTitleEquals("Checking isDocumentTitleEquals()", "first title");
+
+  const kTests = [
+    { description: "designMode=\"on\"",
+      init: function () {
+        iframe.contentDocument.designMode = "on";
+      },
+      cleanUp: function () {
+        iframe.contentDocument.designMode = "off";
+      }
+    },
+    { description: "html element has contenteditable attribute",
+      init: function () {
+        iframe.contentDocument.documentElement.setAttribute("contenteditable", "true");
+      },
+      cleanUp: function () {
+        iframe.contentDocument.documentElement.removeAttribute("contenteditable");
+      }
+    },
+  ];
+
+  for (var i = 0; i < kTests.length; i++) {
+    const kTest = kTests[i];
+    kTest.init();
+
+    var editor = SpecialPowers.wrap(iframe.contentWindow).
+                   QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
+                   getInterface(SpecialPowers.Ci.nsIWebNavigation).
+                   QueryInterface(SpecialPowers.Ci.nsIDocShell).editor;
+    ok(editor, kTest.description + ": The docshell should have editor");
+    var htmlEditor = editor.QueryInterface(SpecialPowers.Ci.nsIHTMLEditor);
+    ok(htmlEditor, kTest.description + ": The editor should have nsIHTMLEditor interface");
+
+    // Replace existing title.
+    htmlEditor.setDocumentTitle("Modified title");
+    isDocumentTitleEquals(kTest.description, "Modified title");
+
+    // When the document doesn't have <title> element, title element should be created automatically.
+    iframe.contentDocument.head.removeChild(iframe.contentDocument.getElementsByTagName("title")[0]);
+    is(iframe.contentDocument.getElementsByTagName("title").length, 0, kTest.description + ": There should be no title element");
+    htmlEditor.setDocumentTitle("new title");
+    is(iframe.contentDocument.getElementsByTagName("title").length, 1, kTest.description + ": There should be a title element");
+    isDocumentTitleEquals(kTest.description, "new title");
+
+    kTest.cleanUp();
+  }
+
+  SimpleTest.finish();
+}
+</script>
+</body>
+
+</html>
--- a/gfx/layers/ipc/CompositorBridgeChild.cpp
+++ b/gfx/layers/ipc/CompositorBridgeChild.cpp
@@ -1054,17 +1054,20 @@ CompositorBridgeChild::AllocShmem(size_t
 {
   ShmemAllocated(this);
   return PCompositorBridgeChild::AllocShmem(aSize, aType, aShmem);
 }
 
 void
 CompositorBridgeChild::DeallocShmem(ipc::Shmem& aShmem)
 {
-    PCompositorBridgeChild::DeallocShmem(aShmem);
+  if (!mCanSend) {
+    return;
+  }
+  PCompositorBridgeChild::DeallocShmem(aShmem);
 }
 
 widget::PCompositorWidgetChild*
 CompositorBridgeChild::AllocPCompositorWidgetChild(const CompositorWidgetInitData& aInitData)
 {
   // We send the constructor manually.
   MOZ_CRASH("Should not be called");
   return nullptr;
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -1,15 +1,16 @@
 /* -*- 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/. */
 
 #include "mozilla/ServoRestyleManager.h"
+#include "mozilla/ServoBindings.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/dom/ChildIterator.h"
 #include "nsContentUtils.h"
 #include "nsPrintfCString.h"
 #include "nsStyleChangeList.h"
 
 using namespace mozilla::dom;
 
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -687,17 +687,17 @@ nsBidiPresUtils::Resolve(nsBlockFrame* a
   // via using nsIFrame::GetWritingMode(nsIFrame*).
   char16_t ch = GetBidiOverride(aBlockFrame->StyleContext());
   if (ch != 0) {
     bpd.PushBidiControl(ch);
   }
   for (nsBlockFrame* block = aBlockFrame; block;
        block = static_cast<nsBlockFrame*>(block->GetNextContinuation())) {
     block->RemoveStateBits(NS_BLOCK_NEEDS_BIDI_RESOLUTION);
-    nsBlockInFlowLineIterator lineIter(block, block->BeginLine());
+    nsBlockInFlowLineIterator lineIter(block, block->LinesBegin());
     bpd.mPrevFrame = nullptr;
     TraverseFrames(aBlockFrame, &lineIter, block->PrincipalChildList().FirstChild(), &bpd);
     // XXX what about overflow lines?
   }
 
   if (ch != 0) {
     bpd.PopBidiControl(ch);
   }
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -6212,18 +6212,18 @@ nsLayoutUtils::GetFirstLinePosition(Writ
       }
       return false;
     }
 
     // No baseline.
     return false;
   }
 
-  for (nsBlockFrame::ConstLineIterator line = block->BeginLine(),
-                                       line_end = block->EndLine();
+  for (nsBlockFrame::ConstLineIterator line = block->LinesBegin(),
+                                       line_end = block->LinesEnd();
        line != line_end; ++line) {
     if (line->IsBlock()) {
       nsIFrame *kid = line->mFirstChild;
       LinePosition kidPosition;
       if (GetFirstLinePosition(aWM, kid, &kidPosition)) {
         //XXX Not sure if this is the correct value to use for container
         //    width here. It will only be used in vertical-rl layout,
         //    which we don't have full support and testing for yet.
@@ -6251,18 +6251,18 @@ nsLayoutUtils::GetFirstLinePosition(Writ
 nsLayoutUtils::GetLastLineBaseline(WritingMode aWM,
                                    const nsIFrame* aFrame, nscoord* aResult)
 {
   const nsBlockFrame* block = nsLayoutUtils::GetAsBlock(const_cast<nsIFrame*>(aFrame));
   if (!block)
     // No baseline.  (We intentionally don't descend into scroll frames.)
     return false;
 
-  for (nsBlockFrame::ConstReverseLineIterator line = block->RBeginLine(),
-                                              line_end = block->REndLine();
+  for (nsBlockFrame::ConstReverseLineIterator line = block->LinesRBegin(),
+                                              line_end = block->LinesREnd();
        line != line_end; ++line) {
     if (line->IsBlock()) {
       nsIFrame *kid = line->mFirstChild;
       nscoord kidBaseline;
       const nsSize& containerSize = line->mContainerSize;
       if (GetLastLineBaseline(aWM, kid, &kidBaseline)) {
         // Ignore relative positioning for baseline calculations
         *aResult = kidBaseline +
@@ -6289,18 +6289,18 @@ nsLayoutUtils::GetLastLineBaseline(Writi
 
 static nscoord
 CalculateBlockContentBEnd(WritingMode aWM, nsBlockFrame* aFrame)
 {
   NS_PRECONDITION(aFrame, "null ptr");
 
   nscoord contentBEnd = 0;
 
-  for (nsBlockFrame::LineIterator line = aFrame->BeginLine(),
-                                  line_end = aFrame->EndLine();
+  for (nsBlockFrame::LineIterator line = aFrame->LinesBegin(),
+                                  line_end = aFrame->LinesEnd();
        line != line_end; ++line) {
     if (line->IsBlock()) {
       nsIFrame* child = line->mFirstChild;
       const nsSize& containerSize = line->mContainerSize;
       nscoord offset =
         child->GetLogicalNormalPosition(aWM, containerSize).B(aWM);
       contentBEnd =
         std::max(contentBEnd,
--- a/layout/generic/BlockReflowInput.cpp
+++ b/layout/generic/BlockReflowInput.cpp
@@ -135,17 +135,17 @@ BlockReflowInput::BlockReflowInput(const
     // a constrained height.
     mFlags.mHasUnconstrainedBSize = true;
     mContentArea.BSize(wm) = mBEndEdge = NS_UNCONSTRAINEDSIZE;
   }
   mContentArea.IStart(wm) = mBorderPadding.IStart(wm);
   mBCoord = mContentArea.BStart(wm) = mBorderPadding.BStart(wm);
 
   mPrevChild = nullptr;
-  mCurrentLine = aFrame->EndLine();
+  mCurrentLine = aFrame->LinesEnd();
 
   mMinLineHeight = aReflowInput.CalcLineHeight();
 }
 
 nscoord
 BlockReflowInput::GetConsumedBSize()
 {
   if (mConsumedBSize == NS_INTRINSICSIZE) {
@@ -411,17 +411,17 @@ BlockReflowInput::GetFloatAvailableSpace
  * margins of blocks collapse).
  */
 void
 BlockReflowInput::ReconstructMarginBefore(nsLineList::iterator aLine)
 {
   mPrevBEndMargin.Zero();
   nsBlockFrame *block = mBlock;
 
-  nsLineList::iterator firstLine = block->BeginLine();
+  nsLineList::iterator firstLine = block->LinesBegin();
   for (;;) {
     --aLine;
     if (aLine->IsBlock()) {
       mPrevBEndMargin = aLine->GetCarriedOutBEndMargin();
       break;
     }
     if (!aLine->IsEmpty()) {
       break;
@@ -564,17 +564,17 @@ BlockReflowInput::RecoverStateFrom(nsLin
 // float as well unless it won't fit next to what we already have.
 // But nobody else implements it that way...
 bool
 BlockReflowInput::AddFloat(nsLineLayout*       aLineLayout,
                              nsIFrame*           aFloat,
                              nscoord             aAvailableISize)
 {
   NS_PRECONDITION(aLineLayout, "must have line layout");
-  NS_PRECONDITION(mBlock->EndLine() != mCurrentLine, "null ptr");
+  NS_PRECONDITION(mBlock->LinesEnd() != mCurrentLine, "null ptr");
   NS_PRECONDITION(aFloat->GetStateBits() & NS_FRAME_OUT_OF_FLOW,
                   "aFloat must be an out-of-flow frame");
 
   MOZ_ASSERT(aFloat->GetParent(), "float must have parent");
   MOZ_ASSERT(aFloat->GetParent()->IsFrameOfType(nsIFrame::eBlockFrame),
              "float's parent must be block");
   MOZ_ASSERT(aFloat->GetParent() == mBlock ||
              (aFloat->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT),
--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -178,18 +178,18 @@ ReflowInput::ReflowInput(
                      const ReflowInput& aParentReflowInput,
                      nsIFrame*                aFrame,
                      const LogicalSize&       aAvailableSpace,
                      const LogicalSize*       aContainingBlockSize,
                      uint32_t                 aFlags)
   : SizeComputationInput(aFrame, aParentReflowInput.mRenderingContext)
   , mBlockDelta(0)
   , mOrthogonalLimit(NS_UNCONSTRAINEDSIZE)
+  , mFlags(aParentReflowInput.mFlags)
   , mReflowDepth(aParentReflowInput.mReflowDepth + 1)
-  , mFlags(aParentReflowInput.mFlags)
 {
   MOZ_ASSERT(aPresContext, "no pres context");
   MOZ_ASSERT(aFrame, "no frame");
   MOZ_ASSERT(aPresContext == aFrame->PresContext(), "wrong pres context");
   NS_PRECONDITION(!mFlags.mSpecialBSizeReflow ||
                   !NS_SUBTREE_DIRTY(aFrame),
                   "frame should be clean when getting special bsize reflow");
 
--- a/layout/generic/ReflowInput.h
+++ b/layout/generic/ReflowInput.h
@@ -172,57 +172,57 @@ public:
   }
 
   SizeComputationInput(nsIFrame *aFrame, nsRenderingContext *aRenderingContext,
                    mozilla::WritingMode aContainingBlockWritingMode,
                    nscoord aContainingBlockISize);
 
   struct ReflowInputFlags {
     ReflowInputFlags() { memset(this, 0, sizeof(*this)); }
-    uint16_t mSpecialBSizeReflow:1;  // used by tables to communicate special reflow (in process) to handle
+    uint32_t mSpecialBSizeReflow:1;  // used by tables to communicate special reflow (in process) to handle
                                      // percent bsize frames inside cells which may not have computed bsizes
-    uint16_t mNextInFlowUntouched:1; // nothing in the frame's next-in-flow (or its descendants)
+    uint32_t mNextInFlowUntouched:1; // nothing in the frame's next-in-flow (or its descendants)
                                      // is changing
-    uint16_t mIsTopOfPage:1;         // Is the current context at the top of a
+    uint32_t mIsTopOfPage:1;         // Is the current context at the top of a
                                      // page?  When true, we force something
                                      // that's too tall for a page/column to
                                      // fit anyway to avoid infinite loops.
-    uint16_t mAssumingHScrollbar:1;  // parent frame is an nsIScrollableFrame and it
+    uint32_t mAssumingHScrollbar:1;  // parent frame is an nsIScrollableFrame and it
                                      // is assuming a horizontal scrollbar
-    uint16_t mAssumingVScrollbar:1;  // parent frame is an nsIScrollableFrame and it
+    uint32_t mAssumingVScrollbar:1;  // parent frame is an nsIScrollableFrame and it
                                      // is assuming a vertical scrollbar
 
-    uint16_t mIsIResize:1;           // Is frame (a) not dirty and (b) a
+    uint32_t mIsIResize:1;           // Is frame (a) not dirty and (b) a
                                      // different inline-size than before?
 
-    uint16_t mIsBResize:1;           // Is frame (a) not dirty and (b) a
+    uint32_t mIsBResize:1;           // Is frame (a) not dirty and (b) a
                                      // different block-size than before or
                                      // (potentially) in a context where
                                      // percent block-sizes have a different
                                      // basis?
-    uint16_t mTableIsSplittable:1;   // tables are splittable, this should happen only inside a page
+    uint32_t mTableIsSplittable:1;   // tables are splittable, this should happen only inside a page
                                      // and never insider a column frame
-    uint16_t mHeightDependsOnAncestorCell:1;   // Does frame height depend on
+    uint32_t mHeightDependsOnAncestorCell:1;   // Does frame height depend on
                                                // an ancestor table-cell?
-    uint16_t mIsColumnBalancing:1;   // nsColumnSetFrame is balancing columns
-    uint16_t mIsFlexContainerMeasuringHeight:1; // nsFlexContainerFrame is
+    uint32_t mIsColumnBalancing:1;   // nsColumnSetFrame is balancing columns
+    uint32_t mIsFlexContainerMeasuringHeight:1; // nsFlexContainerFrame is
                                                 // reflowing this child to
                                                 // measure its intrinsic height.
-    uint16_t mDummyParentReflowInput:1; // a "fake" reflow state made
+    uint32_t mDummyParentReflowInput:1; // a "fake" reflow state made
                                         // in order to be the parent
                                         // of a real one
-    uint16_t mMustReflowPlaceholders:1; // Should this frame reflow its place-
+    uint32_t mMustReflowPlaceholders:1; // Should this frame reflow its place-
                                         // holder children? If the available
                                         // height of this frame didn't change,
                                         // but its in a paginated environment
                                         // (e.g. columns), it should always
                                         // reflow its placeholder children.
-    uint16_t mShrinkWrap:1; // stores the COMPUTE_SIZE_SHRINK_WRAP ctor flag
-    uint16_t mUseAutoBSize:1; // stores the COMPUTE_SIZE_USE_AUTO_BSIZE ctor flag
-    uint16_t mStaticPosIsCBOrigin:1; // the STATIC_POS_IS_CB_ORIGIN ctor flag
+    uint32_t mShrinkWrap:1; // stores the COMPUTE_SIZE_SHRINK_WRAP ctor flag
+    uint32_t mUseAutoBSize:1; // stores the COMPUTE_SIZE_USE_AUTO_BSIZE ctor flag
+    uint32_t mStaticPosIsCBOrigin:1; // the STATIC_POS_IS_CB_ORIGIN ctor flag
   };
 
 #ifdef DEBUG
   // Reflow trace methods.  Defined in nsFrame.cpp so they have access
   // to the display-reflow infrastructure.
   static void* DisplayInitOffsetsEnter(
                                      nsIFrame* aFrame,
                                      SizeComputationInput* aState,
@@ -596,20 +596,21 @@ public:
 
   // CSS margin collapsing sometimes requires us to reflow
   // optimistically assuming that margins collapse to see if clearance
   // is required. When we discover that clearance is required, we
   // store the frame in which clearance was discovered to the location
   // requested here.
   nsIFrame** mDiscoveredClearance;
 
+  ReflowInputFlags mFlags;
+
   // This value keeps track of how deeply nested a given reflow state
   // is from the top of the frame tree.
   int16_t mReflowDepth;
-  ReflowInputFlags mFlags;
 
   // Logical and physical accessors for the resize flags. All users should go
   // via these accessors, so that in due course we can change the storage from
   // physical to logical.
   bool IsHResize() const {
     return mWritingMode.IsVertical() ? mFlags.mIsBResize : mFlags.mIsIResize;
   }
   bool IsVResize() const {
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -68,18 +68,18 @@ static const char16_t kDiscCharacter = 0
 using namespace mozilla;
 using namespace mozilla::css;
 using namespace mozilla::dom;
 using namespace mozilla::layout;
 typedef nsAbsoluteContainingBlock::AbsPosReflowFlags AbsPosReflowFlags;
 
 static void MarkAllDescendantLinesDirty(nsBlockFrame* aBlock)
 {
-  nsLineList::iterator line = aBlock->BeginLine();
-  nsLineList::iterator endLine = aBlock->EndLine();
+  nsLineList::iterator line = aBlock->LinesBegin();
+  nsLineList::iterator endLine = aBlock->LinesEnd();
   while (line != endLine) {
     if (line->IsBlock()) {
       nsIFrame* f = line->mFirstChild;
       nsBlockFrame* bf = nsLayoutUtils::GetAsBlock(f);
       if (bf) {
         MarkAllDescendantLinesDirty(bf);
       }
     }
@@ -112,18 +112,18 @@ static void MarkSameFloatManagerLinesDir
 static bool BlockHasAnyFloats(nsIFrame* aFrame)
 {
   nsBlockFrame* block = nsLayoutUtils::GetAsBlock(aFrame);
   if (!block)
     return false;
   if (block->GetChildList(nsIFrame::kFloatList).FirstChild())
     return true;
 
-  nsLineList::iterator line = block->BeginLine();
-  nsLineList::iterator endLine = block->EndLine();
+  nsLineList::iterator line = block->LinesBegin();
+  nsLineList::iterator endLine = block->LinesEnd();
   while (line != endLine) {
     if (line->IsBlock() && BlockHasAnyFloats(line->mFirstChild))
       return true;
     ++line;
   }
   return false;
 }
 
@@ -392,17 +392,17 @@ nsBlockFrame::List(FILE* out, const char
 
   fprintf_stderr(out, "%s<\n", str.get());
 
   nsCString pfx(aPrefix);
   pfx += "  ";
 
   // Output the lines
   if (!mLines.empty()) {
-    ConstLineIterator line = BeginLine(), line_end = EndLine();
+    ConstLineIterator line = LinesBegin(), line_end = LinesEnd();
     for ( ; line != line_end; ++line) {
       line->List(out, pfx.get(), aFlags);
     }
   }
 
   // Output the overflow lines.
   const FrameLines* overflowLines = GetOverflowLines();
   if (overflowLines && !overflowLines->mLines.empty()) {
@@ -499,17 +499,17 @@ nsBlockFrame::GetLogicalBaseline(Writing
 
 nscoord
 nsBlockFrame::GetCaretBaseline() const
 {
   nsRect contentRect = GetContentRect();
   nsMargin bp = GetUsedBorderAndPadding();
 
   if (!mLines.empty()) {
-    ConstLineIterator line = BeginLine();
+    ConstLineIterator line = LinesBegin();
     const nsLineBox* firstLine = line;
     if (firstLine->GetChildCount()) {
       return bp.top + firstLine->mFirstChild->GetCaretBaseline();
     }
   }
   float inflation = nsLayoutUtils::FontSizeInflationFor(this);
   RefPtr<nsFontMetrics> fm =
     nsLayoutUtils::GetFontMetricsForFrame(this, inflation);
@@ -699,17 +699,17 @@ nsBlockFrame::GetMinISize(nsRenderingCon
   if (RenumberList()) {
     AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
   }
   if (GetStateBits() & NS_BLOCK_NEEDS_BIDI_RESOLUTION)
     ResolveBidi();
   InlineMinISizeData data;
   for (nsBlockFrame* curFrame = this; curFrame;
        curFrame = static_cast<nsBlockFrame*>(curFrame->GetNextContinuation())) {
-    for (LineIterator line = curFrame->BeginLine(), line_end = curFrame->EndLine();
+    for (LineIterator line = curFrame->LinesBegin(), line_end = curFrame->LinesEnd();
       line != line_end; ++line)
     {
 #ifdef DEBUG
       if (gNoisyIntrinsic) {
         IndentBy(stdout, gNoiseIndent);
         printf("line (%s%s)\n",
                line->IsBlock() ? "block" : "inline",
                line->IsEmpty() ? ", empty" : "");
@@ -718,17 +718,17 @@ nsBlockFrame::GetMinISize(nsRenderingCon
 #endif
       if (line->IsBlock()) {
         data.ForceBreak();
         data.mCurrentLine = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
                         line->mFirstChild, nsLayoutUtils::MIN_ISIZE);
         data.ForceBreak();
       } else {
         if (!curFrame->GetPrevContinuation() &&
-            line == curFrame->BeginLine()) {
+            line == curFrame->LinesBegin()) {
           // Only add text-indent if it has no percentages; using a
           // percentage basis of 0 unconditionally would give strange
           // behavior for calc(10%-3px).
           const nsStyleCoord &indent = StyleText()->mTextIndent;
           if (indent.ConvertsToLength())
             data.mCurrentLine += nsRuleNode::ComputeCoordPercentCalc(indent, 0);
         }
         // XXX Bug NNNNNN Should probably handle percentage text-indent.
@@ -787,17 +787,17 @@ nsBlockFrame::GetPrefISize(nsRenderingCo
   if (RenumberList()) {
     AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
   }
   if (GetStateBits() & NS_BLOCK_NEEDS_BIDI_RESOLUTION)
     ResolveBidi();
   InlinePrefISizeData data;
   for (nsBlockFrame* curFrame = this; curFrame;
        curFrame = static_cast<nsBlockFrame*>(curFrame->GetNextContinuation())) {
-    for (LineIterator line = curFrame->BeginLine(), line_end = curFrame->EndLine();
+    for (LineIterator line = curFrame->LinesBegin(), line_end = curFrame->LinesEnd();
          line != line_end; ++line)
     {
 #ifdef DEBUG
       if (gNoisyIntrinsic) {
         IndentBy(stdout, gNoiseIndent);
         printf("line (%s%s)\n",
                line->IsBlock() ? "block" : "inline",
                line->IsEmpty() ? ", empty" : "");
@@ -808,17 +808,17 @@ nsBlockFrame::GetPrefISize(nsRenderingCo
         if (!data.mLineIsEmpty || BlockCanIntersectFloats(line->mFirstChild)) {
           data.ForceBreak();
         }
         data.mCurrentLine = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
                         line->mFirstChild, nsLayoutUtils::PREF_ISIZE);
         data.ForceBreak();
       } else {
         if (!curFrame->GetPrevContinuation() &&
-            line == curFrame->BeginLine()) {
+            line == curFrame->LinesBegin()) {
           // Only add text-indent if it has no percentages; using a
           // percentage basis of 0 unconditionally would give strange
           // behavior for calc(10%-3px).
           const nsStyleCoord &indent = StyleText()->mTextIndent;
           if (indent.ConvertsToLength()) {
             nscoord length = indent.ToLength();
             if (length != 0) {
               data.mCurrentLine += length;
@@ -873,30 +873,30 @@ nsBlockFrame::GetPrefWidthTightBounds(ns
 
   *aX = 0;
   *aXMost = 0;
 
   nsresult rv;
   InlinePrefISizeData data;
   for (nsBlockFrame* curFrame = this; curFrame;
        curFrame = static_cast<nsBlockFrame*>(curFrame->GetNextContinuation())) {
-    for (LineIterator line = curFrame->BeginLine(), line_end = curFrame->EndLine();
+    for (LineIterator line = curFrame->LinesBegin(), line_end = curFrame->LinesEnd();
          line != line_end; ++line)
     {
       nscoord childX, childXMost;
       if (line->IsBlock()) {
         data.ForceBreak();
         rv = line->mFirstChild->GetPrefWidthTightBounds(aRenderingContext,
                                                         &childX, &childXMost);
         NS_ENSURE_SUCCESS(rv, rv);
         *aX = std::min(*aX, childX);
         *aXMost = std::max(*aXMost, childXMost);
       } else {
         if (!curFrame->GetPrevContinuation() &&
-            line == curFrame->BeginLine()) {
+            line == curFrame->LinesBegin()) {
           // Only add text-indent if it has no percentages; using a
           // percentage basis of 0 unconditionally would give strange
           // behavior for calc(10%-3px).
           const nsStyleCoord &indent = StyleText()->mTextIndent;
           if (indent.ConvertsToLength()) {
             data.mCurrentLine += nsRuleNode::ComputeCoordPercentCalc(indent, 0);
           }
         }
@@ -1308,17 +1308,17 @@ nsBlockFrame::Reflow(nsPresContext*     
   // logical direction progresses in a negative physical direction, and
   // therefore block-dir coordinate conversion depends on knowing the width
   // of the coordinate space in order to translate between the logical and
   // physical origins.
   if (wm.IsVerticalRL()) {
     nsSize containerSize = aMetrics.PhysicalSize();
     nscoord deltaX = containerSize.width - state.ContainerSize().width;
     if (deltaX != 0) {
-      for (LineIterator line = BeginLine(), end = EndLine();
+      for (LineIterator line = LinesBegin(), end = LinesEnd();
            line != end; line++) {
         UpdateLineContainerSize(line, containerSize);
       }
       for (nsIFrame* f : mFloats) {
         nsPoint physicalDelta(deltaX, 0);
         f->MovePositionBy(physicalDelta);
       }
       nsFrameList* bulletList = GetOutsideBulletList();
@@ -1479,18 +1479,18 @@ nsBlockFrame::Reflow(nsPresContext*     
 #endif
 
   NS_FRAME_SET_TRUNCATION(aStatus, (*reflowInput), aMetrics);
 }
 
 bool
 nsBlockFrame::CheckForCollapsedBEndMarginFromClearanceLine()
 {
-  LineIterator begin = BeginLine();
-  LineIterator line = EndLine();
+  LineIterator begin = LinesBegin();
+  LineIterator line = LinesEnd();
 
   while (true) {
     if (begin == line) {
       return false;
     }
     --line;
     if (line->BSize() != 0 || !line->CachedIsEmpty()) {
       return false;
@@ -1714,17 +1714,17 @@ nsBlockFrame::ComputeOverflowAreas(const
                                    nscoord               aBEndEdgeOfChildren,
                                    nsOverflowAreas&      aOverflowAreas)
 {
   // Compute the overflow areas of our children
   // XXX_perf: This can be done incrementally.  It is currently one of
   // the things that makes incremental reflow O(N^2).
   nsOverflowAreas areas(aBounds, aBounds);
   if (!ShouldApplyOverflowClipping(this, aDisplay)) {
-    for (LineIterator line = BeginLine(), line_end = EndLine();
+    for (LineIterator line = LinesBegin(), line_end = LinesEnd();
          line != line_end;
          ++line) {
       areas.UnionWith(line->GetOverflowAreas());
     }
 
     // Factor an outside bullet in; normally the bullet will be factored into
     // the line-box's overflow areas. However, if the line is a block
     // line then it won't; if there are no lines, it won't. So just
@@ -1752,17 +1752,17 @@ nsBlockFrame::ComputeOverflowAreas(const
 
 void
 nsBlockFrame::UnionChildOverflow(nsOverflowAreas& aOverflowAreas)
 {
   // We need to update the overflow areas of lines manually, as they
   // get cached and re-used otherwise. Lines aren't exposed as normal
   // frame children, so calling UnionChildOverflow alone will end up
   // using the old cached values.
-  for (LineIterator line = BeginLine(), line_end = EndLine();
+  for (LineIterator line = LinesBegin(), line_end = LinesEnd();
        line != line_end;
        ++line) {
     nsRect bounds = line->GetPhysicalBounds();
     nsOverflowAreas lineAreas(bounds, bounds);
 
     int32_t n = line->GetChildCount();
     for (nsIFrame* lineFrame = line->mFirstChild;
          n > 0; lineFrame = lineFrame->GetNextSibling(), --n) {
@@ -1802,17 +1802,17 @@ nsBlockFrame::ComputeCustomOverflow(nsOv
   ClearLineCursor();
   return nsContainerFrame::ComputeCustomOverflow(aOverflowAreas);
 }
 
 void
 nsBlockFrame::LazyMarkLinesDirty()
 {
   if (GetStateBits() & NS_BLOCK_LOOK_FOR_DIRTY_FRAMES) {
-    for (LineIterator line = BeginLine(), line_end = EndLine();
+    for (LineIterator line = LinesBegin(), line_end = LinesEnd();
          line != line_end; ++line) {
       int32_t n = line->GetChildCount();
       for (nsIFrame* lineFrame = line->mFirstChild;
            n > 0; lineFrame = lineFrame->GetNextSibling(), --n) {
         if (NS_SUBTREE_DIRTY(lineFrame)) {
           // NOTE:  MarkLineDirty does more than just marking the line dirty.
           MarkLineDirty(line, &mLines);
           break;
@@ -1909,17 +1909,17 @@ nsBlockFrame::PrepareResizeReflow(BlockR
 #ifdef DEBUG
     if (gNoisyReflow) {
       IndentBy(stdout, gNoiseIndent);
       ListTag(stdout);
       printf(": trying to avoid marking all lines dirty\n");
     }
 #endif
 
-    for (LineIterator line = BeginLine(), line_end = EndLine();
+    for (LineIterator line = LinesBegin(), line_end = LinesEnd();
          line != line_end;
          ++line)
     {
       // We let child blocks make their own decisions the same
       // way we are here.
       bool isLastLine = line == mLines.back() && !GetNextInFlow();
       if (line->IsBlock() ||
           line->HasFloats() ||
@@ -1937,31 +1937,31 @@ nsBlockFrame::PrepareResizeReflow(BlockR
                line.get(), line->IsImpactedByFloat() ? "" : "not ");
       }
 #endif
 #ifdef DEBUG
       if (gNoisyReflow && !line->IsDirty()) {
         IndentBy(stdout, gNoiseIndent + 1);
         printf("skipped: line=%p next=%p %s %s%s%s breakTypeBefore/After=%s/%s xmost=%d\n",
            static_cast<void*>(line.get()),
-           static_cast<void*>((line.next() != EndLine() ? line.next().get() : nullptr)),
+           static_cast<void*>((line.next() != LinesEnd() ? line.next().get() : nullptr)),
            line->IsBlock() ? "block" : "inline",
            line->HasBreakAfter() ? "has-break-after " : "",
            line->HasFloats() ? "has-floats " : "",
            line->IsImpactedByFloat() ? "impacted " : "",
            line->BreakTypeToString(line->GetBreakTypeBefore()),
            line->BreakTypeToString(line->GetBreakTypeAfter()),
            line->IEnd());
       }
 #endif
     }
   }
   else {
     // Mark everything dirty
-    for (LineIterator line = BeginLine(), line_end = EndLine();
+    for (LineIterator line = LinesBegin(), line_end = LinesEnd();
          line != line_end;
          ++line)
     {
       line->MarkDirty();
     }
   }
 }
 
@@ -2119,18 +2119,18 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
                      (aState.mReflowInput.IsBResize() &&
                       (GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_BSIZE));
 
   // Reflow our last line if our availableBSize has increased
   // so that we (and our last child) pull up content as necessary
   if (aState.mReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE
       && GetNextInFlow() && aState.mReflowInput.AvailableBSize() >
         GetLogicalSize().BSize(aState.mReflowInput.GetWritingMode())) {
-    LineIterator lastLine = EndLine();
-    if (lastLine != BeginLine()) {
+    LineIterator lastLine = LinesEnd();
+    if (lastLine != LinesBegin()) {
       --lastLine;
       lastLine->MarkDirty();
     }
   }
     // the amount by which we will slide the current line if it is not
     // dirty
   nscoord deltaBCoord = 0;
 
@@ -2140,17 +2140,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
   bool needToRecoverState = false;
     // Float continuations were reflowed in ReflowPushedFloats
   bool reflowedFloat = mFloats.NotEmpty() &&
     (mFloats.FirstChild()->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT);
   bool lastLineMovedUp = false;
   // We save up information about BR-clearance here
   StyleClear inlineFloatBreakType = aState.mFloatBreakType;
 
-  LineIterator line = BeginLine(), line_end = EndLine();
+  LineIterator line = LinesBegin(), line_end = LinesEnd();
 
   // Reflow the lines that are already ours
   for ( ; line != line_end; ++line, aState.AdvanceToNextLine()) {
     DumpLine(aState, line, deltaBCoord, 0);
 #ifdef DEBUG
     AutoNoisyIndenter indent2(gNoisyReflow);
 #endif
 
@@ -2358,17 +2358,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
       // block was and is adjacent to the block-start and empty).
       //
       // If the line is empty now, we can't reliably tell if the line was empty
       // before, so we just assume it was and do nextLine->MarkPreviousMarginDirty.
       // This means the checks in 4) are redundant; if the line is empty now
       // we don't need to check 4), but if the line is not empty now and we're sure
       // it wasn't empty before, any adjacency and clearance changes are irrelevant
       // to the result of nextLine->ShouldApplyBStartMargin.
-      if (line.next() != EndLine()) {
+      if (line.next() != LinesEnd()) {
         bool maybeWasEmpty = oldB == line.next()->BStart();
         bool isEmpty = line->CachedIsEmpty();
         if (maybeReflowingForFirstTime /*1*/ ||
             (isEmpty || maybeWasEmpty) /*2/3/4*/) {
           line.next()->MarkPreviousMarginDirty();
           // since it's marked dirty, nobody will care about |deltaBCoord|
         }
       }
@@ -2504,18 +2504,18 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
        !lastLineMovedUp &&
        !(GetStateBits() & NS_FRAME_IS_DIRTY) &&
        !reflowedFloat)) {
     // We'll place lineIter at the last line of this block, so that
     // nsBlockInFlowLineIterator::Next() will take us to the first
     // line of my next-in-flow-chain.  (But first, check that I
     // have any lines -- if I don't, just bail out of this
     // optimization.)
-    LineIterator lineIter = this->EndLine();
-    if (lineIter != this->BeginLine()) {
+    LineIterator lineIter = this->LinesEnd();
+    if (lineIter != this->LinesBegin()) {
       lineIter--; // I have lines; step back from dummy iterator to last line.
       nsBlockInFlowLineIterator bifLineIter(this, lineIter);
 
       // Check for next-in-flow-chain's first line.
       // (First, see if there is such a line, and second, see if it's clean)
       if (!bifLineIter.Next() ||
           !bifLineIter.GetLine()->IsDirty()) {
         skipPull=true;
@@ -2576,17 +2576,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
       NS_ASSERTION(aState.mPrevChild || mLines.empty(), "should have a prevchild here");
       NS_ASSERTION(aState.mPrevChild == mFrames.LastChild(),
                    "Incorrect aState.mPrevChild before inserting line at end");
 
       // Shift pulledLine's frames into our mFrames list.
       mFrames.AppendFrames(nullptr, pulledFrames);
 
       // Add line to our line list, and set its last child as our new prev-child
-      line = mLines.before_insert(EndLine(), pulledLine);
+      line = mLines.before_insert(LinesEnd(), pulledLine);
       aState.mPrevChild = mFrames.LastChild();
 
       // Reparent floats whose placeholders are in the line.
       ReparentFloats(pulledLine->mFirstChild, nextInFlow, true);
 
       DumpLine(aState, pulledLine, deltaBCoord, 0);
 #ifdef DEBUG
       AutoNoisyIndenter indent2(gNoisyReflow);
@@ -2594,17 +2594,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
 
       if (aState.mPresContext->HasPendingInterrupt()) {
         MarkLineDirtyForInterrupt(line);
       } else {
         // Now reflow it and any lines that it makes during it's reflow
         // (we have to loop here because reflowing the line may cause a new
         // line to be created; see SplitLine's callers for examples of
         // when this happens).
-        while (line != EndLine()) {
+        while (line != LinesEnd()) {
           ReflowLine(aState, line, &keepGoing);
 
           if (aState.mReflowInput.WillReflowAgainForClearance()) {
             line->MarkDirty();
             keepGoing = false;
             NS_FRAME_SET_INCOMPLETE(aState.mReflowStatus);
             break;
           }
@@ -2783,17 +2783,17 @@ nsBlockFrame::ReflowLine(BlockReflowInpu
   }
 }
 
 nsIFrame*
 nsBlockFrame::PullFrame(BlockReflowInput& aState,
                         LineIterator       aLine)
 {
   // First check our remaining lines.
-  if (EndLine() != aLine.next()) {
+  if (LinesEnd() != aLine.next()) {
     return PullFrameFrom(aLine, this, aLine.next());
   }
 
   NS_ASSERTION(!GetOverflowLines(),
     "Our overflow lines should have been removed at the start of reflow");
 
   // Try each next-in-flow.
   nsBlockFrame* nextInFlow = aState.mNextInFlow;
@@ -3053,17 +3053,17 @@ nsBlockFrame::IsSelfEmpty()
 
 bool
 nsBlockFrame::CachedIsEmpty()
 {
   if (!IsSelfEmpty()) {
     return false;
   }
 
-  for (LineIterator line = BeginLine(), line_end = EndLine();
+  for (LineIterator line = LinesBegin(), line_end = LinesEnd();
        line != line_end;
        ++line)
   {
     if (!line->CachedIsEmpty())
       return false;
   }
 
   return true;
@@ -3071,17 +3071,17 @@ nsBlockFrame::CachedIsEmpty()
 
 bool
 nsBlockFrame::IsEmpty()
 {
   if (!IsSelfEmpty()) {
     return false;
   }
 
-  for (LineIterator line = BeginLine(), line_end = EndLine();
+  for (LineIterator line = LinesBegin(), line_end = LinesEnd();
        line != line_end;
        ++line)
   {
     if (!line->IsEmpty())
       return false;
   }
 
   return true;
@@ -3103,17 +3103,17 @@ nsBlockFrame::ShouldApplyBStartMargin(Bl
     // If we aren't at the start block-coordinate then something of non-zero
     // height must have been placed. Therefore the childs block-start margin
     // applies.
     aState.mFlags.mShouldApplyBStartMargin = true;
     return true;
   }
 
   // Determine if this line is "essentially" the first line
-  LineIterator line = BeginLine();
+  LineIterator line = LinesBegin();
   if (aState.mFlags.mHasLineAdjacentToTop) {
     line = aState.mLineAdjacentToTop;
   }
   while (line != aLine) {
     if (!line->CachedIsEmpty() || line->HasClearance()) {
       // A line which precedes aLine is non-empty, or has clearance,
       // so therefore the block-start margin applies.
       aState.mFlags.mShouldApplyBStartMargin = true;
@@ -3556,17 +3556,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
       if (!NS_FRAME_IS_FULLY_COMPLETE(frameReflowStatus) &&
           ShouldAvoidBreakInside(aState.mReflowInput)) {
         *aKeepReflowGoing = false;
       }
 
       if (aLine->SetCarriedOutBEndMargin(collapsedBEndMargin)) {
         LineIterator nextLine = aLine;
         ++nextLine;
-        if (nextLine != EndLine()) {
+        if (nextLine != LinesEnd()) {
           nextLine->MarkPreviousMarginDirty();
         }
       }
 
       aLine->SetOverflowAreas(overflowAreas);
       if (*aKeepReflowGoing) {
         // Some of the child block fit
 
@@ -3622,18 +3622,18 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
               // else one of our own overflow lines. In the latter case
               // the line is already marked dirty, so just handle the
               // first case.
               if (!madeContinuation) {
                 nsBlockFrame* nifBlock =
                   nsLayoutUtils::GetAsBlock(nextFrame->GetParent());
                 NS_ASSERTION(nifBlock,
                              "A block's child's next in flow's parent must be a block!");
-                for (LineIterator line = nifBlock->BeginLine(),
-                     line_end = nifBlock->EndLine(); line != line_end; ++line) {
+                for (LineIterator line = nifBlock->LinesBegin(),
+                     line_end = nifBlock->LinesEnd(); line != line_end; ++line) {
                   if (line->Contains(nextFrame)) {
                     line->MarkDirty();
                     break;
                   }
                 }
               }
             }
             *aKeepReflowGoing = false;
@@ -3898,17 +3898,17 @@ nsBlockFrame::DoReflowInlineFrames(Block
   for (i = 0; LineReflowStatus::OK == lineReflowStatus && i < aLine->GetChildCount();
        i++, frame = frame->GetNextSibling()) {
     ReflowInlineFrame(aState, aLineLayout, aLine, frame, &lineReflowStatus);
     if (LineReflowStatus::OK != lineReflowStatus) {
       // It is possible that one or more of next lines are empty
       // (because of DeleteNextInFlowChild). If so, delete them now
       // in case we are finished.
       ++aLine;
-      while ((aLine != EndLine()) && (0 == aLine->GetChildCount())) {
+      while ((aLine != LinesEnd()) && (0 == aLine->GetChildCount())) {
         // XXX Is this still necessary now that DeleteNextInFlowChild
         // uses DoRemoveFrame?
         nsLineBox *toremove = aLine;
         aLine = mLines.erase(aLine);
         NS_ASSERTION(nullptr == toremove->mFirstChild, "bad empty line");
         FreeLineBox(toremove);
       }
       --aLine;
@@ -4378,32 +4378,32 @@ nsBlockFrame::SplitLine(BlockReflowInput
 #endif
   }
 }
 
 bool
 nsBlockFrame::IsLastLine(BlockReflowInput& aState,
                          LineIterator aLine)
 {
-  while (++aLine != EndLine()) {
+  while (++aLine != LinesEnd()) {
     // There is another line
     if (0 != aLine->GetChildCount()) {
       // If the next line is a block line then this line is the last in a
       // group of inline lines.
       return aLine->IsBlock();
     }
     // The next line is empty, try the next one
   }
 
   // XXX Not sure about this part
   // Try our next-in-flows lines to answer the question
   nsBlockFrame* nextInFlow = (nsBlockFrame*) GetNextInFlow();
   while (nullptr != nextInFlow) {
-    for (LineIterator line = nextInFlow->BeginLine(),
-                   line_end = nextInFlow->EndLine();
+    for (LineIterator line = nextInFlow->LinesBegin(),
+                   line_end = nextInFlow->LinesEnd();
          line != line_end;
          ++line)
     {
       if (0 != line->GetChildCount())
         return line->IsBlock();
     }
     nextInFlow = (nsBlockFrame*) nextInFlow->GetNextInFlow();
   }
@@ -4630,19 +4630,19 @@ nsBlockFrame::PushLines(BlockReflowInput
 {
   // NOTE: aLineBefore is always a normal line, not an overflow line.
   // The following expression will assert otherwise.
   DebugOnly<bool> check = aLineBefore == mLines.begin();
 
   nsLineList::iterator overBegin(aLineBefore.next());
 
   // PushTruncatedPlaceholderLine sometimes pushes the first line.  Ugh.
-  bool firstLine = overBegin == BeginLine();
-
-  if (overBegin != EndLine()) {
+  bool firstLine = overBegin == LinesBegin();
+
+  if (overBegin != LinesEnd()) {
     // Remove floats in the lines from mFloats
     nsFrameList floats;
     CollectFloats(overBegin->mFirstChild, floats, true);
 
     if (floats.NotEmpty()) {
 #ifdef DEBUG
       for (nsIFrame* f : floats) {
         MOZ_ASSERT(!(f->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT),
@@ -4673,17 +4673,17 @@ nsBlockFrame::PushLines(BlockReflowInput
         lineBeforeLastFrame = f ? f->GetPrevSibling() : mFrames.LastChild();
         NS_ASSERTION(!f || lineBeforeLastFrame == aLineBefore->LastChild(),
                      "unexpected line frames");
       }
       nsFrameList pushedFrames = mFrames.RemoveFramesAfter(lineBeforeLastFrame);
       overflowLines->mFrames.InsertFrames(nullptr, nullptr, pushedFrames);
 
       overflowLines->mLines.splice(overflowLines->mLines.begin(), mLines,
-                                    overBegin, EndLine());
+                                    overBegin, LinesEnd());
       NS_ASSERTION(!overflowLines->mLines.empty(), "should not be empty");
       // this takes ownership but it won't delete it immediately so we
       // can keep using it.
       SetOverflowLines(overflowLines);
 
       // Mark all the overflow lines dirty so that they get reflowed when
       // they are pulled up by our next-in-flow.
 
@@ -5347,17 +5347,17 @@ nsBlockFrame::AddFrames(nsFrameList& aFr
 #endif
 }
 
 void
 nsBlockFrame::RemoveFloatFromFloatCache(nsIFrame* aFloat)
 {
   // Find which line contains the float, so we can update
   // the float cache.
-  LineIterator line = BeginLine(), line_end = EndLine();
+  LineIterator line = LinesBegin(), line_end = LinesEnd();
   for ( ; line != line_end; ++line) {
     if (line->IsInline() && line->RemoveFloat(aFloat)) {
       break;
     }
   }
 }
 
 void
@@ -5450,32 +5450,32 @@ nsBlockFrame::TryAllLines(nsLineList::it
   }
 }
 
 nsBlockInFlowLineIterator::nsBlockInFlowLineIterator(nsBlockFrame* aFrame,
     LineIterator aLine)
   : mFrame(aFrame), mLine(aLine), mLineList(&aFrame->mLines)
 {
   // This will assert if aLine isn't in mLines of aFrame:
-  DebugOnly<bool> check = aLine == mFrame->BeginLine();
+  DebugOnly<bool> check = aLine == mFrame->LinesBegin();
 }
 
 nsBlockInFlowLineIterator::nsBlockInFlowLineIterator(nsBlockFrame* aFrame,
     LineIterator aLine, bool aInOverflow)
   : mFrame(aFrame), mLine(aLine),
     mLineList(aInOverflow ? &aFrame->GetOverflowLines()->mLines
                           : &aFrame->mLines)
 {
 }
 
 nsBlockInFlowLineIterator::nsBlockInFlowLineIterator(nsBlockFrame* aFrame,
     bool* aFoundValidLine)
   : mFrame(aFrame), mLineList(&aFrame->mLines)
 {
-  mLine = aFrame->BeginLine();
+  mLine = aFrame->LinesBegin();
   *aFoundValidLine = FindValidLine();
 }
 
 static nsIFrame*
 FindChildContaining(nsBlockFrame* aFrame, nsIFrame* aFindFrame)
 {
   NS_ASSERTION(aFrame, "must have frame");
   nsIFrame* child;
@@ -5502,25 +5502,25 @@ nsBlockInFlowLineIterator::nsBlockInFlow
   : mFrame(aFrame), mLineList(&aFrame->mLines)
 {
   *aFoundValidLine = false;
 
   nsIFrame* child = FindChildContaining(aFrame, aFindFrame);
   if (!child)
     return;
 
-  LineIterator line_end = aFrame->EndLine();
+  LineIterator line_end = aFrame->LinesEnd();
   // Try to use the cursor if it exists, otherwise fall back to the first line
   if (nsLineBox* const cursor = aFrame->GetLineCursor()) {
     mLine = line_end;
     // Perform a simultaneous forward and reverse search starting from the
     // line cursor.
-    nsBlockFrame::LineIterator line = aFrame->BeginLineFrom(cursor);
-    nsBlockFrame::ReverseLineIterator rline = aFrame->RBeginLineFrom(cursor);
-    nsBlockFrame::ReverseLineIterator rline_end = aFrame->REndLine();
+    nsBlockFrame::LineIterator line = aFrame->LinesBeginFrom(cursor);
+    nsBlockFrame::ReverseLineIterator rline = aFrame->LinesRBeginFrom(cursor);
+    nsBlockFrame::ReverseLineIterator rline_end = aFrame->LinesREnd();
     // rline is positioned on the line containing 'cursor', so it's not
     // rline_end. So we can safely increment it (i.e. move it to one line
     // earlier) to start searching there.
     ++rline;
     while (line != line_end || rline != rline_end) {
       if (line != line_end) {
         if (line->Contains(child)) {
           mLine = line;
@@ -5539,17 +5539,17 @@ nsBlockInFlowLineIterator::nsBlockInFlow
     if (mLine != line_end) {
       *aFoundValidLine = true;
       if (mLine != cursor) {
         aFrame->Properties().Set(nsBlockFrame::LineCursorProperty(), mLine);
       }
       return;
     }
   } else {
-    for (mLine = aFrame->BeginLine(); mLine != line_end; ++mLine) {
+    for (mLine = aFrame->LinesBegin(); mLine != line_end; ++mLine) {
       if (mLine->Contains(child)) {
         *aFoundValidLine = true;
         return;
       }
     }
   }
   // Didn't find the line
   MOZ_ASSERT(mLine == line_end, "mLine should be line_end at this point");
@@ -6241,18 +6241,18 @@ nsBlockFrame::ReflowFloat(BlockReflowInp
 }
 
 StyleClear
 nsBlockFrame::FindTrailingClear()
 {
   // find the break type of the last line
   for (nsIFrame* b = this; b; b = b->GetPrevInFlow()) {
     nsBlockFrame* block = static_cast<nsBlockFrame*>(b);
-    LineIterator endLine = block->EndLine();
-    if (endLine != block->BeginLine()) {
+    LineIterator endLine = block->LinesEnd();
+    if (endLine != block->LinesBegin()) {
       --endLine;
       return endLine->GetBreakTypeAfter();
     }
   }
   return StyleClear::None;
 }
 
 void
@@ -6345,17 +6345,17 @@ nsBlockFrame::RecoverFloats(nsFloatManag
 
   // Recurse into our overflow container children
   for (nsIFrame* oc = GetChildList(kOverflowContainersList).FirstChild();
        oc; oc = oc->GetNextSibling()) {
     RecoverFloatsFor(oc, aFloatManager, aWM, aContainerSize);
   }
 
   // Recurse into our normal children
-  for (nsBlockFrame::LineIterator line = BeginLine(); line != EndLine(); ++line) {
+  for (nsBlockFrame::LineIterator line = LinesBegin(); line != LinesEnd(); ++line) {
     if (line->IsBlock()) {
       RecoverFloatsFor(line->mFirstChild, aFloatManager, aWM, aContainerSize);
     }
   }
 }
 
 void
 nsBlockFrame::RecoverFloatsFor(nsIFrame*       aFrame,
@@ -6555,17 +6555,17 @@ nsBlockFrame::BuildDisplayList(nsDisplay
   // it might skip lines that contain placeholders but don't themselves
   // intersect with the dirty area.
   // In particular, we really want to check ShouldDescendIntoFrame()
   // on all our child frames, but that might be expensive.  So we
   // approximate it by checking it on |this|; if it's true for any
   // frame in our child list, it's also true for |this|.
   nsLineBox* cursor = aBuilder->ShouldDescendIntoFrame(this) ?
     nullptr : GetFirstLineContaining(aDirtyRect.y);
-  LineIterator line_end = EndLine();
+  LineIterator line_end = LinesEnd();
 
   if (cursor) {
     for (LineIterator line = mLines.begin(cursor);
          line != line_end;
          ++line) {
       nsRect lineArea = line->GetVisualOverflowArea();
       if (!lineArea.IsEmpty()) {
         // Because we have a cursor, the combinedArea.ys are non-decreasing.
@@ -6577,17 +6577,17 @@ nsBlockFrame::BuildDisplayList(nsDisplay
                     linesDisplayListCollection, this, textOverflow.get());
       }
     }
   } else {
     bool nonDecreasingYs = true;
     int32_t lineCount = 0;
     nscoord lastY = INT32_MIN;
     nscoord lastYMost = INT32_MIN;
-    for (LineIterator line = BeginLine();
+    for (LineIterator line = LinesBegin();
          line != line_end;
          ++line) {
       nsRect lineArea = line->GetVisualOverflowArea();
       DisplayLine(aBuilder, lineArea, aDirtyRect, line, depth, drawnLines,
                   linesDisplayListCollection, this, textOverflow.get());
       if (!lineArea.IsEmpty()) {
         if (lineArea.y < lastY
             || lineArea.YMost() < lastYMost) {
@@ -6740,23 +6740,23 @@ nsBlockFrame::ChildIsDirty(nsIFrame* aCh
   // See if the child is absolutely positioned
   if (aChild->GetStateBits() & NS_FRAME_OUT_OF_FLOW &&
       aChild->IsAbsolutelyPositioned()) {
     // do nothing
   } else if (aChild == GetOutsideBullet()) {
     // The bullet lives in the first line, unless the first line has
     // height 0 and there is a second line, in which case it lives
     // in the second line.
-    LineIterator bulletLine = BeginLine();
-    if (bulletLine != EndLine() && bulletLine->BSize() == 0 &&
+    LineIterator bulletLine = LinesBegin();
+    if (bulletLine != LinesEnd() && bulletLine->BSize() == 0 &&
         bulletLine != mLines.back()) {
       bulletLine = bulletLine.next();
     }
 
-    if (bulletLine != EndLine()) {
+    if (bulletLine != LinesEnd()) {
       MarkLineDirty(bulletLine, &mLines);
     }
     // otherwise we have an empty line list, and ReflowDirtyLines
     // will handle reflowing the bullet.
   } else {
     // Note that we should go through our children to mark lines dirty
     // before the next reflow.  Doing it now could make things O(N^2)
     // since finding the right line is O(N).
@@ -7131,17 +7131,17 @@ nsBlockFrame::CheckFloats(BlockReflowInp
 #ifdef DEBUG
   // If any line is still dirty, that must mean we're going to reflow this
   // block again soon (e.g. because we bailed out after noticing that
   // clearance was imposed), so don't worry if the floats are out of sync.
   bool anyLineDirty = false;
 
   // Check that the float list is what we would have built
   AutoTArray<nsIFrame*, 8> lineFloats;
-  for (LineIterator line = BeginLine(), line_end = EndLine();
+  for (LineIterator line = LinesBegin(), line_end = LinesEnd();
        line != line_end; ++line) {
     if (line->HasFloats()) {
       nsFloatCache* fc = line->GetFirstFloat();
       while (fc) {
         lineFloats.AppendElement(fc->mFloat);
         fc = fc->Next();
       }
     }
@@ -7374,17 +7374,17 @@ nsBlockFrame::VerifyLines(bool aFinalChe
   }
 
   nsLineBox* cursor = GetLineCursor();
 
   // Add up the counts on each line. Also validate that IsFirstLine is
   // set properly.
   int32_t count = 0;
   LineIterator line, line_end;
-  for (line = BeginLine(), line_end = EndLine();
+  for (line = LinesBegin(), line_end = LinesEnd();
        line != line_end;
        ++line) {
     if (line == cursor) {
       cursor = nullptr;
     }
     if (aFinalCheckOK) {
       MOZ_ASSERT(line->GetChildCount(), "empty line");
       if (line->IsBlock()) {
@@ -7399,17 +7399,17 @@ nsBlockFrame::VerifyLines(bool aFinalChe
   nsIFrame* frame = mLines.front()->mFirstChild;
   while (frame) {
     frameCount++;
     frame = frame->GetNextSibling();
   }
   NS_ASSERTION(count == frameCount, "bad line list");
 
   // Next: test that each line has right number of frames on it
-  for (line = BeginLine(), line_end = EndLine();
+  for (line = LinesBegin(), line_end = LinesEnd();
        line != line_end;
         ) {
     count = line->GetChildCount();
     frame = line->mFirstChild;
     while (--count >= 0) {
       frame = frame->GetNextSibling();
     }
     ++line;
@@ -7487,18 +7487,18 @@ nsBlockFrame::VerifyOverflowSituation()
       NS_ASSERTION(overflowLines->mLines.front()->mFirstChild,
                    "bad overflow lines");
       NS_ASSERTION(overflowLines->mLines.front()->mFirstChild ==
                    overflowLines->mFrames.FirstChild(),
                    "bad overflow frames / lines");
     }
     nsLineBox* cursor = flow->GetLineCursor();
     if (cursor) {
-      LineIterator line = flow->BeginLine();
-      LineIterator line_end = flow->EndLine();
+      LineIterator line = flow->LinesBegin();
+      LineIterator line_end = flow->LinesEnd();
       for (; line != line_end && line != cursor; ++line)
         ;
       if (line == line_end && overflowLines) {
         line = overflowLines->mLines.begin();
         line_end = overflowLines->mLines.end();
         for (; line != line_end && line != cursor; ++line)
           ;
         }
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -83,26 +83,26 @@ public:
   NS_DECL_QUERYFRAME_TARGET(nsBlockFrame)
   NS_DECL_FRAMEARENA_HELPERS
 
   typedef nsLineList::iterator LineIterator;
   typedef nsLineList::const_iterator ConstLineIterator;
   typedef nsLineList::reverse_iterator ReverseLineIterator;
   typedef nsLineList::const_reverse_iterator ConstReverseLineIterator;
 
-  LineIterator BeginLine() { return mLines.begin(); }
-  LineIterator EndLine() { return mLines.end(); }
-  ConstLineIterator BeginLine() const { return mLines.begin(); }
-  ConstLineIterator EndLine() const { return mLines.end(); }
-  ReverseLineIterator RBeginLine() { return mLines.rbegin(); }
-  ReverseLineIterator REndLine() { return mLines.rend(); }
-  ConstReverseLineIterator RBeginLine() const { return mLines.rbegin(); }
-  ConstReverseLineIterator REndLine() const { return mLines.rend(); }
-  LineIterator BeginLineFrom(nsLineBox* aList) { return mLines.begin(aList); }
-  ReverseLineIterator RBeginLineFrom(nsLineBox* aList) { return mLines.rbegin(aList); }
+  LineIterator LinesBegin() { return mLines.begin(); }
+  LineIterator LinesEnd() { return mLines.end(); }
+  ConstLineIterator LinesBegin() const { return mLines.begin(); }
+  ConstLineIterator LinesEnd() const { return mLines.end(); }
+  ReverseLineIterator LinesRBegin() { return mLines.rbegin(); }
+  ReverseLineIterator LinesREnd() { return mLines.rend(); }
+  ConstReverseLineIterator LinesRBegin() const { return mLines.rbegin(); }
+  ConstReverseLineIterator LinesREnd() const { return mLines.rend(); }
+  LineIterator LinesBeginFrom(nsLineBox* aList) { return mLines.begin(aList); }
+  ReverseLineIterator LinesRBeginFrom(nsLineBox* aList) { return mLines.rbegin(aList); }
 
   friend nsBlockFrame* NS_NewBlockFrame(nsIPresShell* aPresShell,
                                         nsStyleContext* aContext);
 
   // nsQueryFrame
   NS_DECL_QUERYFRAME
 
   // nsIFrame
@@ -793,17 +793,17 @@ protected:
    * @return the pulled frame or nullptr
    */
   nsIFrame* PullFrameFrom(nsLineBox* aLine,
                           nsBlockFrame* aFromContainer,
                           nsLineList::iterator aFromLine);
 
   /**
    * Push the line after aLineBefore to the overflow line list.
-   * @param aLineBefore a line in 'mLines' (or BeginLine() when
+   * @param aLineBefore a line in 'mLines' (or LinesBegin() when
    *        pushing the first line)
    */
   void PushLines(BlockReflowInput& aState,
                  nsLineList::iterator aLineBefore);
 
   void PropagateFloatDamage(BlockReflowInput& aState,
                             nsLineBox* aLine,
                             nscoord aDeltaBCoord);
--- a/layout/generic/nsBlockReflowContext.cpp
+++ b/layout/generic/nsBlockReflowContext.cpp
@@ -109,18 +109,18 @@ nsBlockReflowContext::ComputeCollapsedBS
         nsLineList* lines = frames ? &frames->mLines : nullptr;
         if (!lines) {
           anyLines = false;
         } else {
           line = lines->begin();
           line_end = lines->end();
         }
       } else {
-        line = block->BeginLine();
-        line_end = block->EndLine();
+        line = block->LinesBegin();
+        line_end = block->LinesEnd();
       }
       for (; anyLines && line != line_end; ++line) {
         if (!aClearanceFrame && line->HasClearance()) {
           // If we don't have a clearance frame, then we're computing
           // the collapsed margin in the first pass, assuming that all
           // lines have no clearance. So clear their clearance flags.
           line->ClearHasClearance();
           line->MarkDirty();
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3978,17 +3978,17 @@ static FrameTarget DrillDownToSelectionF
 static FrameTarget GetSelectionClosestFrameForLine(
                       nsBlockFrame* aParent,
                       nsBlockFrame::LineIterator aLine,
                       nsPoint aPoint,
                       uint32_t aFlags)
 {
   nsIFrame *frame = aLine->mFirstChild;
   // Account for end of lines (any iterator from the block is valid)
-  if (aLine == aParent->EndLine())
+  if (aLine == aParent->LinesEnd())
     return DrillDownToSelectionFrame(aParent, true, aFlags);
   nsIFrame *closestFromIStart = nullptr, *closestFromIEnd = nullptr;
   nscoord closestIStart = aLine->IStart(), closestIEnd = aLine->IEnd();
   WritingMode wm = aLine->mWritingMode;
   LogicalPoint pt(wm, aPoint, aLine->mContainerSize);
   bool canSkipBr = false;
   for (int32_t n = aLine->GetChildCount(); n;
        --n, frame = frame->GetNextSibling()) {
@@ -4039,18 +4039,18 @@ static FrameTarget GetSelectionClosestFr
                                                     nsPoint aPoint,
                                                     uint32_t aFlags)
 {
   nsBlockFrame* bf = nsLayoutUtils::GetAsBlock(aFrame); // used only for QI
   if (!bf)
     return FrameTarget::Null();
 
   // This code searches for the correct line
-  nsBlockFrame::LineIterator firstLine = bf->BeginLine();
-  nsBlockFrame::LineIterator end = bf->EndLine();
+  nsBlockFrame::LineIterator firstLine = bf->LinesBegin();
+  nsBlockFrame::LineIterator end = bf->LinesEnd();
   if (firstLine == end) {
     nsIContent *blockContent = aFrame->GetContent();
     if (blockContent) {
       // Return with empty flag true.
       return FrameTarget(aFrame, false, false, true);
     }
     return FrameTarget::Null();
   }
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -5088,18 +5088,18 @@ PaintSelectionBackground(DrawTarget& aDr
 static nscoord
 LazyGetLineBaselineOffset(nsIFrame* aChildFrame, nsBlockFrame* aBlockFrame)
 {
   bool offsetFound;
   nscoord offset = aChildFrame->Properties().Get(
     nsIFrame::LineBaselineOffset(), &offsetFound);
 
   if (!offsetFound) {
-    for (nsBlockFrame::LineIterator line = aBlockFrame->BeginLine(),
-                                    line_end = aBlockFrame->EndLine();
+    for (nsBlockFrame::LineIterator line = aBlockFrame->LinesBegin(),
+                                    line_end = aBlockFrame->LinesEnd();
          line != line_end; line++) {
       if (line->IsInline()) {
         int32_t n = line->GetChildCount();
         nscoord lineBaseline = line->BStart() + line->GetLogicalAscent();
         for (nsIFrame* lineFrame = line->mFirstChild;
              n > 0; lineFrame = lineFrame->GetNextSibling(), --n) {
           offset = lineBaseline - lineFrame->GetNormalPosition().y;
           lineFrame->Properties().Set(nsIFrame::LineBaselineOffset(), offset);
deleted file mode 100644
--- a/layout/style/ServoBindingHelpers.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- 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/. */
-
-#ifndef mozilla_ServoBindingHelpers_h
-#define mozilla_ServoBindingHelpers_h
-
-#include "mozilla/RefPtr.h"
-#include "mozilla/ServoBindings.h"
-#include "mozilla/UniquePtr.h"
-
-namespace mozilla {
-
-#define DEFINE_REFPTR_TRAITS(name_, type_)  \
-  template<>                                \
-  struct RefPtrTraits<type_>                \
-  {                                         \
-    static void AddRef(type_* aPtr)         \
-    {                                       \
-      Servo_##name_##_AddRef(aPtr);         \
-    }                                       \
-    static void Release(type_* aPtr)        \
-    {                                       \
-      Servo_##name_##_Release(aPtr);        \
-    }                                       \
-  }
-
-DEFINE_REFPTR_TRAITS(StyleSheet, RawServoStyleSheet);
-DEFINE_REFPTR_TRAITS(ComputedValues, ServoComputedValues);
-DEFINE_REFPTR_TRAITS(DeclarationBlock, RawServoDeclarationBlock);
-
-#undef DEFINE_REFPTR_TRAITS
-
-template<>
-class DefaultDelete<RawServoStyleSet>
-{
-public:
-  void operator()(RawServoStyleSet* aPtr) const
-  {
-    Servo_StyleSet_Drop(aPtr);
-  }
-};
-
-} // namespace mozilla
-
-#endif // mozilla_ServoBindingHelpers_h
new file mode 100644
--- /dev/null
+++ b/layout/style/ServoBindingTypes.h
@@ -0,0 +1,141 @@
+/* -*- 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/. */
+
+#ifndef mozilla_ServoBindingTypes_h
+#define mozilla_ServoBindingTypes_h
+
+#include "mozilla/RefPtr.h"
+#include "mozilla/UniquePtr.h"
+
+struct ServoComputedValues;
+struct RawServoStyleSheet;
+struct RawServoStyleSet;
+struct RawServoDeclarationBlock;
+
+namespace mozilla {
+namespace dom {
+class Element;
+class StyleChildrenIterator;
+} // namespace dom
+} // namespace mozilla
+
+class nsIDocument;
+class nsINode;
+
+using mozilla::dom::StyleChildrenIterator;
+
+typedef nsINode RawGeckoNode;
+typedef mozilla::dom::Element RawGeckoElement;
+typedef nsIDocument RawGeckoDocument;
+
+// We have these helper types so that we can directly generate
+// things like &T or Borrowed<T> on the Rust side in the function, providing
+// additional safety benefits.
+//
+// FFI has a problem with templated types, so we just use raw pointers here.
+//
+// The "Borrowed" types generate &T or Borrowed<T> in the nullable case.
+//
+// The "Owned" types generate Owned<T> or OwnedOrNull<T>. Some of these
+// are Servo-managed and can be converted to Box<ServoType> on the
+// Servo side.
+//
+// The "Arc" types are Servo-managed Arc<ServoType>s, which are passed
+// over FFI as Strong<T> (which is nullable).
+// Note that T != ServoType, rather T is ArcInner<ServoType>
+#define DECL_BORROWED_REF_TYPE_FOR(type_) typedef type_ const* type_##Borrowed;
+#define DECL_NULLABLE_BORROWED_REF_TYPE_FOR(type_) typedef type_ const* type_##BorrowedOrNull;
+#define DECL_BORROWED_MUT_REF_TYPE_FOR(type_) typedef type_* type_##BorrowedMut;
+#define DECL_NULLABLE_BORROWED_MUT_REF_TYPE_FOR(type_) typedef type_* type_##BorrowedMutOrNull;
+
+#define DECL_ARC_REF_TYPE_FOR(type_)         \
+  DECL_NULLABLE_BORROWED_REF_TYPE_FOR(type_) \
+  DECL_BORROWED_REF_TYPE_FOR(type_)          \
+  struct MOZ_MUST_USE_TYPE type_##Strong     \
+  {                                          \
+    type_* mPtr;                             \
+    already_AddRefed<type_> Consume();       \
+  };
+
+#define DECL_OWNED_REF_TYPE_FOR(type_)    \
+  typedef type_* type_##Owned;            \
+  DECL_BORROWED_REF_TYPE_FOR(type_)       \
+  DECL_BORROWED_MUT_REF_TYPE_FOR(type_)
+
+#define DECL_NULLABLE_OWNED_REF_TYPE_FOR(type_)    \
+  typedef type_* type_##OwnedOrNull;               \
+  DECL_NULLABLE_BORROWED_REF_TYPE_FOR(type_)       \
+  DECL_NULLABLE_BORROWED_MUT_REF_TYPE_FOR(type_)
+
+DECL_ARC_REF_TYPE_FOR(ServoComputedValues)
+DECL_ARC_REF_TYPE_FOR(RawServoStyleSheet)
+DECL_ARC_REF_TYPE_FOR(RawServoDeclarationBlock)
+// This is a reference to a reference of RawServoDeclarationBlock, which
+// corresponds to Option<&Arc<RawServoDeclarationBlock>> in Servo side.
+DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawServoDeclarationBlockStrong)
+
+DECL_OWNED_REF_TYPE_FOR(RawServoStyleSet)
+DECL_NULLABLE_OWNED_REF_TYPE_FOR(StyleChildrenIterator)
+DECL_OWNED_REF_TYPE_FOR(StyleChildrenIterator)
+
+// We don't use BorrowedMut because the nodes may alias
+// Servo itself doesn't directly read or mutate these;
+// it only asks Gecko to do so. In case we wish to in
+// the future, we should ensure that things being mutated
+// are protected from noalias violations by a cell type
+DECL_BORROWED_REF_TYPE_FOR(RawGeckoNode)
+DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawGeckoNode)
+DECL_BORROWED_REF_TYPE_FOR(RawGeckoElement)
+DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawGeckoElement)
+DECL_BORROWED_REF_TYPE_FOR(RawGeckoDocument)
+DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawGeckoDocument)
+DECL_BORROWED_MUT_REF_TYPE_FOR(StyleChildrenIterator)
+
+#undef DECL_ARC_REF_TYPE_FOR
+#undef DECL_OWNED_REF_TYPE_FOR
+#undef DECL_NULLABLE_OWNED_REF_TYPE_FOR
+#undef DECL_BORROWED_REF_TYPE_FOR
+#undef DECL_NULLABLE_BORROWED_REF_TYPE_FOR
+#undef DECL_BORROWED_MUT_REF_TYPE_FOR
+#undef DECL_NULLABLE_BORROWED_MUT_REF_TYPE_FOR
+
+#define DEFINE_REFPTR_TRAITS(name_, type_)           \
+  extern "C" {                                       \
+  void Servo_##name_##_AddRef(type_##Borrowed ptr);  \
+  void Servo_##name_##_Release(type_##Borrowed ptr); \
+  }                                                  \
+  namespace mozilla {                                \
+  template<> struct RefPtrTraits<type_> {            \
+    static void AddRef(type_* aPtr) {                \
+      Servo_##name_##_AddRef(aPtr);                  \
+    }                                                \
+    static void Release(type_* aPtr) {               \
+      Servo_##name_##_Release(aPtr);                 \
+    }                                                \
+  };                                                 \
+  }
+
+DEFINE_REFPTR_TRAITS(StyleSheet, RawServoStyleSheet)
+DEFINE_REFPTR_TRAITS(ComputedValues, ServoComputedValues)
+DEFINE_REFPTR_TRAITS(DeclarationBlock, RawServoDeclarationBlock)
+
+#undef DEFINE_REFPTR_TRAITS
+
+extern "C" void Servo_StyleSet_Drop(RawServoStyleSetOwned ptr);
+
+namespace mozilla {
+template<>
+class DefaultDelete<RawServoStyleSet>
+{
+public:
+  void operator()(RawServoStyleSet* aPtr) const
+  {
+    Servo_StyleSet_Drop(aPtr);
+  }
+};
+}
+
+#endif // mozilla_ServoBindingTypes_h
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -2,28 +2,24 @@
 /* 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 mozilla_ServoBindings_h
 #define mozilla_ServoBindings_h
 
+#include <stdint.h>
+
 #include "mozilla/ServoTypes.h"
+#include "mozilla/ServoBindingTypes.h"
 #include "mozilla/ServoElementSnapshot.h"
 #include "mozilla/css/SheetParsingMode.h"
-#include "mozilla/dom/Element.h"
-#include "nsIDocument.h"
-#include "nsINode.h"
 #include "nsChangeHint.h"
-#include "nsColor.h"
-#include "nsProxyRelease.h"
-#include "nsStyleCoord.h"
 #include "nsStyleStruct.h"
-#include "stdint.h"
 
 /*
  * API for Servo to access Gecko data structures. This file must compile as valid
  * C code in order for the binding generator to parse it.
  *
  * Functions beginning with Gecko_ are implemented in Gecko and invoked from Servo.
  * Functions beginning with Servo_ are implemented in Servo and invoked from Gecko.
  */
@@ -33,109 +29,23 @@ class nsIPrincipal;
 class nsIURI;
 struct nsFont;
 namespace mozilla {
   class FontFamilyList;
   enum FontFamilyType : uint32_t;
 }
 using mozilla::FontFamilyList;
 using mozilla::FontFamilyType;
-using mozilla::dom::Element;
 using mozilla::ServoElementSnapshot;
-struct ServoComputedValues;
-struct RawServoStyleSheet;
-struct RawServoStyleSet;
-class nsHTMLCSSStyleSheet;
 struct nsStyleList;
 struct nsStyleImage;
 struct nsStyleGradientStop;
 class nsStyleGradient;
 class nsStyleCoord;
 struct nsStyleDisplay;
-struct RawServoDeclarationBlock;
-
-namespace mozilla {
-namespace dom {
-class StyleChildrenIterator;
-}
-}
-
-using mozilla::dom::StyleChildrenIterator;
-
-// We have these helper types so that we can directly generate
-// things like &T or Borrowed<T> on the Rust side in the function, providing
-// additional safety benefits.
-//
-// FFI has a problem with templated types, so we just use raw pointers here.
-//
-// The "Borrowed" types generate &T or Borrowed<T> in the nullable case.
-//
-// The "Owned" types generate Owned<T> or OwnedOrNull<T>. Some of these
-// are Servo-managed and can be converted to Box<ServoType> on the
-// Servo side.
-//
-// The "Arc" types are Servo-managed Arc<ServoType>s, which are passed
-// over FFI as Strong<T> (which is nullable).
-// Note that T != ServoType, rather T is ArcInner<ServoType>
-#define DECL_BORROWED_REF_TYPE_FOR(type_) typedef type_ const* type_##Borrowed;
-#define DECL_NULLABLE_BORROWED_REF_TYPE_FOR(type_) typedef type_ const* type_##BorrowedOrNull;
-#define DECL_BORROWED_MUT_REF_TYPE_FOR(type_) typedef type_* type_##BorrowedMut;
-#define DECL_NULLABLE_BORROWED_MUT_REF_TYPE_FOR(type_) typedef type_* type_##BorrowedMutOrNull;
-
-#define DECL_ARC_REF_TYPE_FOR(type_)         \
-  DECL_NULLABLE_BORROWED_REF_TYPE_FOR(type_) \
-  DECL_BORROWED_REF_TYPE_FOR(type_)          \
-  struct MOZ_MUST_USE_TYPE type_##Strong     \
-  {                                          \
-    type_* mPtr;                             \
-    already_AddRefed<type_> Consume();       \
-  };
-
-#define DECL_OWNED_REF_TYPE_FOR(type_)    \
-  typedef type_* type_##Owned;            \
-  DECL_BORROWED_REF_TYPE_FOR(type_)       \
-  DECL_BORROWED_MUT_REF_TYPE_FOR(type_)
-
-#define DECL_NULLABLE_OWNED_REF_TYPE_FOR(type_)    \
-  typedef type_* type_##OwnedOrNull;               \
-  DECL_NULLABLE_BORROWED_REF_TYPE_FOR(type_)       \
-  DECL_NULLABLE_BORROWED_MUT_REF_TYPE_FOR(type_)
-
-DECL_ARC_REF_TYPE_FOR(ServoComputedValues)
-DECL_ARC_REF_TYPE_FOR(RawServoStyleSheet)
-DECL_ARC_REF_TYPE_FOR(RawServoDeclarationBlock)
-// This is a reference to a reference of RawServoDeclarationBlock, which
-// corresponds to Option<&Arc<RawServoDeclarationBlock>> in Servo side.
-DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawServoDeclarationBlockStrong)
-
-DECL_OWNED_REF_TYPE_FOR(RawServoStyleSet)
-DECL_NULLABLE_OWNED_REF_TYPE_FOR(StyleChildrenIterator)
-DECL_OWNED_REF_TYPE_FOR(StyleChildrenIterator)
-
-// We don't use BorrowedMut because the nodes may alias
-// Servo itself doesn't directly read or mutate these;
-// it only asks Gecko to do so. In case we wish to in
-// the future, we should ensure that things being mutated
-// are protected from noalias violations by a cell type
-DECL_BORROWED_REF_TYPE_FOR(RawGeckoNode)
-DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawGeckoNode)
-DECL_BORROWED_REF_TYPE_FOR(RawGeckoElement)
-DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawGeckoElement)
-DECL_BORROWED_REF_TYPE_FOR(RawGeckoDocument)
-DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawGeckoDocument)
-DECL_BORROWED_MUT_REF_TYPE_FOR(StyleChildrenIterator)
-
-#undef DECL_ARC_REF_TYPE_FOR
-#undef DECL_OWNED_REF_TYPE_FOR
-#undef DECL_NULLABLE_OWNED_REF_TYPE_FOR
-#undef DECL_BORROWED_REF_TYPE_FOR
-#undef DECL_NULLABLE_BORROWED_REF_TYPE_FOR
-#undef DECL_BORROWED_MUT_REF_TYPE_FOR
-#undef DECL_NULLABLE_BORROWED_MUT_REF_TYPE_FOR
-
 
 #define NS_DECL_THREADSAFE_FFI_REFCOUNTING(class_, name_)                     \
   void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr);                    \
   void Gecko_Release##name_##ArbitraryThread(class_* aPtr);
 #define NS_IMPL_THREADSAFE_FFI_REFCOUNTING(class_, name_)                     \
   static_assert(class_::HasThreadSafeRefCnt::value,                           \
                 "NS_DECL_THREADSAFE_FFI_REFCOUNTING can only be used with "   \
                 "classes that have thread-safe refcounting");                 \
@@ -343,17 +253,16 @@ NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsSty
 nsCSSShadowArray* Gecko_NewCSSShadowArray(uint32_t len);
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsCSSShadowArray, CSSShadowArray);
 
 nsStyleQuoteValues* Gecko_NewStyleQuoteValues(uint32_t len);
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsStyleQuoteValues, QuoteValues);
 
 // Style-struct management.
 #define STYLE_STRUCT(name, checkdata_cb)                                       \
-  struct nsStyle##name;                                                        \
   void Gecko_Construct_nsStyle##name(nsStyle##name* ptr);                      \
   void Gecko_CopyConstruct_nsStyle##name(nsStyle##name* ptr,                   \
                                          const nsStyle##name* other);          \
   void Gecko_Destroy_nsStyle##name(nsStyle##name* ptr);
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 
 #define SERVO_BINDING_FUNC(name_, return_, ...) return_ name_(__VA_ARGS__);
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -4,18 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_ServoStyleSet_h
 #define mozilla_ServoStyleSet_h
 
 #include "mozilla/EnumeratedArray.h"
 #include "mozilla/EventStates.h"
-#include "mozilla/RefPtr.h"
-#include "mozilla/ServoBindingHelpers.h"
+#include "mozilla/ServoBindingTypes.h"
 #include "mozilla/ServoElementSnapshot.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/SheetType.h"
 #include "mozilla/UniquePtr.h"
 #include "nsCSSPseudoElements.h"
 #include "nsChangeHint.h"
 #include "nsIAtom.h"
 #include "nsTArray.h"
--- a/layout/style/ServoStyleSheet.h
+++ b/layout/style/ServoStyleSheet.h
@@ -4,17 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_ServoStyleSheet_h
 #define mozilla_ServoStyleSheet_h
 
 #include "mozilla/dom/SRIMetadata.h"
 #include "mozilla/RefPtr.h"
-#include "mozilla/ServoBindingHelpers.h"
+#include "mozilla/ServoBindingTypes.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInfo.h"
 #include "nsStringFwd.h"
 
 namespace mozilla {
 
 /**
  * CSS style sheet object that is a wrapper for a Servo Stylesheet.
--- a/layout/style/StyleContextSource.h
+++ b/layout/style/StyleContextSource.h
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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_StyleContextSource_h
 #define mozilla_StyleContextSource_h
 
-#include "mozilla/ServoBindingHelpers.h"
+#include "mozilla/ServoBindingTypes.h"
 #include "nsRuleNode.h"
 
 namespace mozilla {
 
 // Tagged union between Gecko Rule Nodes and Servo Computed Values.
 //
 // The rule node is the node in the lexicographic tree of rule nodes
 // (the "rule tree") that indicates which style rules are used to
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -88,19 +88,19 @@ EXPORTS.mozilla += [
     'CSSVariableValues.h',
     'DeclarationBlock.h',
     'DeclarationBlockInlines.h',
     'HandleRefPtr.h',
     'IncrementalClearCOMRuleArray.h',
     'LayerAnimationInfo.h',
     'RuleNodeCacheConditions.h',
     'RuleProcessorCache.h',
-    'ServoBindingHelpers.h',
     'ServoBindingList.h',
     'ServoBindings.h',
+    'ServoBindingTypes.h',
     'ServoDeclarationBlock.h',
     'ServoElementSnapshot.h',
     'ServoStyleSet.h',
     'ServoStyleSheet.h',
     'ServoTypes.h',
     'ServoUtils.h',
     'SheetType.h',
     'StyleAnimationValue.h',
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -31,16 +31,20 @@
 #include "mozilla/ArenaObjectID.h"
 #include "mozilla/StyleSetHandle.h"
 #include "mozilla/StyleSetHandleInlines.h"
 
 #include "mozilla/ReflowInput.h"
 #include "nsLayoutUtils.h"
 #include "nsCoord.h"
 
+// Ensure the binding function declarations in nsStyleContext.h matches
+// those in ServoBindings.h.
+#include "mozilla/ServoBindings.h"
+
 using namespace mozilla;
 
 //----------------------------------------------------------------------
 
 #ifdef DEBUG
 
 // Check that the style struct IDs are in the same order as they are
 // in nsStyleStructList.h, since when we set up the IDs, we include
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -16,16 +16,25 @@
 
 class nsIAtom;
 class nsPresContext;
 
 namespace mozilla {
 enum class CSSPseudoElementType : uint8_t;
 } // namespace mozilla
 
+extern "C" {
+#define STYLE_STRUCT(name_, checkdata_cb_)     \
+  struct nsStyle##name_;                       \
+  const nsStyle##name_* Servo_GetStyle##name_( \
+    ServoComputedValuesBorrowedOrNull computed_values);
+#include "nsStyleStructList.h"
+#undef STYLE_STRUCT
+}
+
 /**
  * An nsStyleContext represents the computed style data for an element.
  * The computed style data are stored in a set of structs (see
  * nsStyleStruct.h) that are cached either on the style context or in
  * the rule tree (see nsRuleNode.h for a description of this caching and
  * how the cached structs are shared).
  *
  * Since the data in |nsIStyleRule|s and |nsRuleNode|s are immutable
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -47,21 +47,16 @@ class nsTextFrame;
 class imgIContainer;
 struct nsStyleVisibility;
 namespace mozilla {
 namespace dom {
 class ImageTracker;
 } // namespace dom
 } // namespace mozilla
 
-typedef nsINode RawGeckoNode;
-typedef mozilla::dom::Element RawGeckoElement;
-typedef nsIDocument RawGeckoDocument;
-struct ServoNodeData;
-
 // Includes nsStyleStructID.
 #include "nsStyleStructFwd.h"
 
 // Bits for each struct.
 // NS_STYLE_INHERIT_BIT defined in nsStyleStructFwd.h
 #define NS_STYLE_INHERIT_MASK              0x000ffffff
 
 // Bits for inherited structs.
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -4735,20 +4735,20 @@ ShiftAnchoredChunk(nsTArray<mozilla::Cha
 }
 
 void
 SVGTextFrame::AdjustChunksForLineBreaks()
 {
   nsBlockFrame* block = nsLayoutUtils::GetAsBlock(PrincipalChildList().FirstChild());
   NS_ASSERTION(block, "expected block frame");
 
-  nsBlockFrame::LineIterator line = block->BeginLine();
+  nsBlockFrame::LineIterator line = block->LinesBegin();
 
   CharIterator it(this, CharIterator::eOriginal);
-  while (!it.AtEnd() && line != block->EndLine()) {
+  while (!it.AtEnd() && line != block->LinesEnd()) {
     if (it.TextFrame() == line->mFirstChild) {
       mPositions[it.TextElementCharIndex()].mStartOfChunk = true;
       line++;
     }
     it.AdvancePastCurrentFrame();
   }
 }
 
--- a/testing/marionette/harness/marionette/tests/unit/unit-tests.ini
+++ b/testing/marionette/harness/marionette/tests/unit/unit-tests.ini
@@ -117,17 +117,17 @@ skip-if = buildapp == 'b2g' || appname =
 [test_set_window_size.py]
 skip-if = buildapp == 'b2g' || os == "linux" || appname == 'fennec' # Bug 1085717
 [test_with_using_context.py]
 
 [test_modal_dialogs.py]
 skip-if = buildapp == 'b2g' || appname == 'fennec'
 [test_key_actions.py]
 [test_mouse_action.py]
-skip-if = buildapp == 'b2g' || (os == "win" && !debug && os_version == "6.1")  || appname == 'fennec'# Bug 1273758
+skip-if = appname == 'fennec'
 [test_teardown_context_preserved.py]
 skip-if = buildapp == 'b2g'
 [test_file_upload.py]
 skip-if = buildapp == 'b2g' || appname == 'fennec' || os == "win" # http://bugs.python.org/issue14574
 
 [test_execute_sandboxes.py]
 [test_using_permissions.py]
 [test_using_prefs.py]
--- a/testing/web-platform/meta/content-security-policy/child-src/child-src-cross-origin-load.sub.html.ini
+++ b/testing/web-platform/meta/content-security-policy/child-src/child-src-cross-origin-load.sub.html.ini
@@ -1,7 +1,5 @@
 [child-src-cross-origin-load.sub.html]
   type: testharness
-  disabled:
-    if e10s: https://bugzilla.mozilla.org/show_bug.cgi?id=1209756
   [Expecting logs: ["PASS IFrame #1 generated a load event.","PASS IFrame #2 generated a load event.","PASS IFrame #3 generated a load event."\]]
     expected: FAIL
 
--- a/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/utf-16be.html.ini
+++ b/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/utf-16be.html.ini
@@ -1,13 +1,12 @@
 [utf-16be.html]
   type: testharness
   expected: TIMEOUT
-  disabled:
-    if os == "mac": https://bugzilla.mozilla.org/show_bug.cgi?id=1034063
+  disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1034063
   [hyperlink auditing <a ping>]
     expected: TIMEOUT
 
   [hyperlink auditing <area ping>]
     expected: TIMEOUT
 
   [loading image <video poster>]
     disabled: true
--- a/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/utf-16le.html.ini
+++ b/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/utf-16le.html.ini
@@ -1,12 +1,11 @@
 [utf-16le.html]
   type: testharness
-  disabled:
-    if os == "mac": https://bugzilla.mozilla.org/show_bug.cgi?id=1034063
+  disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1034063
   expected: TIMEOUT
   [hyperlink auditing <a ping>]
     expected: TIMEOUT
 
   [hyperlink auditing <area ping>]
     expected: TIMEOUT
 
   [loading image <video poster>]
--- a/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/utf-8.html.ini
+++ b/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/utf-8.html.ini
@@ -1,13 +1,12 @@
 [utf-8.html]
   type: testharness
   expected: TIMEOUT
-  disabled:
-    if os == "mac": https://bugzilla.mozilla.org/show_bug.cgi?id=1034063
+  disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1034063
   [hyperlink auditing <a ping>]
     expected: TIMEOUT
 
   [hyperlink auditing <area ping>]
     expected: TIMEOUT
 
   [loading image <video poster>]
     disabled: true
--- a/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/windows-1251.html.ini
+++ b/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/windows-1251.html.ini
@@ -1,13 +1,12 @@
 [windows-1251.html]
   type: testharness
   expected: TIMEOUT
-  disabled:
-    if os == "mac": https://bugzilla.mozilla.org/show_bug.cgi?id=1034063
+  disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1034063
   [getComputedStyle <body background>]
     expected: FAIL
 
   [getComputedStyle <table background>]
     expected: FAIL
 
   [getComputedStyle <thead background>]
     expected: FAIL
--- a/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/windows-1252.html.ini
+++ b/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/windows-1252.html.ini
@@ -1,13 +1,12 @@
 [windows-1252.html]
   type: testharness
   expected: TIMEOUT
-  disabled:
-    if os == "mac": https://bugzilla.mozilla.org/show_bug.cgi?id=1034063
+  disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1034063
   [hyperlink auditing <a ping>]
     expected: TIMEOUT
 
   [hyperlink auditing <area ping>]
     expected: TIMEOUT
 
   [EventSource constructor]
     expected: FAIL
--- a/tools/power/rapl.cpp
+++ b/tools/power/rapl.cpp
@@ -513,18 +513,18 @@ public:
 
     struct perf_event_attr attr;
     memset(&attr, 0, sizeof(attr));
     attr.type = aType;
     attr.size = uint32_t(sizeof(attr));
     attr.config = config;
 
     // Measure all processes/threads. The specified CPU doesn't matter.
-    mFd = perf_event_open(&attr, /* pid = */ -1, /* cpu = */ 0,
-                          /* group_fd = */ -1, /* flags = */ 0);
+    mFd = perf_event_open(&attr, /* aPid = */ -1, /* aCpu = */ 0,
+                          /* aGroupFd = */ -1, /* aFlags = */ 0);
     if (mFd < 0) {
       Abort("perf_event_open() failed\n"
             "- Did you run as root (e.g. with |sudo|) or set\n"
             "  /proc/sys/kernel/perf_event_paranoid to 0, as required?");
     }
 
     mPrevTicks = 0;
   }
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -798,16 +798,18 @@ NS_InitMinimalXPCOM()
 
   // Global cycle collector initialization.
   if (!nsCycleCollector_init()) {
     return NS_ERROR_UNEXPECTED;
   }
 
   AbstractThread::InitStatics();
   SharedThreadPool::InitStatics();
+  mozilla::HangMonitor::Startup();
+  mozilla::BackgroundHangMonitor::Startup();
 
   return NS_OK;
 }
 
 //
 // NS_ShutdownXPCOM()
 //
 // The shutdown sequence for xpcom would be