diff --git a/dom/ipc/PScreenManager.ipdl b/dom/ipc/PScreenManager.ipdl index 070c11f18b6..d958993fb0a 100644 --- a/dom/ipc/PScreenManager.ipdl +++ b/dom/ipc/PScreenManager.ipdl @@ -9,6 +9,7 @@ include protocol PContent; include "mozilla/GfxMessageUtils.h"; using struct nsIntRect from "nsRect.h"; +using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h"; namespace mozilla { namespace dom { @@ -49,7 +50,7 @@ parent: returns (ScreenDetails screen, bool success); - prio(high) sync ScreenForBrowser(PBrowser aBrowser) + prio(high) sync ScreenForBrowser(TabId aTabId) returns (ScreenDetails screen, bool success); diff --git a/dom/ipc/ScreenManagerParent.cpp b/dom/ipc/ScreenManagerParent.cpp index 19c7f42235f..2e9e0c50ae6 100644 --- a/dom/ipc/ScreenManagerParent.cpp +++ b/dom/ipc/ScreenManagerParent.cpp @@ -9,6 +9,7 @@ #include "nsIWidget.h" #include "nsServiceManagerUtils.h" #include "ScreenManagerParent.h" +#include "ContentProcessManager.h" namespace mozilla { namespace dom { @@ -116,7 +117,7 @@ ScreenManagerParent::RecvScreenForRect(const int32_t& aLeft, } bool -ScreenManagerParent::RecvScreenForBrowser(PBrowserParent* aBrowser, +ScreenManagerParent::RecvScreenForBrowser(const TabId& aTabId, ScreenDetails* aRetVal, bool* aSuccess) { @@ -129,7 +130,14 @@ ScreenManagerParent::RecvScreenForBrowser(PBrowserParent* aBrowser, // Find the mWidget associated with the tabparent, and then return // the nsIScreen it's on. - TabParent* tabParent = static_cast(aBrowser); + ContentParent* cp = static_cast(this->Manager()); + ContentProcessManager* cpm = ContentProcessManager::GetSingleton(); + nsRefPtr tabParent = + cpm->GetTopLevelTabParentByProcessAndTabId(cp->ChildID(), aTabId); + if(!tabParent){ + return false; + } + nsCOMPtr widget = tabParent->GetWidget(); nsCOMPtr screen; diff --git a/dom/ipc/ScreenManagerParent.h b/dom/ipc/ScreenManagerParent.h index 666b8dd9391..e2680e6d1d2 100644 --- a/dom/ipc/ScreenManagerParent.h +++ b/dom/ipc/ScreenManagerParent.h @@ -41,7 +41,7 @@ class ScreenManagerParent : public PScreenManagerParent ScreenDetails* aRetVal, bool* aSuccess) MOZ_OVERRIDE; - virtual bool RecvScreenForBrowser(PBrowserParent* aBrowser, + virtual bool RecvScreenForBrowser(const TabId& aTabId, ScreenDetails* aRetVal, bool* aSuccess) MOZ_OVERRIDE; diff --git a/widget/nsScreenManagerProxy.cpp b/widget/nsScreenManagerProxy.cpp index 747e2fbe617..e014940ade9 100644 --- a/widget/nsScreenManagerProxy.cpp +++ b/widget/nsScreenManagerProxy.cpp @@ -126,7 +126,7 @@ nsScreenManagerProxy::ScreenForNativeWidget(void* aWidget, // for it. bool success = false; ScreenDetails details; - unused << SendScreenForBrowser(tabChild, &details, &success); + unused << SendScreenForBrowser(tabChild->GetTabId(), &details, &success); if (!success) { return NS_ERROR_FAILURE; }