Backed out changeset 85a53a4c3778 (bug 1299061) for merge conflicts
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 05 Sep 2016 13:28:36 -0700
changeset 354010 c3ab4ea823ee80c65a4e5df09b47c2d78499db03
parent 354009 dc09df75de0b6cfecc869cb91a3e5d2360b3080b
child 354011 302dab53de80ffaa66152776fa874a5b6868d629
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1299061
milestone51.0a1
backs out85a53a4c37785347ed00992889499f6d8bb95e56
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
Backed out changeset 85a53a4c3778 (bug 1299061) for merge conflicts
dom/ipc/ContentParent.cpp
dom/presentation/PresentationRequest.cpp
dom/presentation/PresentationService.cpp
dom/presentation/interfaces/nsIPresentationDevicePrompt.idl
dom/presentation/interfaces/nsIPresentationService.idl
dom/presentation/ipc/PPresentation.ipdl
dom/presentation/ipc/PresentationIPCService.cpp
dom/presentation/ipc/PresentationParent.cpp
dom/presentation/ipc/PresentationParent.h
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -3638,17 +3638,17 @@ ContentParent::DeallocPPresentationParen
   RefPtr<PresentationParent> actor =
   dont_AddRef(static_cast<PresentationParent*>(aActor));
   return true;
 }
 
 bool
 ContentParent::RecvPPresentationConstructor(PPresentationParent* aActor)
 {
-  return static_cast<PresentationParent*>(aActor)->Init(mChildID);
+  return static_cast<PresentationParent*>(aActor)->Init();
 }
 
 PFlyWebPublishedServerParent*
 ContentParent::AllocPFlyWebPublishedServerParent(const nsString& name,
                                                  const FlyWebPublishOptions& params)
 {
   RefPtr<FlyWebPublishedServerParent> actor =
     new FlyWebPublishedServerParent(name, params);
--- a/dom/presentation/PresentationRequest.cpp
+++ b/dom/presentation/PresentationRequest.cpp
@@ -179,25 +179,19 @@ PresentationRequest::StartWithDevice(con
 
   nsCOMPtr<nsIPresentationService> service =
     do_GetService(PRESENTATION_SERVICE_CONTRACTID);
   if(NS_WARN_IF(!service)) {
     promise->MaybeReject(NS_ERROR_DOM_OPERATION_ERR);
     return promise.forget();
   }
 
-  // Get xul:browser element in parent process or nsWindowRoot object in child
-  // process. If it's in child process, the corresponding xul:browser element
-  // will be obtained at PresentationRequestParent::DoRequest in its parent
-  // process.
-  nsCOMPtr<nsIDOMEventTarget> handler =
-    do_QueryInterface(GetOwner()->GetChromeEventHandler());
   nsCOMPtr<nsIPresentationServiceCallback> callback =
     new PresentationRequesterCallback(this, mUrl, id, promise);
-  rv = service->StartSession(mUrl, id, origin, aDeviceId, GetOwner()->WindowID(), handler, callback);
+  rv = service->StartSession(mUrl, id, origin, aDeviceId, GetOwner()->WindowID(), callback);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     promise->MaybeReject(NS_ERROR_DOM_OPERATION_ERR);
   }
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
--- a/dom/presentation/PresentationService.cpp
+++ b/dom/presentation/PresentationService.cpp
@@ -68,50 +68,46 @@ class PresentationDeviceRequest final : 
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPRESENTATIONDEVICEREQUEST
 
   PresentationDeviceRequest(const nsAString& aRequestUrl,
                             const nsAString& aId,
                             const nsAString& aOrigin,
                             uint64_t aWindowId,
-                            nsIDOMEventTarget* aEventTarget,
                             nsIPresentationServiceCallback* aCallback);
 
 private:
   virtual ~PresentationDeviceRequest() = default;
   nsresult CreateSessionInfo(nsIPresentationDevice* aDevice);
 
   nsString mRequestUrl;
   nsString mId;
   nsString mOrigin;
   uint64_t mWindowId;
-  nsWeakPtr mChromeEventHandler;
   nsCOMPtr<nsIPresentationServiceCallback> mCallback;
 };
 
 LazyLogModule gPresentationLog("Presentation");
 
 } // namespace dom
 } // namespace mozilla
 
 NS_IMPL_ISUPPORTS(PresentationDeviceRequest, nsIPresentationDeviceRequest)
 
 PresentationDeviceRequest::PresentationDeviceRequest(
                                       const nsAString& aRequestUrl,
                                       const nsAString& aId,
                                       const nsAString& aOrigin,
                                       uint64_t aWindowId,
-                                      nsIDOMEventTarget* aEventTarget,
                                       nsIPresentationServiceCallback* aCallback)
   : mRequestUrl(aRequestUrl)
   , mId(aId)
   , mOrigin(aOrigin)
   , mWindowId(aWindowId)
