Backed out changeset ab7fbaca9fdd (bug 1114890) for being the likely cause of bug 1124046.

This commit is contained in:
Ryan VanderMeulen 2015-02-05 14:35:35 -05:00
Родитель 164a9c3547
Коммит 6048189ffc
24 изменённых файлов: 62 добавлений и 79 удалений

Просмотреть файл

@ -92,7 +92,7 @@ ContentPermissionRequestParent::IsBeingDestroyed()
{
// When TabParent::Destroy() is called, we are being destroyed. It's unsafe
// to send out any message now.
TabParent* tabParent = TabParent::GetFrom(Manager());
TabParent* tabParent = static_cast<TabParent*>(Manager());
return tabParent->IsDestroyed();
}
@ -397,12 +397,14 @@ nsContentPermissionRequestProxy::Allow(JS::HandleValue aChoices)
if (mPermissionRequests[i].type().EqualsLiteral("audio-capture")) {
GonkPermissionService::GetInstance()->addGrantInfo(
"android.permission.RECORD_AUDIO",
TabParent::GetFrom(mParent->Manager())->Manager()->AsContentParent()->Pid());
static_cast<TabParent*>(
mParent->Manager())->Manager()->AsContentParent()->Pid());
}
if (mPermissionRequests[i].type().EqualsLiteral("video-capture")) {
GonkPermissionService::GetInstance()->addGrantInfo(
"android.permission.CAMERA",
TabParent::GetFrom(mParent->Manager())->Manager()->AsContentParent()->Pid());
static_cast<TabParent*>(
mParent->Manager())->Manager()->AsContentParent()->Pid());
}
}
#endif

Просмотреть файл

