Bug 1434399 part 5. Remove nsIDOMXULDocument's commandDispatcher attribute. r=mystor

MozReview-Commit-ID: BjRVr3ScuK5
This commit is contained in:
Boris Zbarsky 2018-01-31 14:49:27 -05:00
Родитель 0cfbd19f50
Коммит 493dd48468
7 изменённых файлов: 22 добавлений и 29 удалений

Просмотреть файл

@ -180,8 +180,7 @@
#include "nsNetCID.h"
#include "nsIArray.h"
// XXX An unfortunate dependency exists here (two XUL files).
#include "nsIDOMXULDocument.h"
#include "XULDocument.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsBindingManager.h"
@ -6385,15 +6384,15 @@ nsGlobalWindowOuter::UpdateCommands(const nsAString& anAction,
return;
}
nsCOMPtr<nsIDOMXULDocument> xulDoc =
do_QueryInterface(rootWindow->GetExtantDoc());
nsIDocument* doc = rootWindow->GetExtantDoc();
XULDocument* xulDoc = doc ? doc->AsXULDocument() : nullptr;
// See if we contain a XUL document.
// selectionchange action is only used for mozbrowser, not for XUL. So we bypass
// XUL command dispatch if anAction is "selectionchange".
if (xulDoc && !anAction.EqualsLiteral("selectionchange")) {
// Retrieve the command dispatcher and call updateCommands on it.
nsCOMPtr<nsIDOMXULCommandDispatcher> xulCommandDispatcher;
xulDoc->GetCommandDispatcher(getter_AddRefs(xulCommandDispatcher));
nsIDOMXULCommandDispatcher* xulCommandDispatcher =
xulDoc->GetCommandDispatcher();
if (xulCommandDispatcher) {
nsContentUtils::AddScriptRunner(new CommandDispatcher(xulCommandDispatcher,
anAction));

Просмотреть файл

@ -173,6 +173,7 @@ class XPathEvaluator;
class XPathExpression;
class XPathNSResolver;
class XPathResult;
class XULDocument;
template<typename> class Sequence;
template<typename, typename> class CallbackObjectHolder;
@ -3042,6 +3043,7 @@ public:
virtual nsHTMLDocument* AsHTMLDocument() { return nullptr; }
virtual mozilla::dom::SVGDocument* AsSVGDocument() { return nullptr; }
virtual mozilla::dom::XULDocument* AsXULDocument() { return nullptr; }
/*
* Given a node, get a weak reference to it and append that reference to

Просмотреть файл

@ -13,8 +13,6 @@ interface nsIBoxObject;
[uuid(7790d4c3-e8f0-4e29-9887-d683ed2b2a44)]
interface nsIDOMXULDocument : nsIDOMDocument
{
readonly attribute nsIDOMXULCommandDispatcher commandDispatcher;
readonly attribute long width;
readonly attribute long height;

Просмотреть файл

@ -50,6 +50,7 @@
#include "nsPIWindowRoot.h"
#include "nsXULCommandDispatcher.h"
#include "nsXULElement.h"
#include "nsXULPrototypeCache.h"
#include "mozilla/Logging.h"
#include "nsIFrame.h"
#include "nsXBLService.h"
@ -1427,14 +1428,6 @@ XULDocument::GetTooltipNode()
return nullptr;
}
NS_IMETHODIMP
XULDocument::GetCommandDispatcher(nsIDOMXULCommandDispatcher** aTracker)
{
*aTracker = mCommandDispatcher;
NS_IF_ADDREF(*aTracker);
return NS_OK;
}
nsresult
XULDocument::AddElementToDocumentPre(Element* aElement)
{

Просмотреть файл

@ -9,7 +9,6 @@
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsXULPrototypeDocument.h"
#include "nsXULPrototypeCache.h"
#include "nsTArray.h"
#include "mozilla/dom/XMLDocument.h"
@ -35,6 +34,7 @@
class nsIRDFResource;
class nsIRDFService;
class nsPIWindowRoot;
class nsXULPrototypeElement;
#if 0 // XXXbe save me, scc (need NSCAP_FORWARD_DECL(nsXULPrototypeScript))
class nsIObjectInputStream;
class nsIObjectOutputStream;
@ -84,6 +84,10 @@ public:
virtual void EndLoad() override;
virtual XULDocument* AsXULDocument() override {
return this;
}
// nsIMutationObserver interface
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED

Просмотреть файл

@ -20,7 +20,6 @@
#include "nsIDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIDOMXULDocument.h"
#include "nsIRDFService.h"
#include "nsIServiceManager.h"
#include "nsXULContentUtils.h"
@ -28,8 +27,10 @@
#include "nsRDFCID.h"
#include "nsString.h"
#include "nsGkAtoms.h"
#include "XULDocument.h"
using namespace mozilla;
using dom::XULDocument;
//------------------------------------------------------------------------
@ -120,16 +121,13 @@ nsXULContentUtils::SetCommandUpdater(nsIDocument* aDocument, Element* aElement)
nsresult rv;
nsCOMPtr<nsIDOMXULDocument> xuldoc = do_QueryInterface(aDocument);
XULDocument* xuldoc = aDocument->AsXULDocument();
NS_ASSERTION(xuldoc != nullptr, "not a xul document");
if (! xuldoc)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIDOMXULCommandDispatcher> dispatcher;
rv = xuldoc->GetCommandDispatcher(getter_AddRefs(dispatcher));
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get dispatcher");
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDOMXULCommandDispatcher> dispatcher =
xuldoc->GetCommandDispatcher();
NS_ASSERTION(dispatcher != nullptr, "no dispatcher");
if (! dispatcher)
return NS_ERROR_UNEXPECTED;

Просмотреть файл

@ -15,8 +15,6 @@
#include "nsIDOMEvent.h"
#include "nsXULElement.h"
#include "nsIDOMXULMenuListElement.h"
#include "nsIXULDocument.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsCSSFrameConstructor.h"
#include "nsGlobalWindow.h"
@ -36,6 +34,7 @@
#include "nsPIWindowRoot.h"
#include "nsFrameManager.h"
#include "nsIObserverService.h"
#include "XULDocument.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
#include "mozilla/dom/UIEvent.h"
@ -1978,10 +1977,10 @@ nsXULPopupManager::UpdateMenuItems(nsIContent* aPopup)
}
// When a menu is opened, make sure that command updating is unlocked first.
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(document);
XULDocument* xulDoc = document->AsXULDocument();
if (xulDoc) {
nsCOMPtr<nsIDOMXULCommandDispatcher> xulCommandDispatcher;
xulDoc->GetCommandDispatcher(getter_AddRefs(xulCommandDispatcher));
nsCOMPtr<nsIDOMXULCommandDispatcher> xulCommandDispatcher =
xulDoc->GetCommandDispatcher();
if (xulCommandDispatcher) {
xulCommandDispatcher->Unlock();
}