Backed out changeset 0b4c68d39a61 (bug 771273) on a CLOSED TREE

This commit is contained in:
Justin Lebar 2012-07-23 11:44:55 -04:00
parent 5f49ebb87d
commit 21d80cc899
3 changed files with 26 additions and 52 deletions

View File

@ -2747,10 +2747,6 @@ nsDocShell::GetSameTypeParent(nsIDocShellTreeItem ** aParent)
NS_ENSURE_ARG_POINTER(aParent);
*aParent = nsnull;
if (mIsBrowserFrame) {
return NS_OK;
}
nsCOMPtr<nsIDocShellTreeItem> parent =
do_QueryInterface(GetAsSupports(mParent));
if (!parent)
@ -2765,27 +2761,6 @@ nsDocShell::GetSameTypeParent(nsIDocShellTreeItem ** aParent)
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetParentIgnoreBrowserFrame(nsIDocShell** aParent)
{
NS_ENSURE_ARG_POINTER(aParent);
*aParent = nsnull;
nsCOMPtr<nsIDocShellTreeItem> parent =
do_QueryInterface(GetAsSupports(mParent));
if (!parent)
return NS_OK;
PRInt32 parentType;
NS_ENSURE_SUCCESS(parent->GetItemType(&parentType), NS_ERROR_FAILURE);
if (parentType == mItemType) {
nsCOMPtr<nsIDocShell> parentDS = do_QueryInterface(parent);
parentDS.forget(aParent);
}
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetRootTreeItem(nsIDocShellTreeItem ** aRootTreeItem)
{
@ -11118,9 +11093,16 @@ NS_IMETHODIMP nsDocShell::EnsureFind()
bool
nsDocShell::IsFrame()
{
nsCOMPtr<nsIDocShellTreeItem> parent;
GetSameTypeParent(getter_AddRefs(parent));
return !!parent;
nsCOMPtr<nsIDocShellTreeItem> parent =
do_QueryInterface(GetAsSupports(mParent));
if (parent) {
PRInt32 parentType = ~mItemType; // Not us
parent->GetItemType(&parentType);
if (parentType == mItemType) // This is a frame
return true;
}
return false;
}
/* boolean IsBeingDestroyed (); */

View File

@ -39,7 +39,7 @@ interface nsIWebBrowserPrint;
interface nsIVariant;
interface nsIPrivacyTransitionObserver;
[scriptable, builtinclass, uuid(51f2b7f0-6435-40ec-b315-588f52be7eea)]
[scriptable, builtinclass, uuid(be5a675b-b675-4443-af75-510530eab5fa)]
interface nsIDocShell : nsISupports
{
/**
@ -644,10 +644,4 @@ interface nsIDocShell : nsISupports
* docshell.
*/
readonly attribute bool asyncPanZoomEnabled;
/**
* Like GetSameTypeParent, except this ignores <iframe mozbrowser>
* boundaries.
*/
nsIDocShell getParentIgnoreBrowserFrame();
};

View File

@ -2990,8 +2990,11 @@ nsGlobalWindow::GetRealParent(nsIDOMWindow** aParent)
return NS_OK;
}
nsCOMPtr<nsIDocShell> parent;
mDocShell->GetParentIgnoreBrowserFrame(getter_AddRefs(parent));
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocShellTreeItem> parent;
docShellAsItem->GetSameTypeParent(getter_AddRefs(parent));
if (parent) {
nsCOMPtr<nsIScriptGlobalObject> globalObject(do_GetInterface(parent));
@ -3070,19 +3073,11 @@ NS_IMETHODIMP
nsGlobalWindow::GetContent(nsIDOMWindow** aContent)
{
FORWARD_TO_OUTER(GetContent, (aContent), NS_ERROR_NOT_INITIALIZED);
*aContent = nsnull;
// If we're contained in <iframe mozbrowser>, then GetContent is the same as
// window.top.
if (mDocShell) {
bool inBrowserFrame = false;
mDocShell->GetContainedInBrowserFrame(&inBrowserFrame);
if (inBrowserFrame) {
return GetScriptableTop(aContent);
}
}
nsCOMPtr<nsIDocShellTreeItem> primaryContent;
if (!nsContentUtils::IsCallerChrome()) {
// If we're called by non-chrome code, make sure we don't return
// the primary content window if the calling tab is hidden. In
@ -3096,6 +3091,7 @@ nsGlobalWindow::GetContent(nsIDOMWindow** aContent)
if (!visible) {
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(mDocShell));
treeItem->GetSameTypeRootTreeItem(getter_AddRefs(primaryContent));
}
}
@ -3115,7 +3111,6 @@ nsGlobalWindow::GetContent(nsIDOMWindow** aContent)
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::GetPrompter(nsIPrompt** aPrompt)
{
@ -7035,16 +7030,19 @@ nsGlobalWindow::GetRealFrameElement(nsIDOMElement** aFrameElement)
*aFrameElement = NULL;
if (!mDocShell) {
nsCOMPtr<nsIDocShellTreeItem> docShellTI(do_QueryInterface(mDocShell));
if (!docShellTI) {
return NS_OK;
}
nsCOMPtr<nsIDocShell> parent;
mDocShell->GetParentIgnoreBrowserFrame(getter_AddRefs(parent));
nsCOMPtr<nsIDocShellTreeItem> parent;
docShellTI->GetSameTypeParent(getter_AddRefs(parent));
if (!parent || parent == mDocShell) {
if (!parent || parent == docShellTI) {
// We're at a chrome boundary, don't expose the chrome iframe
// element to content code.
return NS_OK;
}