@ -7168,7 +7168,8 @@ nsContentUtils::CallOnAllRemoteChildren(nsIMessageBroadcaster* aManager,
static_cast<nsFrameMessageManager*>(tabMM.get())->GetCallback();
if (cb) {
nsFrameLoader* fl = static_cast<nsFrameLoader*>(cb);
TabParent* remote = TabParent::GetFrom(fl);
PBrowserParent* remoteBrowser = fl->GetRemoteBrowser();
TabParent* remote = static_cast<TabParent*>(remoteBrowser);
if (remote && aCallback) {
aCallback(remote, aArg);
}

Просмотреть файл

@ -2098,7 +2098,7 @@ nsFrameLoader::TryRemoteBrowser()
return false;
}
TabParent* openingTab = TabParent::GetFrom(parentDocShell->GetOpener());
TabParent* openingTab = static_cast<TabParent*>(parentDocShell->GetOpener());
ContentParent* openerContentParent = nullptr;
if (openingTab &&
@ -2304,7 +2304,7 @@ nsFrameLoader::CreateStaticClone(nsIFrameLoader* aDest)
bool
nsFrameLoader::DoLoadFrameScript(const nsAString& aURL, bool aRunInGlobalScope)
{
auto* tabParent = TabParent::GetFrom(GetRemoteBrowser());
auto* tabParent = static_cast<TabParent*>(GetRemoteBrowser());
if (tabParent) {
return tabParent->SendLoadRemoteScript(nsString(aURL), aRunInGlobalScope);
}
@ -2500,7 +2500,7 @@ nsFrameLoader::SetRemoteBrowser(nsITabParent* aTabParent)
MOZ_ASSERT(!mRemoteBrowser);
MOZ_ASSERT(!mCurrentRemoteFrame);
mRemoteFrame = true;
mRemoteBrowser = TabParent::GetFrom(aTabParent);
mRemoteBrowser = static_cast<TabParent*>(aTabParent);
mChildID = mRemoteBrowser ? mRemoteBrowser->Manager()->ChildID() : 0;
ShowRemoteFrame(nsIntSize(0, 0));
}

Просмотреть файл

@ -1088,7 +1088,8 @@ bool
EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
nsFrameLoader* aFrameLoader,
nsEventStatus *aStatus) {
TabParent* remote = TabParent::GetFrom(aFrameLoader);
PBrowserParent* remoteBrowser = aFrameLoader->GetRemoteBrowser();
TabParent* remote = static_cast<TabParent*>(remoteBrowser);
if (!remote) {
return false;
}

Просмотреть файл

@ -10987,7 +10987,7 @@ FactoryOp::CheckAtLeastOneAppHasPermission(ContentParent* aContentParent,
index < count;
index++) {
uint32_t appId =
TabParent::GetFrom(browsers[index])->OwnOrContainingAppId();
static_cast<TabParent*>(browsers[index])->OwnOrContainingAppId();
MOZ_ASSERT(kUnknownAppId != appId && kNoAppId != appId);
nsCOMPtr<mozIApplication> app;

Просмотреть файл

@ -83,7 +83,7 @@ AssertAppProcess(PBrowserParent* aActor,
return false;
}
TabParent* tab = TabParent::GetFrom(aActor);
TabParent* tab = static_cast<TabParent*>(aActor);
nsCOMPtr<mozIApplication> app = tab->GetOwnOrContainingApp();
return CheckAppTypeHelper(app, aType, aCapability, tab->IsBrowserElement());
@ -114,7 +114,7 @@ AssertAppStatus(PBrowserParent* aActor,
return false;
}
TabParent* tab = TabParent::GetFrom(aActor);
TabParent* tab = static_cast<TabParent*>(aActor);
nsCOMPtr<mozIApplication> app = tab->GetOwnOrContainingApp();
return CheckAppStatusHelper(app, aStatus);

Просмотреть файл

@ -51,7 +51,7 @@ ColorPickerParent::CreateColorPicker()
return false;
}
Element* ownerElement = TabParent::GetFrom(Manager())->GetOwnerElement();
Element* ownerElement = static_cast<TabParent*>(Manager())->GetOwnerElement();
if (!ownerElement) {
return false;
}

Просмотреть файл

@ -1075,7 +1075,7 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
constructorSender->ChildID(),
constructorSender->IsForApp(),
constructorSender->IsForBrowser());
return TabParent::GetFrom(browser);
return static_cast<TabParent*>(browser);
}
return nullptr;
}
@ -1189,7 +1189,7 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
if (isInContentProcess) {
// Just return directly without the following check in content process.
return TabParent::GetFrom(browser);
return static_cast<TabParent*>(browser);
}
if (!browser) {
@ -1218,7 +1218,7 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
parent->AsContentParent()->MaybeTakeCPUWakeLock(aFrameElement);
return TabParent::GetFrom(browser);
return static_cast<TabParent*>(browser);
}
/*static*/ ContentBridgeParent*

Просмотреть файл

