Merge mozilla-inbound to mozilla-central. a=merge
authorDaniel Varga <dvarga@mozilla.com>
Thu, 06 Dec 2018 23:41:15 +0200
changeset 506014 a52c254930e8
parent 505996 25282bb38b69 (current diff)
parent 505993 90189bd84466 (diff)
child 506015 ef5ba45ab54f
child 506032 5c25aa754f1e
push id10304
push usercsabou@mozilla.com
push dateMon, 10 Dec 2018 13:40:42 +0000
treeherdermozilla-beta@89eaae012b30 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone65.0a1
first release with
nightly linux32
a52c254930e8 / 65.0a1 / 20181206214149 / files
nightly linux64
a52c254930e8 / 65.0a1 / 20181206214149 / files
nightly mac
a52c254930e8 / 65.0a1 / 20181206214149 / files
nightly win32
a52c254930e8 / 65.0a1 / 20181206214149 / files
nightly win64
a52c254930e8 / 65.0a1 / 20181206214149 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-inbound to mozilla-central. a=merge
--- a/browser/locales/en-US/browser/preferences/preferences.ftl
+++ b/browser/locales/en-US/browser/preferences/preferences.ftl
@@ -419,25 +419,25 @@ browsing-use-cursor-navigation =
 browsing-search-on-start-typing =
     .label = Search for text when you start typing
     .accesskey = x
 
 browsing-cfr-recommendations =
     .label = Recommend extensions as you browse
     .accesskey = R
 
-browsing-cfr-recommendations-learn-more = Learn More
+browsing-cfr-recommendations-learn-more = Learn more
 
 ## General Section - Proxy
 
 network-settings-title = Network Settings
 
 network-proxy-connection-description = Configure how { -brand-short-name } connects to the internet.
 
-network-proxy-connection-learn-more = Learn More
+network-proxy-connection-learn-more = Learn more
 
 network-proxy-connection-settings =
     .label = Settingsā€¦
     .accesskey = e
 
 ## Home Section
 
 home-new-windows-tabs-header = New Windows and Tabs
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -3129,16 +3129,34 @@ nsDOMTokenList* Element::GetTokenList(
   if (!list) {
     list = new nsDOMTokenList(this, aAtom, aSupportedTokens);
     NS_ADDREF(list);
     SetProperty(aAtom, list, nsDOMTokenListPropertyDestructor);
   }
   return list;
 }
 
+nsresult Element::CopyInnerTo(Element* aDst) {
+  nsresult rv = aDst->mAttrs.EnsureCapacityToClone(mAttrs);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  uint32_t i, count = mAttrs.AttrCount();
+  for (i = 0; i < count; ++i) {
+    const nsAttrName* name = mAttrs.AttrNameAt(i);
+    const nsAttrValue* value = mAttrs.AttrAt(i);
+    nsAutoString valStr;
+    value->ToString(valStr);
+    rv = aDst->SetAttr(name->NamespaceID(), name->LocalName(),
+                       name->GetPrefix(), valStr, false);
+    NS_ENSURE_SUCCESS(rv, rv);
+  }
+
+  return NS_OK;
+}
+
 Element* Element::Closest(const nsAString& aSelector, ErrorResult& aResult) {
   const RawServoSelectorList* list = ParseSelectorList(aSelector, aResult);
   if (!list) {
     return nullptr;
   }
 
   return const_cast<Element*>(Servo_SelectorList_Closest(this, list));
 }
