Bug 788242: Implement and make use of void versions of NS_ENSURE_* macros; r=ehsan,bsmedberg
authorKoosha Khajeh Moogahi <koosha.khajeh@gmail.com>
Fri, 14 Sep 2012 14:30:31 +0430
changeset 107292 ce2ac7b4015b9473e902035231f5f68f017b048e
parent 107291 af44e1c2035219e319aac901373784930d674ce6
child 107293 62e6efbdf3c12e6b5da8372904c007c253cc5a48
push id23480
push usergraememcc_firefox@graeme-online.co.uk
push dateTue, 18 Sep 2012 11:48:11 +0000
treeherdermozilla-central@e4757379b99a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, bsmedberg
bugs788242
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 788242: Implement and make use of void versions of NS_ENSURE_* macros; r=ehsan,bsmedberg
accessible/src/base/nsEventShell.cpp
accessible/src/generic/Accessible.cpp
accessible/src/generic/HyperTextAccessible.cpp
accessible/src/html/HTMLFormControlAccessible.cpp
accessible/src/xul/XULColorPickerAccessible.cpp
accessible/src/xul/XULFormControlAccessible.cpp
chrome/src/nsChromeRegistryChrome.cpp
content/base/src/nsEventSource.cpp
content/events/src/nsIMEStateManager.cpp
content/html/content/src/nsTextEditorState.cpp
content/html/document/src/nsHTMLDocument.cpp
dom/indexedDB/IDBTransaction.cpp
dom/ipc/ProcessPriorityManager.cpp
dom/system/unix/MaemoLocationProvider.cpp
editor/libeditor/base/nsEditor.cpp
gfx/thebes/gfxFT2Fonts.cpp
gfx/thebes/gfxPlatform.cpp
intl/locale/src/nsLocaleService.cpp
ipc/glue/ScopedXREEmbed.cpp
layout/generic/nsSelection.cpp
toolkit/xre/nsUpdateDriver.cpp
widget/qt/nsWindow.cpp
widget/windows/WinMouseScrollHandler.cpp
xpcom/glue/nsDebug.h
--- a/accessible/src/base/nsEventShell.cpp
+++ b/accessible/src/base/nsEventShell.cpp
@@ -13,34 +13,34 @@
 
 void
 nsEventShell::FireEvent(AccEvent* aEvent)
 {
   if (!aEvent)
     return;
 
   Accessible* accessible = aEvent->GetAccessible();
-  NS_ENSURE_TRUE(accessible,);
+  NS_ENSURE_TRUE_VOID(accessible);
 
   nsINode* node = aEvent->GetNode();
   if (node) {
     sEventTargetNode = node;
     sEventFromUserInput = aEvent->IsFromUserInput();
   }
 
   accessible->HandleAccEvent(aEvent);
 
   sEventTargetNode = nullptr;
 }
 
 void
 nsEventShell::FireEvent(uint32_t aEventType, Accessible* aAccessible,
                         EIsFromUserInput aIsFromUserInput)
 {
-  NS_ENSURE_TRUE(aAccessible,);
+  NS_ENSURE_TRUE_VOID(aAccessible);
 
   nsRefPtr<AccEvent> event = new AccEvent(aEventType, aAccessible,
                                           aIsFromUserInput);
 
   FireEvent(event);
 }
 
 void 
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -2939,17 +2939,17 @@ Accessible::ContainerWidget() const
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible protected methods
 
 void
 Accessible::CacheChildren()
 {
   DocAccessible* doc = Document();
-  NS_ENSURE_TRUE(doc,);
+  NS_ENSURE_TRUE_VOID(doc);
 
   nsAccTreeWalker walker(doc, mContent, CanHaveAnonChildren());
 
   Accessible* child = nullptr;
   while ((child = walker.NextChild()) && AppendChild(child));
 }
 
 void
--- a/accessible/src/generic/HyperTextAccessible.cpp
+++ b/accessible/src/generic/HyperTextAccessible.cpp
@@ -1700,17 +1700,17 @@ HyperTextAccessible::GetSelectionDOMRang
   }
 
   if (!startNode)
     return;
 
   uint32_t childCount = startNode->GetChildCount();
   nsresult rv = domSel->
     GetRangesForIntervalArray(startNode, 0, startNode, childCount, true, aRanges);
