Merge mozilla-central to autoland. On a CLOSED TREE
authorDaniel Varga <dvarga@mozilla.com>
Tue, 02 Jul 2019 19:49:42 +0300
changeset 543807 be87db5f1b62eaadff0597d78d930f25a3034a0c
parent 543806 fae8c77ea4ad7880b7297c564376b3aaa1a9da93 (current diff)
parent 543791 109ccdeb96342a315b86ef0c7ebe76738308673b (diff)
child 543808 da33e6261a816c477c919b30a67042c886eb56b3
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-central to autoland. On a CLOSED TREE
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -2183,17 +2183,17 @@ void Selection::Collapse(const RawRangeB
   // a child of the container when IsSet() is true.  If its offset hasn't been
   // computed yet, this just checks it with its mRef.  So, we can avoid
   // computing offset here.
   if (!aPoint.IsSetAndValid()) {
     aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
     return;
   }
 
-  if (!HasSameRoot(*aPoint.Container())) {
+  if (!HasSameRootOrSameComposedDoc(*aPoint.Container())) {
     // Return with no error
     return;
   }
 
   RefPtr<nsFrameSelection> frameSelection = mFrameSelection;
   frameSelection->InvalidateDesiredPos();
   if (!IsValidSelectionPoint(frameSelection, aPoint.Container())) {
     aRv.Throw(NS_ERROR_FAILURE);
@@ -2484,17 +2484,17 @@ void Selection::Extend(nsINode& aContain
     return;
   }
 
   if (!mFrameSelection) {
     aRv.Throw(NS_ERROR_NOT_INITIALIZED);  // Can't do selection
     return;
   }
 
-  if (!HasSameRoot(aContainer)) {
+  if (!HasSameRootOrSameComposedDoc(aContainer)) {
     // Return with no error
     return;
   }
 
   nsresult res;
   if (!IsValidSelectionPoint(mFrameSelection, &aContainer)) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
@@ -2754,17 +2754,17 @@ void Selection::SelectAllChildrenJS(nsIN
 }
 
 void Selection::SelectAllChildren(nsINode& aNode, ErrorResult& aRv) {
   if (aNode.NodeType() == nsINode::DOCUMENT_TYPE_NODE) {
     aRv.Throw(NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
     return;
   }
 
-  if (!HasSameRoot(aNode)) {
+  if (!HasSameRootOrSameComposedDoc(aNode)) {
     // Return with no error
     return;
   }
 
   if (mFrameSelection) {
     mFrameSelection->PostReason(nsISelectionListener::SELECTALL_REASON);
   }
 
@@ -3400,18 +3400,18 @@ void Selection::SetBaseAndExtentInternal
     return;
   }
 
   if (NS_WARN_IF(!aAnchorRef.IsSet()) || NS_WARN_IF(!aFocusRef.IsSet())) {
     aRv.Throw(NS_ERROR_INVALID_ARG);
     return;
   }
 
-  if (!HasSameRoot(*aAnchorRef.Container()) ||
-      !HasSameRoot(*aFocusRef.Container())) {
+  if (!HasSameRootOrSameComposedDoc(*aAnchorRef.Container()) ||
+      !HasSameRootOrSameComposedDoc(*aFocusRef.Container())) {
     // Return with no error
     return;
   }
 
   // Prevent "selectionchange" event temporarily because it should be fired
   // after we set the direction.
   // XXX If they are disconnected, shouldn't we return error before allocating
   //     new nsRange instance?
@@ -3665,13 +3665,13 @@ JSObject* Selection::WrapObject(JSContex
 }
 
 // AutoHideSelectionChanges
 AutoHideSelectionChanges::AutoHideSelectionChanges(
     const nsFrameSelection* aFrame)
     : AutoHideSelectionChanges(
           aFrame ? aFrame->GetSelection(SelectionType::eNormal) : nullptr) {}
 
-bool Selection::HasSameRoot(nsINode& aNode) {
+bool Selection::HasSameRootOrSameComposedDoc(const nsINode& aNode) {
   nsINode* root = aNode.SubtreeRoot();
   Document* doc = GetParentObject();
   return doc == root || (root && doc == root->GetComposedDoc());
 }
--- a/dom/base/Selection.h
+++ b/dom/base/Selection.h
@@ -585,18 +585,17 @@ class Selection final : public nsSupport
    */
   nsresult SelectionLanguageChange(bool aLangRTL);
 
  private:
   friend class ::nsAutoScrollTimer;
 
   MOZ_CAN_RUN_SCRIPT nsresult DoAutoScroll(nsIFrame* aFrame, nsPoint aPoint);
 
-  // We are not allowed to be in nodes whose root is not our document
-  bool HasSameRoot(nsINode& aNode);
+  bool HasSameRootOrSameComposedDoc(const nsINode& aNode);
 
   // XXX Please don't add additional uses of this method, it's only for
   // XXX supporting broken code (bug 1245883) in the following classes:
   friend class ::nsCopySupport;
   friend class ::nsHTMLCopyEncoder;
   MOZ_CAN_RUN_SCRIPT
   void AddRangeInternal(nsRange& aRange, Document* aDocument, ErrorResult&);
 
--- a/js/src/gc/GCEnum.h
+++ b/js/src/gc/GCEnum.h
@@ -123,17 +123,18 @@ enum class ZealMode {
   _(WasmInstanceExports)                   \
   _(WasmInstanceScopes)                    \
   _(WasmInstanceGlobals)                   \
   _(WasmInstanceInstance)                  \
   _(WasmMemoryObservers)                   \
   _(WasmGlobalCell)                        \
   _(WasmResolveResponseClosure)            \
   _(WasmModule)                            \
-  _(WasmTableTable)
+  _(WasmTableTable)                        \
+  _(FileObjectFile)
 
 #define JS_FOR_EACH_MEMORY_USE(_)  \
   JS_FOR_EACH_PUBLIC_MEMORY_USE(_) \
   JS_FOR_EACH_INTERNAL_MEMORY_USE(_)
 
 enum class MemoryUse : uint8_t {
 #define DEFINE_MEMORY_USE(Name) Name,
   JS_FOR_EACH_MEMORY_USE(DEFINE_MEMORY_USE)
--- a/js/src/shell/OSObject.cpp
+++ b/js/src/shell/OSObject.cpp
@@ -420,26 +420,26 @@ class FileObject : public NativeObject {
   static const js::Class class_;
 
   static FileObject* create(JSContext* cx, RCFile* file) {
     FileObject* obj = js::NewBuiltinClassInstance<FileObject>(cx);
     if (!obj) {
       return nullptr;
     }
 
-    obj->setRCFile(file);
+    InitReservedSlot(obj, FILE_SLOT, file, MemoryUse::FileObjectFile);
     file->acquire();
     return obj;
   }
 
   static void finalize(FreeOp* fop, JSObject* obj) {
     FileObject* fileObj = &obj->as<FileObject>();
     RCFile* file = fileObj->rcFile();
+    RemoveCellMemory(obj, sizeof(*file), MemoryUse::FileObjectFile);
     if (file->release()) {
-      fileObj->setRCFile(nullptr);
       fop->delete_(file);
     }
   }
 
   bool isOpen() {
     RCFile* file = rcFile();
     return file && file->isOpen();
   }
@@ -450,21 +450,16 @@ class FileObject : public NativeObject {
     }
     rcFile()->close();
   }
 
   RCFile* rcFile() {
     return reinterpret_cast<RCFile*>(
         js::GetReservedSlot(this, FILE_SLOT).toPrivate());
   }
-
- private:
-  void setRCFile(RCFile* file) {
-    js::SetReservedSlot(this, FILE_SLOT, PrivateValue(file));
-  }
 };
 
 static const js::ClassOps FileObjectClassOps = {
     nullptr,              /* addProperty */
     nullptr,              /* delProperty */
     nullptr,              /* enumerate */
     nullptr,              /* newEnumerate */
     nullptr,              /* resolve */
--- a/mfbt/HashTable.h
+++ b/mfbt/HashTable.h
@@ -1506,40 +1506,39 @@ class HashTable : private AllocPolicy {
       mIter.rekey(aLookup, aKey);
     }
 
     void rekeyFront(const Key& aKey) { mIter.rekey(aKey); }
   };
 
   // HashTable is movable
   HashTable(HashTable&& aRhs) : AllocPolicy(std::move(aRhs)) {
-    initFrom(aRhs);
-    aRhs.mTable = nullptr;
+    moveFrom(aRhs);
   }
   void operator=(HashTable&& aRhs) {
     MOZ_ASSERT(this != &aRhs, "self-move assignment is prohibited");
     if (mTable) {
       destroyTable(*this, mTable, capacity());
     }
     AllocPolicy::operator=(std::move(aRhs));
-    initFrom(aRhs);
-    aRhs.mTable = nullptr;
+    moveFrom(aRhs);
   }
 
  private:
-  void initFrom(const HashTable& aRhs) {
+  void moveFrom(HashTable& aRhs) {
     mGen = aRhs.mGen;
     mHashShift = aRhs.mHashShift;
     mTable = aRhs.mTable;
     mEntryCount = aRhs.mEntryCount;
     mRemovedCount = aRhs.mRemovedCount;
 #ifdef DEBUG
     mMutationCount = aRhs.mMutationCount;
     mEntered = aRhs.mEntered;
 #endif
+    aRhs.mTable = nullptr;
   }
 
   // HashTable is not copyable or assignable
   HashTable(const HashTable&) = delete;
   void operator=(const HashTable&) = delete;
 
   static const uint32_t CAP_BITS = 30;