Bug 1520372 - Add an ownerElement property to nsITabParent, r=qdot
authorNika Layzell <nika@thelayzells.com>
Wed, 16 Jan 2019 20:00:17 +0000
changeset 511571 6927759957ba288fffa5c32011b758cc7aeea5a4
parent 511570 a69c1a1dc6fe4dec9598bcdd3038d12bf681a045
child 511572 2a3cb2c2431d84093ba8caae7444dd681c3a2c66
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1520372
milestone66.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 1520372 - Add an ownerElement property to nsITabParent, r=qdot Differential Revision: https://phabricator.services.mozilla.com/D16713
dom/interfaces/base/nsITabParent.idl
dom/ipc/TabParent.cpp
--- a/dom/interfaces/base/nsITabParent.idl
+++ b/dom/interfaces/base/nsITabParent.idl
@@ -1,16 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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;
 
 [builtinclass, scriptable, uuid(8e49f7b0-1f98-4939-bf91-e9c39cd56434)]
 interface nsITabParent : nsISupports
 {
   void getChildProcessOffset(out int32_t aCssX, out int32_t aCssY);
 
   /**
    * Manages the docshell active state of the remote browser. Setting the
@@ -77,16 +78,21 @@ interface nsITabParent : nsISupports
 
   /**
    * True if any of the frames loaded in the TabChild have registered
    * an onbeforeunload event handler.
    */
   readonly attribute boolean hasBeforeUnload;
 
   /**
+   * The frame element which currently embeds this nsITabParent object.
+   */
+  readonly attribute Element ownerElement;
+
+  /**
    * Notify APZ to start autoscrolling.
    * (aAnchorX, aAnchorY) are the coordinates of the autoscroll anchor,
    * in CSS coordinates relative to the screen. aScrollId and 
    * aPresShellId identify the scroll frame that content chose to scroll.
    * Returns whether we were successfully able to notify APZ.
    * If this function returns true, APZ (which may live in another process)
    * may still reject the autoscroll, but it's then APZ's reponsibility
    * to notify content via an "autoscroll-rejected-by-apz" message.
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -300,16 +300,21 @@ void TabParent::SetOwnerElement(Element*
     WindowsHandle widgetNativeData = reinterpret_cast<WindowsHandle>(
         widget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW));
     if (widgetNativeData) {
       Unused << SendSetWidgetNativeData(widgetNativeData);
     }
   }
 }
 
+NS_IMETHODIMP TabParent::GetOwnerElement(Element** aElement) {
+  *aElement = do_AddRef(GetOwnerElement()).take();
+  return NS_OK;
+}
+
 void TabParent::AddWindowListeners() {
   if (mFrameElement) {
     if (nsCOMPtr<nsPIDOMWindowOuter> window =
             mFrameElement->OwnerDoc()->GetWindow()) {
       nsCOMPtr<EventTarget> eventTarget = window->GetTopWindowRoot();
       if (eventTarget) {
         eventTarget->AddEventListener(NS_LITERAL_STRING("MozUpdateWindowPos"),
                                       this, false, false);