Bug 1498222 - Add BrowsingContext.docShell webidl. r=peterv
authorAndreas Farre <farre@mozilla.com>
Thu, 18 Oct 2018 06:52:30 +0000
changeset 490673 2a0dfe99894b5e2173bd37ea01a1c7292b11e886
parent 490672 6debc9a91039a43baaa8bac92779dbdf1cd82e07
child 490674 f1aba3f856d0d40fd326b7238b1998c02fe8b308
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerspeterv
bugs1498222
milestone64.0a1
Bug 1498222 - Add BrowsingContext.docShell webidl. r=peterv Differential Revision: https://phabricator.services.mozilla.com/D8381
docshell/base/BrowsingContext.h
dom/chrome-webidl/BrowsingContext.webidl
--- a/docshell/base/BrowsingContext.h
+++ b/docshell/base/BrowsingContext.h
@@ -74,16 +74,21 @@ public:
 
   already_AddRefed<BrowsingContext> GetParent()
   {
     return do_AddRef(mParent.get());
   }
 
   void GetChildren(nsTArray<RefPtr<BrowsingContext>>& aChildren);
 
+  already_AddRefed<nsIDocShell> GetDocShell()
+  {
+    return do_AddRef(mDocShell.get());
+  }
+
   static void GetRootBrowsingContexts(
     nsTArray<RefPtr<BrowsingContext>>& aBrowsingContexts);
 
   nsISupports* GetParentObject() const;
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
 
   MOZ_DECLARE_WEAKREFERENCE_TYPENAME(BrowsingContext)
--- a/dom/chrome-webidl/BrowsingContext.webidl
+++ b/dom/chrome-webidl/BrowsingContext.webidl
@@ -1,13 +1,17 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
+interface nsIDocShell;
+
 [Exposed=(Window, System), ChromeOnly]
 interface BrowsingContext {
   readonly attribute BrowsingContext? parent;
 
   sequence<BrowsingContext> getChildren();
 
+  readonly attribute nsIDocShell? docShell;
+
   readonly attribute unsigned long long id;
 };