Bug 1549753 - Use Visit method in BrowserParent::SetOwnerElement. r=afarre
authorRyan Hunt <rhunt@eqrion.net>
Tue, 07 May 2019 11:08:48 -0500
changeset 532048 5c8c16e22ba1904a8574901a1aa46406b65d4a80
parent 532047 935abf72cddc101831a8f4dc314d1ad94a68c3c9
child 532049 57f13fa5da0abf289a4b02a88703ecdc7e917f0f
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 - Use Visit method in BrowserParent::SetOwnerElement. r=afarre Differential Revision: https://phabricator.services.mozilla.com/D30216
dom/ipc/BrowserParent.cpp
--- a/dom/ipc/BrowserParent.cpp
+++ b/dom/ipc/BrowserParent.cpp
@@ -535,24 +535,19 @@ void BrowserParent::SetOwnerElement(Elem
   }
 
   // Set our BrowsingContext's embedder if we're not embedded within a
   // BrowserBridgeParent.
   if (!GetBrowserBridgeParent() && mBrowsingContext) {
     mBrowsingContext->SetEmbedderElement(mFrameElement);
   }
 
-  // Ensure all BrowserParent actors within BrowserBridges are also updated.
-  const auto& browserBridges = ManagedPBrowserBridgeParent();
-  for (auto iter = browserBridges.ConstIter(); !iter.Done(); iter.Next()) {
-    BrowserBridgeParent* browserBridge =
-        static_cast<BrowserBridgeParent*>(iter.Get()->GetKey());
-
-    browserBridge->GetBrowserParent()->SetOwnerElement(aElement);
-  }
+  VisitChildren([aElement](BrowserBridgeParent* aBrowser) {
+    aBrowser->GetBrowserParent()->SetOwnerElement(aElement);
+  });
 }
 
 NS_IMETHODIMP BrowserParent::GetOwnerElement(Element** aElement) {
   *aElement = do_AddRef(GetOwnerElement()).take();
   return NS_OK;
 }
 
 void BrowserParent::CacheFrameLoader(nsFrameLoader* aFrameLoader) {