Bug 1484373: Part 1 - Allow querying to ContentFrameMessageManager. r=smaug
authorKris Maglione <maglione.k@gmail.com>
Fri, 17 Aug 2018 16:14:43 -0700
changeset 481483 ddba7fcc0d3b5493f7039d5dd61a77d647cb03f3
parent 481482 e3bbdb2f97fed1fbdb74b2e15ecb3170ee490780
child 481484 70b72c8bddc6dd189bf6cbc79828b790e032af3e
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewerssmaug
bugs1484373
milestone63.0a1
Bug 1484373: Part 1 - Allow querying to ContentFrameMessageManager. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D3691
dom/base/ContentFrameMessageManager.h
dom/base/InProcessTabChildMessageManager.cpp
dom/ipc/TabChild.cpp
--- a/dom/base/ContentFrameMessageManager.h
+++ b/dom/base/ContentFrameMessageManager.h
@@ -11,26 +11,32 @@
 #include "mozilla/dom/MessageManagerGlobal.h"
 #include "mozilla/dom/ResolveSystemBinding.h"
 #include "nsContentUtils.h"
 #include "xpcpublic.h"
 
 namespace mozilla {
 namespace dom {
 
+#define NS_CONTENTFRAMEMESSAGEMANAGER_IID \
+{ 0x97e192a6, 0xab7a, 0x4c8f, \
+  { 0xb7, 0xdd, 0xf7, 0xec, 0x36, 0x38, 0x71, 0xb5 } }
+
 /**
  * Base class for implementing the WebIDL ContentFrameMessageManager class.
  */
 class ContentFrameMessageManager : public DOMEventTargetHelper,
                                    public MessageManagerGlobal
 {
 public:
   using DOMEventTargetHelper::AddRef;
   using DOMEventTargetHelper::Release;
 
+  NS_DECLARE_STATIC_IID_ACCESSOR(NS_CONTENTFRAMEMESSAGEMANAGER_IID)
+
   virtual already_AddRefed<nsPIDOMWindowOuter> GetContent(ErrorResult& aError) = 0;
   virtual already_AddRefed<nsIDocShell> GetDocShell(ErrorResult& aError) = 0;
   virtual already_AddRefed<nsIEventTarget> GetTabEventTarget() = 0;
   virtual uint64_t ChromeOuterWindowID() = 0;
 
   nsFrameMessageManager* GetMessageManager()
   {
     return mMessageManager;
@@ -45,12 +51,14 @@ public:
 
 protected:
   explicit ContentFrameMessageManager(nsFrameMessageManager* aMessageManager)
     : DOMEventTargetHelper(xpc::NativeGlobal(xpc::PrivilegedJunkScope()))
     , MessageManagerGlobal(aMessageManager)
   {}
 };
 
+NS_DEFINE_STATIC_IID_ACCESSOR(ContentFrameMessageManager, NS_CONTENTFRAMEMESSAGEMANAGER_IID)
+
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_ContentFrameMessageManager_h
--- a/dom/base/InProcessTabChildMessageManager.cpp
+++ b/dom/base/InProcessTabChildMessageManager.cpp
@@ -142,16 +142,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_IN
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mMessageManager)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocShell)
   tmp->nsMessageManagerScriptExecutor::Unlink();
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(InProcessTabChildMessageManager)
   NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
   NS_INTERFACE_MAP_ENTRY(nsIInProcessContentFrameMessageManager)
+  NS_INTERFACE_MAP_ENTRY(ContentFrameMessageManager)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
 NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
 
 NS_IMPL_ADDREF_INHERITED(InProcessTabChildMessageManager, DOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(InProcessTabChildMessageManager, DOMEventTargetHelper)
 
 JSObject*
 InProcessTabChildMessageManager::WrapObject(JSContext* aCx,
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -3558,16 +3558,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(TabChildMessageManager,
                                                   DOMEventTargetHelper)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMessageManager)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTabChild)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TabChildMessageManager)
   NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
+  NS_INTERFACE_MAP_ENTRY(ContentFrameMessageManager)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
 NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
 
 NS_IMPL_ADDREF_INHERITED(TabChildMessageManager, DOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(TabChildMessageManager, DOMEventTargetHelper)
 
 JSObject*
 TabChildMessageManager::WrapObject(JSContext* aCx,