@ -292,7 +292,7 @@ ContentProcessManager::GetTabParentByProcessAndTabId(const ContentParentId& aChi
const InfallibleTArray<PBrowserParent*>& browsers =
iter->second.mCp->ManagedPBrowserParent();
for (uint32_t i = 0; i < browsers.Length(); i++) {
nsRefPtr<TabParent> tab = TabParent::GetFrom(browsers[i]);
nsRefPtr<TabParent> tab = static_cast<TabParent*>(browsers[i]);
if (tab->GetTabId() == aChildTabId) {
return tab.forget();
}

Просмотреть файл

@ -113,7 +113,7 @@ FilePickerParent::FileSizeAndDateRunnable::Destroy()
void
FilePickerParent::SendFiles(const nsCOMArray<nsIDOMFile>& aDomfiles)
{
nsIContentParent* parent = TabParent::GetFrom(Manager())->Manager();
nsIContentParent* parent = static_cast<TabParent*>(Manager())->Manager();
InfallibleTArray<PBlobParent*> files;
for (unsigned i = 0; i < aDomfiles.Length(); i++) {
@ -183,7 +183,7 @@ FilePickerParent::CreateFilePicker()
return false;
}
Element* element = TabParent::GetFrom(Manager())->GetOwnerElement();
Element* element = static_cast<TabParent*>(Manager())->GetOwnerElement();
if (!element) {
return false;
}

Просмотреть файл

@ -619,7 +619,7 @@ HangMonitoredProcess::GetScriptBrowser(nsIDOMElement** aBrowser)
nsTArray<PBrowserParent*> tabs;
mContentParent->ManagedPBrowserParent(tabs);
for (size_t i = 0; i < tabs.Length(); i++) {
TabParent* tp = TabParent::GetFrom(tabs[i]);
TabParent* tp = static_cast<TabParent*>(tabs[i]);
if (tp->GetTabId() == tabId) {
nsCOMPtr<nsIDOMElement> node = do_QueryInterface(tp->GetOwnerElement());
node.forget(aBrowser);
@ -765,13 +765,14 @@ HangMonitoredProcess::IsReportForBrowser(nsIFrameLoader* aFrameLoader, bool* aRe
return NS_OK;
}
TabParent* tp = TabParent::GetFrom(aFrameLoader);
if (!tp) {
nsCOMPtr<nsITabParent> itp;
aFrameLoader->GetTabParent(getter_AddRefs(itp));
if (!itp) {
*aResult = false;
return NS_OK;
}
*aResult = mContentParent == tp->Manager();
*aResult = mContentParent == static_cast<TabParent*>(itp.get())->Manager();
return NS_OK;
}

Просмотреть файл

@ -813,11 +813,12 @@ ParticularProcessPriorityManager::OnRemoteBrowserFrameShown(nsISupports* aSubjec
return;
}
TabParent* tp = TabParent::GetFrom(fl);
nsCOMPtr<nsITabParent> tp;
fl->GetTabParent(getter_AddRefs(tp));
NS_ENSURE_TRUE_VOID(tp);
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
if (tp->Manager() != mContentParent) {
if (static_cast<TabParent*>(tp.get())->Manager() != mContentParent) {
return;
}
@ -831,7 +832,7 @@ ParticularProcessPriorityManager::OnTabParentDestroyed(nsISupports* aSubject)
NS_ENSURE_TRUE_VOID(tp);
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
if (TabParent::GetFrom(tp)->Manager() != mContentParent) {
if (static_cast<TabParent*>(tp.get())->Manager() != mContentParent) {
return;
}
@ -844,13 +845,14 @@ ParticularProcessPriorityManager::OnFrameloaderVisibleChanged(nsISupports* aSubj
nsCOMPtr<nsIFrameLoader> fl = do_QueryInterface(aSubject);
NS_ENSURE_TRUE_VOID(fl);
TabParent* tp = TabParent::GetFrom(fl);
nsCOMPtr<nsITabParent> tp;
fl->GetTabParent(getter_AddRefs(tp));
if (!tp) {
return;
}
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
if (tp->Manager() != mContentParent) {
if (static_cast<TabParent*>(tp.get())->Manager() != mContentParent) {
return;
}
@ -930,7 +932,7 @@ ParticularProcessPriorityManager::HasAppType(const char* aAppType)
mContentParent->ManagedPBrowserParent();
for (uint32_t i = 0; i < browsers.Length(); i++) {
nsAutoString appType;
TabParent::GetFrom(browsers[i])->GetAppType(appType);
static_cast<TabParent*>(browsers[i])->GetAppType(appType);
if (appType.EqualsASCII(aAppType)) {
return true;
}
@ -945,7 +947,7 @@ ParticularProcessPriorityManager::IsExpectingSystemMessage()
const InfallibleTArray<PBrowserParent*>& browsers =
mContentParent->ManagedPBrowserParent();
for (uint32_t i = 0; i < browsers.Length(); i++) {
TabParent* tp = TabParent::GetFrom(browsers[i]);
TabParent* tp = static_cast<TabParent*>(browsers[i]);
nsCOMPtr<nsIMozBrowserFrame> bf = do_QueryInterface(tp->GetOwnerElement());
if (!bf) {
continue;
@ -977,7 +979,7 @@ ParticularProcessPriorityManager::ComputePriority()
const InfallibleTArray<PBrowserParent*>& browsers =
mContentParent->ManagedPBrowserParent();
for (uint32_t i = 0; i < browsers.Length(); i++) {
if (TabParent::GetFrom(browsers[i])->IsVisible()) {
if (static_cast<TabParent*>(browsers[i])->IsVisible()) {
isVisible = true;
break;
}

Просмотреть файл

@ -257,7 +257,7 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
TabContext *context;
if (ipcContext.opener().type() == PBrowserOrId::TPBrowserParent) {
context = TabParent::GetFrom(ipcContext.opener().get_PBrowserParent());
context = static_cast<TabParent*>(ipcContext.opener().get_PBrowserParent());
if (context->IsBrowserElement() && !ipcContext.isBrowserElement()) {
// If the TabParent corresponds to a browser element, then it can only
// open other browser elements, for security reasons. We should have

Просмотреть файл

@ -549,7 +549,7 @@ TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, false);
TabParent* newTab = TabParent::GetFrom(aNewTab);
TabParent* newTab = static_cast<TabParent*>(aNewTab);
nsCOMPtr<nsIContent> frame(do_QueryInterface(mFrameElement));
@ -653,7 +653,7 @@ TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
nsCOMPtr<nsITabParent> newRemoteTab = newDocShell->GetOpenedRemote();
NS_ENSURE_TRUE(newRemoteTab, false);
MOZ_ASSERT(TabParent::GetFrom(newRemoteTab) == newTab);
MOZ_ASSERT(static_cast<TabParent*>(newRemoteTab.get()) == newTab);
aFrameScripts->SwapElements(newTab->mDelayedFrameScripts);
return true;
@ -2027,26 +2027,6 @@ TabParent::GetFrom(nsFrameLoader* aFrameLoader)
return static_cast<TabParent*>(remoteBrowser);
}
/*static*/ TabParent*
TabParent::GetFrom(nsIFrameLoader* aFrameLoader)
{
if (!aFrameLoader)
return nullptr;
return GetFrom(static_cast<nsFrameLoader*>(aFrameLoader));
}
/*static*/ TabParent*
TabParent::GetFrom(nsITabParent* aTabParent)
{
return static_cast<TabParent*>(aTabParent);
}
/*static*/ TabParent*
TabParent::GetFrom(PBrowserParent* aTabParent)
{
return static_cast<TabParent*>(aTabParent);
}
/*static*/ TabParent*
TabParent::GetFrom(nsIContent* aContent)
{
@ -2445,7 +2425,7 @@ TabParent::RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
bool* aOutWindowOpened)
{
BrowserElementParent::OpenWindowResult opened =
BrowserElementParent::OpenWindowOOP(TabParent::GetFrom(aOpener),
BrowserElementParent::OpenWindowOOP(static_cast<TabParent*>(aOpener),
this, aURL, aName, aFeatures);
*aOutWindowOpened = (opened != BrowserElementParent::OPEN_WINDOW_CANCELLED);
return true;

Просмотреть файл

@ -24,7 +24,6 @@
#include "js/TypeDecls.h"
class nsFrameLoader;
class nsIFrameLoader;
class nsIContent;
class nsIPrincipal;
class nsIURI;
@ -329,9 +328,6 @@ public:
bool SendSelectionEvent(mozilla::WidgetSelectionEvent& event);
static TabParent* GetFrom(nsFrameLoader* aFrameLoader);
static TabParent* GetFrom(nsIFrameLoader* aFrameLoader);
static TabParent* GetFrom(nsITabParent* aTabParent);
static TabParent* GetFrom(PBrowserParent* aTabParent);
static TabParent* GetFrom(nsIContent* aContent);
static TabId GetTabIdFrom(nsIDocShell* docshell);

Просмотреть файл

@ -87,7 +87,7 @@ nsIContentParent::CanOpenBrowser(const IPCTabContext& aContext)
return false;
}
auto opener = TabParent::GetFrom(popupContext.opener().get_PBrowserParent());
auto opener = static_cast<TabParent*>(popupContext.opener().get_PBrowserParent());
if (!opener) {
ASSERT_UNLESS_FUZZING("Got null opener from child; aborting AllocPBrowserParent.");
return false;
@ -140,7 +140,7 @@ nsIContentParent::AllocPBrowserParent(const TabId& aTabId,
bool
nsIContentParent::DeallocPBrowserParent(PBrowserParent* aFrame)
{
TabParent* parent = TabParent::GetFrom(aFrame);
TabParent* parent = static_cast<TabParent*>(aFrame);
NS_RELEASE(parent);
return true;
}

Просмотреть файл

@ -76,7 +76,7 @@ TCPServerSocketParent::GetAppId()
const PContentParent *content = Manager()->Manager();
const InfallibleTArray<PBrowserParent*>& browsers = content->ManagedPBrowserParent();
if (browsers.Length() > 0) {
TabParent *tab = TabParent::GetFrom(browsers[0]);
TabParent *tab = static_cast<TabParent*>(browsers[0]);
appId = tab->OwnAppId();
}
return appId;
@ -89,7 +89,7 @@ TCPServerSocketParent::GetInBrowser()
const PContentParent *content = Manager()->Manager();
const InfallibleTArray<PBrowserParent*>& browsers = content->ManagedPBrowserParent();
if (browsers.Length() > 0) {
TabParent *tab = TabParent::GetFrom(browsers[0]);
TabParent *tab = static_cast<TabParent*>(browsers[0]);
inBrowser = tab->IsBrowserElement();
}
return inBrowser;

Просмотреть файл

@ -87,7 +87,7 @@ TCPSocketParent::GetAppId()
const PContentParent *content = Manager()->Manager();
const InfallibleTArray<PBrowserParent*>& browsers = content->ManagedPBrowserParent();
if (browsers.Length() > 0) {
TabParent *tab = TabParent::GetFrom(browsers[0]);
TabParent *tab = static_cast<TabParent*>(browsers[0]);
appId = tab->OwnAppId();
}
return appId;
@ -100,7 +100,7 @@ TCPSocketParent::GetInBrowser()
const PContentParent *content = Manager()->Manager();
const InfallibleTArray<PBrowserParent*>& browsers = content->ManagedPBrowserParent();
if (browsers.Length() > 0) {
TabParent *tab = TabParent::GetFrom(browsers[0]);
TabParent *tab = static_cast<TabParent*>(browsers[0]);
inBrowser = tab->IsBrowserElement();
}
return inBrowser;

Просмотреть файл

@ -69,7 +69,7 @@ UDPSocketParent::GetAppId()
const PContentParent *content = Manager()->Manager();
const InfallibleTArray<PBrowserParent*>& browsers = content->ManagedPBrowserParent();
if (browsers.Length() > 0) {
TabParent *tab = TabParent::GetFrom(browsers[0]);
TabParent *tab = static_cast<TabParent*>(browsers[0]);
appId = tab->OwnAppId();
}
return appId;

Просмотреть файл

@ -143,7 +143,7 @@ PrintingParent::DOMWindowFromBrowserParent(PBrowserParent* parent)
return nullptr;
}
TabParent* tabParent = TabParent::GetFrom(parent);
TabParent* tabParent = static_cast<TabParent*>(parent);
if (!tabParent) {
return nullptr;
}

Просмотреть файл

@ -507,7 +507,7 @@ public:
PBrowserParent *browserParent) MOZ_OVERRIDE
{
// We give all content vibration permission.
TabParent *tabParent = TabParent::GetFrom(browserParent);
TabParent *tabParent = static_cast<TabParent*>(browserParent);
nsCOMPtr<nsIDOMWindow> window =
do_QueryInterface(tabParent->GetBrowserDOMWindow());
WindowIdentifier newID(id, window);
@ -519,7 +519,7 @@ public:
RecvCancelVibrate(InfallibleTArray<uint64_t> &&id,
PBrowserParent *browserParent) MOZ_OVERRIDE
{
TabParent *tabParent = TabParent::GetFrom(browserParent);
TabParent *tabParent = static_cast<TabParent*>(browserParent);
nsCOMPtr<nsIDOMWindow> window =
do_QueryInterface(tabParent->GetBrowserDOMWindow());
WindowIdentifier newID(id, window);

Просмотреть файл

@ -92,7 +92,7 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
if (mRenderFrame) {
TabParent* browser = TabParent::GetFrom(mRenderFrame->Manager());
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
browser->UpdateFrame(aFrameMetrics);
}
}
@ -110,7 +110,7 @@ public:
return;
}
if (mRenderFrame) {
TabParent* browser = TabParent::GetFrom(mRenderFrame->Manager());
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
browser->AcknowledgeScrollUpdate(aScrollId, aScrollGeneration);
}
}
@ -129,7 +129,7 @@ public:
return;
}
if (mRenderFrame) {
TabParent* browser = TabParent::GetFrom(mRenderFrame->Manager());
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
browser->HandleDoubleTap(aPoint, aModifiers, aGuid);
}
}
@ -148,7 +148,7 @@ public:
return;
}
if (mRenderFrame) {
TabParent* browser = TabParent::GetFrom(mRenderFrame->Manager());
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
browser->HandleSingleTap(aPoint, aModifiers, aGuid);
}
}
@ -168,7 +168,7 @@ public:
return;
}
if (mRenderFrame) {
TabParent* browser = TabParent::GetFrom(mRenderFrame->Manager());
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
browser->HandleLongTap(aPoint, aModifiers, aGuid, aInputBlockId);
}
}
@ -187,7 +187,7 @@ public:
return;
}
if (mRenderFrame) {
TabParent* browser = TabParent::GetFrom(mRenderFrame->Manager());
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
browser->HandleLongTapUp(aPoint, aModifiers, aGuid);
}
}
@ -207,7 +207,7 @@ public:
return;
}
if (mRenderFrame && aIsRoot) {
TabParent* browser = TabParent::GetFrom(mRenderFrame->Manager());
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
BrowserElementParent::DispatchAsyncScrollEvent(browser, aContentRect,
aContentSize);
}
@ -247,7 +247,7 @@ public:
return;
}
if (mRenderFrame) {
TabParent* browser = TabParent::GetFrom(mRenderFrame->Manager());
TabParent* browser = static_cast<TabParent*>(mRenderFrame->Manager());
browser->NotifyAPZStateChange(aGuid.mScrollId, aChange, aArg);
}
}

Просмотреть файл

@ -182,7 +182,7 @@ NeckoParent::CreateChannelLoadContext(const PBrowserOrId& aBrowser,
case PBrowserOrId::TPBrowserParent:
{
nsRefPtr<TabParent> tabParent =
TabParent::GetFrom(aBrowser.get_PBrowserParent());
static_cast<TabParent*>(aBrowser.get_PBrowserParent());
dom::Element* topFrameElement = nullptr;
if (tabParent) {
topFrameElement = tabParent->GetOwnerElement();
@ -332,7 +332,7 @@ NeckoParent::AllocPWebSocketParent(const PBrowserOrId& browser,
return nullptr;
}
nsRefPtr<TabParent> tabParent = TabParent::GetFrom(browser.get_PBrowserParent());
nsRefPtr<TabParent> tabParent = static_cast<TabParent*>(browser.get_PBrowserParent());
PBOverrideStatus overrideStatus = PBOverrideStatusFromLoadContext(serialized);
WebSocketChannelParent* p = new WebSocketChannelParent(tabParent, loadContext,
overrideStatus);

Просмотреть файл

@ -81,7 +81,7 @@ ExternalHelperAppParent::Init(ContentParent *parent,
nsCOMPtr<nsIInterfaceRequestor> window;
if (aBrowser) {
TabParent* tabParent = TabParent::GetFrom(aBrowser);
TabParent* tabParent = static_cast<TabParent*>(aBrowser);
if (tabParent->GetOwnerElement())
window = do_QueryInterface(tabParent->GetOwnerElement()->OwnerDoc()->GetWindow());
}