mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Changed NS_ENSURE to be NS_ENSURE_TRUE.
This commit is contained in:
parent
57619db811
commit
71c2abe1fd
@ -92,7 +92,7 @@ NS_IMETHODIMP nsDocShellBase::GetDocument(nsIDOMDocument** aDocument)
|
||||
|
||||
nsCOMPtr<nsIDocument>doc;
|
||||
NS_ENSURE_SUCCESS(presShell->GetDocument(getter_AddRefs(doc)), NS_ERROR_FAILURE);
|
||||
NS_ENSURE(doc, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// the result's addref comes from this QueryInterface call
|
||||
NS_ENSURE_SUCCESS(CallQueryInterface(doc, aDocument), NS_ERROR_FAILURE);
|
||||
@ -142,7 +142,7 @@ NS_IMETHODIMP nsDocShellBase::GetPresContext(nsIPresContext** aPresContext)
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(mContentViewer));
|
||||
NS_ENSURE(docv, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(docv, NS_ERROR_FAILURE);
|
||||
|
||||
NS_ENSURE_SUCCESS(docv->GetPresContext(*aPresContext), NS_ERROR_FAILURE);
|
||||
|
||||
@ -200,11 +200,11 @@ NS_IMETHODIMP nsDocShellBase::GetRootDocShell(nsIDocShell** aRootDocShell)
|
||||
*aRootDocShell = this;
|
||||
|
||||
nsCOMPtr<nsIDocShell> parent;
|
||||
NS_ENSURE(GetParent(getter_AddRefs(parent)), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(GetParent(getter_AddRefs(parent)), NS_ERROR_FAILURE);
|
||||
while (parent)
|
||||
{
|
||||
*aRootDocShell = parent;
|
||||
NS_ENSURE(GetParent(getter_AddRefs(parent)), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(GetParent(getter_AddRefs(parent)), NS_ERROR_FAILURE);
|
||||
}
|
||||
NS_IF_ADDREF(*aRootDocShell);
|
||||
return NS_OK;
|
||||
@ -324,6 +324,12 @@ NS_IMETHODIMP nsDocShellBase::GetCopyable(PRBool *aCopyable)
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::CutSelection()
|
||||
{
|
||||
PRBool cutable;
|
||||
NS_ENSURE_SUCCESS(GetCutable(&cutable), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(cutable, NS_ERROR_UNEXPECTED);
|
||||
|
||||
|
||||
|
||||
//XXX Implement
|
||||
//Should check to find the current focused object. Then cut the contents.
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -794,7 +800,7 @@ NS_IMETHODIMP nsDocShellBase::GetCurScrollPos(PRInt32 scrollOrientation,
|
||||
return NS_OK;
|
||||
|
||||
default:
|
||||
NS_ENSURE(PR_FALSE, NS_ERROR_INVALID_ARG);
|
||||
NS_ENSURE_TRUE(PR_FALSE, NS_ERROR_INVALID_ARG);
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -825,7 +831,7 @@ NS_IMETHODIMP nsDocShellBase::SetCurScrollPos(PRInt32 scrollOrientation,
|
||||
break;
|
||||
|
||||
default:
|
||||
NS_ENSURE(PR_FALSE, NS_ERROR_INVALID_ARG);
|
||||
NS_ENSURE_TRUE(PR_FALSE, NS_ERROR_INVALID_ARG);
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS(scrollView->ScrollTo(x, y, NS_VMREFRESH_IMMEDIATE),
|
||||
@ -872,7 +878,7 @@ NS_IMETHODIMP nsDocShellBase::GetScrollRange(PRInt32 scrollOrientation,
|
||||
return NS_OK;
|
||||
|
||||
default:
|
||||
NS_ENSURE(PR_FALSE, NS_ERROR_INVALID_ARG);
|
||||
NS_ENSURE_TRUE(PR_FALSE, NS_ERROR_INVALID_ARG);
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -1006,7 +1012,7 @@ nsresult nsDocShellBase::GetChildOffset(nsIDOMNode *aChild, nsIDOMNode* aParent,
|
||||
nsCOMPtr<nsIDOMNodeList> childNodes;
|
||||
NS_ENSURE_SUCCESS(aParent->GetChildNodes(getter_AddRefs(childNodes)),
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE(childNodes, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(childNodes, NS_ERROR_FAILURE);
|
||||
|
||||
PRInt32 i=0;
|
||||
|
||||
@ -1015,7 +1021,7 @@ nsresult nsDocShellBase::GetChildOffset(nsIDOMNode *aChild, nsIDOMNode* aParent,
|
||||
nsCOMPtr<nsIDOMNode> childNode;
|
||||
NS_ENSURE_SUCCESS(childNodes->Item(i, getter_AddRefs(childNode)),
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE(childNode, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(childNode, NS_ERROR_FAILURE);
|
||||
|
||||
if(childNode.get() == aChild)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ NS_IMETHODIMP nsHTMLDocShell::Create(nsISupports* aOuter, const nsIID& aIID,
|
||||
NS_ENSURE_NO_AGGREGATION(aOuter);
|
||||
|
||||
nsHTMLDocShell* docShell = new nsHTMLDocShell();
|
||||
NS_ENSURE(docShell, NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(docShell);
|
||||
nsresult rv = docShell->QueryInterface(aIID, ppv);
|
||||
@ -92,7 +92,7 @@ NS_IMETHODIMP nsHTMLDocShell::ScrollToNode(nsIDOMNode* aNode)
|
||||
// get the primary frame
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
NS_ENSURE(content, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||
|
||||
// Get the primary frame
|
||||
nsIFrame* frame; // Remember Frames aren't ref-counted. They are in their
|
||||
@ -296,7 +296,7 @@ NS_IMETHODIMP nsHTMLDocShell::SelectAll()
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
NS_ENSURE_SUCCESS(mPresShell->GetSelection(SELECTION_NORMAL,
|
||||
getter_AddRefs(selection)), NS_ERROR_FAILURE);
|
||||
NS_ENSURE(selection, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
|
||||
|
||||
// get the body node
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
@ -308,16 +308,16 @@ NS_IMETHODIMP nsHTMLDocShell::SelectAll()
|
||||
|
||||
NS_ENSURE_SUCCESS(document->GetElementsByTagName(bodyTag,
|
||||
getter_AddRefs(nodeList)), NS_ERROR_FAILURE);
|
||||
NS_ENSURE(nodeList, NS_OK); // this means the document has no body, so nothing to select
|
||||
NS_ENSURE_TRUE(nodeList, NS_OK); // this means the document has no body, so nothing to select
|
||||
|
||||
PRUint32 count;
|
||||
NS_ENSURE_SUCCESS(nodeList->GetLength(&count), NS_ERROR_FAILURE);
|
||||
NS_ENSURE(count != 1, NS_OK); // could be true for a frameset doc
|
||||
NS_ENSURE_TRUE(count != 1, NS_OK); // could be true for a frameset doc
|
||||
|
||||
// select all children of the body
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
NS_ENSURE_SUCCESS(nodeList->Item(0, getter_AddRefs(node)), NS_ERROR_FAILURE);
|
||||
NS_ENSURE(node, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_FAILURE);
|
||||
|
||||
NS_ENSURE_SUCCESS(selection->Collapse(bodyNode, 0), NS_ERROR_FAILURE);
|
||||
|
||||
@ -326,7 +326,7 @@ NS_IMETHODIMP nsHTMLDocShell::SelectAll()
|
||||
NS_ENSURE_SUCCESS(bodyNode->GetLastChild(getter_AddRefs(lastChild)),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
NS_ENSURE(lastChild, NS_OK); // body isn't required to have any children, so it's ok if lastChild is null
|
||||
NS_ENSURE_TRUE(lastChild, NS_OK); // body isn't required to have any children, so it's ok if lastChild is null
|
||||
|
||||
NS_ENSURE_SUCCESS(GetChildOffset(lastChild, bodyNode, numBodyChildren),
|
||||
NS_ERROR_FAILURE);
|
||||
|
@ -44,7 +44,7 @@ NS_IMETHODIMP nsWebBrowserSetup::Create(nsISupports* aOuter, const nsIID& aIID,
|
||||
NS_ENSURE_NO_AGGREGATION(aOuter);
|
||||
|
||||
nsWebBrowserSetup* setup = new nsWebBrowserSetup();
|
||||
NS_ENSURE(setup, NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ENSURE_TRUE(setup, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(setup);
|
||||
nsresult rv = setup->QueryInterface(aIID, ppv);
|
||||
|
@ -56,7 +56,7 @@ NS_IMETHODIMP nsWebBrowser::Create(nsISupports* aOuter, const nsIID& aIID,
|
||||
NS_ENSURE_NO_AGGREGATION(aOuter);
|
||||
|
||||
nsWebBrowser* browser = new nsWebBrowser();
|
||||
NS_ENSURE(browser, NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ENSURE_TRUE(browser, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(browser);
|
||||
nsresult rv = browser->QueryInterface(aIID, ppv);
|
||||
@ -83,7 +83,7 @@ NS_IMETHODIMP nsWebBrowser::AddWebBrowserListener(nsIInterfaceRequestor* listene
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
// Make sure it isn't already in the list... This is bad!
|
||||
NS_ENSURE(m_ListenerList->IndexOf(listener) == -1, NS_ERROR_INVALID_ARG);
|
||||
NS_ENSURE_TRUE(m_ListenerList->IndexOf(listener) == -1, NS_ERROR_INVALID_ARG);
|
||||
|
||||
NS_ENSURE_SUCCESS(m_ListenerList->AppendElement(listener), NS_ERROR_FAILURE);
|
||||
|
||||
@ -104,9 +104,9 @@ NS_IMETHODIMP nsWebBrowser::RemoveWebBrowserListener(nsIInterfaceRequestor* list
|
||||
if(!listener)
|
||||
listener = (nsIInterfaceRequestor*)cookie;
|
||||
|
||||
NS_ENSURE(listener, NS_ERROR_INVALID_ARG);
|
||||
NS_ENSURE_TRUE(listener, NS_ERROR_INVALID_ARG);
|
||||
|
||||
NS_ENSURE(m_ListenerList->RemoveElement(listener), NS_ERROR_INVALID_ARG);
|
||||
NS_ENSURE_TRUE(m_ListenerList->RemoveElement(listener), NS_ERROR_INVALID_ARG);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -705,7 +705,7 @@ NS_IMETHODIMP nsWebBrowser::GetCurScrollPos(PRInt32 scrollOrientation,
|
||||
|
||||
nsCOMPtr<nsIScrollable> scroll(do_QueryInterface(m_DocShell));
|
||||
|
||||
NS_ENSURE(scroll, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(scroll, NS_ERROR_FAILURE);
|
||||
|
||||
return scroll->GetCurScrollPos(scrollOrientation, curPos);
|
||||
}
|
||||
@ -717,7 +717,7 @@ NS_IMETHODIMP nsWebBrowser::SetCurScrollPos(PRInt32 scrollOrientation,
|
||||
|
||||
nsCOMPtr<nsIScrollable> scroll(do_QueryInterface(m_DocShell));
|
||||
|
||||
NS_ENSURE(scroll, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(scroll, NS_ERROR_FAILURE);
|
||||
|
||||
return scroll->SetCurScrollPos(scrollOrientation, curPos);
|
||||
}
|
||||
@ -729,7 +729,7 @@ NS_IMETHODIMP nsWebBrowser::SetCurScrollPosEx(PRInt32 curHorizontalPos,
|
||||
|
||||
nsCOMPtr<nsIScrollable> scroll(do_QueryInterface(m_DocShell));
|
||||
|
||||
NS_ENSURE(scroll, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(scroll, NS_ERROR_FAILURE);
|
||||
|
||||
return scroll->SetCurScrollPosEx(curHorizontalPos, curVerticalPos);
|
||||
}
|
||||
@ -742,7 +742,7 @@ NS_IMETHODIMP nsWebBrowser::GetScrollRange(PRInt32 scrollOrientation,
|
||||
|
||||
nsCOMPtr<nsIScrollable> scroll(do_QueryInterface(m_DocShell));
|
||||
|
||||
NS_ENSURE(scroll, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(scroll, NS_ERROR_FAILURE);
|
||||
|
||||
return scroll->GetScrollRange(scrollOrientation, minPos, maxPos);
|
||||
}
|
||||
@ -754,7 +754,7 @@ NS_IMETHODIMP nsWebBrowser::SetScrollRange(PRInt32 scrollOrientation,
|
||||
|
||||
nsCOMPtr<nsIScrollable> scroll(do_QueryInterface(m_DocShell));
|
||||
|
||||
NS_ENSURE(scroll, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(scroll, NS_ERROR_FAILURE);
|
||||
|
||||
return scroll->SetScrollRange(scrollOrientation, minPos, maxPos);
|
||||
}
|
||||
@ -766,7 +766,7 @@ NS_IMETHODIMP nsWebBrowser::SetScrollRangeEx(PRInt32 minHorizontalPos,
|
||||
|
||||
nsCOMPtr<nsIScrollable> scroll(do_QueryInterface(m_DocShell));
|
||||
|
||||
NS_ENSURE(scroll, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(scroll, NS_ERROR_FAILURE);
|
||||
|
||||
return scroll->SetScrollRangeEx(minHorizontalPos, maxHorizontalPos,
|
||||
minVerticalPos, maxVerticalPos);
|
||||
@ -780,7 +780,7 @@ NS_IMETHODIMP nsWebBrowser::GetScrollbarPreferences(PRInt32 scrollOrientation,
|
||||
|
||||
nsCOMPtr<nsIScrollable> scroll(do_QueryInterface(m_DocShell));
|
||||
|
||||
NS_ENSURE(scroll, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(scroll, NS_ERROR_FAILURE);
|
||||
|
||||
return scroll->GetScrollbarPreferences(scrollOrientation, scrollbarPref);
|
||||
}
|
||||
@ -792,7 +792,7 @@ NS_IMETHODIMP nsWebBrowser::SetScrollbarPreferences(PRInt32 scrollOrientation,
|
||||
|
||||
nsCOMPtr<nsIScrollable> scroll(do_QueryInterface(m_DocShell));
|
||||
|
||||
NS_ENSURE(scroll, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(scroll, NS_ERROR_FAILURE);
|
||||
|
||||
return scroll->SetScrollbarPreferences(scrollOrientation, scrollbarPref);
|
||||
}
|
||||
@ -804,7 +804,7 @@ NS_IMETHODIMP nsWebBrowser::GetScrollbarVisibility(PRBool* verticalVisible,
|
||||
|
||||
nsCOMPtr<nsIScrollable> scroll(do_QueryInterface(m_DocShell));
|
||||
|
||||
NS_ENSURE(scroll, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(scroll, NS_ERROR_FAILURE);
|
||||
|
||||
return scroll->GetScrollbarVisibility(verticalVisible, horizontalVisible);
|
||||
}
|
||||
@ -819,7 +819,7 @@ NS_IMETHODIMP nsWebBrowser::ScrollByLines(PRInt32 numLines)
|
||||
|
||||
nsCOMPtr<nsITextScroll> scroll(do_QueryInterface(m_DocShell));
|
||||
|
||||
NS_ENSURE(scroll, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(scroll, NS_ERROR_FAILURE);
|
||||
|
||||
return scroll->ScrollByLines(numLines);
|
||||
}
|
||||
@ -830,7 +830,7 @@ NS_IMETHODIMP nsWebBrowser::ScrollByPages(PRInt32 numPages)
|
||||
|
||||
nsCOMPtr<nsITextScroll> scroll(do_QueryInterface(m_DocShell));
|
||||
|
||||
NS_ENSURE(scroll, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(scroll, NS_ERROR_FAILURE);
|
||||
|
||||
return scroll->ScrollByPages(numPages);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user