Bug 1525720, part 3 - Remove method to createRemoteFrameLoader from nsIMozBrowserFrame interface. r=farre
☠☠ backed out by f287bb6c1894 ☠ ☠
authorRyan Hunt <rhunt@eqrion.net>
Wed, 24 Apr 2019 23:25:56 -0500
changeset 474956 9a255864f75ddcf4096b6222d016a914f5a43c8a
parent 474955 5f1c1b609ec1ecc28734e1b6daeeb3f6854ded38
child 474957 b255e0a84e12657a62a2cdfd4a4c2ebb893b2a0d
push id113182
push userrhunt@eqrion.net
push dateWed, 22 May 2019 20:02:12 +0000
treeherdermozilla-inbound@9b79caa460a0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfarre
bugs1525720
milestone69.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 1525720, part 3 - Remove method to createRemoteFrameLoader from nsIMozBrowserFrame interface. r=farre This appears unused and adds unneeded surface area for these API's to support. Differential Revision: https://phabricator.services.mozilla.com/D31431
dom/base/nsFrameLoader.cpp
dom/base/nsFrameLoader.h
dom/html/nsGenericHTMLFrameElement.cpp
dom/html/nsGenericHTMLFrameElement.h
dom/interfaces/html/nsIMozBrowserFrame.idl
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -3038,20 +3038,20 @@ nsresult nsFrameLoader::ReallyLoadFrameS
   }
   return NS_OK;
 }
 
 already_AddRefed<Element> nsFrameLoader::GetOwnerElement() {
   return do_AddRef(mOwnerContent);
 }
 
