Bug 784436 - Part 2: Use new infallible nsIDocShell methods. r=bz

This commit is contained in:
Justin Lebar 2012-08-22 18:27:04 -07:00
parent 6ba4f56931
commit 29483a3082
7 changed files with 14 additions and 65 deletions

View File

@ -8599,9 +8599,7 @@ HasCrossProcessParent(nsIDocument* aDocument)
if (!docShell) {
return false;
}
bool isBrowserElement = false;
docShell->GetIsBrowserElement(&isBrowserElement);
return isBrowserElement;
return docShell->GetIsBrowserElement();
}
static bool

View File

@ -1142,27 +1142,10 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
return NS_ERROR_NOT_IMPLEMENTED;
}
bool ourContentBoundary, otherContentBoundary;
ourDocshell->GetIsContentBoundary(&ourContentBoundary);
otherDocshell->GetIsContentBoundary(&otherContentBoundary);
if (ourContentBoundary != otherContentBoundary) {
return NS_ERROR_NOT_IMPLEMENTED;
}
if (ourContentBoundary) {
bool ourIsBrowser, otherIsBrowser;
ourDocshell->GetIsBrowserElement(&ourIsBrowser);
otherDocshell->GetIsBrowserElement(&otherIsBrowser);
if (ourIsBrowser != otherIsBrowser) {
if (ourDocshell->GetIsBrowserElement() !=
otherDocshell->GetIsBrowserElement() ||
ourDocshell->GetIsApp() != otherDocshell->GetIsApp()) {
return NS_ERROR_NOT_IMPLEMENTED;
}
bool ourIsApp, otherIsApp;
ourDocshell->GetIsApp(&ourIsApp);
otherDocshell->GetIsApp(&otherIsApp);
if (ourIsApp != otherIsApp) {
return NS_ERROR_NOT_IMPLEMENTED;
}
}
if (mInSwap || aOther->mInSwap) {

View File

@ -311,9 +311,7 @@ bool nsDSURIContentListener::CheckOneFrameOptionsPolicy(nsIRequest *request,
parentDocShellItem) {
nsCOMPtr<nsIDocShell> curDocShell = do_QueryInterface(curDocShellItem);
bool isContentBoundary;
curDocShell->GetIsContentBoundary(&isContentBoundary);
if (isContentBoundary) {
if (curDocShell && curDocShell->GetIsContentBoundary()) {
break;
}

View File

@ -5135,9 +5135,7 @@ nsDocShell::SetIsActive(bool aIsActive)
continue;
}
bool isContentBoundary = false;
docshell->GetIsContentBoundary(&isContentBoundary);
if (!isContentBoundary) {
if (!docshell->GetIsContentBoundary()) {
docshell->SetIsActive(aIsActive);
}
}
@ -12272,7 +12270,6 @@ nsDocShell::GetFrameType()
nsDocShell::GetIsBrowserElement(bool* aIsBrowser)
{
*aIsBrowser = (GetFrameType() == eFrameTypeBrowser);
return NS_OK;
}

View File

@ -2973,9 +2973,7 @@ nsGlobalWindow::GetScriptableParent(nsIDOMWindow** aParent)
return NS_OK;
}
bool isContentBoundary = false;
mDocShell->GetIsContentBoundary(&isContentBoundary);
if (isContentBoundary) {
if (mDocShell->GetIsContentBoundary()) {
nsCOMPtr<nsIDOMWindow> parent = static_cast<nsIDOMWindow*>(this);
parent.swap(*aParent);
return NS_OK;
@ -3082,12 +3080,8 @@ nsGlobalWindow::GetContent(nsIDOMWindow** aContent)
// If we're contained in <iframe mozbrowser>, then GetContent is the same as
// window.top.
if (mDocShell) {
bool belowContentBoundary = false;
mDocShell->GetIsBelowContentBoundary(&belowContentBoundary);
if (belowContentBoundary) {
return GetScriptableTop(aContent);
}
if (mDocShell && mDocShell->GetIsBelowContentBoundary()) {
return GetScriptableTop(aContent);
}
nsCOMPtr<nsIDocShellTreeItem> primaryContent;
@ -6490,13 +6484,8 @@ nsGlobalWindow::Close()
{
FORWARD_TO_OUTER(Close, (), NS_ERROR_NOT_INITIALIZED);
bool isContentBoundary = false;
if (mDocShell) {
mDocShell->GetIsContentBoundary(&isContentBoundary);
}
if ((!isContentBoundary && IsFrame()) ||
!mDocShell || IsInModalState()) {
if (!mDocShell || IsInModalState() ||
(IsFrame() && !mDocShell->GetIsContentBoundary())) {
// window.close() is called on a frame in a frameset, on a window
// that's already closed, or on a window for which there's
// currently a modal dialog open. Ignore such calls.
@ -7021,13 +7010,7 @@ nsGlobalWindow::GetScriptableFrameElement(nsIDOMElement** aFrameElement)
FORWARD_TO_OUTER(GetScriptableFrameElement, (aFrameElement), NS_ERROR_NOT_INITIALIZED);
*aFrameElement = NULL;
if (!mDocShell) {
return NS_OK;
}
bool isContentBoundary = false;
mDocShell->GetIsContentBoundary(&isContentBoundary);
if (isContentBoundary) {
if (!mDocShell || mDocShell->GetIsContentBoundary()) {
return NS_OK;
}

View File

@ -386,12 +386,7 @@ TabChild::ProvideWindow(nsIDOMWindow* aParent, uint32_t aChromeFlags,
// open a modal-type window, we're going to create a new <iframe mozbrowser>
// and return its window here.
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(aParent);
bool isInContentBoundary = false;
if (docshell) {
docshell->GetIsBelowContentBoundary(&isInContentBoundary);
}
if (isInContentBoundary &&
if (docshell && docshell->GetIsBelowContentBoundary() &&
!(aChromeFlags & (nsIWebBrowserChrome::CHROME_MODAL |
nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
nsIWebBrowserChrome::CHROME_OPENAS_CHROME))) {

View File

@ -848,12 +848,7 @@ nsContentTreeOwner::ProvideWindow(nsIDOMWindow* aParent,
// open a modal-type window, we're going to create a new <iframe mozbrowser>
// and return its window here.
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(aParent);
bool isInContentBoundary = false;
if (docshell) {
docshell->GetIsBelowContentBoundary(&isInContentBoundary);
}
if (isInContentBoundary &&
if (docshell && docshell->GetIsBelowContentBoundary() &&
!(aChromeFlags & (nsIWebBrowserChrome::CHROME_MODAL |
nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
nsIWebBrowserChrome::CHROME_OPENAS_CHROME))) {