Back out dd82458147fd (bug 714861) for mochitest-3 failures and Linux mochitest-chrome leaks

This commit is contained in:
Phil Ringnalda 2012-04-19 20:06:34 -07:00
parent ceda947d1e
commit 017e6a2601
9 changed files with 44 additions and 140 deletions

View File

@ -422,10 +422,9 @@ pref("browser.link.open_newwindow", 3);
// 2: don't divert window.open with features
pref("browser.link.open_newwindow.restriction", 0);
// Enable browser frames, but not OOP.
// Enable browser frame
pref("dom.mozBrowserFramesEnabled", true);
pref("dom.mozBrowserFramesWhitelist", "http://homescreen.gaiamobile.org,http://browser.gaiamobile.org");
pref("dom.ipc.tabs.disabled", true);
// Temporary permission hack for WebSMS
pref("dom.sms.enabled", true);

View File

@ -457,13 +457,8 @@ nsFrameLoader::ReallyStartLoadingInternal()
}
}
if (mRemoteBrowserShown || ShowRemoteFrame(nsIntSize(0, 0))) {
// FIXME get error codes from child
mRemoteBrowser->LoadURL(mURIToLoad);
} else {
NS_WARNING("[nsFrameLoader] ReallyStartLoadingInternal tried but couldn't show remote browser.\n");
}
// FIXME get error codes from child
mRemoteBrowser->LoadURL(mURIToLoad);
return NS_OK;
}
@ -917,18 +912,6 @@ nsFrameLoader::ShowRemoteFrame(const nsIntSize& size)
// cross-process layers; need to figure out what behavior we really
// want here. For now, hack.
if (!mRemoteBrowserShown) {
if (!mOwnerContent ||
!mOwnerContent->GetCurrentDoc()) {
return false;
}
nsRefPtr<layers::LayerManager> layerManager =
nsContentUtils::LayerManagerForDocument(mOwnerContent->GetCurrentDoc());
if (!layerManager) {
// This is just not going to work.
return false;
}
mRemoteBrowser->Show(size);
mRemoteBrowserShown = true;
@ -1372,27 +1355,19 @@ nsFrameLoader::SetOwnerContent(Element* aContent)
}
}
bool
nsFrameLoader::OwnerIsBrowserFrame()
{
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
bool isBrowser = false;
if (browserFrame) {
browserFrame->GetReallyIsBrowser(&isBrowser);
}
return isBrowser;
}
bool
nsFrameLoader::ShouldUseRemoteProcess()
{
// Check for *disabled* multi-process first: environment, pref
// Then check for *enabled* multi-process attribute
// Default is not-remote.
if (PR_GetEnv("MOZ_DISABLE_OOP_TABS") ||
Preferences::GetBool("dom.ipc.tabs.disabled", false)) {
return false;
}
return OwnerIsBrowserFrame() ||
(bool) mOwnerContent->AttrValueIs(kNameSpaceID_None,
return (bool) mOwnerContent->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::Remote,
nsGkAtoms::_true,
eCaseMatters);
@ -1867,27 +1842,24 @@ nsFrameLoader::TryRemoteBrowser()
nsCOMPtr<nsIDocShellTreeItem> parentAsItem(do_QueryInterface(parentAsWebNav));
// <iframe mozbrowser> gets to skip these checks.
if (!OwnerIsBrowserFrame()) {
PRInt32 parentType;
parentAsItem->GetItemType(&parentType);
PRInt32 parentType;
parentAsItem->GetItemType(&parentType);
if (parentType != nsIDocShellTreeItem::typeChrome) {
return false;
}
if (parentType != nsIDocShellTreeItem::typeChrome) {
return false;
}
if (!mOwnerContent->IsXUL()) {
return false;
}
if (!mOwnerContent->IsXUL()) {
return false;
}
nsAutoString value;
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, value);
nsAutoString value;
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, value);
if (!value.LowerCaseEqualsLiteral("content") &&
!StringBeginsWith(value, NS_LITERAL_STRING("content-"),
nsCaseInsensitiveStringComparator())) {
return false;
}
if (!value.LowerCaseEqualsLiteral("content") &&
!StringBeginsWith(value, NS_LITERAL_STRING("content-"),
nsCaseInsensitiveStringComparator())) {
return false;
}
PRUint32 chromeFlags = 0;
@ -2159,19 +2131,6 @@ nsFrameLoader::GetRootContentView(nsIContentView** aContentView)
return NS_OK;
}
static already_AddRefed<nsIDocShell>
GetRootDocShell(nsIDocument *aDocument)
{
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(aDocument->GetWindow());
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(webNav);
NS_ENSURE_TRUE(treeItem, NULL);
nsCOMPtr<nsIDocShellTreeItem> rootItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootItem));
nsCOMPtr<nsIDocShell> rootDocShell = do_QueryInterface(rootItem);
return rootDocShell.forget();
}
nsresult
nsFrameLoader::EnsureMessageManager()
{
@ -2200,12 +2159,8 @@ nsFrameLoader::EnsureMessageManager()
NS_ENSURE_STATE(cx);
nsCOMPtr<nsIDOMChromeWindow> chromeWindow =
do_QueryInterface(OwnerDoc()->GetWindow());
if (!chromeWindow) {
nsCOMPtr<nsIDocShell> rootDocShell = GetRootDocShell(OwnerDoc());
nsCOMPtr<nsIDOMWindow> rootWindow = do_GetInterface(rootDocShell);
chromeWindow = do_GetInterface(rootWindow);
}
do_QueryInterface(mOwnerContent->OwnerDoc()->GetWindow());
NS_ENSURE_STATE(chromeWindow);
nsCOMPtr<nsIChromeFrameMessageManager> parentManager;
chromeWindow->GetMessageManager(getter_AddRefs(parentManager));

View File

@ -295,12 +295,6 @@ private:
bool ShouldUseRemoteProcess();
/**
* Is this a frameloader for a bona fide <iframe mozbrowser>? (I.e., does
* the frame return true for nsIMozBrowserFrame::GetReallyIsBrowser()?)
*/
bool OwnerIsBrowserFrame();
/**
* If we are an IPC frame, set mRemoteFrame. Otherwise, create and
* initialize mDocShell.

View File

@ -100,8 +100,6 @@
#include "nsIDOMUIEvent.h"
#include "nsDOMDragEvent.h"
#include "nsIDOMNSEditableElement.h"
#include "nsIDOMMozBrowserFrame.h"
#include "nsIMozBrowserFrame.h"
#include "nsCaret.h"
@ -1703,30 +1701,12 @@ nsEventStateManager::DispatchCrossProcessEvent(nsEvent* aEvent, nsIFrameLoader*
bool
nsEventStateManager::IsRemoteTarget(nsIContent* target) {
if (!target) {
return false;
}
// <browser/iframe remote=true> from XUL
if ((target->Tag() == nsGkAtoms::browser ||
target->Tag() == nsGkAtoms::iframe) &&
target->IsXUL() &&
target->AttrValueIs(kNameSpaceID_None, nsGkAtoms::Remote,
nsGkAtoms::_true, eIgnoreCase)) {
return true;
}
// <frame/iframe mozbrowser>
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(target);
if (browserFrame) {
bool isRemote = false;
browserFrame->GetReallyIsBrowser(&isRemote);
if (isRemote) {
return true;
}
}
return false;
return target &&
(target->Tag() == nsGkAtoms::browser ||
target->Tag() == nsGkAtoms::iframe) &&
target->IsXUL() &&
target->AttrValueIs(kNameSpaceID_None, nsGkAtoms::Remote,
nsGkAtoms::_true, eIgnoreCase);
}

View File

@ -233,9 +233,9 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage)
ContentChild* ContentChild::sSingleton;
ContentChild::ContentChild()
: mID(PRUint64(-1))
#ifdef ANDROID
, mScreenSize(0, 0)
: mScreenSize(0, 0)
, mID(PRUint64(-1))
#endif
{
// This process is a content process, so it's clearly running in

View File

@ -199,6 +199,8 @@ private:
gfxIntSize mScreenSize;
#endif
AppInfo mAppInfo;
/**
* An ID unique to the process containing our corresponding
* content parent.
@ -208,8 +210,6 @@ private:
*/
PRUint64 mID;
AppInfo mAppInfo;
static ContentChild* sSingleton;
DISALLOW_EVIL_CONSTRUCTORS(ContentChild);

View File

@ -70,7 +70,6 @@
#include "nsIViewManager.h"
#include "mozilla/unused.h"
#include "nsDebug.h"
#include "nsPrintfCString.h"
using namespace mozilla::dom;
using namespace mozilla::ipc;
@ -94,7 +93,6 @@ TabParent::TabParent()
, mIMESeqno(0)
, mDPI(0)
, mActive(false)
, mShown(false)
{
}
@ -106,7 +104,13 @@ void
TabParent::SetOwnerElement(nsIDOMElement* aElement)
{
mFrameElement = aElement;
TryCacheDPI();
// Cache the DPI of the screen, since we may lose the element/widget later
if (aElement) {
nsCOMPtr<nsIWidget> widget = GetWidget();
NS_ABORT_IF_FALSE(widget, "Non-null OwnerElement must provide a widget!");
mDPI = widget->GetDPI();
}
}
void
@ -193,16 +197,6 @@ TabParent::AnswerCreateWindow(PBrowserParent** retval)
void
TabParent::LoadURL(nsIURI* aURI)
{
if (!mShown) {
nsCAutoString spec;
if (aURI) {
aURI->GetSpec(spec);
}
NS_WARNING(nsPrintfCString(1024, "TabParent::LoadURL(%s) called before "
"Show(). Ignoring LoadURL.\n", spec.get()).get());
return;
}
nsCString spec;
aURI->GetSpec(spec);
@ -213,7 +207,6 @@ void
TabParent::Show(const nsIntSize& size)
{
// sigh
mShown = true;
unused << SendShow(size);
}
@ -628,7 +621,6 @@ TabParent::RecvSetInputContext(const PRInt32& aIMEEnabled,
bool
TabParent::RecvGetDPI(float* aValue)
{
TryCacheDPI();
NS_ABORT_IF_FALSE(mDPI > 0,
"Must not ask for DPI before OwnerElement is received!");
*aValue = mDPI;
@ -856,19 +848,6 @@ TabParent::GetFrameLoader() const
return frameLoaderOwner ? frameLoaderOwner->GetFrameLoader() : nsnull;
}
void
TabParent::TryCacheDPI()
{
if (mDPI > 0) {
return;
}
nsCOMPtr<nsIWidget> widget = GetWidget();
if (widget) {
mDPI = widget->GetDPI();
}
}
already_AddRefed<nsIWidget>
TabParent::GetWidget() const
{
@ -880,8 +859,7 @@ TabParent::GetWidget() const
if (!frame)
return nsnull;
nsCOMPtr<nsIWidget> widget = frame->GetNearestWidget();
return widget.forget();
return nsCOMPtr<nsIWidget>(frame->GetNearestWidget()).forget();
}
} // namespace tabs

View File

@ -233,12 +233,10 @@ protected:
float mDPI;
bool mActive;
bool mShown;
private:
already_AddRefed<nsFrameLoader> GetFrameLoader() const;
already_AddRefed<nsIWidget> GetWidget() const;
void TryCacheDPI();
};
} // namespace dom

View File

@ -52,7 +52,6 @@
#include "nsViewportFrame.h"
#include "nsSubDocumentFrame.h"
#include "nsIObserver.h"
#include "nsContentUtils.h"
typedef nsContentView::ViewConfig ViewConfig;
using namespace mozilla::layers;
@ -696,7 +695,8 @@ RenderFrameParent::BuildViewMap()
LayerManager*
RenderFrameParent::GetLayerManager() const
{
return nsContentUtils::LayerManagerForDocument(mFrameLoader->OwnerDoc()).get();
nsIDocument* doc = mFrameLoader->OwnerDoc();
return doc->GetShell()->GetLayerManager();
}
ShadowLayersParent*