Bug 1552263 - Add docShell attribute to JSWindowActorChild; r=nika
authorJohn Dai <jdai@mozilla.com>
Fri, 17 May 2019 19:01:21 +0000
changeset 474474 f798f327a76198fc38ae07358768e556fe126039
parent 474473 c19a74cafdb7b009cd6d5c800c904754e2dc614e
child 474475 29d9eb1276a71d4f4f1edefe4b0e720e4b16f952
push id36040
push userrgurzau@mozilla.com
push dateMon, 20 May 2019 13:43:21 +0000
treeherdermozilla-central@319a369ccde4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1552263
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 1552263 - Add docShell attribute to JSWindowActorChild; r=nika Differential Revision: https://phabricator.services.mozilla.com/D31614
dom/chrome-webidl/JSWindowActor.webidl
dom/ipc/JSWindowActorChild.cpp
dom/ipc/JSWindowActorChild.h
--- a/dom/chrome-webidl/JSWindowActor.webidl
+++ b/dom/chrome-webidl/JSWindowActor.webidl
@@ -30,16 +30,19 @@ interface JSWindowActorChild {
   readonly attribute WindowGlobalChild manager;
 
   [Throws]
   readonly attribute Document? document;
 
   [Throws]
   readonly attribute BrowsingContext? browsingContext;
 
+  [Throws]
+  readonly attribute nsIDocShell? docShell;
+
   // NOTE: As this returns a window proxy, it may not be currently referencing
   // the document associated with this JSWindowActor. Generally prefer using
   // `document`.
   [Throws]
   readonly attribute WindowProxy? contentWindow;
 };
 JSWindowActorChild implements JSWindowActor;
 
--- a/dom/ipc/JSWindowActorChild.cpp
+++ b/dom/ipc/JSWindowActorChild.cpp
@@ -101,16 +101,24 @@ BrowsingContext* JSWindowActorChild::Get
   if (!mManager) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return nullptr;
   }
 
   return mManager->BrowsingContext();
 }
 
+nsIDocShell* JSWindowActorChild::GetDocShell(ErrorResult& aRv) {
+  if (BrowsingContext* bc = GetBrowsingContext(aRv)) {
+    return bc->GetDocShell();
+  }
+
+  return nullptr;
+}
+
 Nullable<WindowProxyHolder> JSWindowActorChild::GetContentWindow(
     ErrorResult& aRv) {
   if (BrowsingContext* bc = GetBrowsingContext(aRv)) {
     return WindowProxyHolder(bc);
   }
   return nullptr;
 }
 
--- a/dom/ipc/JSWindowActorChild.h
+++ b/dom/ipc/JSWindowActorChild.h
@@ -46,16 +46,17 @@ class JSWindowActorChild final : public 
   }
 
   WindowGlobalChild* Manager() const;
   void Init(const nsAString& aName, WindowGlobalChild* aManager);
   void StartDestroy();
   void AfterDestroy();
   Document* GetDocument(ErrorResult& aRv);
   BrowsingContext* GetBrowsingContext(ErrorResult& aRv);
+  nsIDocShell* GetDocShell(ErrorResult& aRv);
   Nullable<WindowProxyHolder> GetContentWindow(ErrorResult& aRv);
 
  protected:
   void SendRawMessage(const JSWindowActorMessageMeta& aMeta,
                       ipc::StructuredCloneData&& aData,
                       ErrorResult& aRv) override;
 
  private: