Bug 1480244: Part 1c - Rename TabChildGlobal to TabChildMessageManager. r=bz draft
authorKris Maglione <maglione.k@gmail.com>
Fri, 10 Aug 2018 14:04:23 -0700
changeset 828427 e93e24a62aca9596f41e6d16045771177f38611c
parent 828426 02a79251d27d575cf034d117ff046d1873e667e2
child 828428 3c0bfe59abd1a357297cf8be3e7933cd372494d0
push id118679
push usermaglione.k@gmail.com
push dateFri, 10 Aug 2018 21:19:41 +0000
reviewersbz
bugs1480244
milestone63.0a1
Bug 1480244: Part 1c - Rename TabChildGlobal to TabChildMessageManager. r=bz MozReview-Commit-ID: ECtFjFV7dZa
docshell/shistory/ChildSHistory.cpp
dom/base/nsCCUncollectableMarker.cpp
dom/base/nsFrameMessageManager.cpp
dom/base/nsWrapperCache.h
dom/events/EventDispatcher.cpp
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
--- a/docshell/shistory/ChildSHistory.cpp
+++ b/docshell/shistory/ChildSHistory.cpp
@@ -127,17 +127,17 @@ JSObject*
 ChildSHistory::WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto)
 {
   return ChildSHistory_Binding::Wrap(cx, this, aGivenProto);
 }
 
 nsISupports*
 ChildSHistory::GetParentObject() const
 {
-  // We want to get the TabChildGlobal, which is the
+  // We want to get the TabChildMessageManager, which is the
   // messageManager on mDocShell.
   RefPtr<ContentFrameMessageManager> mm;
   if (mDocShell) {
     mm = mDocShell->GetMessageManager();
   }
   // else we must be unlinked... can that happen here?
   return ToSupports(mm);
 }
--- a/dom/base/nsCCUncollectableMarker.cpp
+++ b/dom/base/nsCCUncollectableMarker.cpp
@@ -286,17 +286,17 @@ MarkWindowList(nsISimpleEnumerator* aWin
          iter) {
     if (nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryInterface(iter)) {
       nsCOMPtr<nsIDocShell> rootDocShell = window->GetDocShell();
 
       MarkDocShell(rootDocShell, aCleanupJS);
 
       RefPtr<TabChild> tabChild = TabChild::GetFrom(rootDocShell);
       if (tabChild) {
-        RefPtr<TabChildGlobal> mm = tabChild->GetMessageManager();
+        RefPtr<TabChildMessageManager> mm = tabChild->GetMessageManager();
         if (mm) {
           // MarkForCC ends up calling UnmarkGray on message listeners, which
           // TraceBlackJS can't do yet.
           mm->MarkForCC();
         }
       }
     }
   }