-  , mChromeEventHandler(do_GetWeakReference(aEventTarget))
   , mCallback(aCallback)
 {
   MOZ_ASSERT(!mRequestUrl.IsEmpty());
   MOZ_ASSERT(!mId.IsEmpty());
   MOZ_ASSERT(!mOrigin.IsEmpty());
   MOZ_ASSERT(mCallback);
 }
 
@@ -125,24 +121,16 @@ PresentationDeviceRequest::GetOrigin(nsA
 NS_IMETHODIMP
 PresentationDeviceRequest::GetRequestURL(nsAString& aRequestUrl)
 {
   aRequestUrl = mRequestUrl;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-PresentationDeviceRequest::GetChromeEventHandler(nsIDOMEventTarget** aChromeEventHandler)
-{
-  nsCOMPtr<nsIDOMEventTarget> handler(do_QueryReferent(mChromeEventHandler));
-  handler.forget(aChromeEventHandler);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 PresentationDeviceRequest::Select(nsIPresentationDevice* aDevice)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aDevice);
 
   nsresult rv = CreateSessionInfo(aDevice);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     mCallback->NotifyError(rv);
@@ -584,33 +572,31 @@ PresentationService::IsAppInstalled(nsIU
 }
 
 NS_IMETHODIMP
 PresentationService::StartSession(const nsAString& aUrl,
                                   const nsAString& aSessionId,
                                   const nsAString& aOrigin,
                                   const nsAString& aDeviceId,
                                   uint64_t aWindowId,
-                                  nsIDOMEventTarget* aEventTarget,
                                   nsIPresentationServiceCallback* aCallback)
 {
   PRES_DEBUG("%s:url[%s], id[%s]\n", __func__,
              NS_ConvertUTF16toUTF8(aUrl).get(),
              NS_ConvertUTF16toUTF8(aSessionId).get());
 
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aCallback);
   MOZ_ASSERT(!aSessionId.IsEmpty());
 
   nsCOMPtr<nsIPresentationDeviceRequest> request =
     new PresentationDeviceRequest(aUrl,
                                   aSessionId,
                                   aOrigin,
                                   aWindowId,
-                                  aEventTarget,
                                   aCallback);
 
   if (aDeviceId.IsVoid()) {
     // Pop up a prompt and ask user to select a device.
     nsCOMPtr<nsIPresentationDevicePrompt> prompt =
       do_GetService(PRESENTATION_DEVICE_PROMPT_CONTRACTID);
     if (NS_WARN_IF(!prompt)) {
       return aCallback->NotifyError(NS_ERROR_DOM_OPERATION_ERR);
--- a/dom/presentation/interfaces/nsIPresentationDevicePrompt.idl
+++ b/dom/presentation/interfaces/nsIPresentationDevicePrompt.idl
@@ -1,15 +1,14 @@
 /* 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 "nsISupports.idl"
 
-interface nsIDOMEventTarget;
 interface nsIPresentationDevice;
 
 %{C++
 #define PRESENTATION_DEVICE_PROMPT_CONTRACTID "@mozilla.org/presentation-device/prompt;1"
 %}
 
 /*
  * The information and callbacks for device selection
@@ -18,19 +17,16 @@ interface nsIPresentationDevice;
 interface nsIPresentationDeviceRequest : nsISupports
 {
   // The origin which initiate the request.
   readonly attribute DOMString origin;
 
   // The URL to be opened after selection.
   readonly attribute DOMString requestURL;
 
-  // The XUL browser element that the request was originated in.
-  readonly attribute nsIDOMEventTarget chromeEventHandler;
-
   /*
    * Callback after selecting a device
    * @param device The selected device.
    */
   void select(in nsIPresentationDevice device);
 
   /*
    * Callback after selection failed or canceled by user.
--- a/dom/presentation/interfaces/nsIPresentationService.idl
+++ b/dom/presentation/interfaces/nsIPresentationService.idl
@@ -1,15 +1,14 @@
 /* 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 "nsISupports.idl"
 
-interface nsIDOMEventTarget;
 interface nsIInputStream;
 interface nsIPresentationAvailabilityListener;
 interface nsIPresentationRespondingListener;
 interface nsIPresentationSessionListener;
 
 %{C++
 #define PRESENTATION_SERVICE_CID \
   { 0x1d9bb10c, 0xc0ab, 0x4fe8, \
@@ -47,35 +46,31 @@ interface nsIPresentationService : nsISu
   /*
    * Start a new presentation session and display a prompt box which asks users
    * to select a device.
    *
    * @param url: The url of presenting page.
    * @param sessionId: An ID to identify presentation session.
    * @param origin: The url of requesting page.
    * @param deviceId: The specified device of handling this request, null string
-   *                  for prompt device selection dialog.
+                      for prompt device selection dialog.
    * @param windowId: The inner window ID associated with the presentation
    *                  session. (0 implies no window ID since no actual window
    *                  uses 0 as its ID. Generally it's the case the window is
    *                  located in different process from this service)
-   * @param eventTarget: The chrome event handler, in particular XUL browser
-   *                     element in parent process, that the request was
-   *                     originated in.
    * @param callback: Invoke the callback when the operation is completed.
    *                  NotifySuccess() is called with |id| if a session is
    *                  established successfully with the selected device.
    *                  Otherwise, NotifyError() is called with a error message.
    */
   void startSession(in DOMString url,
                     in DOMString sessionId,
                     in DOMString origin,
                     in DOMString deviceId,
                     in unsigned long long windowId,
-                    in nsIDOMEventTarget eventTarget,
                     in nsIPresentationServiceCallback callback);
 
   /*
    * Send the message to the session.
    *
    * @param sessionId: An ID to identify presentation session.
    * @param role: Identify the function called by controller or receiver.
    * @param data: the message being sent out.
--- a/dom/presentation/ipc/PPresentation.ipdl
+++ b/dom/presentation/ipc/PPresentation.ipdl
@@ -5,29 +5,26 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 include protocol PContent;
 include protocol PPresentationRequest;
 include protocol PPresentationBuilder;
 
 include InputStreamParams;
 
-using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
-
 namespace mozilla {
 namespace dom {
 
 struct StartSessionRequest
 {
   nsString url;
   nsString sessionId;
   nsString origin;
   nsString deviceId;
   uint64_t windowId;
-  TabId tabId;
 };
 
 struct SendSessionMessageRequest
 {
   nsString sessionId;
   uint8_t role;
   nsString data;
 };
--- a/dom/presentation/ipc/PresentationIPCService.cpp
+++ b/dom/presentation/ipc/PresentationIPCService.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set sw=2 ts=8 et ft=cpp : */
 /* 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 "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/PPresentation.h"
-#include "mozilla/dom/TabParent.h"
 #include "mozilla/ipc/InputStreamUtils.h"
 #include "mozilla/ipc/URIUtils.h"
 #include "nsGlobalWindow.h"
 #include "nsIPresentationListener.h"
 #include "PresentationCallbacks.h"
 #include "PresentationChild.h"
 #include "PresentationContentSessionInfo.h"
 #include "PresentationIPCService.h"
@@ -53,35 +52,29 @@ PresentationIPCService::~PresentationIPC
 }
 
 NS_IMETHODIMP
 PresentationIPCService::StartSession(const nsAString& aUrl,
                                      const nsAString& aSessionId,
                                      const nsAString& aOrigin,
                                      const nsAString& aDeviceId,
                                      uint64_t aWindowId,
-                                     nsIDOMEventTarget* aEventTarget,
                                      nsIPresentationServiceCallback* aCallback)
 {
   if (aWindowId != 0) {
     AddRespondingSessionId(aWindowId,
                            aSessionId,
                            nsIPresentationService::ROLE_CONTROLLER);
   }
 
-  nsPIDOMWindowInner* window =
-    nsGlobalWindow::GetInnerWindowWithId(aWindowId)->AsInner();
-  TabId tabId = TabParent::GetTabIdFrom(window->GetDocShell());
-
   return SendRequest(aCallback, StartSessionRequest(nsString(aUrl),
                                                     nsString(aSessionId),
                                                     nsString(aOrigin),
                                                     nsString(aDeviceId),
-                                                    aWindowId,
-                                                    tabId));
+                                                    aWindowId));
 }
 
 NS_IMETHODIMP
 PresentationIPCService::SendSessionMessage(const nsAString& aSessionId,
                                            uint8_t aRole,
                                            const nsAString& aData)
 {
   MOZ_ASSERT(!aSessionId.IsEmpty());
--- a/dom/presentation/ipc/PresentationParent.cpp
+++ b/dom/presentation/ipc/PresentationParent.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* 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 "DCPresentationChannelDescription.h"
-#include "mozilla/dom/ContentProcessManager.h"
 #include "mozilla/ipc/InputStreamUtils.h"
 #include "nsIPresentationDeviceManager.h"
 #include "nsServiceManagerUtils.h"
 #include "PresentationBuilderParent.h"
 #include "PresentationParent.h"
 #include "PresentationService.h"
 #include "PresentationSessionInfo.h"
 
@@ -31,21 +30,20 @@ PresentationParent::PresentationParent()
 }
 
 /* virtual */ PresentationParent::~PresentationParent()
 {
   MOZ_COUNT_DTOR(PresentationParent);
 }
 
 bool
-PresentationParent::Init(ContentParentId aContentParentId)
+PresentationParent::Init()
 {
   MOZ_ASSERT(!mService);
   mService = do_GetService(PRESENTATION_SERVICE_CONTRACTID);
-  mChildId = aContentParentId;
   return NS_WARN_IF(!mService) ? false : true;
 }
 
 void
 PresentationParent::ActorDestroy(ActorDestroyReason aWhy)
 {
   mActorDestroyed = true;
 
@@ -104,17 +102,17 @@ PresentationParent::RecvPPresentationReq
   return NS_WARN_IF(NS_FAILED(rv)) ? false : true;
 }
 
 PPresentationRequestParent*
 PresentationParent::AllocPPresentationRequestParent(
   const PresentationIPCRequest& aRequest)
 {
   MOZ_ASSERT(mService);
-  RefPtr<PresentationRequestParent> actor = new PresentationRequestParent(mService, mChildId);
+  RefPtr<PresentationRequestParent> actor = new PresentationRequestParent(mService);
   return actor.forget().take();
 }
 
 bool
 PresentationParent::DeallocPPresentationRequestParent(
   PPresentationRequestParent* aActor)
 {
   RefPtr<PresentationRequestParent> actor =
@@ -306,20 +304,18 @@ PresentationParent::RecvNotifyTransportC
 }
 
 /*
  * Implementation of PresentationRequestParent
  */
 
 NS_IMPL_ISUPPORTS(PresentationRequestParent, nsIPresentationServiceCallback)
 
-PresentationRequestParent::PresentationRequestParent(nsIPresentationService* aService,
-                                                     ContentParentId aContentParentId)
+PresentationRequestParent::PresentationRequestParent(nsIPresentationService* aService)
   : mService(aService)
-  , mChildId(aContentParentId)
 {
   MOZ_COUNT_CTOR(PresentationRequestParent);
 }
 
 PresentationRequestParent::~PresentationRequestParent()
 {
   MOZ_COUNT_DTOR(PresentationRequestParent);
 }
@@ -332,28 +328,19 @@ PresentationRequestParent::ActorDestroy(
 }
 
 nsresult
 PresentationRequestParent::DoRequest(const StartSessionRequest& aRequest)
 {
   MOZ_ASSERT(mService);
   mNeedRegisterBuilder = true;
   mSessionId = aRequest.sessionId();
-
-  nsCOMPtr<nsIDOMEventTarget> eventTarget;
-  ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
-  RefPtr<TabParent> tp =
-    cpm->GetTopLevelTabParentByProcessAndTabId(mChildId, aRequest.tabId());
-  if (tp) {
-    eventTarget = do_QueryInterface(tp->GetOwnerElement());
-  }
-
   return mService->StartSession(aRequest.url(), aRequest.sessionId(),
                                 aRequest.origin(), aRequest.deviceId(),
-                                aRequest.windowId(), eventTarget, this);
+                                aRequest.windowId(), this);
 }
 
 nsresult
 PresentationRequestParent::DoRequest(const SendSessionMessageRequest& aRequest)
 {
   MOZ_ASSERT(mService);
 
   // Validate the accessibility (primarily for receiver side) so that a
--- a/dom/presentation/ipc/PresentationParent.h
+++ b/dom/presentation/ipc/PresentationParent.h
@@ -2,17 +2,16 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef mozilla_dom_PresentationParent_h__
 #define mozilla_dom_PresentationParent_h__
 
-#include "mozilla/dom/ipc/IdType.h"
 #include "mozilla/dom/PPresentationBuilderParent.h"
 #include "mozilla/dom/PPresentationParent.h"
 #include "mozilla/dom/PPresentationRequestParent.h"
 #include "nsIPresentationListener.h"
 #include "nsIPresentationService.h"
 #include "nsIPresentationSessionTransportBuilder.h"
 
 namespace mozilla {
@@ -26,17 +25,17 @@ class PresentationParent final : public 
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPRESENTATIONAVAILABILITYLISTENER
   NS_DECL_NSIPRESENTATIONSESSIONLISTENER
   NS_DECL_NSIPRESENTATIONRESPONDINGLISTENER
 
   PresentationParent();
 
-  bool Init(ContentParentId aContentParentId);
+  bool Init();
 
   bool RegisterTransportBuilder(const nsString& aSessionId, const uint8_t& aRole);
 
   virtual void ActorDestroy(ActorDestroyReason aWhy) override;
 
   virtual bool
   RecvPPresentationRequestConstructor(PPresentationRequestParent* aActor,
                                       const PresentationIPCRequest& aRequest) override;
@@ -82,30 +81,28 @@ public:
 private:
   virtual ~PresentationParent();
 
   bool mActorDestroyed = false;
   nsCOMPtr<nsIPresentationService> mService;
   nsTArray<nsString> mSessionIdsAtController;
   nsTArray<nsString> mSessionIdsAtReceiver;
   nsTArray<uint64_t> mWindowIds;
-  ContentParentId mChildId;
 };
 
 class PresentationRequestParent final : public PPresentationRequestParent
                                       , public nsIPresentationServiceCallback
 {
   friend class PresentationParent;
 
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPRESENTATIONSERVICECALLBACK
 
-  explicit PresentationRequestParent(nsIPresentationService* aService,
-                                     ContentParentId aContentParentId);
+  explicit PresentationRequestParent(nsIPresentationService* aService);
 
   virtual void ActorDestroy(ActorDestroyReason aWhy) override;
 
 private:
   virtual ~PresentationRequestParent();
 
   nsresult SendResponse(nsresult aResult);
 
@@ -120,15 +117,14 @@ private:
   nsresult DoRequest(const ReconnectSessionRequest& aRequest);
 
   nsresult DoRequest(const BuildTransportRequest& aRequest);
 
   bool mActorDestroyed = false;
   bool mNeedRegisterBuilder = false;
   nsString mSessionId;
   nsCOMPtr<nsIPresentationService> mService;
-  ContentParentId mChildId;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_PresentationParent_h__