fixes bug 328925 "Replace NS_WARN_IF_FALSE with NS_ASSERTION (where appropriate)" r=dbaron

git-svn-id: svn://10.0.0.236/trunk@193272 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%meer.net 2006-03-30 18:40:56 +00:00
parent 4abf2f1f94
commit 70deb5f58d
57 changed files with 112 additions and 112 deletions

View File

@ -145,8 +145,8 @@ setTextContentsCB(AtkEditableText *aText, const gchar *aString)
NS_ConvertUTF8toUTF16 strContent(aString);
nsresult rv = accText->SetTextContents(strContent);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::SetTextContents, failed\n");
NS_ASSERTION(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::SetTextContents, failed\n");
}
void
@ -172,8 +172,8 @@ insertTextCB(AtkEditableText *aText,
// *aPosition = pos;
nsresult rv = accText->InsertText(strContent, *aPosition);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::InsertText, failed\n");
NS_ASSERTION(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::InsertText, failed\n");
MAI_LOG_DEBUG(("EditableText: insert aString=%s, aLength=%d, aPosition=%d",
aString, aLength, *aPosition));
@ -195,8 +195,8 @@ copyTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
MAI_LOG_DEBUG(("EditableText: copyTextCB, aStartPos=%d, aEndPos=%d",
aStartPos, aEndPos));
nsresult rv = accText->CopyText(aStartPos, aEndPos);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::CopyText, failed\n");
NS_ASSERTION(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::CopyText, failed\n");
}
void
@ -214,8 +214,8 @@ cutTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
MAI_LOG_DEBUG(("EditableText: cutTextCB, aStartPos=%d, aEndPos=%d",
aStartPos, aEndPos));
nsresult rv = accText->CutText(aStartPos, aEndPos);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::CutText, failed\n");
NS_ASSERTION(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::CutText, failed\n");
}
void
@ -234,8 +234,8 @@ deleteTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
MAI_LOG_DEBUG(("EditableText: deleteTextCB, aStartPos=%d, aEndPos=%d",
aStartPos, aEndPos));
nsresult rv = accText->DeleteText(aStartPos, aEndPos);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::DeleteText, failed\n");
NS_ASSERTION(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::DeleteText, failed\n");
}
void
@ -253,6 +253,6 @@ pasteTextCB(AtkEditableText *aText, gint aPosition)
MAI_LOG_DEBUG(("EditableText: pasteTextCB, aPosition=%d", aPosition));
nsresult rv = accText->PasteText(aPosition);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::PasteText, failed\n");
NS_ASSERTION(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::PasteText, failed\n");
}

View File

@ -370,8 +370,8 @@ getCharacterExtentsCB(AtkText *aText, gint aOffset,
*aY = extY;
*aWidth = extWidth;
*aHeight = extHeight;
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceText::GetCharacterExtents, failed\n");
NS_ASSERTION(NS_SUCCEEDED(rv),
"MaiInterfaceText::GetCharacterExtents, failed\n");
}
gint

View File

@ -130,7 +130,7 @@ nsPrincipal::Init(const nsACString& aCertFingerprint,
}
}
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "nsPrincipal::Init() failed");
NS_ASSERTION(NS_SUCCEEDED(rv), "nsPrincipal::Init() failed");
return rv;
}

View File

@ -2025,7 +2025,7 @@ nsContentUtils::LoadImage(nsIURI* aURI, nsIDocument* aLoadingDocument,
}
nsCOMPtr<nsILoadGroup> loadGroup = aLoadingDocument->GetDocumentLoadGroup();
NS_WARN_IF_FALSE(loadGroup, "Could not get loadgroup; onload may fire too early");
NS_ASSERTION(loadGroup, "Could not get loadgroup; onload may fire too early");
nsIURI *documentURI = aLoadingDocument->GetDocumentURI();

View File