-  NS_ENSURE_SUCCESS(rv,);
+  NS_ENSURE_SUCCESS_VOID(rv);
 
   // Remove collapsed ranges
   uint32_t numRanges = aRanges->Length();
   for (uint32_t idx = 0; idx < numRanges; idx ++) {
     if ((*aRanges)[idx]->Collapsed()) {
       aRanges->RemoveElementAt(idx);
       --numRanges;
       --idx;
--- a/accessible/src/html/HTMLFormControlAccessible.cpp
+++ b/accessible/src/html/HTMLFormControlAccessible.cpp
@@ -154,17 +154,17 @@ HTMLRadioButtonAccessible::GetPositionAn
   nsRefPtr<nsContentList> inputElms;
 
   nsCOMPtr<nsIFormControl> formControlNode(do_QueryInterface(mContent));
   dom::Element* formElm = formControlNode->GetFormElement();
   if (formElm)
     inputElms = NS_GetContentList(formElm, namespaceId, tagName);
   else
     inputElms = NS_GetContentList(mContent->OwnerDoc(), namespaceId, tagName);
-  NS_ENSURE_TRUE(inputElms, );
+  NS_ENSURE_TRUE_VOID(inputElms);
 
   uint32_t inputCount = inputElms->Length(false);
 
   // Compute posinset and setsize.
   int32_t indexOf = 0;
   int32_t count = 0;
 
   for (uint32_t index = 0; index < inputCount; index++) {
--- a/accessible/src/xul/XULColorPickerAccessible.cpp
+++ b/accessible/src/xul/XULColorPickerAccessible.cpp
@@ -134,17 +134,17 @@ XULColorPickerAccessible::AreItemsOperab
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULColorPickerAccessible: protected Accessible
 
 void
 XULColorPickerAccessible::CacheChildren()
 {
-  NS_ENSURE_TRUE(mDoc,);
+  NS_ENSURE_TRUE_VOID(mDoc);
 
   nsAccTreeWalker walker(mDoc, mContent, true);
 
   Accessible* child = nullptr;
   while ((child = walker.NextChild())) {
     uint32_t role = child->Role();
 
     // Get an accessible for menupopup or panel elements.
--- a/accessible/src/xul/XULFormControlAccessible.cpp
+++ b/accessible/src/xul/XULFormControlAccessible.cpp
@@ -176,17 +176,17 @@ XULButtonAccessible::CacheChildren()
                                        nsGkAtoms::menu,
                                        eCaseMatters);
 
   bool isMenuButton = isMenu ?
     false :
     mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                           nsGkAtoms::menuButton, eCaseMatters);
 
-  NS_ENSURE_TRUE(mDoc,);
+  NS_ENSURE_TRUE_VOID(mDoc);
   if (!isMenu && !isMenuButton)
     return;
 
   Accessible* menupopup = nullptr;
   Accessible* button = nullptr;
 
   nsAccTreeWalker walker(mDoc, mContent, true);
 
@@ -818,17 +818,17 @@ XULTextFieldAccessible::GetEditor() cons
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTextFieldAccessible: Accessible protected
 
 void
 XULTextFieldAccessible::CacheChildren()
 {
-  NS_ENSURE_TRUE(mDoc,);
+  NS_ENSURE_TRUE_VOID(mDoc);
   // Create child accessibles for native anonymous content of underlying HTML
   // input element.
   nsCOMPtr<nsIContent> inputContent(GetInputField());
   if (!inputContent)
     return;
 
   nsAccTreeWalker walker(mDoc, inputContent, false);
 
--- a/chrome/src/nsChromeRegistryChrome.cpp
+++ b/chrome/src/nsChromeRegistryChrome.cpp
@@ -444,32 +444,32 @@ nsChromeRegistryChrome::SendRegisteredCh
   InfallibleTArray<OverrideMapping> overrides;
 
   EnumerationArgs args = {
     packages, mSelectedLocale, mSelectedSkin
   };
   PL_DHashTableEnumerate(&mPackagesHash, CollectPackages, &args);
 
   nsCOMPtr<nsIIOService> io (do_GetIOService());
-  NS_ENSURE_TRUE(io, );
+  NS_ENSURE_TRUE_VOID(io);
 
   nsCOMPtr<nsIProtocolHandler> ph;
   nsresult rv = io->GetProtocolHandler("resource", getter_AddRefs(ph));
-  NS_ENSURE_SUCCESS(rv, );
+  NS_ENSURE_SUCCESS_VOID(rv);
 
   //FIXME: Some substitutions are set up lazily and might not exist yet
   nsCOMPtr<nsIResProtocolHandler> irph (do_QueryInterface(ph));
   nsResProtocolHandler* rph = static_cast<nsResProtocolHandler*>(irph.get());
   rph->CollectSubstitutions(resources);
 
   mOverrideTable.EnumerateRead(&EnumerateOverride, &overrides);
 
   bool success = aParent->SendRegisterChrome(packages, resources, overrides,
                                              mSelectedLocale);
-  NS_ENSURE_TRUE(success, );
+  NS_ENSURE_TRUE_VOID(success);
 }
 
 PLDHashOperator
 nsChromeRegistryChrome::CollectPackages(PLDHashTable *table,
                                   PLDHashEntryHdr *entry,
                                   uint32_t number,
                                   void *arg)
 {
--- a/content/base/src/nsEventSource.cpp
+++ b/content/base/src/nsEventSource.cpp
@@ -1362,37 +1362,37 @@ nsEventSource::DispatchAllMessageEvents(
 
   nsresult rv = CheckInnerWindowCorrectness();
   if (NS_FAILED(rv)) {
     return;
   }
 
   // Let's play get the JSContext
   nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(GetOwner());
-  NS_ENSURE_TRUE(sgo,);
+  NS_ENSURE_TRUE_VOID(sgo);
 
   nsIScriptContext* scriptContext = sgo->GetContext();
-  NS_ENSURE_TRUE(scriptContext,);
+  NS_ENSURE_TRUE_VOID(scriptContext);
 
   JSContext* cx = scriptContext->GetNativeContext();
-  NS_ENSURE_TRUE(cx,);
+  NS_ENSURE_TRUE_VOID(cx);
 
   while (mMessagesToDispatch.GetSize() > 0) {
     nsAutoPtr<Message>
       message(static_cast<Message*>(mMessagesToDispatch.PopFront()));
 
     // Now we can turn our string into a jsval
     jsval jsData;
     {
       JSString* jsString;
       JSAutoRequest ar(cx);
       jsString = JS_NewUCStringCopyN(cx,
                                      message->mData.get(),
                                      message->mData.Length());
-      NS_ENSURE_TRUE(jsString,);
+      NS_ENSURE_TRUE_VOID(jsString);
 
       jsData = STRING_TO_JSVAL(jsString);
     }
 
     // create an event that uses the MessageEvent interface,
     // which does not bubble, is not cancelable, and has no default action
 
     nsCOMPtr<nsIDOMEvent> event;
--- a/content/events/src/nsIMEStateManager.cpp
+++ b/content/events/src/nsIMEStateManager.cpp
@@ -193,35 +193,35 @@ nsIMEStateManager::OnClickInEditor(nsPre
                                    nsIContent* aContent,
                                    nsIDOMMouseEvent* aMouseEvent)
 {
   if (sPresContext != aPresContext || sContent != aContent) {
     return;
   }
 
   nsCOMPtr<nsIWidget> widget = GetWidget(aPresContext);
-  NS_ENSURE_TRUE(widget, );
+  NS_ENSURE_TRUE_VOID(widget);
 
   bool isTrusted;
   nsresult rv = aMouseEvent->GetIsTrusted(&isTrusted);
-  NS_ENSURE_SUCCESS(rv, );
+  NS_ENSURE_SUCCESS_VOID(rv);
   if (!isTrusted) {
     return; // ignore untrusted event.
   }
 
   uint16_t button;
   rv = aMouseEvent->GetButton(&button);
-  NS_ENSURE_SUCCESS(rv, );
+  NS_ENSURE_SUCCESS_VOID(rv);
   if (button != 0) {
     return; // not a left click event.
   }
 
   int32_t clickCount;
   rv = aMouseEvent->GetDetail(&clickCount);
-  NS_ENSURE_SUCCESS(rv, );
+  NS_ENSURE_SUCCESS_VOID(rv);
   if (clickCount != 1) {
     return; // should notify only first click event.
   }
 
   InputContextAction action(InputContextAction::CAUSE_MOUSE,
                             InputContextAction::FOCUS_NOT_CHANGED);
   IMEState newState = GetNewIMEState(aPresContext, aContent);
   SetIMEState(newState, aContent, widget, action);
@@ -305,17 +305,17 @@ private:
 };
 
 void
 nsIMEStateManager::SetIMEState(const IMEState &aState,
                                nsIContent* aContent,
                                nsIWidget* aWidget,
                                InputContextAction aAction)
 {
-  NS_ENSURE_TRUE(aWidget, );
+  NS_ENSURE_TRUE_VOID(aWidget);
 
   InputContext oldContext = aWidget->GetInputContext();
 
   InputContext context;
   context.mIMEState = aState;
 
   if (aContent && aContent->GetNameSpaceID() == kNameSpaceID_XHTML &&
       (aContent->Tag() == nsGkAtoms::input ||
--- a/content/html/content/src/nsTextEditorState.cpp
+++ b/content/html/content/src/nsTextEditorState.cpp
@@ -1380,17 +1380,17 @@ nsTextEditorState::DestroyEditor()
     mEditor->PreDestroy(true);
     mEditorInitialized = false;
   }
 }
 
 void
 nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame)
 {
-  NS_ENSURE_TRUE(mBoundFrame, );
+  NS_ENSURE_TRUE_VOID(mBoundFrame);
 
   // If it was, however, it should be unbounded from the same frame.
   NS_ASSERTION(!aFrame || aFrame == mBoundFrame, "Unbinding from the wrong frame");
   NS_ENSURE_TRUE(!aFrame || aFrame == mBoundFrame, );
 
   // We need to start storing the value outside of the editor if we're not
   // going to use it anymore, so retrieve it for now.
   nsAutoString value;
@@ -1979,17 +1979,17 @@ nsTextEditorState::SetPlaceholderClass(b
   nsAutoString classValue;
 
   classValue.Assign(NS_LITERAL_STRING("anonymous-div placeholder"));
 
   if (!aVisible)
     classValue.AppendLiteral(" hidden");
 
   nsIContent* placeholderDiv = GetPlaceholderNode();
-  NS_ENSURE_TRUE(placeholderDiv, );
+  NS_ENSURE_TRUE_VOID(placeholderDiv);
 
   placeholderDiv->SetAttr(kNameSpaceID_None, nsGkAtoms::_class,
                           classValue, aNotify);
 }
 
 void
 nsTextEditorState::HideSelectionIfBlurred()
 {
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -2400,51 +2400,51 @@ nsHTMLDocument::DeferredContentEditableC
   if (mParser ||
       (mUpdateNestLevel > 0 && (mContentEditableCount > 0) != IsEditingOn())) {
     return;
   }
 
   EditingState oldState = mEditingState;
 
   nsresult rv = EditingStateChanged();
-  NS_ENSURE_SUCCESS(rv, );
+  NS_ENSURE_SUCCESS_VOID(rv);
 
   if (oldState == mEditingState && mEditingState == eContentEditable) {
     // We just changed the contentEditable state of a node, we need to reset
     // the spellchecking state of that node.
     nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aElement);
     if (node) {
       nsPIDOMWindow *window = GetWindow();
       if (!window)
         return;
 
       nsIDocShell *docshell = window->GetDocShell();
       if (!docshell)
         return;
 
       nsCOMPtr<nsIEditorDocShell> editorDocShell =
         do_QueryInterface(docshell, &rv);
-      NS_ENSURE_SUCCESS(rv, );
+      NS_ENSURE_SUCCESS_VOID(rv);
 
       nsCOMPtr<nsIEditor> editor;
       editorDocShell->GetEditor(getter_AddRefs(editor));
       if (editor) {
         nsRefPtr<nsRange> range = new nsRange();
         rv = range->SelectNode(node);
         if (NS_FAILED(rv)) {
           // The node might be detached from the document at this point,
           // which would cause this call to fail.  In this case, we can
           // safely ignore the contenteditable count change.
           return;
         }
 
         nsCOMPtr<nsIInlineSpellChecker> spellChecker;
         rv = editor->GetInlineSpellChecker(false,
                                            getter_AddRefs(spellChecker));
-        NS_ENSURE_SUCCESS(rv, );
+        NS_ENSURE_SUCCESS_VOID(rv);
 
         if (spellChecker) {
           rv = spellChecker->SpellCheckRange(range);
         }
       }
     }
   }
 }
--- a/dom/indexedDB/IDBTransaction.cpp
+++ b/dom/indexedDB/IDBTransaction.cpp
@@ -324,22 +324,22 @@ IDBTransaction::RollbackSavepoint()
   NS_PRECONDITION(mConnection, "No connection!");
 
   NS_ASSERTION(mSavepointCount == 1, "Mismatch!");
   mSavepointCount = 0;
 
   nsCOMPtr<mozIStorageStatement> stmt = GetCachedStatement(NS_LITERAL_CSTRING(
     "ROLLBACK TO SAVEPOINT " SAVEPOINT_NAME
   ));
-  NS_ENSURE_TRUE(stmt,);
+  NS_ENSURE_TRUE_VOID(stmt);
 
   mozStorageStatementScoper scoper(stmt);
 
   nsresult rv = stmt->Execute();
-  NS_ENSURE_SUCCESS(rv,);
+  NS_ENSURE_SUCCESS_VOID(rv);
 }
 
 nsresult
 IDBTransaction::GetOrCreateConnection(mozIStorageConnection** aResult)
 {
   NS_ASSERTION(IndexedDatabaseManager::IsMainProcess(), "Wrong process!");
   NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
 
@@ -1060,24 +1060,24 @@ UpdateRefcountFunction::WillCommit(mozIS
 }
 
 void
 UpdateRefcountFunction::DidCommit()
 {
   mFileInfoEntries.EnumerateRead(FileInfoUpdateCallback, nullptr);
 
   nsresult rv = RemoveJournals(mJournalsToRemoveAfterCommit);
-  NS_ENSURE_SUCCESS(rv,);
+  NS_ENSURE_SUCCESS_VOID(rv);
 }
 
 void
 UpdateRefcountFunction::DidAbort()
 {
   nsresult rv = RemoveJournals(mJournalsToRemoveAfterAbort);
-  NS_ENSURE_SUCCESS(rv,);
+  NS_ENSURE_SUCCESS_VOID(rv);
 }
 
 nsresult
 UpdateRefcountFunction::ProcessValue(mozIStorageValueArray* aValues,
                                      int32_t aIndex,
                                      UpdateType aUpdateType)
 {
   int32_t type;
--- a/dom/ipc/ProcessPriorityManager.cpp
+++ b/dom/ipc/ProcessPriorityManager.cpp
@@ -160,33 +160,33 @@ ProcessPriorityManager::HandleEvent(
 
 void
 ProcessPriorityManager::OnContentDocumentGlobalCreated(
   nsISupports* aOuterWindow)
 {
   // Get the inner window (the topic of content-document-global-created is
   // the /outer/ window!).
   nsCOMPtr<nsPIDOMWindow> outerWindow = do_QueryInterface(aOuterWindow);
-  NS_ENSURE_TRUE(outerWindow, );
+  NS_ENSURE_TRUE_VOID(outerWindow);
   nsCOMPtr<nsPIDOMWindow> innerWindow = outerWindow->GetCurrentInnerWindow();
-  NS_ENSURE_TRUE(innerWindow, );
+  NS_ENSURE_TRUE_VOID(innerWindow);
 
   // We're only interested in top-level windows.
   nsCOMPtr<nsIDOMWindow> parentOuterWindow;
   innerWindow->GetScriptableParent(getter_AddRefs(parentOuterWindow));
-  NS_ENSURE_TRUE(parentOuterWindow, );
+  NS_ENSURE_TRUE_VOID(parentOuterWindow);
   if (parentOuterWindow != outerWindow) {
     return;
   }
 
   nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(innerWindow);
-  NS_ENSURE_TRUE(target, );
+  NS_ENSURE_TRUE_VOID(target);
 
   nsWeakPtr weakWin = do_GetWeakReference(innerWindow);
-  NS_ENSURE_TRUE(weakWin, );
+  NS_ENSURE_TRUE_VOID(weakWin);
 
   if (mWindows.Contains(weakWin)) {
     return;
   }
 
   target->AddSystemEventListener(NS_LITERAL_STRING("mozvisibilitychange"),
                                  this,
                                  /* useCapture = */ false,
--- a/dom/system/unix/MaemoLocationProvider.cpp
+++ b/dom/system/unix/MaemoLocationProvider.cpp
@@ -62,17 +62,17 @@ void MaemoLocationProvider::LocationChan
   guint32 &fields = device->fix->fields;
   if (!(fields & LOCATION_GPS_DEVICE_LATLONG_SET))
     return;
 
   if (!(device->fix->eph && !isnan(device->fix->eph)))
     return;
 
   MaemoLocationProvider* provider = static_cast<MaemoLocationProvider*>(self);
-  NS_ENSURE_TRUE(provider, );
+  NS_ENSURE_TRUE_VOID(provider);
   provider->LocationUpdate(device);
 }
 
 nsresult
 MaemoLocationProvider::LocationUpdate(LocationGPSDevice* aDev)
 {
   double hErr = aDev->fix->eph/100;
   if (mIgnoreBigHErr && hErr > (double)mMaxHErr)
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -1831,17 +1831,17 @@ nsEditor::NotifyEditorObservers(void)
   }
 
   // We don't need to dispatch multiple input events if there is a pending
   // input event.  However, it may have different event target.  If we resolved
   // this issue, we need to manage the pending events in an array.  But it's
   // overwork.  We don't need to do it for the very rare case.
 
   nsCOMPtr<nsIContent> target = GetInputEventTargetContent();
-  NS_ENSURE_TRUE(target, );
+  NS_ENSURE_TRUE_VOID(target);
 
   nsContentUtils::AddScriptRunner(
     new EditorInputEventDispatcher(this, mHandlingTrustedAction, target));
 }
 
 NS_IMETHODIMP
 nsEditor::AddEditActionListener(nsIEditActionListener *aListener)
 {
@@ -1992,17 +1992,17 @@ nsEditor::BeginIMEComposition()
     mPhonetic->Truncate(0);
   }
   return NS_OK;
 }
 
 void
 nsEditor::EndIMEComposition()
 {
-  NS_ENSURE_TRUE(mInIMEMode, ); // nothing to do
+  NS_ENSURE_TRUE_VOID(mInIMEMode); // nothing to do
 
   // commit the IME transaction..we can get at it via the transaction mgr.
   // Note that this means IME won't work without an undo stack!
   if (mTxnMgr) {
     nsCOMPtr<nsITransaction> txn = mTxnMgr->PeekUndoStack();
     nsCOMPtr<nsIAbsorbingTransaction> plcTxn = do_QueryInterface(txn);
     if (plcTxn) {
       DebugOnly<nsresult> rv = plcTxn->Commit();
@@ -5180,17 +5180,17 @@ nsEditor::SwitchTextDirection()
 }
 
 void
 nsEditor::SwitchTextDirectionTo(uint32_t aDirection)
 {
   // Get the current root direction from its frame
   dom::Element *rootElement = GetRoot();
   nsresult rv = DetermineCurrentDirection();
-  NS_ENSURE_SUCCESS(rv, );
+  NS_ENSURE_SUCCESS_VOID(rv);
 
   // Apply the requested direction
   if (aDirection == nsIPlaintextEditor::eEditorLeftToRight &&
       (mFlags & nsIPlaintextEditor::eEditorRightToLeft)) {
     NS_ASSERTION(!(mFlags & nsIPlaintextEditor::eEditorLeftToRight),
                  "Unexpected mutually exclusive flag");
     mFlags &= ~nsIPlaintextEditor::eEditorRightToLeft;
     mFlags |= nsIPlaintextEditor::eEditorLeftToRight;
--- a/gfx/thebes/gfxFT2Fonts.cpp
+++ b/gfx/thebes/gfxFT2Fonts.cpp
@@ -235,17 +235,17 @@ void gfxFT2FontGroup::GetCJKPrefFonts(ns
     gfxToolkitPlatform *platform = gfxToolkitPlatform::GetPlatform();
 
     nsAutoCString key("x-internal-cjk-");
     key.AppendInt(mStyle.style);
     key.Append("-");
     key.AppendInt(mStyle.weight);
 
     if (!platform->GetPrefFontEntries(key, &aFontEntryList)) {
-        NS_ENSURE_TRUE(Preferences::GetRootBranch(), );
+        NS_ENSURE_TRUE_VOID(Preferences::GetRootBranch());
         // Add the CJK pref fonts from accept languages, the order should be same order
         nsAdoptingCString list = Preferences::GetLocalizedCString("intl.accept_languages");
         if (!list.IsEmpty()) {
             const char kComma = ',';
             const char *p, *p_end;
             list.BeginReading(p);
             list.EndReading(p_end);
             while (p < p_end) {
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -850,17 +850,17 @@ gfxPlatform::MakePlatformFont(const gfxP
         NS_Free((void*)aFontData);
     }
     return nullptr;
 }
 
 static void
 AppendGenericFontFromPref(nsString& aFonts, nsIAtom *aLangGroup, const char *aGenericName)
 {
-    NS_ENSURE_TRUE(Preferences::GetRootBranch(), );
+    NS_ENSURE_TRUE_VOID(Preferences::GetRootBranch());
 
     nsAutoCString prefName, langGroupString;
 
     aLangGroup->ToUTF8String(langGroupString);
 
     nsAutoCString genericDotLang;
     if (aGenericName) {
         genericDotLang.Assign(aGenericName);
--- a/intl/locale/src/nsLocaleService.cpp
+++ b/intl/locale/src/nsLocaleService.cpp
@@ -104,33 +104,33 @@ protected:
 nsLocaleService::nsLocaleService(void) 
 {
 #ifdef XP_WIN
     nsAutoString        xpLocale;
     //
     // get the system LCID
     //
     LCID win_lcid = GetSystemDefaultLCID();
-    NS_ENSURE_TRUE(win_lcid, );
+    NS_ENSURE_TRUE_VOID(win_lcid);
     nsWin32Locale::GetXPLocale(win_lcid, xpLocale);
     nsresult rv = NewLocale(xpLocale, getter_AddRefs(mSystemLocale));
-    NS_ENSURE_SUCCESS(rv, );
+    NS_ENSURE_SUCCESS_VOID(rv);
 
     //
     // get the application LCID
     //
     win_lcid = GetUserDefaultLCID();
-    NS_ENSURE_TRUE(win_lcid, );
+    NS_ENSURE_TRUE_VOID(win_lcid);
     nsWin32Locale::GetXPLocale(win_lcid, xpLocale);
     rv = NewLocale(xpLocale, getter_AddRefs(mApplicationLocale));
-    NS_ENSURE_SUCCESS(rv, );
+    NS_ENSURE_SUCCESS_VOID(rv);
 #endif
 #if defined(XP_UNIX) && !defined(XP_MACOSX)
     nsRefPtr<nsLocale> resultLocale(new nsLocale());
-    NS_ENSURE_TRUE(resultLocale, );
+    NS_ENSURE_TRUE_VOID(resultLocale);
 
 #ifdef MOZ_WIDGET_QT
     const char* lang = QLocale::system().name().toAscii();
 #else
     // Get system configuration
     const char* lang = getenv("LANG");
 #endif
 
--- a/ipc/glue/ScopedXREEmbed.cpp
+++ b/ipc/glue/ScopedXREEmbed.cpp
@@ -46,42 +46,42 @@ ScopedXREEmbed::Start()
     return;
 
   nsCOMPtr<nsIFile> parent;
   rv = localFile->GetParent(getter_AddRefs(parent));
   if (NS_FAILED(rv))
     return;
 
   localFile = do_QueryInterface(parent);
-  NS_ENSURE_TRUE(localFile,);
+  NS_ENSURE_TRUE_VOID(localFile);
 
 #ifdef OS_MACOSX
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
     // We're an XPCOM-using subprocess.  Walk out of
     // [subprocess].app/Contents/MacOS to the real GRE dir.
     rv = localFile->GetParent(getter_AddRefs(parent));
     if (NS_FAILED(rv))
       return;
 
     localFile = do_QueryInterface(parent);
-    NS_ENSURE_TRUE(localFile,);
+    NS_ENSURE_TRUE_VOID(localFile);
 
     rv = localFile->GetParent(getter_AddRefs(parent));
     if (NS_FAILED(rv))
       return;
 
     localFile = do_QueryInterface(parent);
-    NS_ENSURE_TRUE(localFile,);
+    NS_ENSURE_TRUE_VOID(localFile);
 
     rv = localFile->GetParent(getter_AddRefs(parent));
     if (NS_FAILED(rv))
       return;
 
     localFile = do_QueryInterface(parent);
-    NS_ENSURE_TRUE(localFile,);
+    NS_ENSURE_TRUE_VOID(localFile);
   }
 #endif
 
   rv = XRE_InitEmbedding2(localFile, localFile, nullptr);
   if (NS_FAILED(rv))
     return;
 
   mShouldKillEmbedding = true;
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -4700,17 +4700,17 @@ Selection::SetAnchorFocusToRange(nsRange
   setAnchorFocusRange(aOutIndex);
 
   return NS_OK;
 }
 
 void
 Selection::ReplaceAnchorFocusRange(nsRange* aRange)
 {
-  NS_ENSURE_TRUE(mAnchorFocusRange, );
+  NS_ENSURE_TRUE_VOID(mAnchorFocusRange);
   nsRefPtr<nsPresContext> presContext;
   GetPresContext(getter_AddRefs(presContext));
   if (presContext) {
     selectFrames(presContext, mAnchorFocusRange, false);
     SetAnchorFocusToRange(aRange);
     selectFrames(presContext, mAnchorFocusRange, true);
   }
 }
--- a/toolkit/xre/nsUpdateDriver.cpp
+++ b/toolkit/xre/nsUpdateDriver.cpp
@@ -995,28 +995,28 @@ nsUpdateProcessor::StartBackgroundUpdate
   nsresult rv = ProcessUpdates(mInfo.mGREDir,
                                mInfo.mAppDir,
                                mInfo.mUpdateRoot,
                                mInfo.mArgc,
                                mInfo.mArgv,
                                mInfo.mAppVersion.get(),
                                false,
                                &mUpdaterPID);
-  NS_ENSURE_SUCCESS(rv, );
+  NS_ENSURE_SUCCESS_VOID(rv);
 
   if (mUpdaterPID) {
     // Track the state of the background updater process
     rv = NS_DispatchToCurrentThread(NS_NewRunnableMethod(this, &nsUpdateProcessor::WaitForProcess));
-    NS_ENSURE_SUCCESS(rv, );
+    NS_ENSURE_SUCCESS_VOID(rv);
   } else {
     // Failed to launch the background updater process for some reason.
     // We need to shutdown the current thread as there isn't anything more for
     // us to do...
     rv = NS_DispatchToMainThread(NS_NewRunnableMethod(this, &nsUpdateProcessor::ShutdownWatcherThread));
-    NS_ENSURE_SUCCESS(rv, );
+    NS_ENSURE_SUCCESS_VOID(rv);
   }
 }
 
 void
 nsUpdateProcessor::ShutdownWatcherThread()
 {
   NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread");
   mProcessWatcher->Shutdown();
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -601,17 +601,17 @@ nsWindow::SetSizeMode(int32_t aMode)
     return rv;
 }
 
 // Helper function to recursively find the first parent item that
 // is still visible (QGraphicsItem can be hidden even if they are
 // set to visible if one of their ancestors is invisible)
 static void find_first_visible_parent(QGraphicsItem* aItem, QGraphicsItem*& aVisibleItem)
 {
-    NS_ENSURE_TRUE(aItem, );
+    NS_ENSURE_TRUE_VOID(aItem);
 
     aVisibleItem = nullptr;
     QGraphicsItem* parItem = nullptr;
     while (!aVisibleItem) {
         if (aItem->isVisible())
             aVisibleItem = aItem;
         else {
             parItem = aItem->parentItem();
@@ -2325,17 +2325,17 @@ nsWindow::NativeResize(int32_t aWidth, i
 {
     LOG(("nsWindow::NativeResize [%p] %d %d\n", (void *)this,
          aWidth, aHeight));
 
     mNeedsResize = false;
 
     if (mIsTopLevel) {
         QGraphicsView *widget = qobject_cast<QGraphicsView*>(GetViewWidget());
-        NS_ENSURE_TRUE(widget,);
+        NS_ENSURE_TRUE_VOID(widget);
         // map from in-scene widget to scene, from scene to view.
         QRect r = widget->mapFromScene(mWidget->mapToScene(QRect(0, 0, aWidth, aHeight))).boundingRect();
         // going from QPolygon to QRect includes the points, adding one to width and height
         r.adjust(0, 0, -1, -1);
         widget->resize(r.width(), r.height());
     }
     else {
         mWidget->resize(aWidth, aHeight);
@@ -2353,17 +2353,17 @@ nsWindow::NativeResize(int32_t aX, int32
     LOG(("nsWindow::NativeResize [%p] %d %d %d %d\n", (void *)this,
          aX, aY, aWidth, aHeight));
 
     mNeedsResize = false;
     mNeedsMove = false;
 
     if (mIsTopLevel) {
         QGraphicsView *widget = qobject_cast<QGraphicsView*>(GetViewWidget());
-        NS_ENSURE_TRUE(widget,);
+        NS_ENSURE_TRUE_VOID(widget);
         // map from in-scene widget to scene, from scene to view.
         QRect r = widget->mapFromScene(mWidget->mapToScene(QRect(aX, aY, aWidth, aHeight))).boundingRect();
         // going from QPolygon to QRect includes the points, adding one to width and height
         r.adjust(0, 0, -1, -1);
         widget->setGeometry(r.x(), r.y(), r.width(), r.height());
     }
     else {
         mWidget->setGeometry(aX, aY, aWidth, aHeight);
@@ -3161,17 +3161,17 @@ x11EventFilter(void* message, long* resu
     return false;
 }
 #endif
 
 NS_IMETHODIMP_(void)
 nsWindow::SetInputContext(const InputContext& aContext,
                           const InputContextAction& aAction)
 {
-    NS_ENSURE_TRUE(mWidget, );
+    NS_ENSURE_TRUE_VOID(mWidget);
 
     // SetSoftwareKeyboardState uses mInputContext,
     // so, before calling that, record aContext in mInputContext.
     mInputContext = aContext;
 
 #if defined(MOZ_X11) && (MOZ_PLATFORM_MAEMO == 6)
     if (sPluginIMEAtom) {
         static QCoreApplication::EventFilter currentEventFilter = NULL;
--- a/widget/windows/WinMouseScrollHandler.cpp
+++ b/widget/windows/WinMouseScrollHandler.cpp
@@ -305,17 +305,17 @@ MouseScrollHandler::DispatchEvent(nsWind
 }
 
 /* static */
 void
 MouseScrollHandler::InitEvent(nsWindow* aWindow,
                               nsGUIEvent& aEvent,
                               nsIntPoint* aPoint)
 {
-  NS_ENSURE_TRUE(aWindow, );
+  NS_ENSURE_TRUE_VOID(aWindow);
   nsIntPoint point;
   if (aPoint) {
     point = *aPoint;
   } else {
     POINTS pts = GetCurrentMessagePos();
     POINT pt;
     pt.x = pts.x;
     pt.y = pts.y;
--- a/xpcom/glue/nsDebug.h
+++ b/xpcom/glue/nsDebug.h
@@ -253,44 +253,73 @@
        NS_WARNING("NS_ENSURE_TRUE(" #x ") failed");           \
        return ret;                                            \
     }                                                         \
   } while(0)
 
 #define NS_ENSURE_FALSE(x, ret)                               \
   NS_ENSURE_TRUE(!(x), ret)
 
+#define NS_ENSURE_TRUE_VOID(x)                                \
+  do {                                                        \
+    if (NS_UNLIKELY(!(x))) {                                  \
+       NS_WARNING("NS_ENSURE_TRUE(" #x ") failed");           \
+       return;                                                \
+    }                                                         \
+  } while(0)
+
+#define NS_ENSURE_FALSE_VOID(x)                               \
+  NS_ENSURE_TRUE_VOID(!(x))
+
 /******************************************************************************
 ** Macros for checking results
 ******************************************************************************/
 
 #if defined(DEBUG) && !defined(XPCOM_GLUE_AVOID_NSPR)
 
 #define NS_ENSURE_SUCCESS_BODY(res, ret)                                  \
     char *msg = PR_smprintf("NS_ENSURE_SUCCESS(%s, %s) failed with "      \
                             "result 0x%X", #res, #ret, __rv);             \
     NS_WARNING(msg);                                                      \
     PR_smprintf_free(msg);
 
+#define NS_ENSURE_SUCCESS_BODY_VOID(res)                                  \
+    char *msg = PR_smprintf("NS_ENSURE_SUCCESS_VOID(%s) failed with "     \
+                            "result 0x%X", #res, __rv);                   \
+    NS_WARNING(msg);                                                      \
+    PR_smprintf_free(msg);
+
 #else
 
 #define NS_ENSURE_SUCCESS_BODY(res, ret)                                  \
     NS_WARNING("NS_ENSURE_SUCCESS(" #res ", " #ret ") failed");
 
+#define NS_ENSURE_SUCCESS_BODY_VOID(res)                                  \
+    NS_WARNING("NS_ENSURE_SUCCESS_VOID(" #res ") failed");
+
 #endif
 
 #define NS_ENSURE_SUCCESS(res, ret)                                       \
   do {                                                                    \
     nsresult __rv = res; /* Don't evaluate |res| more than once */        \
     if (NS_FAILED(__rv)) {                                                \
       NS_ENSURE_SUCCESS_BODY(res, ret)                                    \
       return ret;                                                         \
     }                                                                     \
   } while(0)
 
+#define NS_ENSURE_SUCCESS_VOID(res)                                       \
+  do {                                                                    \
+    nsresult __rv = res;                                                  \
+    if (NS_FAILED(__rv)) {                                                \
+      NS_ENSURE_SUCCESS_BODY_VOID(res)                                    \
+      return;                                                             \
+    }                                                                     \
+  } while(0)
+
 /******************************************************************************
 ** Macros for checking state and arguments upon entering interface boundaries
 ******************************************************************************/
 
 #define NS_ENSURE_ARG(arg)                                    \
   NS_ENSURE_TRUE(arg, NS_ERROR_INVALID_ARG)
 
 #define NS_ENSURE_ARG_POINTER(arg)                            \