diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index be9173afab..41a9edcd3a 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -413,28 +413,43 @@ Element::GetBindingURL(nsIDocument *aDocument, css::URLValue **aResult) JSObject* Element::WrapObject(JSContext *aCx, JS::Handle aGivenProto) { - JS::Rooted obj(aCx, nsINode::WrapObject(aCx, aGivenProto)); + JS::Rooted givenProto(aCx, aGivenProto); + JS::Rooted customProto(aCx); + + if (!givenProto) { + // Custom element prototype swizzling. + CustomElementData* data = GetCustomElementData(); + if (data) { + // If this is a registered custom element then fix the prototype. + nsDocument* document = static_cast(OwnerDoc()); + document->GetCustomPrototype(NodeInfo()->NamespaceID(), data->mType, &customProto); + if (customProto && + NodePrincipal()->SubsumesConsideringDomain(nsContentUtils::ObjectPrincipal(customProto))) { + // Just go ahead and create with the right proto up front. Set + // customProto to null to flag that we don't need to do any post-facto + // proto fixups here. + givenProto = customProto; + customProto = nullptr; + } + } + } + + JS::Rooted obj(aCx, nsINode::WrapObject(aCx, givenProto)); if (!obj) { return nullptr; } - // Custom element prototype swizzling. - CustomElementData* data = GetCustomElementData(); - if (obj && data) { - // If this is a registered custom element then fix the prototype. - nsDocument* document = static_cast(OwnerDoc()); - JS::Rooted prototype(aCx); - document->GetCustomPrototype(NodeInfo()->NamespaceID(), data->mType, &prototype); - if (prototype) { - // We want to set the custom prototype in the compartment where it was - // registered. In the case that |obj| and |prototype| are in different - // compartments, this will set the prototype on the |obj|'s wrapper and - // thus only visible in the wrapper's compartment. - JSAutoCompartment ac(aCx, prototype); - if (!JS_WrapObject(aCx, &obj) || !JS_SetPrototype(aCx, obj, prototype)) { - dom::Throw(aCx, NS_ERROR_FAILURE); - return nullptr; - } + if (customProto) { + // We want to set the custom prototype in the compartment where it was + // registered. In the case that |obj| and |prototype| are in different + // compartments, this will set the prototype on the |obj|'s wrapper and + // thus only visible in the wrapper's compartment, since we know obj's + // principal does not subsume customProto's in this case. + JSAutoCompartment ac(aCx, customProto); + JS::Rooted wrappedObj(aCx, obj); + if (!JS_WrapObject(aCx, &wrappedObj) || + !JS_SetPrototype(aCx, wrappedObj, customProto)) { + return nullptr; } } @@ -1051,10 +1066,12 @@ Element::CreateShadowRoot(ErrorResult& aError) return shadowRoot.forget(); } -NS_IMPL_CYCLE_COLLECTION(DestinationInsertionPointList, mParent, mDestinationPoints) +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DestinationInsertionPointList, mParent, + mDestinationPoints) NS_INTERFACE_TABLE_HEAD(DestinationInsertionPointList) - NS_INTERFACE_TABLE(DestinationInsertionPointList, nsINodeList) + NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY + NS_INTERFACE_TABLE(DestinationInsertionPointList, nsINodeList, nsIDOMNodeList) NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(DestinationInsertionPointList) NS_INTERFACE_MAP_END diff --git a/dom/base/Element.h b/dom/base/Element.h index c4341c8c8b..bfe8003e41 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -19,6 +19,7 @@ #include "mozilla/dom/DirectionalityUtils.h" #include "nsIDOMElement.h" #include "nsILinkHandler.h" +#include "nsINodeList.h" #include "nsNodeUtils.h" #include "nsAttrAndChildArray.h" #include "mozFlushType.h" @@ -1356,7 +1357,7 @@ public: explicit DestinationInsertionPointList(Element* aElement); NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_CLASS(DestinationInsertionPointList) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DestinationInsertionPointList) // nsIDOMNodeList NS_DECL_NSIDOMNODELIST diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index a7d8221a25..e44be965e3 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -126,6 +126,7 @@ #include "nsStyledElement.h" #include "nsIContentInlines.h" +#include "nsChildContentList.h" using namespace mozilla; using namespace mozilla::dom; @@ -313,7 +314,7 @@ nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const if (binding) { // XXX sXBL/XBL2 issue // If this is an anonymous XBL element use the binding - // document for the base URI. + // document for the base URI. // XXX Will fail with xml:base base = binding->PrototypeBinding()->DocURI(); break; @@ -326,7 +327,7 @@ nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const base = explicitBaseURI; break; } - + // Otherwise check for xml:base attribute elem->GetAttr(kNameSpaceID_XML, nsGkAtoms::base, attr); if (!attr.IsEmpty()) { @@ -334,7 +335,7 @@ nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const } elem = elem->GetParent(); } while(elem); - + // Now resolve against all xml:base attrs for (uint32_t i = baseAttrs.Length() - 1; i != uint32_t(-1); --i) { nsCOMPtr newBase; @@ -455,7 +456,7 @@ FragmentOrElement::Children() FragmentOrElement::nsDOMSlots *slots = DOMSlots(); if (!slots->mChildrenList) { - slots->mChildrenList = new nsContentList(this, kNameSpaceID_Wildcard, + slots->mChildrenList = new nsContentList(this, kNameSpaceID_Wildcard, nsGkAtoms::_asterisk, nsGkAtoms::_asterisk, false); } @@ -1679,7 +1680,7 @@ FragmentOrElement::CanSkip(nsINode* aNode, bool aRemovingAllowed) if (!root) { return false; } - + // Subtree has been traversed already, and aNode has // been handled in a way that doesn't require revisiting it. if (root->IsPurpleRoot()) { @@ -1733,7 +1734,7 @@ FragmentOrElement::CanSkip(nsINode* aNode, bool aRemovingAllowed) } } - if (!currentDoc || !foundBlack) { + if (!currentDoc || !foundBlack) { root->SetIsPurpleRoot(true); if (domOnlyCycle) { if (!gNodesToUnbind) { @@ -1773,7 +1774,7 @@ FragmentOrElement::CanSkip(nsINode* aNode, bool aRemovingAllowed) nsIContent* n = nodesToClear[i]; MarkNodeChildren(n); // Can't remove currently handled purple node, - // unless aRemovingAllowed is true. + // unless aRemovingAllowed is true. if ((n != aNode || aRemovingAllowed) && n->IsPurple()) { n->RemovePurple(); } @@ -1791,7 +1792,7 @@ FragmentOrElement::CanSkipThis(nsINode* aNode) return true; } nsIDocument* c = aNode->GetUncomposedDoc(); - return + return ((c && nsCCUncollectableMarker::InGeneration(c->GetMarkedCCGeneration())) || aNode->InCCBlackTree()) && !NeedsScriptTraverse(aNode); } @@ -2457,7 +2458,7 @@ StartElement(Element* aContent, StringBuilder& aBuilder) delete attValue; continue; } - + aBuilder.Append(" "); if (MOZ_LIKELY(attNs == kNameSpaceID_None) || @@ -2517,12 +2518,12 @@ ShouldEscape(nsIContent* aParent) static const nsIAtom* nonEscapingElements[] = { nsGkAtoms::style, nsGkAtoms::script, nsGkAtoms::xmp, nsGkAtoms::iframe, nsGkAtoms::noembed, nsGkAtoms::noframes, - nsGkAtoms::plaintext, + nsGkAtoms::plaintext, // Per the current spec noscript should be escaped in case // scripts are disabled or if document doesn't have // browsing context. However the latter seems to be a spec bug // and Gecko hasn't traditionally done the former. - nsGkAtoms::noscript + nsGkAtoms::noscript }; static mozilla::BloomFilter<12, nsIAtom> sFilter; static bool sInitialized = false; diff --git a/dom/base/FragmentOrElement.h b/dom/base/FragmentOrElement.h index 49e9c33938..b92d045672 100644 --- a/dom/base/FragmentOrElement.h +++ b/dom/base/FragmentOrElement.h @@ -18,7 +18,6 @@ #include "nsAttrAndChildArray.h" // member #include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_* #include "nsIContent.h" // base class -#include "nsINodeList.h" // base class #include "nsIWeakReference.h" // base class #include "nsNodeUtils.h" // class member nsNodeUtils::CloneNodeImpl #include "nsIHTMLCollection.h" @@ -39,50 +38,6 @@ class Element; } // namespace dom } // namespace mozilla -/** - * Class that implements the nsIDOMNodeList interface (a list of children of - * the content), by holding a reference to the content and delegating GetLength - * and Item to its existing child list. - * @see nsIDOMNodeList - */ -class nsChildContentList final : public nsINodeList -{ -public: - explicit nsChildContentList(nsINode* aNode) - : mNode(aNode) - { - } - - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsChildContentList) - - // nsWrapperCache - virtual JSObject* WrapObject(JSContext *cx, JS::Handle aGivenProto) override; - - // nsIDOMNodeList interface - NS_DECL_NSIDOMNODELIST - - // nsINodeList interface - virtual int32_t IndexOf(nsIContent* aContent) override; - virtual nsIContent* Item(uint32_t aIndex) override; - - void DropReference() - { - mNode = nullptr; - } - - virtual nsINode* GetParentObject() override - { - return mNode; - } - -private: - ~nsChildContentList() {} - - // The node whose children make up the list (weak reference) - nsINode* mNode; -}; - /** * A class that implements nsIWeakReference */ @@ -110,7 +65,7 @@ public: private: ~nsNodeWeakReference(); - nsINode* mNode; + nsINode* MOZ_NON_OWNING_REF mNode; }; /** diff --git a/dom/base/URL.cpp b/dom/base/URL.cpp index b3bb5e978f..ff647939ce 100644 --- a/dom/base/URL.cpp +++ b/dom/base/URL.cpp @@ -23,22 +23,13 @@ namespace mozilla { namespace dom { -NS_IMPL_CYCLE_COLLECTION_CLASS(URL) - -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(URL) - NS_IMPL_CYCLE_COLLECTION_UNLINK(mParent) - NS_IMPL_CYCLE_COLLECTION_UNLINK(mSearchParams) -NS_IMPL_CYCLE_COLLECTION_UNLINK_END - -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(URL) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParent) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSearchParams) -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(URL, mParent, mSearchParams) NS_IMPL_CYCLE_COLLECTING_ADDREF(URL) NS_IMPL_CYCLE_COLLECTING_RELEASE(URL) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(URL) + NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_END diff --git a/dom/base/URL.h b/dom/base/URL.h index 812733e147..81e5625a6b 100644 --- a/dom/base/URL.h +++ b/dom/base/URL.h @@ -39,7 +39,7 @@ class URL final : public URLSearchParamsObserver public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_CLASS(URL) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(URL) URL(nsISupports* aParent, already_AddRefed aURI); diff --git a/dom/base/moz.build b/dom/base/moz.build index cb94fc66a5..2925843e6f 100644 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -53,6 +53,7 @@ EXPORTS += [ 'nsAttrValue.h', 'nsAttrValueInlines.h', 'nsCaseTreatment.h', + 'nsChildContentList.h', 'nsContentCID.h', 'nsContentCreatorFunctions.h', 'nsContentList.h', diff --git a/dom/base/nsChildContentList.h b/dom/base/nsChildContentList.h new file mode 100644 index 0000000000..96c4e0eff1 --- /dev/null +++ b/dom/base/nsChildContentList.h @@ -0,0 +1,63 @@ +/* -*- 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 nsChildContentList_h__ +#define nsChildContentList_h__ + +#include "nsISupportsImpl.h" +#include "nsINodeList.h" // base class +#include "js/TypeDecls.h" // for Handle, Value, JSObject, JSContext + +class nsIContent; +class nsINode; + +/** + * Class that implements the nsIDOMNodeList interface (a list of children of + * the content), by holding a reference to the content and delegating GetLength + * and Item to its existing child list. + * @see nsIDOMNodeList + */ +class nsChildContentList final : public nsINodeList +{ +public: + explicit nsChildContentList(nsINode* aNode) + : mNode(aNode) + { + } + + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsChildContentList) + + // nsWrapperCache + virtual JSObject* WrapObject(JSContext *cx, JS::Handle aGivenProto) override; + + // nsIDOMNodeList interface + NS_DECL_NSIDOMNODELIST + + // nsINodeList interface + virtual int32_t IndexOf(nsIContent* aContent) override; + virtual nsIContent* Item(uint32_t aIndex) override; + + void DropReference() + { + mNode = nullptr; + } + + virtual nsINode* GetParentObject() override + { + return mNode; + } + +private: + ~nsChildContentList() {} + + // The node whose children make up the list. + // This is a non-owning ref which is safe because it's set to nullptr by + // DropReference() by the node slots get destroyed. + nsINode* MOZ_NON_OWNING_REF mNode; +}; + +#endif /* nsChildContentList_h__ */ diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp index 4cc13bc7c1..c84c5a2790 100644 --- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp @@ -104,15 +104,20 @@ #include "nsDOMMutationObserver.h" #include "GeometryUtils.h" #include "nsIAnimationObserver.h" +#include "nsChildContentList.h" using namespace mozilla; using namespace mozilla::dom; +nsINode::nsSlots::nsSlots() + : mWeakReference(nullptr) +{ +} + nsINode::nsSlots::~nsSlots() { if (mChildNodes) { mChildNodes->DropReference(); - NS_RELEASE(mChildNodes); } if (mWeakReference) { @@ -132,7 +137,6 @@ nsINode::nsSlots::Unlink() { if (mChildNodes) { mChildNodes->DropReference(); - NS_RELEASE(mChildNodes); } } @@ -368,12 +372,8 @@ nsINodeList* nsINode::ChildNodes() { nsSlots* slots = Slots(); - if (!slots->mChildNodes) { - slots->mChildNodes = new nsChildContentList(this); - if (slots->mChildNodes) { - NS_ADDREF(slots->mChildNodes); - } - } + MOZ_ASSERT(!slots->mChildNodes); + slots->mChildNodes = new nsChildContentList(this); return slots->mChildNodes; } diff --git a/dom/base/nsINode.h b/dom/base/nsINode.h index 97a3bd04f0..aa69ed41fc 100644 --- a/dom/base/nsINode.h +++ b/dom/base/nsINode.h @@ -42,6 +42,7 @@ class nsIDOMNodeList; class nsIEditor; class nsIFrame; class nsIMutationObserver; +class nsINode; class nsINodeList; class nsIPresShell; class nsIPrincipal; @@ -385,6 +386,10 @@ protected: * WrapNode is called from WrapObject to actually wrap this node, WrapObject * does some additional checks and fix-up that's common to all nodes. WrapNode * should just call the DOM binding's Wrap function. + * + * aGivenProto is the prototype to use (or null if the default one should be + * used) and should just be passed directly on to the DOM binding's Wrap + * function. */ virtual JSObject* WrapNode(JSContext *aCx, JS::Handle aGivenProto) = 0; @@ -707,7 +712,7 @@ public: { return InsertChildAt(aKid, GetChildCount(), aNotify); } - + /** * Remove a child from this node. This method handles calling UnbindFromTree * on the child appropriately. @@ -870,7 +875,7 @@ public: virtual void* UnsetProperty(uint16_t aCategory, nsIAtom *aPropertyName, nsresult *aStatus = nullptr); - + bool HasProperties() const { return HasFlag(NODE_HAS_PROPERTIES); @@ -902,7 +907,7 @@ public: { return mParent; } - + /** * Get the parent nsINode for this node if it is an Element. * @return the parent node @@ -1025,12 +1030,7 @@ public: class nsSlots { public: - nsSlots() - : mChildNodes(nullptr), - mWeakReference(nullptr), - mEditableDescendantCount(0) - { - } + nsSlots(); // If needed we could remove the vtable pointer this dtor causes by // putting a DestroySlots function on nsINode @@ -1048,15 +1048,14 @@ public: * An object implementing nsIDOMNodeList for this content (childNodes) * @see nsIDOMNodeList * @see nsGenericHTMLElement::GetChildNodes - * - * MSVC 7 doesn't like this as an nsRefPtr */ - nsChildContentList* mChildNodes; + nsRefPtr mChildNodes; /** - * Weak reference to this node + * Weak reference to this node. This is cleared by the destructor of + * nsNodeWeakReference. */ - nsNodeWeakReference* mWeakReference; + nsNodeWeakReference* MOZ_NON_OWNING_REF mWeakReference; /** * Number of descendant nodes in the uncomposed document that have been @@ -1238,7 +1237,7 @@ protected: } return nullptr; } - + public: void GetTextContent(nsAString& aTextContent, mozilla::ErrorResult& aError) @@ -1293,7 +1292,7 @@ public: nsresult GetUserData(const nsAString& aKey, nsIVariant** aResult) { NS_IF_ADDREF(*aResult = GetUserData(aKey)); - + return NS_OK; } @@ -1454,7 +1453,7 @@ private: NodeIsCCMarkedRoot, // Maybe set if this node is in black subtree. NodeIsCCBlackTree, - // Maybe set if the node is a root of a subtree + // Maybe set if the node is a root of a subtree // which needs to be kept in the purple buffer. NodeIsPurpleRoot, // Set if the node has an explicit base URI stored @@ -1971,23 +1970,33 @@ protected: nsRefPtr mNodeInfo; - nsINode* mParent; + // mParent is an owning ref most of the time, except for the case of document + // nodes, so it cannot be represented by nsCOMPtr, so mark is as + // MOZ_OWNING_REF. + nsINode* MOZ_OWNING_REF mParent; private: // Boolean flags. uint32_t mBoolFlags; protected: - nsIContent* mNextSibling; - nsIContent* mPreviousSibling; - nsIContent* mFirstChild; + // These references are non-owning and safe, as they are managed by + // nsAttrAndChildArray. + nsIContent* MOZ_NON_OWNING_REF mNextSibling; + nsIContent* MOZ_NON_OWNING_REF mPreviousSibling; + // This reference is non-owning and safe, since in the case of documents, + // it is set to null when the document gets destroyed, and in the case of + // other nodes, the children keep the parents alive. + nsIContent* MOZ_NON_OWNING_REF mFirstChild; union { // Pointer to our primary frame. Might be null. nsIFrame* mPrimaryFrame; // Pointer to the root of our subtree. Might be null. - nsINode* mSubtreeRoot; + // This reference is non-owning and safe, since it either points to the + // object itself, or is reset by ClearSubtreeRootPointer. + nsINode* MOZ_NON_OWNING_REF mSubtreeRoot; }; // Storage for more members that are usually not needed; allocated lazily. diff --git a/dom/base/nsINodeList.h b/dom/base/nsINodeList.h index 8c4ebff163..15ca3a39a4 100644 --- a/dom/base/nsINodeList.h +++ b/dom/base/nsINodeList.h @@ -16,6 +16,9 @@ { 0xadb5e54c, 0x6e96, 0x4102, \ { 0x8d, 0x40, 0xe0, 0x12, 0x3d, 0xcf, 0x48, 0x7a } } +class nsIContent; +class nsINode; + /** * An internal interface for a reasonably fast indexOf. */ diff --git a/xpcom/base/nsQueryObject.h b/xpcom/base/nsQueryObject.h index 689556b5f8..77f954c288 100644 --- a/xpcom/base/nsQueryObject.h +++ b/xpcom/base/nsQueryObject.h @@ -15,7 +15,7 @@ /*****************************************************************************/ template -class nsQueryObject : public nsCOMPtr_helper +class MOZ_STACK_CLASS nsQueryObject final : public nsCOMPtr_helper { public: explicit nsQueryObject(T* aRawPtr) @@ -35,7 +35,7 @@ private: }; template -class MOZ_STACK_CLASS nsQueryObjectWithError : public nsCOMPtr_helper +class MOZ_STACK_CLASS nsQueryObjectWithError final : public nsCOMPtr_helper { public: nsQueryObjectWithError(T* aRawPtr, nsresult* aErrorPtr) diff --git a/xpcom/glue/nsArrayUtils.h b/xpcom/glue/nsArrayUtils.h index fd36da9dbf..68032e8c0a 100644 --- a/xpcom/glue/nsArrayUtils.h +++ b/xpcom/glue/nsArrayUtils.h @@ -11,7 +11,7 @@ #include "nsIArray.h" // helper class for do_QueryElementAt -class MOZ_STACK_CLASS nsQueryArrayElementAt : public nsCOMPtr_helper +class MOZ_STACK_CLASS nsQueryArrayElementAt final : public nsCOMPtr_helper { public: nsQueryArrayElementAt(nsIArray* aArray, uint32_t aIndex, diff --git a/xpcom/glue/nsCOMPtr.h b/xpcom/glue/nsCOMPtr.h index 75373a25e6..be3c4d9f60 100644 --- a/xpcom/glue/nsCOMPtr.h +++ b/xpcom/glue/nsCOMPtr.h @@ -168,7 +168,7 @@ private: nsISupports* MOZ_OWNING_REF mRawPtr; }; -class nsQueryInterfaceWithError +class nsQueryInterfaceWithError final { public: nsQueryInterfaceWithError(nsISupports* aRawPtr, nsresult* aError) @@ -217,7 +217,7 @@ do_QueryInterface(already_AddRefed&, nsresult*) //////////////////////////////////////////////////////////////////////////// // Using servicemanager with COMPtrs -class nsGetServiceByCID +class nsGetServiceByCID final { public: explicit nsGetServiceByCID(const nsCID& aCID) : mCID(aCID) {} @@ -228,7 +228,7 @@ private: const nsCID& mCID; }; -class nsGetServiceByCIDWithError +class nsGetServiceByCIDWithError final { public: nsGetServiceByCIDWithError(const nsCID& aCID, nsresult* aErrorPtr) @@ -244,7 +244,7 @@ private: nsresult* mErrorPtr; }; -class nsGetServiceByContractID +class nsGetServiceByContractID final { public: explicit nsGetServiceByContractID(const char* aContractID) @@ -258,7 +258,7 @@ private: const char* mContractID; }; -class nsGetServiceByContractIDWithError +class nsGetServiceByContractIDWithError final { public: nsGetServiceByContractIDWithError(const char* aContractID, nsresult* aErrorPtr) diff --git a/xpcom/glue/nsComponentManagerUtils.h b/xpcom/glue/nsComponentManagerUtils.h index 1c2da53a7d..1249010ead 100644 --- a/xpcom/glue/nsComponentManagerUtils.h +++ b/xpcom/glue/nsComponentManagerUtils.h @@ -26,7 +26,7 @@ nsresult CallGetClassObject(const char* aContractID, const nsIID& aIID, void** aResult); -class MOZ_STACK_CLASS nsCreateInstanceByCID : public nsCOMPtr_helper +class MOZ_STACK_CLASS nsCreateInstanceByCID final : public nsCOMPtr_helper { public: nsCreateInstanceByCID(const nsCID& aCID, nsISupports* aOuter, @@ -46,7 +46,7 @@ private: nsresult* mErrorPtr; }; -class MOZ_STACK_CLASS nsCreateInstanceByContractID : public nsCOMPtr_helper +class MOZ_STACK_CLASS nsCreateInstanceByContractID final : public nsCOMPtr_helper { public: nsCreateInstanceByContractID(const char* aContractID, nsISupports* aOuter, @@ -65,7 +65,7 @@ private: nsresult* mErrorPtr; }; -class MOZ_STACK_CLASS nsCreateInstanceFromFactory : public nsCOMPtr_helper +class MOZ_STACK_CLASS nsCreateInstanceFromFactory final : public nsCOMPtr_helper { public: nsCreateInstanceFromFactory(nsIFactory* aFactory, nsISupports* aOuter, @@ -124,7 +124,7 @@ do_CreateInstance(nsIFactory* aFactory, nsISupports* aOuter, } -class MOZ_STACK_CLASS nsGetClassObjectByCID : public nsCOMPtr_helper +class MOZ_STACK_CLASS nsGetClassObjectByCID final : public nsCOMPtr_helper { public: nsGetClassObjectByCID(const nsCID& aCID, nsresult* aErrorPtr) @@ -140,7 +140,7 @@ private: nsresult* mErrorPtr; }; -class MOZ_STACK_CLASS nsGetClassObjectByContractID : public nsCOMPtr_helper +class MOZ_STACK_CLASS nsGetClassObjectByContractID final : public nsCOMPtr_helper { public: nsGetClassObjectByContractID(const char* aContractID, nsresult* aErrorPtr) diff --git a/xpcom/glue/nsIInterfaceRequestorUtils.h b/xpcom/glue/nsIInterfaceRequestorUtils.h index fa7b3b0e8e..718cf387b5 100644 --- a/xpcom/glue/nsIInterfaceRequestorUtils.h +++ b/xpcom/glue/nsIInterfaceRequestorUtils.h @@ -22,7 +22,7 @@ CallGetInterface(T* aSource, DestinationType** aDestination) reinterpret_cast(aDestination)); } -class MOZ_STACK_CLASS nsGetInterface : public nsCOMPtr_helper +class MOZ_STACK_CLASS nsGetInterface final : public nsCOMPtr_helper { public: nsGetInterface(nsISupports* aSource, nsresult* aError) diff --git a/xpcom/glue/nsIWeakReferenceUtils.h b/xpcom/glue/nsIWeakReferenceUtils.h index 91b2922b5a..1c84e00dfb 100644 --- a/xpcom/glue/nsIWeakReferenceUtils.h +++ b/xpcom/glue/nsIWeakReferenceUtils.h @@ -30,7 +30,7 @@ CallQueryReferent(T* aSource, DestinationType** aDestination) } -class MOZ_STACK_CLASS nsQueryReferent : public nsCOMPtr_helper +class MOZ_STACK_CLASS nsQueryReferent final : public nsCOMPtr_helper { public: nsQueryReferent(nsIWeakReference* aWeakPtr, nsresult* aError) diff --git a/xpcom/glue/nsServiceManagerUtils.h b/xpcom/glue/nsServiceManagerUtils.h index 1849a0e338..d1ea408a2a 100644 --- a/xpcom/glue/nsServiceManagerUtils.h +++ b/xpcom/glue/nsServiceManagerUtils.h @@ -34,7 +34,7 @@ do_GetService(const char* aContractID, nsresult* aError) return nsGetServiceByContractIDWithError(aContractID, aError); } -class MOZ_STACK_CLASS nsGetServiceFromCategory : public nsCOMPtr_helper +class MOZ_STACK_CLASS nsGetServiceFromCategory final : public nsCOMPtr_helper { public: nsGetServiceFromCategory(const char* aCategory, const char* aEntry,