@@ -3914,16 +3932,17 @@ void Element::SetCustomElementDefinition
 }
 
 MOZ_DEFINE_MALLOC_SIZE_OF(ServoElementMallocSizeOf)
 MOZ_DEFINE_MALLOC_ENCLOSING_SIZE_OF(ServoElementMallocEnclosingSizeOf)
 
 void Element::AddSizeOfExcludingThis(nsWindowSizes& aSizes,
                                      size_t* aNodeSize) const {
   FragmentOrElement::AddSizeOfExcludingThis(aSizes, aNodeSize);
+  *aNodeSize += mAttrs.SizeOfExcludingThis(aSizes.mState.mMallocSizeOf);
 
   if (HasServoData()) {
     // Measure the ElementData object itself.
     aSizes.mLayoutElementDataObjects +=
         aSizes.mState.mMallocSizeOf(mServoData.Get());
 
     // Measure mServoData, excluding the ComputedValues. This measurement
     // counts towards the element's size. We use ServoElementMallocSizeOf and
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -875,16 +875,23 @@ class Element : public FragmentOrElement
    * @note    The pointer returned by this function is only valid until the
    *          next call of either GetAttrNameAt or SetAttr on the element.
    */
   const nsAttrName* GetAttrNameAt(uint32_t aIndex) const {
     return mAttrs.GetSafeAttrNameAt(aIndex);
   }
 
   /**
+   * Same as above, but does not do out-of-bounds checks!
+   */
+  const nsAttrName* GetUnsafeAttrNameAt(uint32_t aIndex) const {
+    return mAttrs.AttrNameAt(aIndex);
+  }
+
+  /**
    * Gets the attribute info (name and value) for this element at a given index.
    */
   BorrowedAttrInfo GetAttrInfoAt(uint32_t aIndex) const {
     if (aIndex >= mAttrs.AttrCount()) {
       return BorrowedAttrInfo(nullptr, nullptr);
     }
 
     return mAttrs.AttrInfoAt(aIndex);
@@ -1846,16 +1853,22 @@ class Element : public FragmentOrElement
    * (e.g. _blank).
    */
   virtual void GetLinkTarget(nsAString& aTarget);
 
   nsDOMTokenList* GetTokenList(
       nsAtom* aAtom,
       const DOMTokenListSupportedTokenArray aSupportedTokens = nullptr);
 
+  /**
+   * Copy attributes and state to another element
+   * @param aDest the object to copy to
+   */
+  nsresult CopyInnerTo(Element* aDest);
+
  private:
   /**
    * Slow path for GetClasses, this should only be called for SVG elements.
    */
   const nsAttrValue* GetSVGAnimatedClass() const;
 
   /**
    * Get this element's client area rect in app units.
@@ -1878,16 +1891,20 @@ class Element : public FragmentOrElement
 
   // Data members
   EventStates mState;
   // Per-node data managed by Servo.
   //
   // There should not be data on nodes that are in the flattened tree, or
   // descendants of display: none elements.
   mozilla::RustCell<ServoNodeData*> mServoData;
+
+protected:
+  // Array containing all attributes for this element
+  AttrArray mAttrs;
 };
 
 class RemoveFromBindingManagerRunnable : public mozilla::Runnable {
  public:
   RemoveFromBindingManagerRunnable(nsBindingManager* aManager,
                                    nsIContent* aContent, nsIDocument* aDoc);
 
   NS_IMETHOD Run() override;
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -1903,54 +1903,37 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
             effectSet->Traverse(cb);
           }
         }
       }
     }
   }
 
   // Traverse attribute names.
-  {
+  if (tmp->IsElement()) {
+    Element* element = tmp->AsElement();
     uint32_t i;
-    uint32_t attrs = tmp->mAttrs.AttrCount();
+    uint32_t attrs = element->GetAttrCount();
     for (i = 0; i < attrs; i++) {
-      const nsAttrName* name = tmp->mAttrs.AttrNameAt(i);
+      const nsAttrName* name = element->GetUnsafeAttrNameAt(i);
       if (!name->IsAtom()) {
         NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mAttrs[i]->NodeInfo()");
         cb.NoteNativeChild(name->NodeInfo(),
                            NS_CYCLE_COLLECTION_PARTICIPANT(NodeInfo));
       }
     }
   }
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_INTERFACE_MAP_BEGIN(FragmentOrElement)
   NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(FragmentOrElement)
 NS_INTERFACE_MAP_END_INHERITING(nsIContent)
 
 //----------------------------------------------------------------------
 
-nsresult FragmentOrElement::CopyInnerTo(FragmentOrElement* aDst) {
-  nsresult rv = aDst->mAttrs.EnsureCapacityToClone(mAttrs);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  uint32_t i, count = mAttrs.AttrCount();
-  for (i = 0; i < count; ++i) {
-    const nsAttrName* name = mAttrs.AttrNameAt(i);
-    const nsAttrValue* value = mAttrs.AttrAt(i);
-    nsAutoString valStr;
-    value->ToString(valStr);
-    rv = aDst->AsElement()->SetAttr(name->NamespaceID(), name->LocalName(),
-                                    name->GetPrefix(), valStr, false);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  return NS_OK;
-}
-
 const nsTextFragment* FragmentOrElement::GetText() { return nullptr; }
 
 uint32_t FragmentOrElement::TextLength() const {
   // We can remove this assertion if it turns out to be useful to be able
   // to depend on this returning 0
   MOZ_ASSERT_UNREACHABLE("called FragmentOrElement::TextLength");
 
   return 0;
@@ -2162,15 +2145,14 @@ void FragmentOrElement::FireNodeRemovedF
        child = child->GetNextSibling()) {
     nsContentUtils::MaybeFireNodeRemoved(child, this);
   }
 }
 
 void FragmentOrElement::AddSizeOfExcludingThis(nsWindowSizes& aSizes,
                                                size_t* aNodeSize) const {
   nsIContent::AddSizeOfExcludingThis(aSizes, aNodeSize);
-  *aNodeSize += mAttrs.SizeOfExcludingThis(aSizes.mState.mMallocSizeOf);
 
   nsDOMSlots* slots = GetExistingDOMSlots();
   if (slots) {
     *aNodeSize += slots->SizeOfIncludingThis(aSizes.mState.mMallocSizeOf);
   }
 }
--- a/dom/base/FragmentOrElement.h
+++ b/dom/base/FragmentOrElement.h
@@ -11,17 +11,16 @@
  */
 
 #ifndef FragmentOrElement_h___
 #define FragmentOrElement_h___
 
 #include "mozilla/Attributes.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/UniquePtr.h"
-#include "AttrArray.h"                     // member
 #include "nsCycleCollectionParticipant.h"  // NS_DECL_CYCLE_*
 #include "nsIContent.h"                    // base class
 #include "nsNodeUtils.h"  // class member nsNodeUtils::CloneNodeImpl
 #include "nsIHTMLCollection.h"
 #include "nsDataHashtable.h"
 #include "nsXBLBinding.h"
 
 class ContentUnbinder;
@@ -139,20 +138,20 @@ class FragmentOrElement : public nsICont
    * Is the HTML local name a void element?
    */
   static bool IsHTMLVoid(nsAtom* aLocalName);
 
  protected:
   virtual ~FragmentOrElement();
 
   /**
-   * Copy attributes and state to another element
-   * @param aDest the object to copy to
+   * Dummy CopyInnerTo so that we can use the same macros for
+   * Elements and DocumentFragments.
    */
-  nsresult CopyInnerTo(FragmentOrElement* aDest);
+  nsresult CopyInnerTo(FragmentOrElement* aDest) { return NS_OK; }
 
  public:
   /**
    * There are a set of DOM- and scripting-specific instance variables
    * that may only be instantiated when a content object is accessed
    * through the DOM. Rather than burn actual slots in the content
    * objects for each of these instance variables, we put them off
    * in a side structure that's only allocated when the content is
@@ -300,20 +299,16 @@ class FragmentOrElement : public nsICont
         GetExistingExtendedContentSlots());
   }
 
   nsExtendedDOMSlots* GetExistingExtendedDOMSlots() {
     return static_cast<nsExtendedDOMSlots*>(GetExistingExtendedContentSlots());
   }
 
   friend class ::ContentUnbinder;
-  /**
-   * Array containing all attributes for this element
-   */
-  AttrArray mAttrs;
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #define NS_ELEMENT_INTERFACE_TABLE_TO_MAP_SEGUE               \
   if (NS_SUCCEEDED(rv)) return rv;                            \
                                                               \
--- a/dom/security/test/general/browser.ini
+++ b/dom/security/test/general/browser.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
 [browser_test_toplevel_data_navigations.js]
-skip-if = (verify && debug && (os == 'mac'))
+skip-if = (verify && debug && (os == 'mac')) || (debug && (os == 'mac' || os == 'linux')) # Bug 1403815
 support-files =
   file_toplevel_data_navigations.sjs
   file_toplevel_data_meta_redirect.html
 [browser_test_data_download.js]
 support-files =
   file_data_download.html
 [browser_test_data_text_csv.js]
 support-files =
--- a/js/public/TraceKind.h
+++ b/js/public/TraceKind.h
@@ -63,28 +63,16 @@ enum class TraceKind {
   Scope = 0x3F,
   RegExpShared = 0x4F,
 #ifdef ENABLE_BIGINT
   BigInt = 0x5F
 #endif
 };
 const static uintptr_t OutOfLineTraceKindMask = 0x07;
 
-// Returns true if the JS::TraceKind is one the cycle collector cares about.
-// Everything used as WeakMap key should be listed here, to represent the key
-// in cycle collector's graph, otherwise the key is considered to be pointed
-// from somewhere unknown, and results in leaking the subgraph which contains
-// the key.
-// See the comments in NoteWeakMapsTracer::trace for more details.
-inline constexpr bool IsCCTraceKind(JS::TraceKind aKind) {
-  return aKind == JS::TraceKind::Object || aKind == JS::TraceKind::Script ||
-         aKind == JS::TraceKind::LazyScript || aKind == JS::TraceKind::Scope ||
-         aKind == JS::TraceKind::RegExpShared;
-}
-
 #define ASSERT_TRACE_KIND(tk)                                             \
   static_assert(                                                          \
       (uintptr_t(tk) & OutOfLineTraceKindMask) == OutOfLineTraceKindMask, \
       "mask bits are set")
 ASSERT_TRACE_KIND(JS::TraceKind::BaseShape);
 ASSERT_TRACE_KIND(JS::TraceKind::JitCode);
 ASSERT_TRACE_KIND(JS::TraceKind::LazyScript);
 ASSERT_TRACE_KIND(JS::TraceKind::Scope);
@@ -111,25 +99,49 @@ struct MapTypeToTraceKind {
   D(ObjectGroup, js::ObjectGroup, true)                   \
   D(Script, JSScript, true)                               \
   D(Shape, js::Shape, true)                               \
   D(String, JSString, false)                              \
   D(Symbol, JS::Symbol, false)                            \
   IF_BIGINT(D(BigInt, JS::BigInt, false), )               \
   D(RegExpShared, js::RegExpShared, true)
 
+// Returns true if the JS::TraceKind is one the cycle collector cares about.
+// Everything used as WeakMap key should be listed here, to represent the key
+// in cycle collector's graph, otherwise the key is considered to be pointed
+// from somewhere unknown, and results in leaking the subgraph which contains
+// the key.
+// See the comments in NoteWeakMapsTracer::trace for more details.
+inline constexpr bool IsCCTraceKind(JS::TraceKind aKind)
+{
+  switch (aKind) {
+#define JS_EXPAND_DEF(name, _, isCCTraceKind) \
+    case JS::TraceKind::name: \
+      return isCCTraceKind;
+    JS_FOR_EACH_TRACEKIND(JS_EXPAND_DEF);
+#undef JS_EXPAND_DEF
+    default:
+      return false;
+  }
+}
+
 // Map from all public types to their trace kind.
 #define JS_EXPAND_DEF(name, type, _)                       \
   template <>                                              \
   struct MapTypeToTraceKind<type> {                        \
     static const JS::TraceKind kind = JS::TraceKind::name; \
   };
 JS_FOR_EACH_TRACEKIND(JS_EXPAND_DEF);
 #undef JS_EXPAND_DEF
 
+template <typename T>
+struct TypeParticipatesInCC {
+  static const bool value = IsCCTraceKind(MapTypeToTraceKind<T>::kind);
+};
+
 // RootKind is closely related to TraceKind. Whereas TraceKind's indices are
 // laid out for convenient embedding as a pointer tag, the indicies of RootKind
 // are designed for use as array keys via EnumeratedArray.
 enum class RootKind : int8_t {
 // These map 1:1 with trace kinds.
 #define EXPAND_ROOT_KIND(name, _0, _1) name,
   JS_FOR_EACH_TRACEKIND(EXPAND_ROOT_KIND)
 #undef EXPAND_ROOT_KIND
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -909,30 +909,20 @@ struct TraverseEdgeFunctor : public Void
 
 template <typename S, typename T>
 void js::GCMarker::traverseEdge(S source, const T& thing) {
   DispatchTyped(TraverseEdgeFunctor<T, S>(), thing, this, source);
 }
 
 namespace {
 
-template <typename T>
-struct TypeParticipatesInCC {};
-#define EXPAND_PARTICIPATES_IN_CC(_, type, addToCCKind) \
-  template <>                                           \
-  struct TypeParticipatesInCC<type> {                   \
-    static const bool value = addToCCKind;              \
-  };
-JS_FOR_EACH_TRACEKIND(EXPAND_PARTICIPATES_IN_CC)
-#undef EXPAND_PARTICIPATES_IN_CC
-
 struct ParticipatesInCCFunctor {
   template <typename T>
   bool operator()() {
-    return TypeParticipatesInCC<T>::value;
+    return JS::TypeParticipatesInCC<T>::value;
   }
 };
 
 }  // namespace
 
 static bool TraceKindParticipatesInCC(JS::TraceKind kind) {
   return DispatchTraceKindTyped(ParticipatesInCCFunctor(), kind);
 }
@@ -940,17 +930,17 @@ static bool TraceKindParticipatesInCC(JS
 template <typename T>
 bool js::GCMarker::mark(T* thing) {
   if (IsInsideNursery(thing)) {
     return false;
   }
   AssertShouldMarkInZone(thing);
   TenuredCell* cell = TenuredCell::fromPointer(thing);
 
-  if (!TypeParticipatesInCC<T>::value) {
+  if (!JS::TypeParticipatesInCC<T>::value) {
     return cell->markIfUnmarked(MarkColor::Black);
   }
 
   return cell->markIfUnmarked(markColor());
 }
 
 /*** Inline, Eager GC Marking ***********************************************/
 
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -576,17 +576,17 @@ impl<'le> fmt::Debug for GeckoElement<'l
         write!(f, "> ({:#x})", self.as_node().opaque().0)
     }
 }
 
 impl<'le> GeckoElement<'le> {
     #[inline(always)]
     fn attrs(&self) -> &[structs::AttrArray_InternalAttr] {
         unsafe {
-            let attrs = match self.0._base.mAttrs.mImpl.mPtr.as_ref() {
+            let attrs = match self.0.mAttrs.mImpl.mPtr.as_ref() {
                 Some(attrs) => attrs,
                 None => return &[],
             };
 
             attrs.mBuffer.as_slice(attrs.mAttrCount as usize)
         }
     }
 
--- a/toolkit/components/perfmonitoring/tests/browser/browser.ini
+++ b/toolkit/components/perfmonitoring/tests/browser/browser.ini
@@ -2,10 +2,10 @@
 head = head.js
 tags = addons
 support-files =
   browser_compartments.html
   browser_compartments_frame.html
   browser_compartments_script.js
 
 [browser_compartments.js]
-skip-if = os == "linux" && !debug && e10s # Bug 1230018
+skip-if = (os == "linux" && !debug && e10s) || (os == "win" && os_version == "10.0") # Bug 1230018, Bug 1409631
 [browser_webpagePerformanceAlerts.js]