Commit 96c856d3 authored by David Teller's avatar David Teller
Browse files

Bug 1580447 - Expose Content{Parent, Child} to JS;r=nika

Differential Revision: https://phabricator.services.mozilla.com/D65344

--HG--
extra : moz-landing-system : lando
parent 477d3ef5
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include "mozilla/ResultExtensions.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/IdleDeadline.h"
#include "mozilla/dom/JSWindowActorService.h"
@@ -1187,6 +1188,11 @@ void ChromeUtils::GenerateMediaControlKeysTestEvent(
  }
}

/* static */
nsIContentChild* ChromeUtils::GetContentChild(const GlobalObject&) {
  return ContentChild::GetSingleton();
}

/* static */
void ChromeUtils::GetCurrentActiveMediaMetadata(const GlobalObject& aGlobal,
                                                MediaMetadataInit& aMetadata) {
+3 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/ChromeUtilsBinding.h"
#include "mozilla/ErrorResult.h"
#include "nsIContentChild.h"

namespace mozilla {

@@ -203,6 +204,8 @@ class ChromeUtils {
  static void GenerateMediaControlKeysTestEvent(
      const GlobalObject& aGlobal, MediaControlKeysTestEvent aEvent);

  static nsIContentChild* GetContentChild(const GlobalObject&);

  // This function would only be used for testing.
  static void GetCurrentActiveMediaMetadata(const GlobalObject& aGlobal,
                                            MediaMetadataInit& aMetadata);
+2 −0
Original line number Diff line number Diff line
@@ -1885,6 +1885,8 @@ addExternalIface('nsITreeSelection', nativeType='nsITreeSelection',
                 notflattened=True)
addExternalIface('nsISupports', nativeType='nsISupports')
addExternalIface('nsIDocShell', nativeType='nsIDocShell', notflattened=True)
addExternalIface('nsIContentChild', nativeType='nsIContentChild', notflattened=True)
addExternalIface('nsIContentParent', nativeType='nsIContentParent', notflattened=True)
addExternalIface('nsIReferrerInfo', nativeType='nsIReferrerInfo', notflattened=True)
addExternalIface('nsIWebNavigation', nativeType='nsIWebNavigation', notflattened=True)
addExternalIface('nsIEditor', nativeType='nsIEditor', notflattened=True)
+6 −0
Original line number Diff line number Diff line
@@ -446,6 +446,12 @@ partial namespace ChromeUtils {
  [ChromeOnly]
  void generateMediaControlKeysTestEvent(MediaControlKeysTestEvent aEvent);

  /**
   * ContentChild of the current process.
   */
  [ChromeOnly]
  readonly attribute nsIContentChild? contentChild;

  // This is used to get the media metadata from the current main controller in
  // testing.
  [ChromeOnly]
+2 −0
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

interface nsISupports;
interface nsIContentChild;
interface nsIContentParent;

interface mixin JSWindowActor {
  [Throws]
Loading