зеркало из https://github.com/mozilla/pjs.git
Bug 398433 - "PRBool misuse bugs in content/" [p=tglek@mozilla.com (Taras Glek) r+sr=sicking a1.9=schrep a=blocking1.9+]
This commit is contained in:
Родитель
e74a25928b
Коммит
203ab3e6e7
|
@ -916,7 +916,7 @@ nsContentUtils::CanCallerAccess(nsIDOMNode *aNode)
|
|||
|
||||
PRBool subsumes;
|
||||
nsresult rv = subjectPrincipal->Subsumes(nodePrincipal, &subsumes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
if (subsumes) {
|
||||
return PR_TRUE;
|
||||
|
|
|
@ -1374,11 +1374,11 @@ IsSameOrigin(nsIPrincipal* aPrincipal, nsIChannel* aChannel)
|
|||
|
||||
nsCOMPtr<nsIURI> codebase;
|
||||
nsresult rv = aPrincipal->GetURI(getter_AddRefs(codebase));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
nsCOMPtr<nsIURI> channelURI;
|
||||
rv = aChannel->GetURI(getter_AddRefs(channelURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
rv = nsContentUtils::GetSecurityManager()->
|
||||
CheckSameOriginURI(codebase, channelURI, PR_FALSE);
|
||||
|
@ -2477,7 +2477,7 @@ nsXMLHttpRequest::OverrideMimeType(const nsACString& aMimeType)
|
|||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::GetMultipart(PRBool *_retval)
|
||||
{
|
||||
*_retval = mState & XML_HTTP_REQUEST_MULTIPART;
|
||||
*_retval = !!(mState & XML_HTTP_REQUEST_MULTIPART);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1835,7 +1835,7 @@ nsCanvasRenderingContext2D::IsPointInPath(float x, float y, PRBool *retVal)
|
|||
if (!FloatValidate(x,y))
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
|
||||
*retVal = (PRBool) cairo_in_fill(mCairo, x, y);
|
||||
*retVal = !!cairo_in_fill(mCairo, x, y);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ nsIMEStateManager::OnInstalledMenuKeyboardListener(PRBool aInstalling)
|
|||
PRBool
|
||||
nsIMEStateManager::IsActive(nsPresContext* aPresContext)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPresContext);
|
||||
NS_ENSURE_TRUE(aPresContext, PR_FALSE);
|
||||
nsPIDOMWindow* window = aPresContext->Document()->GetWindow();
|
||||
NS_ENSURE_TRUE(window, PR_FALSE);
|
||||
if (!sActiveWindow || sActiveWindow != window->GetPrivateRoot()) {
|
||||
|
@ -254,7 +254,7 @@ nsIMEStateManager::SetIMEState(nsPresContext* aPresContext,
|
|||
aKB->SetIMEEnabled(state);
|
||||
}
|
||||
if (aState & nsIContent::IME_STATUS_MASK_OPENED) {
|
||||
PRBool open = (aState & nsIContent::IME_STATUS_OPEN);
|
||||
PRBool open = !!(aState & nsIContent::IME_STATUS_OPEN);
|
||||
aKB->SetIMEOpenState(open);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1097,7 +1097,7 @@ nsGenericHTMLElement::UpdateEditableState()
|
|||
// XXX Should we do this only when in a document?
|
||||
ContentEditableTristate value = GetContentEditableValue();
|
||||
if (value != eInherit) {
|
||||
SetEditableFlag(value);
|
||||
SetEditableFlag(!!value);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1882,7 +1882,7 @@ nsGenericHTMLFormElement::UpdateEditableFormControlState()
|
|||
{
|
||||
ContentEditableTristate value = GetContentEditableValue();
|
||||
if (value != eInherit) {
|
||||
SetEditableFlag(value);
|
||||
SetEditableFlag(!!value);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1596,10 +1596,10 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
|||
return NS_OK;
|
||||
}
|
||||
nsresult rv = NS_OK;
|
||||
PRBool outerActivateEvent = aVisitor.mItemFlags & NS_OUTER_ACTIVATE_EVENT;
|
||||
PRBool outerActivateEvent = !!(aVisitor.mItemFlags & NS_OUTER_ACTIVATE_EVENT);
|
||||
PRBool originalCheckedValue =
|
||||
aVisitor.mItemFlags & NS_ORIGINAL_CHECKED_VALUE;
|
||||
PRBool noContentDispatch = aVisitor.mItemFlags & NS_NO_CONTENT_DISPATCH;
|
||||
!!(aVisitor.mItemFlags & NS_ORIGINAL_CHECKED_VALUE);
|
||||
PRBool noContentDispatch = !!(aVisitor.mItemFlags & NS_NO_CONTENT_DISPATCH);
|
||||
PRInt8 oldType = NS_CONTROL_TYPE(aVisitor.mItemFlags);
|
||||
// Ideally we would make the default action for click and space just dispatch
|
||||
// DOMActivate, and the default action for DOMActivate flip the checkbox/
|
||||
|
|
|
@ -246,8 +246,8 @@ nsXBLPrototypeHandler::ExecuteHandler(nsPIDOMEventTarget* aTarget,
|
|||
return rv;
|
||||
|
||||
// See if our event receiver is a content node (and not us).
|
||||
PRBool isXULKey = (mType & NS_HANDLER_TYPE_XUL);
|
||||
PRBool isXBLCommand = (mType & NS_HANDLER_TYPE_XBL_COMMAND);
|
||||
PRBool isXULKey = !!(mType & NS_HANDLER_TYPE_XUL);
|
||||
PRBool isXBLCommand = !!(mType & NS_HANDLER_TYPE_XBL_COMMAND);
|
||||
NS_ASSERTION(!(isXULKey && isXBLCommand),
|
||||
"can't be both a key and xbl command handler");
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ RelationalExpr::compareResults(txIEvalContext* aContext, txAExprResult* aLeft,
|
|||
txNodeSet* nodeSet = static_cast<txNodeSet*>(aLeft);
|
||||
nsRefPtr<StringResult> strResult;
|
||||
rv = aContext->recycler()->getStringResult(getter_AddRefs(strResult));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
PRInt32 i;
|
||||
for (i = 0; i < nodeSet->size(); ++i) {
|
||||
|
@ -88,7 +88,7 @@ RelationalExpr::compareResults(txIEvalContext* aContext, txAExprResult* aLeft,
|
|||
txNodeSet* nodeSet = static_cast<txNodeSet*>(aRight);
|
||||
nsRefPtr<StringResult> strResult;
|
||||
rv = aContext->recycler()->getStringResult(getter_AddRefs(strResult));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
PRInt32 i;
|
||||
for (i = 0; i < nodeSet->size(); ++i) {
|
||||
|
|
|
@ -47,7 +47,7 @@ CurrentFunctionCall::getReturnType()
|
|||
PRBool
|
||||
CurrentFunctionCall::isSensitiveTo(ContextSensitivity aContext)
|
||||
{
|
||||
return (aContext & PRIVATE_CONTEXT);
|
||||
return !!(aContext & PRIVATE_CONTEXT);
|
||||
}
|
||||
|
||||
#ifdef TX_TO_STRING
|
||||
|
|
|
@ -1111,7 +1111,7 @@ TX_XSLTFunctionAvailable(nsIAtom* aName, PRInt32 aNameSpaceID)
|
|||
{
|
||||
nsRefPtr<txStylesheetCompiler> compiler =
|
||||
new txStylesheetCompiler(EmptyString(), nsnull);
|
||||
NS_ENSURE_TRUE(compiler, NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ENSURE_TRUE(compiler, PR_FALSE);
|
||||
|
||||
nsAutoPtr<FunctionCall> fnCall;
|
||||
|
||||
|
|
|
@ -456,7 +456,7 @@ MBool txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext
|
|||
// Create the context node set for evaluating the predicates
|
||||
nsRefPtr<txNodeSet> nodes;
|
||||
nsresult rv = aContext->recycler()->getNodeSet(getter_AddRefs(nodes));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, MB_FALSE);
|
||||
|
||||
PRBool hasNext = mIsAttr ? walker.moveToFirstAttribute() :
|
||||
walker.moveToFirstChild();
|
||||
|
@ -471,7 +471,7 @@ MBool txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext
|
|||
Expr* predicate = mPredicates[0];
|
||||
nsRefPtr<txNodeSet> newNodes;
|
||||
rv = aContext->recycler()->getNodeSet(getter_AddRefs(newNodes));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, MB_FALSE);
|
||||
|
||||
PRUint32 i, predLen = mPredicates.Length();
|
||||
for (i = 1; i < predLen; ++i) {
|
||||
|
|
|
@ -604,7 +604,7 @@ public:
|
|||
void ClearLazyState(LazyState aFlags)
|
||||
{ UnsetFlags(aFlags << XUL_ELEMENT_LAZY_STATE_OFFSET); }
|
||||
PRBool GetLazyState(LazyState aFlag)
|
||||
{ return GetFlags() & (aFlag << XUL_ELEMENT_LAZY_STATE_OFFSET); }
|
||||
{ return !!(GetFlags() & (aFlag << XUL_ELEMENT_LAZY_STATE_OFFSET)); }
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE(nsGenericElement::)
|
||||
|
|
|
@ -274,7 +274,7 @@ nsRDFConInstanceTestNode::CanPropagate(nsIRDFResource* aSource,
|
|||
= do_GetService("@mozilla.org/rdf/container-utils;1");
|
||||
|
||||
if (! rdfc)
|
||||
return NS_ERROR_FAILURE;
|
||||
return PR_FALSE;
|
||||
|
||||
// We can certainly propagate ordinal properties
|
||||
rv = rdfc->IsOrdinalProperty(aProperty, &canpropagate);
|
||||
|
|
|
@ -502,7 +502,7 @@ nsRDFConMemberTestNode::CanPropagate(nsIRDFResource* aSource,
|
|||
do_GetService("@mozilla.org/rdf/container-utils;1");
|
||||
|
||||
if (! rdfc)
|
||||
return NS_ERROR_FAILURE;
|
||||
return PR_FALSE;
|
||||
|
||||
// We can certainly propagate ordinal properties
|
||||
rv = rdfc->IsOrdinalProperty(aProperty, &canpropagate);
|
||||
|
|
Загрузка…
Ссылка в новой задаче