-void nsFrameLoader::SetRemoteBrowser(nsIRemoteTab* aBrowserParent) {
+void nsFrameLoader::InitializeFromBrowserParent(BrowserParent* aBrowserParent) {
   MOZ_ASSERT(!mBrowserParent);
   mIsRemoteFrame = true;
-  mBrowserParent = BrowserParent::GetFrom(aBrowserParent);
+  mBrowserParent = aBrowserParent;
   mChildID = mBrowserParent ? mBrowserParent->Manager()->ChildID() : 0;
   MaybeUpdatePrimaryBrowserParent(eBrowserParentChanged);
   ReallyLoadFrameScripts();
   InitializeBrowserAPI();
   mBrowserParent->InitRendering();
   ShowRemoteFrame(ScreenIntSize(0, 0));
 }
 
--- a/dom/base/nsFrameLoader.h
+++ b/dom/base/nsFrameLoader.h
@@ -337,17 +337,17 @@ class nsFrameLoader final : public nsStu
   /**
    * Tell this FrameLoader to use a particular remote browser.
    *
    * This will assert if mBrowserParent is non-null.  In practice,
    * this means you can't have successfully run TryRemoteBrowser() on
    * this object, which means you can't have called ShowRemoteFrame()
    * or ReallyStartLoading().
    */
-  void SetRemoteBrowser(nsIRemoteTab* aBrowserParent);
+  void InitializeFromBrowserParent(BrowserParent* aBrowserParent);
 
   /**
    * Stashes a detached nsIFrame on the frame loader. We do this when we're
    * destroying the nsSubDocumentFrame. If the nsSubdocumentFrame is
    * being reframed we'll restore the detached nsIFrame when it's recreated,
    * otherwise we'll discard the old presentation and set the detached
    * subdoc nsIFrame to null. aContainerDoc is the document containing the
    * the subdoc frame. This enables us to detect when the containing
--- a/dom/html/nsGenericHTMLFrameElement.cpp
+++ b/dom/html/nsGenericHTMLFrameElement.cpp
@@ -127,31 +127,44 @@ void nsGenericHTMLFrameElement::EnsureFr
     return;
   }
 
   // Strangely enough, this method doesn't actually ensure that the
   // frameloader exists.  It's more of a best-effort kind of thing.
   mFrameLoader = nsFrameLoader::Create(this, mOpenerWindow, mNetworkCreated);
 }
 
-nsresult nsGenericHTMLFrameElement::CreateRemoteFrameLoader(
-    nsIRemoteTab* aBrowserParent) {
+void nsGenericHTMLFrameElement::DisallowCreateFrameLoader() {
+  MOZ_ASSERT(!mFrameLoader);
+  MOZ_ASSERT(!mFrameLoaderCreationDisallowed);
+  mFrameLoaderCreationDisallowed = true;
+}
+
+void nsGenericHTMLFrameElement::AllowCreateFrameLoader() {
+  MOZ_ASSERT(!mFrameLoader);
+  MOZ_ASSERT(mFrameLoaderCreationDisallowed);
+  mFrameLoaderCreationDisallowed = false;
+}
+
+void nsGenericHTMLFrameElement::CreateRemoteFrameLoader(
+    BrowserParent* aBrowserParent) {
   MOZ_ASSERT(!mFrameLoader);
   EnsureFrameLoader();
-  NS_ENSURE_STATE(mFrameLoader);
-  mFrameLoader->SetRemoteBrowser(aBrowserParent);
+  if (NS_WARN_IF(!mFrameLoader)) {
+    return;
+  }
+  mFrameLoader->InitializeFromBrowserParent(aBrowserParent);
 
   if (nsSubDocumentFrame* subdocFrame = do_QueryFrame(GetPrimaryFrame())) {
     // The reflow for this element already happened while we were waiting
     // for the iframe creation. Therefore the subdoc frame didn't have a
     // frameloader when UpdatePositionAndSize was supposed to be called in
     // ReflowFinished, and we need to do it properly now.
     mFrameLoader->UpdatePositionAndSize(subdocFrame);
   }
-  return NS_OK;
 }
 
 void nsGenericHTMLFrameElement::PresetOpenerWindow(
     const Nullable<WindowProxyHolder>& aOpenerWindow, ErrorResult& aRv) {
   MOZ_ASSERT(!mFrameLoader);
   mOpenerWindow =
       aOpenerWindow.IsNull() ? nullptr : aOpenerWindow.Value().get();
 }
@@ -438,32 +451,16 @@ NS_IMETHODIMP nsGenericHTMLFrameElement:
   }
 
   // Isolation is only disabled if the attribute is present
   *aOut = !HasAttr(kNameSpaceID_None, nsGkAtoms::noisolation);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericHTMLFrameElement::DisallowCreateFrameLoader() {
-  MOZ_ASSERT(!mFrameLoader);
-  MOZ_ASSERT(!mFrameLoaderCreationDisallowed);
-  mFrameLoaderCreationDisallowed = true;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGenericHTMLFrameElement::AllowCreateFrameLoader() {
-  MOZ_ASSERT(!mFrameLoader);
-  MOZ_ASSERT(mFrameLoaderCreationDisallowed);
-  mFrameLoaderCreationDisallowed = false;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsGenericHTMLFrameElement::InitializeBrowserAPI() {
   MOZ_ASSERT(mFrameLoader);
   InitBrowserElementAPI();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGenericHTMLFrameElement::DestroyBrowserFrameScripts() {
--- a/dom/html/nsGenericHTMLFrameElement.h
+++ b/dom/html/nsGenericHTMLFrameElement.h
@@ -14,16 +14,17 @@
 #include "nsFrameLoader.h"
 #include "nsFrameLoaderOwner.h"
 #include "nsGenericHTMLElement.h"
 #include "nsIDOMEventListener.h"
 #include "nsIMozBrowserFrame.h"
 
 namespace mozilla {
 namespace dom {
+class BrowserParent;
 template <typename>
 struct Nullable;
 class WindowProxyHolder;
 class XULFrameElement;
 }  // namespace dom
 }  // namespace mozilla
 
 #define NS_GENERICHTMLFRAMEELEMENT_IID               \
@@ -85,16 +86,41 @@ class nsGenericHTMLFrameElement : public
 
   void SwapFrameLoaders(nsFrameLoaderOwner* aOtherLoaderOwner,
                         mozilla::ErrorResult& rv);
 
   void PresetOpenerWindow(const mozilla::dom::Nullable<
                               mozilla::dom::WindowProxyHolder>& aOpenerWindow,
                           mozilla::ErrorResult& aRv);
 
+  /**
+   * Normally, a frame tries to create its frame loader when its src is
+   * modified, or its contentWindow is accessed.
+   *
+   * disallowCreateFrameLoader prevents the frame element from creating its
+   * frame loader (in the same way that not being inside a document prevents the
+   * creation of a frame loader).  allowCreateFrameLoader lifts this
+   * restriction.
+   *
+   * These methods are not re-entrant -- it is an error to call
+   * disallowCreateFrameLoader twice without first calling allowFrameLoader.
+   *
+   * It's also an error to call either method if we already have a frame loader.
+   */
+  void DisallowCreateFrameLoader();
+  void AllowCreateFrameLoader();
+
+  /**
+   * Create a remote (i.e., out-of-process) frame loader attached to the given
+   * remote tab.
+   *
+   * It is an error to call this method if we already have a frame loader.
+   */
+  void CreateRemoteFrameLoader(mozilla::dom::BrowserParent* aBrowserParent);
+
   static void InitStatics();
   static bool BrowserFramesEnabled();
 
   /**
    * Helper method to map a HTML 'scrolling' attribute value to a nsIScrollable
    * enum value.  scrolling="no" (and its synonyms) maps to
    * nsIScrollable::Scrollbar_Never, and anything else (including nullptr) maps
    * to nsIScrollable::Scrollbar_Auto.
--- a/dom/interfaces/html/nsIMozBrowserFrame.idl
+++ b/dom/interfaces/html/nsIMozBrowserFrame.idl
@@ -31,40 +31,16 @@ interface nsIMozBrowserFrame : nsIDOMMoz
    *
    * Isolation can be disabled by setting the frame's isolated attribute to
    * false.  Disabling isolation is only allowed if the containing document has
    * browser permission (or equivalent access).
    */
   [infallible] readonly attribute boolean isolated;
 
   /**
-   * Normally, a frame tries to create its frame loader when its src is
-   * modified, or its contentWindow is accessed.
-   *
-   * disallowCreateFrameLoader prevents the frame element from creating its
-   * frame loader (in the same way that not being inside a document prevents the
-   * creation of a frame loader).  allowCreateFrameLoader lifts this restriction.
-   *
-   * These methods are not re-entrant -- it is an error to call
-   * disallowCreateFrameLoader twice without first calling allowFrameLoader.
-   *
-   * It's also an error to call either method if we already have a frame loader.
-   */
-  void disallowCreateFrameLoader();
-  void allowCreateFrameLoader();
-
-  /**
-   * Create a remote (i.e., out-of-process) frame loader attached to the given
-   * remote tab.
-   *
-   * It is an error to call this method if we already have a frame loader.
-   */
-  void createRemoteFrameLoader(in nsIRemoteTab aRemoteTab);
-
-  /**
    * Initialize the API, and add frame message listener that supports API
    * invocations.
    */
   [noscript] void initializeBrowserAPI();
 
   /**
    * Notify frame scripts that support the API to destroy.
    */