From 6c854a72756a051ac1cf284b29c7e530e3804ddc Mon Sep 17 00:00:00 2001 From: Adrian Wielgosik Date: Wed, 14 Feb 2018 20:10:45 +0100 Subject: [PATCH] Bug 1438270 - Remove nsIDOMDocumentXBL. r=bz MozReview-Commit-ID: 4TsjUaEdDP2 --HG-- extra : rebase_source : ab61d1832113a8c7b126b8856de59056fcf5ec5e --- browser/installer/package-manifest.in | 1 - dom/base/nsDocument.cpp | 69 +------------------- dom/base/nsDocument.h | 5 -- dom/base/nsIDocument.h | 6 -- dom/interfaces/xbl/moz.build | 15 ----- dom/interfaces/xbl/nsIDOMDocumentXBL.idl | 21 ------ dom/moz.build | 1 - dom/webidl/Document.webidl | 2 +- dom/xml/nsXMLPrettyPrinter.cpp | 1 - dom/xul/nsXULPopupListener.cpp | 20 ++---- mobile/android/installer/package-manifest.in | 1 - xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp | 3 - 12 files changed, 6 insertions(+), 139 deletions(-) delete mode 100644 dom/interfaces/xbl/moz.build delete mode 100644 dom/interfaces/xbl/nsIDOMDocumentXBL.idl diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 848573e0ec7e..dcf869583183 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -221,7 +221,6 @@ @RESPATH@/components/dom_webspeechrecognition.xpt #endif @RESPATH@/components/dom_workers.xpt -@RESPATH@/components/dom_xbl.xpt @RESPATH@/components/dom_xhr.xpt @RESPATH@/components/dom_xul.xpt @RESPATH@/components/dom_presentation.xpt diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 8e205db6f301..20a23e6c8e66 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -59,7 +59,6 @@ #include "mozilla/dom/Attr.h" #include "mozilla/dom/BindingDeclarations.h" -#include "nsIDOMDocumentXBL.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/FramingChecker.h" #include "nsGenericHTMLElement.h" @@ -1802,7 +1801,6 @@ NS_INTERFACE_TABLE_HEAD(nsDocument) NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDocument) NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocument) NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMNode) - NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentXBL) NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIScriptObjectPrincipal) NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMEventTarget) NS_INTERFACE_TABLE_ENTRY(nsDocument, mozilla::dom::EventTarget) @@ -6214,30 +6212,10 @@ nsIDocument::ImportNode(nsINode& aNode, bool aDeep, ErrorResult& rv) const return nullptr; } -NS_IMETHODIMP -nsDocument::LoadBindingDocument(const nsAString& aURI) -{ - ErrorResult rv; - nsIDocument::LoadBindingDocument(aURI, - nsContentUtils::GetCurrentJSContext() - ? Some(nsContentUtils::SubjectPrincipal()) - : Nothing(), - rv); - return rv.StealNSResult(); -} - void nsIDocument::LoadBindingDocument(const nsAString& aURI, nsIPrincipal& aSubjectPrincipal, ErrorResult& rv) -{ - LoadBindingDocument(aURI, Some(&aSubjectPrincipal), rv); -} - -void -nsIDocument::LoadBindingDocument(const nsAString& aURI, - const Maybe& aSubjectPrincipal, - ErrorResult& rv) { nsCOMPtr uri; rv = NS_NewURI(getter_AddRefs(uri), aURI, mCharacterSet, GetDocBaseURI()); @@ -6245,24 +6223,7 @@ nsIDocument::LoadBindingDocument(const nsAString& aURI, return; } - // Note - This computation of subjectPrincipal isn't necessarily sensical. - // It's just designed to preserve the old semantics during a mass-conversion - // patch. - nsCOMPtr subjectPrincipal = - aSubjectPrincipal.isSome() ? aSubjectPrincipal.value() : NodePrincipal(); - BindingManager()->LoadBindingDocument(this, uri, subjectPrincipal); -} - -NS_IMETHODIMP -nsDocument::GetBindingParent(nsIDOMNode* aNode, nsIDOMElement** aResult) -{ - nsCOMPtr node = do_QueryInterface(aNode); - NS_ENSURE_ARG_POINTER(node); - - Element* bindingParent = nsIDocument::GetBindingParent(*node); - nsCOMPtr retval = do_QueryInterface(bindingParent); - retval.forget(aResult); - return NS_OK; + BindingManager()->LoadBindingDocument(this, uri, &aSubjectPrincipal); } Element* @@ -6333,23 +6294,6 @@ nsDocument::GetAnonymousElementByAttribute(nsIContent* aElement, return nullptr; } -NS_IMETHODIMP -nsDocument::GetAnonymousElementByAttribute(nsIDOMElement* aElement, - const nsAString& aAttrName, - const nsAString& aAttrValue, - nsIDOMElement** aResult) -{ - nsCOMPtr element = do_QueryInterface(aElement); - NS_ENSURE_ARG_POINTER(element); - - Element* anonEl = - nsIDocument::GetAnonymousElementByAttribute(*element, aAttrName, - aAttrValue); - nsCOMPtr retval = do_QueryInterface(anonEl); - retval.forget(aResult); - return NS_OK; -} - Element* nsIDocument::GetAnonymousElementByAttribute(Element& aElement, const nsAString& aAttrName, @@ -6360,17 +6304,6 @@ nsIDocument::GetAnonymousElementByAttribute(Element& aElement, return GetAnonymousElementByAttribute(&aElement, attribute, aAttrValue); } - -NS_IMETHODIMP -nsDocument::GetAnonymousNodes(nsIDOMElement* aElement, - nsIDOMNodeList** aResult) -{ - *aResult = nullptr; - - nsCOMPtr content(do_QueryInterface(aElement)); - return BindingManager()->GetAnonymousNodesFor(content, aResult); -} - nsINodeList* nsIDocument::GetAnonymousNodes(Element& aElement) { diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index cb559d0945b0..853a7951e765 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -21,7 +21,6 @@ #include "nsTArray.h" #include "nsIdentifierMapEntry.h" #include "nsIDOMDocument.h" -#include "nsIDOMDocumentXBL.h" #include "nsStubDocumentObserver.h" #include "nsIScriptGlobalObject.h" #include "nsIContent.h" @@ -322,7 +321,6 @@ class PrincipalFlashClassifier; // Base class for our document implementations. class nsDocument : public nsIDocument, public nsIDOMDocument, - public nsIDOMDocumentXBL, public nsSupportsWeakReference, public nsIScriptObjectPrincipal, public nsIRadioGroupContainer, @@ -636,9 +634,6 @@ public: // nsIDOMDocument NS_DECL_NSIDOMDOCUMENT - // nsIDOMDocumentXBL - NS_DECL_NSIDOMDOCUMENTXBL - using mozilla::dom::DocumentOrShadowRoot::GetElementById; using mozilla::dom::DocumentOrShadowRoot::GetElementsByTagName; using mozilla::dom::DocumentOrShadowRoot::GetElementsByTagNameNS; diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index 6069cccfad6d..86874504796e 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -2091,9 +2091,6 @@ public: return mHaveFiredTitleChange; } - /** - * See GetAnonymousElementByAttribute on nsIDOMDocumentXBL. - */ virtual Element* GetAnonymousElementByAttribute(nsIContent* aElement, nsAtom* aAttrName, @@ -2985,9 +2982,6 @@ public: void LoadBindingDocument(const nsAString& aURI, nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& rv); - void LoadBindingDocument(const nsAString& aURI, - const mozilla::Maybe& aSubjectPrincipal, - mozilla::ErrorResult& rv); mozilla::dom::XPathExpression* CreateExpression(const nsAString& aExpression, mozilla::dom::XPathNSResolver* aResolver, diff --git a/dom/interfaces/xbl/moz.build b/dom/interfaces/xbl/moz.build deleted file mode 100644 index a466d5d8d082..000000000000 --- a/dom/interfaces/xbl/moz.build +++ /dev/null @@ -1,15 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# 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/. - -with Files("**"): - BUG_COMPONENT = ("Core", "XBL") - -XPIDL_SOURCES += [ - 'nsIDOMDocumentXBL.idl', -] - -XPIDL_MODULE = 'dom_xbl' - diff --git a/dom/interfaces/xbl/nsIDOMDocumentXBL.idl b/dom/interfaces/xbl/nsIDOMDocumentXBL.idl deleted file mode 100644 index 0ae7154d2217..000000000000 --- a/dom/interfaces/xbl/nsIDOMDocumentXBL.idl +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- Mode: IDL; 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/. */ - -#include "domstubs.idl" - -[uuid(af628000-e3fa-40d2-9118-fbaa9f3ec6b9)] -interface nsIDOMDocumentXBL : nsISupports -{ - /** - * See the MDC documentation for what these methods do. - */ - nsIDOMNodeList getAnonymousNodes(in nsIDOMElement elt); - nsIDOMElement getAnonymousElementByAttribute(in nsIDOMElement elt, - in DOMString attrName, - in DOMString attrValue); - - nsIDOMElement getBindingParent(in nsIDOMNode node); - void loadBindingDocument(in DOMString documentURL); -}; diff --git a/dom/moz.build b/dom/moz.build index b9f7b2d6ac9d..0a549364ddb8 100644 --- a/dom/moz.build +++ b/dom/moz.build @@ -21,7 +21,6 @@ interfaces = [ 'events', 'sidebar', 'range', - 'xbl', 'xul', 'security', 'storage', diff --git a/dom/webidl/Document.webidl b/dom/webidl/Document.webidl index d743404a7e08..007f4cf47cdf 100644 --- a/dom/webidl/Document.webidl +++ b/dom/webidl/Document.webidl @@ -323,7 +323,7 @@ partial interface Document { // Mozilla extensions of various sorts partial interface Document { - // nsIDOMDocumentXBL. Wish we could make these [ChromeOnly], but + // XBL support. Wish we could make these [ChromeOnly], but // that would likely break bindings running with the page principal. [Func="IsChromeOrXBL"] NodeList? getAnonymousNodes(Element elt); diff --git a/dom/xml/nsXMLPrettyPrinter.cpp b/dom/xml/nsXMLPrettyPrinter.cpp index c1be2a1849ff..a1c4b975ec77 100644 --- a/dom/xml/nsXMLPrettyPrinter.cpp +++ b/dom/xml/nsXMLPrettyPrinter.cpp @@ -6,7 +6,6 @@ #include "nsXMLPrettyPrinter.h" #include "nsContentUtils.h" #include "nsICSSDeclaration.h" -#include "nsIDOMDocumentXBL.h" #include "nsIObserver.h" #include "nsSyncLoadService.h" #include "nsPIDOMWindow.h" diff --git a/dom/xul/nsXULPopupListener.cpp b/dom/xul/nsXULPopupListener.cpp index 3a64ba767771..9e9188377794 100644 --- a/dom/xul/nsXULPopupListener.cpp +++ b/dom/xul/nsXULPopupListener.cpp @@ -12,15 +12,10 @@ #include "nsCOMPtr.h" #include "nsGkAtoms.h" #include "nsIDOMElement.h" -#include "nsIDOMXULElement.h" -#include "nsIDOMNodeList.h" -#include "nsIDOMDocument.h" -#include "nsIDOMDocumentXBL.h" #include "nsContentCID.h" #include "nsContentUtils.h" #include "nsXULPopupManager.h" #include "nsIScriptContext.h" -#include "nsIDOMWindow.h" #include "nsIDocument.h" #include "nsServiceManagerUtils.h" #include "nsIPrincipal.h" @@ -368,18 +363,11 @@ nsXULPopupListener::LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent) if (identifier.EqualsLiteral("_child")) { popup = GetImmediateChild(mElement, nsGkAtoms::menupopup); if (!popup) { - nsCOMPtr nsDoc(do_QueryInterface(document)); - nsCOMPtr list; - nsCOMPtr el = do_QueryInterface(mElement); - nsDoc->GetAnonymousNodes(el, getter_AddRefs(list)); + nsINodeList* list = document->GetAnonymousNodes(*mElement); if (list) { - uint32_t ctr,listLength; - nsCOMPtr node; - list->GetLength(&listLength); - for (ctr = 0; ctr < listLength; ctr++) { - list->Item(ctr, getter_AddRefs(node)); - nsCOMPtr childContent(do_QueryInterface(node)); - + uint32_t listLength = list->Length(); + for (uint32_t ctr = 0; ctr < listLength; ctr++) { + nsIContent* childContent = list->Item(ctr); if (childContent->NodeInfo()->Equals(nsGkAtoms::menupopup, kNameSpaceID_XUL)) { popup = childContent->AsElement(); diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in index 265519775324..199b94a7c8e2 100644 --- a/mobile/android/installer/package-manifest.in +++ b/mobile/android/installer/package-manifest.in @@ -145,7 +145,6 @@ #ifdef MOZ_WEBSPEECH @BINPATH@/components/dom_webspeechrecognition.xpt #endif -@BINPATH@/components/dom_xbl.xpt @BINPATH@/components/dom_xhr.xpt @BINPATH@/components/dom_xul.xpt @BINPATH@/components/dom_presentation.xpt diff --git a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp index 6a7b620885ae..5a2034893b25 100644 --- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp +++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp @@ -24,7 +24,6 @@ #include "nsIDOMDocument.h" #include "nsIDOMDocumentFragment.h" #include "nsIDOMDocumentType.h" -#include "nsIDOMDocumentXBL.h" #include "nsIDOMDragEvent.h" #include "nsIDOMElement.h" #include "nsIDOMEvent.h" @@ -86,7 +85,6 @@ #include "mozilla/dom/DocumentBinding.h" #include "mozilla/dom/DocumentFragmentBinding.h" #include "mozilla/dom/DocumentTypeBinding.h" -#include "mozilla/dom/DocumentBinding.h" #include "mozilla/dom/DragEventBinding.h" #include "mozilla/dom/ElementBinding.h" #include "mozilla/dom/EventBinding.h" @@ -210,7 +208,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] = DEFINE_SHIM(Document), DEFINE_SHIM(DocumentFragment), DEFINE_SHIM(DocumentType), - DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMDocumentXBL, Document), DEFINE_SHIM(DragEvent), DEFINE_SHIM(Element), DEFINE_SHIM(Event),