@@ -498,18 +498,18 @@ mozilla::dom::TraceBlackJS(JSTracer* aTr
             EventListenerManager* elm = inner->GetExistingListenerManager();
             if (elm) {
               elm->TraceListeners(aTrc);
             }
           }
         }
 
         if (window->IsRootOuterWindow()) {
-          // In child process trace all the TabChildGlobals.
-          // Since there is one root outer window per TabChildGlobal, we need
+          // In child process trace all the TabChildMessageManagers.
+          // Since there is one root outer window per TabChildMessageManager, we need
           // to look for only those windows, not all.
           nsIDocShell* ds = window->GetDocShell();
           if (ds) {
             nsCOMPtr<nsITabChild> tabChild = ds->GetTabChild();
             if (tabChild) {
               RefPtr<ContentFrameMessageManager> mm;
               tabChild->GetMessageManager(getter_AddRefs(mm));
               if (mm) {
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -804,17 +804,17 @@ nsFrameMessageManager::ReceiveMessage(ns
       if (aTargetFrameLoader) {
         argument.mTargetFrameLoader.Construct(*aTargetFrameLoader);
       }
 
       JS::Rooted<JS::Value> thisValue(cx, JS::UndefinedValue());
 
       if (JS::IsCallable(object)) {
         // A small hack to get 'this' value right on content side where
-        // messageManager is wrapped in TabChildGlobal.
+        // messageManager is wrapped in TabChildMessageManager's global.
         nsCOMPtr<nsISupports> defaultThisValue;
         if (mChrome) {
           defaultThisValue = do_QueryObject(this);
         } else {
           defaultThisValue = aTarget;
         }
         js::AssertSameCompartment(cx, object);
         aError = nsContentUtils::WrapNative(cx, defaultThisValue, &thisValue);
--- a/dom/base/nsWrapperCache.h
+++ b/dom/base/nsWrapperCache.h
@@ -13,17 +13,17 @@
 #include "js/Value.h"       // must come before js/RootingAPI.h
 #include "js/RootingAPI.h"
 #include "js/TracingAPI.h"
 
 namespace mozilla {
 namespace dom {
 class ContentProcessMessageManager;
 class InProcessTabChildMessageManager;
-class TabChildGlobal;
+class TabChildMessageManager;
 } // namespace dom
 } // namespace mozilla
 class SandboxPrivate;
 class nsWindowRoot;
 
 #define NS_WRAPPERCACHE_IID \
 { 0x6f3179a1, 0x36f7, 0x4a5c, \
   { 0x8c, 0xf1, 0xad, 0xc8, 0x7c, 0xde, 0x3e, 0x87 } }
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -881,17 +881,17 @@ EventDispatcher::Dispatch(nsISupports* a
       // If we can't dispatch the event to chrome, do nothing.
       EventTarget* piTarget = win ? win->GetParentTarget() : nullptr;
       if (!piTarget) {
         return NS_OK;
       }
 
       // Set the target to be the original dispatch target,
       aEvent->mTarget = target;
-      // but use chrome event handler or TabChildGlobal for event target chain.
+      // but use chrome event handler or TabChildMessageManager for event target chain.
       target = piTarget;
     } else if (NS_WARN_IF(!doc)) {
       return NS_ERROR_UNEXPECTED;
     }
   }
 
 #ifdef DEBUG
   if (NS_IsMainThread() &&
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -2751,17 +2751,17 @@ TabChild::InitTabChildGlobal()
 {
   if (!mTabChildGlobal) {
     nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
     NS_ENSURE_TRUE(window, false);
     nsCOMPtr<EventTarget> chromeHandler =
       do_QueryInterface(window->GetChromeEventHandler());
     NS_ENSURE_TRUE(chromeHandler, false);
 
-    RefPtr<TabChildGlobal> scope = mTabChildGlobal = new TabChildGlobal(this);
+    RefPtr<TabChildMessageManager> scope = mTabChildGlobal = new TabChildMessageManager(this);
 
     NS_NAMED_LITERAL_CSTRING(globalId, "outOfProcessTabChildGlobal");
     if (NS_WARN_IF(!InitChildGlobalInternal(globalId))) {
         mTabChildGlobal = nullptr;
         return false;
     }
 
     nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(chromeHandler);
@@ -3518,153 +3518,153 @@ TabChild::GetHasSiblings(bool* aHasSibli
 
 nsresult
 TabChild::SetHasSiblings(bool aHasSiblings)
 {
   mHasSiblings = aHasSiblings;
   return NS_OK;
 }
 
-TabChildGlobal::TabChildGlobal(TabChild* aTabChild)
+TabChildMessageManager::TabChildMessageManager(TabChild* aTabChild)
 : ContentFrameMessageManager(new nsFrameMessageManager(aTabChild)),
   mTabChild(aTabChild)
 {
 }
 
-TabChildGlobal::~TabChildGlobal()
+TabChildMessageManager::~TabChildMessageManager()
 {
 }
 
-NS_IMPL_CYCLE_COLLECTION_CLASS(TabChildGlobal)
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(TabChildGlobal,
+NS_IMPL_CYCLE_COLLECTION_CLASS(TabChildMessageManager)
+
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(TabChildMessageManager,
                                                 DOMEventTargetHelper)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mMessageManager);
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mTabChild);
   tmp->UnlinkHostObjectURIs();
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(TabChildGlobal,
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(TabChildMessageManager,
                                                   DOMEventTargetHelper)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMessageManager)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTabChild)
   tmp->TraverseHostObjectURIs(cb);
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TabChildGlobal)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TabChildMessageManager)
   NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
   NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
   NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
 NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
 
-NS_IMPL_ADDREF_INHERITED(TabChildGlobal, DOMEventTargetHelper)
-NS_IMPL_RELEASE_INHERITED(TabChildGlobal, DOMEventTargetHelper)
+NS_IMPL_ADDREF_INHERITED(TabChildMessageManager, DOMEventTargetHelper)
+NS_IMPL_RELEASE_INHERITED(TabChildMessageManager, DOMEventTargetHelper)
 
 bool
-TabChildGlobal::WrapGlobalObject(JSContext* aCx,
-                                 JS::RealmOptions& aOptions,
-                                 JS::MutableHandle<JSObject*> aReflector)
+TabChildMessageManager::WrapGlobalObject(JSContext* aCx,
+                                         JS::RealmOptions& aOptions,
+                                         JS::MutableHandle<JSObject*> aReflector)
 {
   bool ok = ContentFrameMessageManager_Binding::Wrap(aCx, this, this, aOptions,
-                                                       nsJSPrincipals::get(mTabChild->GetPrincipal()),
-                                                       true, aReflector);
+                                                     nsJSPrincipals::get(mTabChild->GetPrincipal()),
+                                                     true, aReflector);
   if (ok) {
     // Since we can't rewrap we have to preserve the global's wrapper here.
     PreserveWrapper(ToSupports(this));
   }
   return ok;
 }
 
 void
-TabChildGlobal::MarkForCC()
+TabChildMessageManager::MarkForCC()
 {
   if (mTabChild) {
     mTabChild->MarkScopesForCC();
   }
   EventListenerManager* elm = GetExistingListenerManager();
   if (elm) {
     elm->MarkForCC();
   }
   MessageManagerGlobal::MarkForCC();
 }
 
 already_AddRefed<nsPIDOMWindowOuter>
-TabChildGlobal::GetContent(ErrorResult& aError)
+TabChildMessageManager::GetContent(ErrorResult& aError)
 {
   if (!mTabChild) {
     aError.Throw(NS_ERROR_NULL_POINTER);
     return nullptr;
   }
   nsCOMPtr<nsPIDOMWindowOuter> window =
     do_GetInterface(mTabChild->WebNavigation());
   return window.forget();
 }
 
 already_AddRefed<nsIDocShell>
-TabChildGlobal::GetDocShell(ErrorResult& aError)
+TabChildMessageManager::GetDocShell(ErrorResult& aError)
 {
   if (!mTabChild) {
     aError.Throw(NS_ERROR_NULL_POINTER);
     return nullptr;
   }
   nsCOMPtr<nsIDocShell> window = do_GetInterface(mTabChild->WebNavigation());
   return window.forget();
 }
 
 already_AddRefed<nsIEventTarget>
-TabChildGlobal::GetTabEventTarget()
+TabChildMessageManager::GetTabEventTarget()
 {
   nsCOMPtr<nsIEventTarget> target = EventTargetFor(TaskCategory::Other);
   return target.forget();
 }
 
 uint64_t
-TabChildGlobal::ChromeOuterWindowID()
+TabChildMessageManager::ChromeOuterWindowID()
 {
   if (!mTabChild) {
     return 0;
   }
   return mTabChild->ChromeOuterWindowID();
 }
 
 nsIPrincipal*
-TabChildGlobal::GetPrincipal()
+TabChildMessageManager::GetPrincipal()
 {
   if (!mTabChild)
     return nullptr;
   return mTabChild->GetPrincipal();
 }
 
 JSObject*
-TabChildGlobal::GetGlobalJSObject()
+TabChildMessageManager::GetGlobalJSObject()
 {
   NS_ENSURE_TRUE(mTabChild, nullptr);
   return GetWrapper();
 }
 
 nsresult
-TabChildGlobal::Dispatch(TaskCategory aCategory,
+TabChildMessageManager::Dispatch(TaskCategory aCategory,
                          already_AddRefed<nsIRunnable>&& aRunnable)
 {
   if (mTabChild && mTabChild->TabGroup()) {
     return mTabChild->TabGroup()->Dispatch(aCategory, std::move(aRunnable));
   }
   return DispatcherTrait::Dispatch(aCategory, std::move(aRunnable));
 }
 
 nsISerialEventTarget*
-TabChildGlobal::EventTargetFor(TaskCategory aCategory) const
+TabChildMessageManager::EventTargetFor(TaskCategory aCategory) const
 {
   if (mTabChild && mTabChild->TabGroup()) {
     return mTabChild->TabGroup()->EventTargetFor(aCategory);
   }
   return DispatcherTrait::EventTargetFor(aCategory);
 }
 
 AbstractThread*
-TabChildGlobal::AbstractMainThreadFor(TaskCategory aCategory)
+TabChildMessageManager::AbstractMainThreadFor(TaskCategory aCategory)
 {
   if (mTabChild && mTabChild->TabGroup()) {
     return mTabChild->TabGroup()->AbstractMainThreadFor(aCategory);
   }
   return DispatcherTrait::AbstractMainThreadFor(aCategory);
 }
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -74,27 +74,27 @@ struct AutoCacheNativeKeyCommands;
 namespace dom {
 
 class TabChild;
 class TabGroup;
 class ClonedMessageData;
 class CoalescedMouseData;
 class CoalescedWheelData;
 
-class TabChildGlobal : public ContentFrameMessageManager,
-                       public nsIMessageSender,
-                       public nsIScriptObjectPrincipal,
-                       public nsIGlobalObject,
-                       public nsSupportsWeakReference
+class TabChildMessageManager : public ContentFrameMessageManager,
+                               public nsIMessageSender,
+                               public nsIScriptObjectPrincipal,
+                               public nsIGlobalObject,
+                               public nsSupportsWeakReference
 {
 public:
-  explicit TabChildGlobal(TabChild* aTabChild);
+  explicit TabChildMessageManager(TabChild* aTabChild);
 
   NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, DOMEventTargetHelper)
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildMessageManager, DOMEventTargetHelper)
 
   void MarkForCC();
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override
   {
     MOZ_CRASH("We should never get here!");
   }
@@ -126,17 +126,17 @@ public:
   EventTargetFor(mozilla::TaskCategory aCategory) const override;
 
   virtual AbstractThread*
   AbstractMainThreadFor(mozilla::TaskCategory aCategory) override;
 
   RefPtr<TabChild> mTabChild;
 
 protected:
-  ~TabChildGlobal();
+  ~TabChildMessageManager();
 };
 
 class ContentListener final : public nsIDOMEventListener
 {
 public:
   explicit ContentListener(TabChild* aTabChild) : mTabChild(aTabChild) {}
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMEVENTLISTENER
@@ -195,17 +195,17 @@ protected:
   void DispatchMessageManagerMessage(const nsAString& aMessageName,
                                      const nsAString& aJSONData);
 
   void ProcessUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics);
 
   bool UpdateFrameHandler(const mozilla::layers::FrameMetrics& aFrameMetrics);
 
 protected:
-  RefPtr<TabChildGlobal> mTabChildGlobal;
+  RefPtr<TabChildMessageManager> mTabChildGlobal;
   nsCOMPtr<nsIWebBrowserChrome3> mWebBrowserChrome;
 };
 
 class TabChild final : public TabChildBase,
                        public PBrowserChild,
                        public nsIWebBrowserChrome2,
                        public nsIEmbeddingSiteWindow,
                        public nsIWebBrowserChromeFocus,
@@ -273,17 +273,17 @@ public:
   NS_DECL_NSITABCHILD
   NS_DECL_NSIOBSERVER
   NS_DECL_NSITOOLTIPLISTENER
 
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(TabChild, TabChildBase)
 
   FORWARD_SHMEM_ALLOCATOR_TO(PBrowserChild)
 
-  TabChildGlobal* GetMessageManager()
+  TabChildMessageManager* GetMessageManager()
   {
     return mTabChildGlobal;
   }
 
   /**
    * MessageManagerCallback methods that we override.
    */
   virtual bool DoSendBlockingMessage(JSContext* aCx,