Bug 1479569 part 3. Remove nsIContentFrameMessageManager. r=kmag

This commit is contained in:
Boris Zbarsky 2018-08-02 23:49:09 -04:00
parent 0197de77c0
commit b318c42b9e
11 changed files with 22 additions and 36 deletions

View File

@ -639,11 +639,6 @@ nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
} else if (aIID.Equals(NS_GET_IID(nsITabChild))) {
*aSink = GetTabChild().take();
return *aSink ? NS_OK : NS_ERROR_FAILURE;
} else if (aIID.Equals(NS_GET_IID(nsIContentFrameMessageManager))) {
RefPtr<ContentFrameMessageManager> mm = GetMessageManager();
nsCOMPtr<nsIContentFrameMessageManager> mm2 = do_QueryObject(mm);
mm2.forget(aSink);
return *aSink ? NS_OK : NS_NOINTERFACE;
} else {
return nsDocLoader::GetInterface(aIID, aSink);
}

View File

@ -6,6 +6,7 @@
#include "mozilla/dom/ChildSHistory.h"
#include "mozilla/dom/ChildSHistoryBinding.h"
#include "mozilla/dom/ContentFrameMessageManager.h"
#include "nsIMessageManager.h"
#include "nsComponentManagerUtils.h"
#include "nsSHistory.h"
@ -20,6 +21,7 @@ ChildSHistory::ChildSHistory(nsDocShell* aDocShell)
: mDocShell(aDocShell)
, mHistory(new nsSHistory())
{
MOZ_ASSERT(mDocShell);
mHistory->SetRootDocShell(mDocShell);
}
@ -131,10 +133,13 @@ nsISupports*
ChildSHistory::GetParentObject() const
{
// We want to get the TabChildGlobal, which is the
// nsIContentFrameMessageManager on mDocShell.
nsCOMPtr<nsIContentFrameMessageManager> mm =
do_GetInterface(static_cast<nsIDocShell*>(mDocShell));
return mm;
// messageManager on mDocShell.
RefPtr<ContentFrameMessageManager> mm;
if (mDocShell) {
mm = mDocShell->GetMessageManager();
}
// else we must be unlinked... can that happen here?
return ToSupports(mm);
}
} // namespace dom

View File

@ -509,14 +509,13 @@ mozilla::dom::TraceBlackJS(JSTracer* aTrc, bool aIsShutdownGC)
if (ds) {
nsCOMPtr<nsITabChild> tabChild = ds->GetTabChild();
if (tabChild) {
nsCOMPtr<nsISupports> mm;
RefPtr<ContentFrameMessageManager> mm;
tabChild->GetMessageManager(getter_AddRefs(mm));
nsCOMPtr<EventTarget> et = do_QueryInterface(mm);
if (et) {
if (mm) {
nsCOMPtr<nsISupports> tabChildAsSupports =
do_QueryInterface(tabChild);
mozilla::TraceScriptHolder(tabChildAsSupports, aTrc);
EventListenerManager* elm = et->GetExistingListenerManager();
EventListenerManager* elm = mm->GetExistingListenerManager();
if (elm) {
elm->TraceListeners(aTrc);
}

View File

@ -145,7 +145,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameMessageManager)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentFrameMessageManager)
NS_INTERFACE_MAP_ENTRY(nsISupports)
/* Message managers in child process implement nsIMessageSender.
Message managers in the chrome process are
@ -153,9 +153,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameMessageManager)
managers) or they're simple message senders. */
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIMessageSender, !mChrome || !mIsBroadcaster)
/* nsIContentFrameMessageManager is accessible only in TabChildGlobal. */
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIContentFrameMessageManager,
!mChrome && !mIsProcessManager)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameMessageManager)

View File

@ -161,7 +161,7 @@ private:
JS::Rooted<JSObject*> mObj;
};
class nsFrameMessageManager : public nsIContentFrameMessageManager
class nsFrameMessageManager : public nsIMessageSender
{
friend class mozilla::dom::MessageManagerReporter;
typedef mozilla::dom::ipc::StructuredCloneData StructuredCloneData;
@ -180,8 +180,7 @@ public:
{}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsFrameMessageManager,
nsIContentFrameMessageManager)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsFrameMessageManager)
void MarkForCC();
@ -243,7 +242,6 @@ public:
mozilla::dom::ipc::WritableSharedMap* SharedData();
NS_DECL_NSIMESSAGESENDER
NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
static mozilla::dom::ProcessMessageManager* NewProcessMessageManager(bool aIsRemote);

View File

@ -13,14 +13,8 @@ interface nsIMessageSender : nsISupports
{
};
// NOTE: Only scriptable for Ci.nsIContentFrameMessageManager
[scriptable, builtinclass, uuid(694e367c-aa25-4446-8499-2c527c4bd838)]
interface nsIContentFrameMessageManager : nsIMessageSender
{
};
[uuid(b39a3324-b574-4f85-8cdb-274d04f807ef)]
interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
interface nsIInProcessContentFrameMessageManager : nsIMessageSender
{
[notxpcom] nsIContent getOwnerContent();
};

View File

@ -166,7 +166,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsInProcessTabChildGlobal)
NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
NS_INTERFACE_MAP_ENTRY(nsIContentFrameMessageManager)
NS_INTERFACE_MAP_ENTRY(nsIInProcessContentFrameMessageManager)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)

View File

@ -84,7 +84,6 @@ public:
virtual uint64_t ChromeOuterWindowID() override;
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
NS_DECL_NSIINPROCESSCONTENTFRAMEMESSAGEMANAGER

View File

@ -8,13 +8,15 @@
interface nsIWebBrowserChrome3;
webidl ContentFrameMessageManager;
native CommandsArray(nsTArray<nsCString>);
[ref] native CommandsArrayRef(nsTArray<nsCString>);
[scriptable, uuid(1fb79c27-e760-4088-b19c-1ce3673ec24e)]
interface nsITabChild : nsISupports
{
readonly attribute nsISupports messageManager;
readonly attribute ContentFrameMessageManager messageManager;
attribute nsIWebBrowserChrome3 webBrowserChrome;

View File

@ -2993,9 +2993,9 @@ TabChild::IsVisible()
}
NS_IMETHODIMP
TabChild::GetMessageManager(nsISupports** aResult)
TabChild::GetMessageManager(ContentFrameMessageManager** aResult)
{
nsCOMPtr<nsIContentFrameMessageManager> mm(mTabChildGlobal);
RefPtr<ContentFrameMessageManager> mm(mTabChildGlobal);
mm.forget(aResult);
return *aResult ? NS_OK : NS_ERROR_FAILURE;
}
@ -3551,7 +3551,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TabChildGlobal)
NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
NS_INTERFACE_MAP_ENTRY(nsIContentFrameMessageManager)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)

View File

@ -80,7 +80,7 @@ class CoalescedMouseData;
class CoalescedWheelData;
class TabChildGlobal : public ContentFrameMessageManager,
public nsIContentFrameMessageManager,
public nsIMessageSender,
public nsIScriptObjectPrincipal,
public nsIGlobalObject,
public nsSupportsWeakReference
@ -108,7 +108,6 @@ public:
virtual uint64_t ChromeOuterWindowID() override;
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
void
GetEventTargetParent(EventChainPreVisitor& aVisitor) override