Bug 1549753 - Add `windowGlobalParents` getter to nsIRemoteTab. r=afarre
authorRyan Hunt <rhunt@eqrion.net>
Tue, 07 May 2019 11:09:15 -0500
changeset 532049 57f13fa5da0abf289a4b02a88703ecdc7e917f0f
parent 532048 5c8c16e22ba1904a8574901a1aa46406b65d4a80
child 532050 f28f80e2466839e5b50c9b9f728988044fecb186
child 532253 a2c6cc61a9f29bc5d3ea828b59315091fee086db
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersafarre
bugs1549753
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1549753 - Add `windowGlobalParents` getter to nsIRemoteTab. r=afarre Differential Revision: https://phabricator.services.mozilla.com/D30218
dom/interfaces/base/nsIRemoteTab.idl
dom/ipc/BrowserParent.cpp
--- a/dom/interfaces/base/nsIRemoteTab.idl
+++ b/dom/interfaces/base/nsIRemoteTab.idl
@@ -2,16 +2,17 @@
  * 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"
 
 interface nsIPrincipal;
 webidl Element;
+webidl WindowGlobalParent;
 
 [builtinclass, scriptable, uuid(8e49f7b0-1f98-4939-bf91-e9c39cd56434)]
 interface nsIRemoteTab : nsISupports
 {
   /**
    * Manages the docshell active state of the remote browser. Setting the
    * docShell to be active will also cause it to render layers and upload
    * them to the compositor. Setting the docShell as not active will clear
@@ -64,16 +65,21 @@ interface nsIRemoteTab : nsISupports
   readonly attribute boolean hasContentOpener;
   /**
    * True if we've previously received layers for this tab when switching to
    * it.
    */
   readonly attribute boolean hasPresented;
 
   /**
+   * Gets all of the WindowGlobalParent actors for this remote tab.
+   */
+  readonly attribute Array<WindowGlobalParent> windowGlobalParents;
+
+  /**
    * Ensures that the content process which has this remote tab has all of the
    * permissions required to load a document with the given principal.
    */
   void transmitPermissionsForPrincipal(in nsIPrincipal aPrincipal);
 
   /**
    * True if any of the frames loaded in the tab have registered
    * an onbeforeunload event handler.
--- a/dom/ipc/BrowserParent.cpp
+++ b/dom/ipc/BrowserParent.cpp
@@ -3245,16 +3245,31 @@ BrowserParent::GetHasPresented(bool* aRe
   return NS_OK;
 }
 
 void BrowserParent::NavigateByKey(bool aForward, bool aForDocumentNavigation) {
   Unused << SendNavigateByKey(aForward, aForDocumentNavigation);
 }
 
 NS_IMETHODIMP
+BrowserParent::GetWindowGlobalParents(
+    nsTArray<RefPtr<WindowGlobalParent>>& aWindowGlobalParents) {
+  VisitAll([&aWindowGlobalParents](BrowserParent* aBrowser) {
+    const auto& windowGlobalParents = aBrowser->ManagedPWindowGlobalParent();
+    for (auto iter = windowGlobalParents.ConstIter(); !iter.Done();
+         iter.Next()) {
+      WindowGlobalParent* windowGlobalParent =
+          static_cast<WindowGlobalParent*>(iter.Get()->GetKey());
+      aWindowGlobalParents.AppendElement(windowGlobalParent);
+    }
+  });
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 BrowserParent::TransmitPermissionsForPrincipal(nsIPrincipal* aPrincipal) {
   return Manager()->TransmitPermissionsForPrincipal(aPrincipal);
 }
 
 NS_IMETHODIMP
 BrowserParent::GetHasBeforeUnload(bool* aResult) {
   *aResult = mHasBeforeUnload;
   return NS_OK;