@ -410,8 +410,8 @@ nsFrameLoader::EnsureDocShell()
// enclosing chrome shell.
chromeEventHandler = do_QueryInterface(mOwnerContent);
NS_WARN_IF_FALSE(chromeEventHandler,
"This mContent should implement this.");
NS_ASSERTION(chromeEventHandler,
"This mContent should implement this.");
} else {
nsCOMPtr<nsIDocShell> parentShell(do_QueryInterface(parentAsNode));

View File

@ -1588,7 +1588,7 @@ nsPlainTextSerializer::Write(const nsAString& aString)
// This mustn't be mixed with intelligent wrapping without clearing
// the mCurrentLine buffer before!!!
NS_WARN_IF_FALSE(mCurrentLine.IsEmpty(),
NS_ASSERTION(mCurrentLine.IsEmpty(),
"Mixed wrapping data and nonwrapping data on the same line");
if (!mCurrentLine.IsEmpty()) {
FlushLine();

View File

@ -800,7 +800,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
if (!focusedWindow)
focusedWindow = win;
NS_WARN_IF_FALSE(focusedWindow,"check why focusedWindow is null!!!");
NS_ASSERTION(focusedWindow,"check why focusedWindow is null!!!");
// Focus the DOM window.
if (focusedWindow) {
@ -1462,7 +1462,7 @@ void
nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
nsMouseEvent *aEvent)
{
NS_WARN_IF_FALSE(aPresContext, "This shouldn't happen.");
NS_ASSERTION(aPresContext, "This shouldn't happen.");
if ( IsTrackingDragGesture() ) {
mCurrentTarget = aPresContext->GetPresShell()->GetPrimaryFrameFor(mGestureDownFrameOwner);

View File

@ -93,7 +93,7 @@ nsPrivateTextRangeList::nsPrivateTextRangeList(PRUint16 aLength,
: mLength(aLength), mList(aList)
{
if(! aList) {
NS_WARN_IF_FALSE(!aLength, "Geez, this deosn't make sense");
NS_ASSERTION(!aLength, "Geez, this deosn't make sense");
mLength = 0;
}

View File

@ -1863,7 +1863,7 @@ nsFormControlList::NamedItem(const nsAString& aName,
if (!*aReturn) {
// If not, we check if it's a node list.
nsCOMPtr<nsIDOMNodeList> nodeList(do_QueryInterface(supports));
NS_WARN_IF_FALSE(nodeList, "Huh, what's going one here?");
NS_ASSERTION(nodeList, "Huh, what's going one here?");
if (nodeList) {
// And since we're only asking for one node here, we return the first

View File

@ -338,7 +338,7 @@ nsHTMLImageElement::GetWidthHeight()
if (imageFrame) {
CallQueryInterface(imageFrame, &frame);
NS_WARN_IF_FALSE(frame,"Should not happen - image frame is not frame");
NS_ASSERTION(frame,"Should not happen - image frame is not frame");
}
if (frame) {

View File

@ -1315,8 +1315,8 @@ SinkContext::CloseContainer(const nsHTMLTag aTag, PRBool aMalformed)
"SinkContext::CloseContainer",
aTag, mStackPos - 1, mSink);
NS_WARN_IF_FALSE(mStackPos > 0,
"stack out of bounds. wrong context probably!");
NS_ASSERTION(mStackPos > 0,
"stack out of bounds. wrong context probably!");
if (mStackPos <= 0) {
return NS_OK; // Fix crash - Ref. bug 45975 or 45007
@ -2052,7 +2052,7 @@ HTMLContentSink::Init(nsIDocument* aDoc,
service->GetTopicObservers(NS_LITERAL_STRING("text/html"),
getter_AddRefs(mObservers));
NS_WARN_IF_FALSE(mDocShell, "oops no docshell!");
NS_ASSERTION(mDocShell, "oops no docshell!");
// Find out if subframes are enabled
if (mDocShell) {

View File

@ -2449,8 +2449,8 @@ nsHTMLDocument::GetElementById(const nsAString& aElementId,
return GetElementById(aElementId, aReturn);
}
NS_WARN_IF_FALSE(!aElementId.IsEmpty(),
"getElementById(\"\") called, fix caller?");
NS_ASSERTION(!aElementId.IsEmpty(),
"getElementById(\"\") called, fix caller?");
if (mRootContent && !aElementId.IsEmpty()) {
e = nsContentUtils::MatchElementId(mRootContent, idAtom);
@ -3534,7 +3534,7 @@ nsHTMLDocument::CreateAndAddWyciwygChannel(void)
channel->SetOriginalURI(wcwgURI);
rv = loadGroup->AddRequest(mWyciwygChannel, nsnull);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to add request to load group.");
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to add request to load group.");
}
return rv;

View File

@ -764,7 +764,7 @@ nsXMLDocument::GetElementById(const nsAString& aElementId,
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
NS_WARN_IF_FALSE(!aElementId.IsEmpty(), "getElementById(\"\"), fix caller?");
NS_ASSERTION(!aElementId.IsEmpty(), "getElementById(\"\"), fix caller?");
if (aElementId.IsEmpty())
return NS_OK;

View File

@ -1622,7 +1622,7 @@ nsXULDocument::GetElementById(const nsAString& aId,
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
NS_WARN_IF_FALSE(!aId.IsEmpty(),"getElementById(\"\"), fix caller?");
NS_ASSERTION(!aId.IsEmpty(),"getElementById(\"\"), fix caller?");
if (aId.IsEmpty())
return NS_OK;

View File

@ -66,7 +66,7 @@ nsDSURIContentListener::Init()
{
nsresult rv;
mNavInfo = do_GetService(NS_WEBNAVIGATION_INFO_CONTRACTID, &rv);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to get webnav info");
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to get webnav info");
return rv;
}

View File

@ -357,7 +357,7 @@ nsDocShell::DestroyChildren()
PRInt32 n = mChildList.Count();
for (PRInt32 i = 0; i < n; i++) {
shell = do_QueryInterface(ChildAt(i));
NS_WARN_IF_FALSE(shell, "docshell has null child");
NS_ASSERTION(shell, "docshell has null child");
if (shell) {
shell->SetTreeOwner(nsnull);

View File

@ -3845,7 +3845,7 @@ nsWindowSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
// after the wrapper is found.
nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(nativeObj));
NS_WARN_IF_FALSE(sgo, "nativeObj not a global object!");
NS_ASSERTION(sgo, "nativeObj not a global object!");
if (sgo) {
*parentObj = sgo->GetGlobalJSObject();

View File

@ -140,8 +140,8 @@ nsDOMWindowList::Item(PRUint32 aIndex, nsIDOMWindow** aReturn)
mDocShellNode->GetChildAt(aIndex, getter_AddRefs(item));
nsCOMPtr<nsIScriptGlobalObject> globalObject(do_GetInterface(item));
NS_WARN_IF_FALSE(!item || (item && globalObject),
"Couldn't get to the globalObject");
NS_ASSERTION(!item || (item && globalObject),
"Couldn't get to the globalObject");
if (globalObject) {
CallQueryInterface(globalObject, aReturn);

View File

@ -837,8 +837,8 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
PRBool aClearScopeHint,
PRBool aIsInternalCall)
{
NS_WARN_IF_FALSE(mDocumentPrincipal == nsnull,
"mDocumentPrincipal prematurely set!");
NS_ASSERTION(mDocumentPrincipal == nsnull,
"mDocumentPrincipal prematurely set!");
#ifdef PR_LOGGING
if (IsInnerWindow() && aDocument && gDOMLeakPRLog &&
PR_LOG_TEST(gDOMLeakPRLog, PR_LOG_DEBUG)) {
@ -3089,7 +3089,7 @@ nsGlobalWindow::MakeScriptDialogTitle(const nsAString &aInTitle,
// right thing for javascript: and data: documents.
nsresult rv = NS_OK;
NS_WARN_IF_FALSE(sSecMan, "Global Window has no security manager!");
NS_ASSERTION(sSecMan, "Global Window has no security manager!");
if (sSecMan) {
nsCOMPtr<nsIPrincipal> principal;
rv = sSecMan->GetSubjectPrincipal(getter_AddRefs(principal));

View File

@ -189,7 +189,7 @@ AppLauncherDlg::LaunchProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
if (uMsg == WM_INITDIALOG)
{
pThis = (AppLauncherDlg *) lParam;
NS_WARN_IF_FALSE(pThis, "need a pointer to this!");
NS_ASSERTION(pThis, "need a pointer to this!");
pThis->mHwndDlg = hwndDlg;
SetWindowLong(hwndDlg, DWL_USER, lParam);
}
@ -205,7 +205,7 @@ AppLauncherDlg::LaunchProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED)
{
NS_WARN_IF_FALSE(pThis, "Should be non-null!");
NS_ASSERTION(pThis, "Should be non-null!");
switch (LOWORD(wParam))
{
case IDC_CHOOSE:
@ -348,13 +348,13 @@ ProgressDlg::ProgressProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
switch (uMsg)
{
case WM_INITDIALOG:
NS_WARN_IF_FALSE(pThis, "Should be non-null!");
NS_ASSERTION(pThis, "Should be non-null!");
pThis->OnInitDialog();
return TRUE;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED)
{
NS_WARN_IF_FALSE(pThis, "Should be non-null!");
NS_ASSERTION(pThis, "Should be non-null!");
switch (LOWORD(wParam))
{
case IDCANCEL:

View File

@ -567,7 +567,7 @@ EmbedPrivate::PushStartup(void)
XRE_NotifyProfile();
rv = RegisterAppComponents();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Warning: Failed to register app components.\n");
NS_ASSERTION(NS_SUCCEEDED(rv), "Warning: Failed to register app components.\n");
// XXX startup appshell service?
// XXX create offscreen window for appshell service?

View File

@ -185,13 +185,13 @@ OSStatus CTextInputEventHandler::HandleUpdateActiveInputArea(
if (noErr == err)
{
TextRangeArray* pt = (TextRangeArray*)::malloc(rngSize);
NS_WARN_IF_FALSE( (pt), "Cannot malloc for hiliteRng") ;
NS_ASSERTION( (pt), "Cannot malloc for hiliteRng") ;
if (pt)
{
hiliteRng = pt;
err = ::GetEventParameter(inEvent, kEventParamTextInputSendHiliteRng, typeTextRangeArray, NULL,
rngSize, &rngSize, hiliteRng);
NS_WARN_IF_FALSE( (noErr == err), "Cannot get hiliteRng") ;
NS_ASSERTION( (noErr == err), "Cannot get hiliteRng") ;
}
}
// printf("call HandleUpdateActiveInputArea textlength = %d ",text.Length());

View File

@ -122,10 +122,10 @@ QGeckoGlobals::pushStartup()
}
rv = startupProfile();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Warning: Failed to start up profiles.\n");
NS_ASSERTION(NS_SUCCEEDED(rv), "Warning: Failed to start up profiles.\n");
rv = registerAppComponents();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Warning: Failed to register app components.\n");
NS_ASSERTION(NS_SUCCEEDED(rv), "Warning: Failed to register app components.\n");
// XXX startup appshell service?

View File

@ -264,7 +264,7 @@ PyG_Base::MakeInterfaceParam(nsISupports *pis,
// But if it ever triggers, the poor Python code has no real hope
// of returning something useful, so we should at least do our
// best to provide the useful data.
NS_WARN_IF_FALSE( ((piid != NULL) ^ (d != NULL)) == 1, "No information on the interface available - Python's gunna have a hard time doing much with it!");
NS_ASSERTION( ((piid != NULL) ^ (d != NULL)) == 1, "No information on the interface available - Python's gunna have a hard time doing much with it!");
PyObject *obIID = NULL;
PyObject *obISupports = NULL;
PyObject *obParamDesc = NULL;
@ -306,7 +306,7 @@ PyG_Base::MakeInterfaceParam(nsISupports *pis,
paramIndex);
done:
if (PyErr_Occurred()) {
NS_WARN_IF_FALSE(result==NULL, "Have an error, but also a result!");
NS_ASSERTION(result==NULL, "Have an error, but also a result!");
PyXPCOM_LogError("Wrapping an interface object for the gateway failed\n");
}
Py_XDECREF(obIID);
@ -389,7 +389,7 @@ PyG_Base::QueryInterface(REFNSIID iid, void** ppv)
Py_DECREF(result);
} else {
NS_ABORT_IF_FALSE(PyErr_Occurred(), "Got NULL result, but no Python error flagged!");
NS_WARN_IF_FALSE(!supports, "Have failure with success flag set!");
NS_ASSERTION(!supports, "Have failure with success flag set!");
PyXPCOM_LogError("The _QueryInterface_ processing failed.\n");
// supports remains false.
// We have reported the error, and are returning to COM,

View File

@ -1188,7 +1188,7 @@ PRBool PyXPCOM_InterfaceVariantHelper::FillInVariant(const PythonTypeDescriptor
NS_ABORT_IF_FALSE(!td.is_auto_in, "Param is 'auto-in', but we are filling it normally!");
PyObject *val_use = NULL; // a temp object converters can use, and will be DECREF'd
PyObject *val = PySequence_GetItem(m_pyparams, param_index);
NS_WARN_IF_FALSE(val, "Have an 'in' param, but no Python value!");
NS_ASSERTION(val, "Have an 'in' param, but no Python value!");
if (val==NULL) {
PyErr_Format(PyExc_ValueError, "Param %d is marked as 'in', but no value was given", value_index);
return PR_FALSE;
@ -1397,7 +1397,7 @@ PRBool PyXPCOM_InterfaceVariantHelper::FillInVariant(const PythonTypeDescriptor
case nsXPTType::T_INTERFACE_IS: {
nsIID iid;
nsXPTCVariant &ns_viid = m_var_array[td.argnum];
NS_WARN_IF_FALSE(XPT_TDP_TAG(ns_viid.type)==nsXPTType::T_IID, "The INTERFACE_IS iid describer isn't an IID!");
NS_ASSERTION(XPT_TDP_TAG(ns_viid.type)==nsXPTType::T_IID, "The INTERFACE_IS iid describer isn't an IID!");
// This is a pretty serious problem, but not Python's fault!
// Just return an nsISupports and hope the caller does whatever
// QI they need before using it.
@ -1718,7 +1718,7 @@ PyObject *PyXPCOM_InterfaceVariantHelper::MakeSinglePythonResult(int index)
case nsXPTType::T_INTERFACE_IS: {
nsIID iid;
nsXPTCVariant &ns_viid = m_var_array[td.argnum];
NS_WARN_IF_FALSE(XPT_TDP_TAG(ns_viid.type)==nsXPTType::T_IID, "The INTERFACE_IS iid describer isn't an IID!");
NS_ASSERTION(XPT_TDP_TAG(ns_viid.type)==nsXPTType::T_IID, "The INTERFACE_IS iid describer isn't an IID!");
if (XPT_TDP_TAG(ns_viid.type)==nsXPTType::T_IID) {
nsIID *piid = (nsIID *)ns_viid.val.p;
if (piid==NULL)
@ -2173,7 +2173,7 @@ PRBool PyXPCOM_GatewayVariantHelper::GetIIDForINTERFACE_ID(int index, const nsII
// in or out, so we will allow it.
nsXPTParamInfo *pi = (nsXPTParamInfo *)m_info->params+index;
nsXPTType typ = pi->GetType();
NS_WARN_IF_FALSE(XPT_TDP_TAG(typ) == nsXPTType::T_IID, "INTERFACE_IS IID param isn't an IID!");
NS_ASSERTION(XPT_TDP_TAG(typ) == nsXPTType::T_IID, "INTERFACE_IS IID param isn't an IID!");
NS_ABORT_IF_FALSE(typ.IsPointer(), "Expecting to re-fill a pointer value.");
if (XPT_TDP_TAG(typ) != nsXPTType::T_IID)
*ppret = &NS_GET_IID(nsISupports);

View File

@ -234,7 +234,7 @@ void pyxpcom_construct(void)
#ifndef PYXPCOM_USE_PYGILSTATE
PRStatus status;
status = PR_NewThreadPrivateIndex( &tlsIndex, NULL );
NS_WARN_IF_FALSE(status==0, "Could not allocate TLS storage");
NS_ASSERTION(status==0, "Could not allocate TLS storage");
if (NS_FAILED(status)) {
PR_DestroyLock(g_lockMain);
return; // PR_FALSE;

View File

@ -148,7 +148,7 @@ PyXPCOMMethod_XPTC_InvokeByIndex(PyObject *self, PyObject *args)
// We no longer rely on PyErr_Occurred() for our error state,
// but keeping this assertion can't hurt - it should still always be true!
NS_WARN_IF_FALSE(!PyErr_Occurred(), "Should be no pending Python error!");
NS_ASSERTION(!PyErr_Occurred(), "Should be no pending Python error!");
if (!PyArg_ParseTuple(args, "OiO", &obIS, &index, &obParams))
return NULL;

View File

@ -274,9 +274,9 @@ nsWebDAVService::ChannelFromResource(nsIWebDAVResource *aResource,
if (NS_SUCCEEDED(rv)) {
rv = baseChannel->SetLoadFlags(loadFlags |
nsIRequest::VALIDATE_ALWAYS);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"nsWebDavService::ChannelFromResource(): "
"Couldn't set loadflags on channel");
NS_ASSERTION(NS_SUCCEEDED(rv),
"nsWebDavService::ChannelFromResource(): "
"Couldn't set loadflags on channel");
}
rv = CallQueryInterface(baseChannel, aChannel);

View File

@ -986,7 +986,7 @@ nsXFormsUtils::EventHandlingAllowed(nsIDOMEvent* aEvent, nsIDOMNode* aTarget)
}
}
}
NS_WARN_IF_FALSE(allow, "Event handling not allowed!");
NS_ASSERTION(allow, "Event handling not allowed!");
return allow;
}

View File

@ -74,7 +74,7 @@ class NS_PSSHARED nsPaperSizePS {
* @return VOID
*/
void Next() {
NS_WARN_IF_FALSE(!AtEnd(), "Invalid current item");
NS_ASSERTION(!AtEnd(), "Invalid current item");
mCurrent++;
}

View File

@ -1054,8 +1054,8 @@ nsXPConnect::RestoreWrappedNativePrototype(JSContext * aJSContext,
// This code should do the right thing even if we're
// restoring the current proto, but warn in that case
// since doing that is pointless.
NS_WARN_IF_FALSE(proto != oldProto,
"Restoring current prototype, fix caller!");
NS_ASSERTION(proto != oldProto,
"Restoring current prototype, fix caller!");
}
map->Add(aClassInfo, proto);

View File

@ -763,7 +763,7 @@ public:
nsIXPCSecurityManager* GetAppropriateSecurityManager(PRUint16 flags) const
{
NS_WARN_IF_FALSE(CallerTypeIsKnown(),"missing caller type set somewhere");
NS_ASSERTION(CallerTypeIsKnown(),"missing caller type set somewhere");
if(!CallerTypeIsJavaScript())
return nsnull;
if(mSecurityManager)

View File

@ -1496,7 +1496,7 @@ XPCWrappedNative::InitTearOff(XPCCallContext& ccx,
proto = JS_GetPrototype(ccx, jso);
NS_WARN_IF_FALSE(proto && proto != our_proto,
NS_ASSERTION(proto && proto != our_proto,
"!!! xpconnect/xbl check - wrapper has no special proto");
PRBool found_our_proto = PR_FALSE;
@ -1506,7 +1506,7 @@ XPCWrappedNative::InitTearOff(XPCCallContext& ccx,
found_our_proto = proto == our_proto;
}
NS_WARN_IF_FALSE(found_our_proto,
NS_ASSERTION(found_our_proto,
"!!! xpconnect/xbl check - wrapper has extra proto");
}
else

View File

@ -756,7 +756,7 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow)
// get the DOM event receiver
nsCOMPtr<nsIDOMEventReceiver> erP(do_QueryInterface(mDocument));
NS_WARN_IF_FALSE(erP, "No event receiver in document!");
NS_ASSERTION(erP, "No event receiver in document!");
if (erP) {
rv = erP->AddEventListenerByIID(mFocusListener,
@ -1298,7 +1298,7 @@ DocumentViewerImpl::Open(nsISupports *aState, nsISHEntry *aSHEntry)
if (mFocusListener) {
// get the DOM event receiver
nsCOMPtr<nsIDOMEventReceiver> erP(do_QueryInterface(mDocument));
NS_WARN_IF_FALSE(erP, "No event receiver in document!");
NS_ASSERTION(erP, "No event receiver in document!");
if (erP) {
erP->AddEventListenerByIID(mFocusListener,
@ -1360,7 +1360,7 @@ DocumentViewerImpl::Close(nsISHEntry *aSHEntry)
if (mFocusListener) {
// get the DOM event receiver
nsCOMPtr<nsIDOMEventReceiver> erP(do_QueryInterface(mDocument));
NS_WARN_IF_FALSE(erP, "No event receiver in document!");
NS_ASSERTION(erP, "No event receiver in document!");
if (erP) {
erP->RemoveEventListenerByIID(mFocusListener,
@ -1687,7 +1687,7 @@ DocumentViewerImpl::SetDOMDocument(nsIDOMDocument *aDocument)
// Register the focus listener on the new document
nsCOMPtr<nsIDOMEventReceiver> erP = do_QueryInterface(mDocument, &rv);
NS_WARN_IF_FALSE(erP, "No event receiver in document!");
NS_ASSERTION(erP, "No event receiver in document!");
if (erP) {
rv = erP->AddEventListenerByIID(mFocusListener,

View File

@ -5315,7 +5315,7 @@ nsTextFrame::MeasureText(nsPresContext* aPresContext,
if (isWhitespace) {
if ('\n' == firstChar) {
// We hit a newline. Stop looping.
NS_WARN_IF_FALSE(aTs.mPreformatted, "newline w/o ts.mPreformatted");
NS_ASSERTION(aTs.mPreformatted, "newline w/o ts.mPreformatted");
prevOffset = aTextData.mOffset;
aTextData.mOffset++;
endsInWhitespace = PR_TRUE;

View File

@ -320,7 +320,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(const nsHTMLReflowState& aReflowSt
if (totalCounts[PCT] > 0) {
if (totalAllocated + totalWidths[PCT] - dupedWidths[PCT] <= maxWidth) {
AllocateFully(totalAllocated, allocTypes, PCT);
//NS_WARN_IF_FALSE(totalAllocated <= maxWidth, "over allocated");
//NS_ASSERTION(totalAllocated <= maxWidth, "over allocated");
}
else {
AllocateConstrained(maxWidth - totalAllocated, PCT, PR_FALSE, allocTypes, p2t);
@ -331,7 +331,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(const nsHTMLReflowState& aReflowSt
if ((totalAllocated < maxWidth) && (totalCounts[FIX] > 0)) {
if (totalAllocated + totalWidths[FIX] - dupedWidths[FIX] <= maxWidth) {
AllocateFully(totalAllocated, allocTypes, FIX);
//NS_WARN_IF_FALSE(totalAllocated <= maxWidth, "over allocated");
//NS_ASSERTION(totalAllocated <= maxWidth, "over allocated");
}
else {
AllocateConstrained(maxWidth - totalAllocated, FIX, PR_TRUE, allocTypes, p2t);
@ -342,7 +342,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(const nsHTMLReflowState& aReflowSt
if ((totalAllocated < maxWidth) && (totalCounts[FIX_ADJ] > 0)) {
if (totalAllocated + totalWidths[FIX_ADJ] - dupedWidths[FIX_ADJ] <= maxWidth) {
AllocateFully(totalAllocated, allocTypes, FIX_ADJ);
//NS_WARN_IF_FALSE(totalAllocated <= maxWidth, "over allocated");
//NS_ASSERTION(totalAllocated <= maxWidth, "over allocated");
}
else {
AllocateConstrained(maxWidth - totalAllocated, FIX_ADJ, PR_TRUE, allocTypes, p2t);
@ -355,7 +355,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(const nsHTMLReflowState& aReflowSt
if (totalAllocated + totalWidths[MIN_PRO] - dupedWidths[MIN_PRO] +
totalWidths[DES_CON] - dupedWidths[DES_CON] <= maxWidth) {
AllocateFully(totalAllocated, allocTypes, DES_CON);
//NS_WARN_IF_FALSE(totalAllocated <= maxWidth, "over allocated");
//NS_ASSERTION(totalAllocated <= maxWidth, "over allocated");
}
else {
AllocateConstrained(maxWidth - totalAllocated, DES_CON, PR_TRUE, allocTypes, p2t);

View File

@ -1061,8 +1061,8 @@ nsTableRowGroupFrame::SplitRowGroup(nsPresContext* aPresContext,
if ((rowMetrics.height <= rowReflowState.availableHeight) || isTopOfPage) {
// The row stays on this page because either it split ok or we're on the top of page.
// If top of page and the height exceeded the avail height, then there will be data loss
NS_WARN_IF_FALSE(rowMetrics.height <= rowReflowState.availableHeight,
"data loss - incomplete row needed more height than available, on top of page");
NS_ASSERTION(rowMetrics.height <= rowReflowState.availableHeight,
"data loss - incomplete row needed more height than available, on top of page");
CreateContinuingRowFrame(*aPresContext, *rowFrame, (nsIFrame**)&contRow);
if (contRow) {
aDesiredSize.height += rowMetrics.height;

View File

@ -483,7 +483,7 @@ nsMenuPopupFrame::AdjustClientXYForNestedDocuments ( nsIDOMXULDocument* inPopupD
if ( rootView )
popupDocumentWidget = rootView->GetNearestWidget(nsnull);
}
NS_WARN_IF_FALSE(popupDocumentWidget, "ACK, BAD WIDGET");
NS_ASSERTION(popupDocumentWidget, "ACK, BAD WIDGET");
// Find the widget associated with the target's document.
// For tooltips, we check the document's tooltipNode (which is set by
@ -496,7 +496,7 @@ nsMenuPopupFrame::AdjustClientXYForNestedDocuments ( nsIDOMXULDocument* inPopupD
else
inPopupDoc->TrustedGetPopupNode(getter_AddRefs(targetNode));
//NS_WARN_IF_FALSE(targetNode, "no popup/tooltip node on document!");
//NS_ASSERTION(targetNode, "no popup/tooltip node on document!");
nsCOMPtr<nsIContent> targetAsContent ( do_QueryInterface(targetNode) );
nsIWidget* targetDocumentWidget = nsnull;
if ( targetAsContent ) {
@ -529,7 +529,7 @@ nsMenuPopupFrame::AdjustClientXYForNestedDocuments ( nsIDOMXULDocument* inPopupD
}
}
}
//NS_WARN_IF_FALSE(targetDocumentWidget, "ACK, BAD TARGET");
//NS_ASSERTION(targetDocumentWidget, "ACK, BAD TARGET");
// the offset we need is the difference between the upper left corner of the two widgets. Use
// screen coordinates to find the global offset between them.

View File

@ -119,7 +119,7 @@ EndGather(MimeObject *obj, PRBool abort_p)
*ssobj->buffer,
asHTML);
if (NS_FAILED(rv)) {
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "converter failure");
NS_ASSERTION(NS_SUCCEEDED(rv), "converter failure");
return -1;
}

View File

@ -5157,7 +5157,7 @@ nsresult nsPluginHostImpl::FindPlugins(PRBool aCreatePluginList, PRBool * aPlugi
// Failure here is not a show-stopper so just warn.
rv = EnsurePrivateDirServiceProvider();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to register dir service provider.");
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to register dir service provider.");
nsCOMPtr<nsIProperties> dirService(do_GetService(kDirectoryServiceContractID, &rv));
if (NS_FAILED(rv))

View File

@ -104,10 +104,10 @@ nsEntryStack::~nsEntryStack() {
void
nsEntryStack::ReleaseAll(nsNodeAllocator* aNodeAllocator)
{
NS_WARN_IF_FALSE(aNodeAllocator,"no allocator? - potential leak!");
NS_ASSERTION(aNodeAllocator,"no allocator? - potential leak!");
if(aNodeAllocator) {
NS_WARN_IF_FALSE(mCount >= 0,"count should not be negative");
NS_ASSERTION(mCount >= 0,"count should not be negative");
while(mCount > 0) {
nsCParserNode* node=this->Pop();
IF_FREE(node,aNodeAllocator);

View File

@ -842,7 +842,7 @@ nsresult
nsExpatDriver::HandleError()
{
PRInt32 code = XML_GetErrorCode(mExpatParser);
NS_WARN_IF_FALSE(code > XML_ERROR_NONE, "unexpected XML error code");
NS_ASSERTION(code > XML_ERROR_NONE, "unexpected XML error code");
// Map Expat error code to an error string
// XXX Deal with error returns.

View File

@ -240,7 +240,7 @@ nsMimeMapperMac::ParseMappings ( const char* inMappings )
char*
nsMimeMapperMac::ExportMapping ( short * outLength ) const
{
NS_WARN_IF_FALSE ( outLength, "No out param provided" );
NS_ASSERTION ( outLength, "No out param provided" );
if ( outLength )
*outLength = 0;

View File

@ -2398,11 +2398,11 @@ NS_IMETHODIMP nsWindow::ResetInputState()
// currently, the nsMacEventHandler is owned by nsMacWindow, which is the top level window
// we delegate this call to its parent
nsIWidget* parent = GetParent();
NS_WARN_IF_FALSE(parent, "cannot get parent");
NS_ASSERTION(parent, "cannot get parent");
if (parent)
{
nsCOMPtr<nsIKBStateControl> kb = do_QueryInterface(parent);
NS_WARN_IF_FALSE(kb, "cannot get parent");
NS_ASSERTION(kb, "cannot get parent");
if (kb) {
return kb->ResetInputState();
}

View File

@ -163,14 +163,14 @@ nsExceptionService::nsExceptionService()
if (tlsIndex == BAD_TLS_INDEX) {
PRStatus status;
status = PR_NewThreadPrivateIndex( &tlsIndex, ThreadDestruct );
NS_WARN_IF_FALSE(status==0, "ScriptErrorService could not allocate TLS storage.");
NS_ASSERTION(status==0, "ScriptErrorService could not allocate TLS storage.");
}
lock = PR_NewLock();
NS_WARN_IF_FALSE(lock, "Error allocating ExceptionService lock");
NS_ASSERTION(lock, "Error allocating ExceptionService lock");
// observe XPCOM shutdown.
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1");
NS_WARN_IF_FALSE(observerService, "Could not get observer service!");
NS_ASSERTION(observerService, "Could not get observer service!");
if (observerService)
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
}

View File

@ -145,7 +145,7 @@ struct nsTraceRefcntStats {
// I hope to turn this on for everybody once we hit it a little less.
#define ASSERT_ACTIVITY_IS_LEGAL \
NS_WARN_IF_FALSE(gActivityTLS != BAD_TLS_INDEX && \
NS_ASSERTION(gActivityTLS != BAD_TLS_INDEX && \
NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0, \
"XPCOM objects created/destroyed from static ctor/dtor");

View File

@ -539,7 +539,7 @@ __cl__16nsQueryInterfaceCFRC4nsIDPPv proc
mov [ebp-04h],eax; status
; 48 #ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
; 49 NS_WARN_IF_FALSE(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
; 49 NS_ASSERTION(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
; 50 #endif
; 51 }
jmp @BLBL2
@ -583,7 +583,7 @@ nsQueryInterface::operator()( const nsIID& aIID, void** answer ) const
{
status = mRawPtr->QueryInterface(aIID, answer);
#ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
NS_WARN_IF_FALSE(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
NS_ASSERTION(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
#endif
}
else

View File

@ -800,7 +800,7 @@ NS_ShutdownXPCOM(nsIServiceManager* servMgr)
if (nsComponentManagerImpl::gComponentManager) {
nsrefcnt cnt;
NS_RELEASE2(nsComponentManagerImpl::gComponentManager, cnt);
NS_WARN_IF_FALSE(cnt == 0, "Component Manager being held past XPCOM shutdown.");
NS_ASSERTION(cnt == 0, "Component Manager being held past XPCOM shutdown.");
}
nsComponentManagerImpl::gComponentManager = nsnull;

View File

@ -192,7 +192,7 @@ static TimelineThreadData *GetThisThreadData()
if (new_data->timers==NULL)
goto done;
new_data->initTime = PR_Now();
NS_WARN_IF_FALSE(!gTimelineDisabled,
NS_ASSERTION(!gTimelineDisabled,
"Why are we creating new state when disabled?");
new_data->disabled = PR_FALSE;
data = new_data;
@ -202,7 +202,7 @@ static TimelineThreadData *GetThisThreadData()
done:
if (new_data) // eeek - error during creation!
delete new_data;
NS_WARN_IF_FALSE(data, "TimelineService could not get thread-local data");
NS_ASSERTION(data, "TimelineService could not get thread-local data");
return data;
}
@ -232,7 +232,7 @@ PRStatus TimelineInit(void)
PRInt64 tmp1, tmp2;
PRStatus status = PR_NewThreadPrivateIndex( &gTLSIndex, ThreadDestruct );
NS_WARN_IF_FALSE(status==0, "TimelineService could not allocate TLS storage.");
NS_ASSERTION(status==0, "TimelineService could not allocate TLS storage.");
timeStr = PR_GetEnv("NS_TIMELINE_INIT_TIME");
// NS_TIMELINE_INIT_TIME only makes sense for the main thread, so if it

View File

@ -366,7 +366,7 @@ nsBaseHashtableMT<KeyClass,DataType,UserDataType>::Init(PRUint32 initSize)
return PR_FALSE;
this->mLock = PR_NewLock();
NS_WARN_IF_FALSE(this->mLock, "Error creating lock during nsBaseHashtableL::Init()");
NS_ASSERTION(this->mLock, "Error creating lock during nsBaseHashtableL::Init()");
return (this->mLock != nsnull);
}

View File

@ -46,7 +46,7 @@ nsQueryInterface::operator()( const nsIID& aIID, void** answer ) const
{
status = mRawPtr->QueryInterface(aIID, answer);
#ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
NS_WARN_IF_FALSE(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
NS_ASSERTION(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
#endif
}
else
@ -63,7 +63,7 @@ nsQueryInterfaceWithError::operator()( const nsIID& aIID, void** answer ) const
{
status = mRawPtr->QueryInterface(aIID, answer);
#ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
NS_WARN_IF_FALSE(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
NS_ASSERTION(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
#endif
}
else

View File

@ -929,7 +929,7 @@ void nsFileSpec::MakeUnique(PRBool inCreateFile)
localFile->GetNativePath(path);
}
NS_WARN_IF_FALSE(!path.IsEmpty(), "MakeUnique() failed!");
NS_ASSERTION(!path.IsEmpty(), "MakeUnique() failed!");
*this = path.get(); // reset the filepath to point to the unique location
} // nsFileSpec::MakeUnique

View File

@ -539,7 +539,7 @@ __cl__16nsQueryInterfaceCFRC4nsIDPPv proc
mov [ebp-04h],eax; status
; 48 #ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
; 49 NS_WARN_IF_FALSE(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
; 49 NS_ASSERTION(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
; 50 #endif
; 51 }
jmp @BLBL2
@ -583,7 +583,7 @@ nsQueryInterface::operator()( const nsIID& aIID, void** answer ) const
{
status = mRawPtr->QueryInterface(aIID, answer);
#ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
NS_WARN_IF_FALSE(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
NS_ASSERTION(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
#endif
}
else

View File

@ -778,7 +778,7 @@ NS_IMETHODIMP nsXULWindow::SetVisibility(PRBool aVisibility)
// notify observers so that we can hide the splash screen if possible
nsCOMPtr<nsIObserverService> obssvc
(do_GetService("@mozilla.org/observer-service;1"));
NS_WARN_IF_FALSE(obssvc, "Couldn't get observer service.");
NS_ASSERTION(obssvc, "Couldn't get observer service.");
if (obssvc) {
obssvc->NotifyObservers(nsnull, "xul-window-visible", nsnull);
}

View File

@ -338,11 +338,11 @@ void AEApplicationClass::HandleReOpen(AEDesc *token, const AppleEvent *appleEven
if (!nas) ThrowIfOSErr(errAEEventNotHandled);
#else
nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID));
NS_WARN_IF_FALSE(appStartup, "Failed to get appstartup service");
NS_ASSERTION(appStartup, "Failed to get appstartup service");
if(!appStartup) ThrowIfOSErr(errAEEventNotHandled);
rv = appStartup->GetNativeAppSupport(getter_AddRefs(nas));
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to get NativeAppSupport");
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to get NativeAppSupport");
if(NS_FAILED(rv)) ThrowIfOSErr(errAEEventNotHandled);
#endif

View File

@ -223,7 +223,7 @@ nsWindowsHooks::GetSettings( nsWindowsHooksSettings **result ) {
prefs->mHaveBeenSet = BoolRegistryEntry( "haveBeenSet" );
#ifdef DEBUG_law
NS_WARN_IF_FALSE( NS_SUCCEEDED( rv ), "GetPreferences failed" );
NS_ASSERTION( NS_SUCCEEDED( rv ), "GetPreferences failed" );
#endif
return rv;

View File

@ -365,7 +365,7 @@ else printf( "Setting %s=%s\n", fullName().get(), setting.get() );
rc = ::RegSetValueExA( key, valueNameArg(), 0, REG_SZ,
(LPBYTE)cSetting.get(), cSetting.Length() );
#ifdef DEBUG_law
NS_WARN_IF_FALSE( rc == ERROR_SUCCESS, fullName().get() );
NS_ASSERTION( rc == ERROR_SUCCESS, fullName().get() );
#endif
if ( rc == ERROR_SUCCESS ) {
result = NS_OK;
@ -397,7 +397,7 @@ else printf( "Setting %s=%s\n", fullName().get(), setting.get() );
::RegCloseKey( key );
} else {
#ifdef DEBUG_law
NS_WARN_IF_FALSE( rc == ERROR_SUCCESS, fullName().get() );
NS_ASSERTION( rc == ERROR_SUCCESS, fullName().get() );
#endif
}
return result;