diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 7efd2902d097..42032a6baea3 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -3139,6 +3139,12 @@ nsIDocument::GetLastModified(nsAString& aLastModified) const } } +static void +IncrementExpandoGeneration(nsIDocument& aDoc) +{ + ++static_cast(aDoc).mExpandoAndGeneration.generation; +} + void nsIDocument::AddToNameTable(Element* aElement, nsAtom* aName) { @@ -3152,7 +3158,7 @@ nsIDocument::AddToNameTable(Element* aElement, nsAtom* aName) if (entry) { if (!entry->HasNameElement() && !entry->HasIdElementExposedAsHTMLDocumentProperty()) { - ++mExpandoAndGeneration.generation; + IncrementExpandoGeneration(*this); } entry->AddNameElement(this, aElement); } @@ -3172,7 +3178,7 @@ nsIDocument::RemoveFromNameTable(Element* aElement, nsAtom* aName) entry->RemoveNameElement(aElement); if (!entry->HasNameElement() && !entry->HasIdElementExposedAsHTMLDocumentProperty()) { - ++mExpandoAndGeneration.generation; + IncrementExpandoGeneration(*this); } } @@ -3185,7 +3191,7 @@ nsIDocument::AddToIdTable(Element* aElement, nsAtom* aId) if (nsGenericHTMLElement::ShouldExposeIdAsHTMLDocumentProperty(aElement) && !entry->HasNameElement() && !entry->HasIdElementExposedAsHTMLDocumentProperty()) { - ++mExpandoAndGeneration.generation; + IncrementExpandoGeneration(*this); } entry->AddIdElement(aElement); } @@ -3209,7 +3215,7 @@ nsIDocument::RemoveFromIdTable(Element* aElement, nsAtom* aId) if (nsGenericHTMLElement::ShouldExposeIdAsHTMLDocumentProperty(aElement) && !entry->HasNameElement() && !entry->HasIdElementExposedAsHTMLDocumentProperty()) { - ++mExpandoAndGeneration.generation; + IncrementExpandoGeneration(*this); } if (entry->IsEmpty()) { mIdentifierMap.RemoveEntry(entry); @@ -8747,7 +8753,7 @@ nsIDocument::DestroyElementMaps() #endif mStyledLinks.Clear(); mIdentifierMap.Clear(); - ++mExpandoAndGeneration.generation; + IncrementExpandoGeneration(*this); } void diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index 41d9f8c0a2d2..c61c898a197c 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -13,6 +13,7 @@ #include "nsIDocument.h" +#include "jsfriendapi.h" #include "nsCOMPtr.h" #include "nsAutoPtr.h" #include "nsCRT.h" @@ -377,6 +378,14 @@ protected: void EnsureOnloadBlocker(); public: + // FIXME(emilio): This needs to be here instead of in nsIDocument because Rust + // can't represent alignas(8) values on 32-bit architectures, which would + // cause nsIDocument's layout to be wrong in the Rust side. + // + // This can be fixed after updating to rust 1.25 and updating bindgen to + // include https://github.com/rust-lang-nursery/rust-bindgen/pull/1271. + js::ExpandoAndGeneration mExpandoAndGeneration; + RefPtr mListenerManager; nsClassHashtable mRadioGroups; diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index 8f2f01c27a40..185beeb8255d 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -6,7 +6,6 @@ #ifndef nsIDocument_h___ #define nsIDocument_h___ -#include "jsfriendapi.h" #include "mozilla/FlushType.h" // for enum #include "nsAttrAndChildArray.h" #include "nsAutoPtr.h" // for member @@ -4423,11 +4422,6 @@ protected: // 2) We haven't had Destroy() called on us yet. nsCOMPtr mLayoutHistoryState; -public: - js::ExpandoAndGeneration mExpandoAndGeneration; - -protected: - nsTArray> mOnDemandBuiltInUASheets; nsTArray> mAdditionalSheets[AdditionalSheetTypeCount];