Bug 767388 - Kill NS_DEBUG. r=bz.
authorJonathan Watt <jwatt@jwatt.org>
Mon, 25 Jun 2012 20:59:42 +0100
changeset 102424 db9fc4c50e24f3a4080e1fc7299ffa79561e07f2
parent 102423 493781e75ced48565b48c193a7e10b9e7965b49a
child 102425 97dfd947b752967dea2fcf4b56f30342f1c5ee6f
push id1316
push userakeybl@mozilla.com
push dateMon, 27 Aug 2012 22:37:00 +0000
treeherdermozilla-beta@db4b09302ee2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs767388
milestone16.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 767388 - Kill NS_DEBUG. r=bz.
accessible/src/generic/Accessible.cpp
content/base/src/nsContentSink.cpp
content/base/src/nsContentSink.h
content/html/document/src/nsHTMLContentSink.cpp
content/xml/document/src/nsXMLContentSink.cpp
content/xul/document/src/nsXULCommandDispatcher.cpp
docshell/base/nsDocShell.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfo.h
dom/base/nsGlobalWindow.cpp
dom/base/nsJSEnvironment.cpp
dom/plugins/base/nsNPAPIPluginStreamListener.cpp
dom/plugins/base/nsPluginHost.cpp
dom/plugins/base/nsPluginNativeWindowGtk2.cpp
dom/plugins/base/nsPluginsDirUnix.cpp
dom/src/events/nsJSEventListener.cpp
editor/libeditor/base/CreateElementTxn.cpp
editor/libeditor/base/DeleteElementTxn.cpp
editor/libeditor/base/DeleteRangeTxn.cpp
editor/libeditor/base/InsertElementTxn.cpp
editor/libeditor/base/InsertTextTxn.cpp
editor/libeditor/base/JoinElementTxn.cpp
editor/libeditor/base/SplitElementTxn.cpp
editor/libeditor/html/TextEditorTest.h
embedding/components/appstartup/src/nsAppStartupNotifier.cpp
image/src/imgRequest.cpp
intl/uconv/tests/TestUConv.cpp
intl/uconv/util/nsUCSupport.cpp
intl/uconv/util/nsUCSupport.h
ipc/glue/SharedMemorySysV.h
layout/base/nsDisplayItemTypes.h
layout/base/nsDocumentViewer.cpp
layout/base/nsFrameManager.cpp
layout/base/nsFrameManager.h
layout/base/nsIPresShell.h
layout/base/nsLayoutDebugger.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsPresShell.cpp
layout/base/nsPresShell.h
layout/build/nsLayoutModule.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsComboboxControlFrame.h
layout/forms/nsFileControlFrame.cpp
layout/forms/nsFileControlFrame.h
layout/forms/nsLegendFrame.cpp
layout/forms/nsLegendFrame.h
layout/forms/nsMeterFrame.h
layout/forms/nsProgressFrame.h
layout/forms/nsTextControlFrame.h
layout/generic/nsAbsoluteContainingBlock.cpp
layout/generic/nsBlockFrame.h
layout/generic/nsBlockReflowContext.cpp
layout/generic/nsBulletFrame.cpp
layout/generic/nsBulletFrame.h
layout/generic/nsCanvasFrame.cpp
layout/generic/nsContainerFrame.cpp
layout/generic/nsFirstLetterFrame.cpp
layout/generic/nsFirstLetterFrame.h
layout/generic/nsFrame.cpp
layout/generic/nsFrame.h
layout/generic/nsFrameUtil.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsGfxScrollFrame.h
layout/generic/nsHTMLReflowState.cpp
layout/generic/nsIFrame.h
layout/generic/nsImageFrame.cpp
layout/generic/nsLineBox.h
layout/generic/nsPageContentFrame.h
layout/generic/nsPageFrame.h
layout/generic/nsSimplePageSequence.h
layout/generic/nsTextFrameThebes.cpp
layout/generic/nsViewportFrame.cpp
layout/mathml/nsMathMLChar.cpp
layout/mathml/nsMathMLContainerFrame.cpp
layout/mathml/nsMathMLFrame.cpp
layout/mathml/nsMathMLFrame.h
layout/mathml/nsMathMLOperators.cpp
layout/mathml/nsMathMLmactionFrame.cpp
layout/mathml/nsMathMLmoFrame.cpp
layout/mathml/nsMathMLmpaddedFrame.cpp
layout/mathml/nsMathMLmrootFrame.cpp
layout/mathml/nsMathMLmtableFrame.cpp
layout/printing/nsPrintEngine.cpp
layout/tables/nsCellMap.cpp
layout/tables/nsCellMap.h
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableOuterFrame.cpp
layout/tables/nsTableOuterFrame.h
layout/xul/base/src/grid/nsGridRowGroupFrame.h
layout/xul/base/src/grid/nsGridRowLeafFrame.h
layout/xul/base/src/nsDeckFrame.h
layout/xul/base/src/nsProgressMeterFrame.cpp
layout/xul/base/src/nsProgressMeterFrame.h
layout/xul/base/src/nsStackFrame.h
layout/xul/base/src/nsXULLabelFrame.cpp
parser/htmlparser/src/nsDTDUtils.cpp
parser/htmlparser/src/nsDTDUtils.h
parser/htmlparser/src/nsElementTable.cpp
parser/htmlparser/src/nsElementTable.h
parser/htmlparser/src/nsHTMLEntities.cpp
parser/htmlparser/src/nsParser.cpp
parser/htmlparser/src/nsParserModule.cpp
parser/htmlparser/src/nsToken.cpp
rdf/base/src/nsCompositeDataSource.cpp
rdf/tests/dsds/nsRDFDataSourceDS.cpp
rdf/tests/dsds/nsRDFDataSourceFactory.cpp
view/src/nsView.cpp
widget/nsGUIEvent.h
widget/windows/nsClipboard.cpp
widget/windows/nsDragService.cpp
widget/xpwidgets/nsPrintOptionsImpl.cpp
xpcom/base/nsExceptionService.cpp
xpcom/base/nsExceptionService.h
xpcom/base/nsISupportsObsolete.h
xpcom/glue/nsCOMPtr.h
xpcom/glue/nsDebug.h
xpcom/glue/nsHashKeys.h
xpcom/glue/nsISupportsImpl.h
xpcom/string/src/nsStringObsolete.cpp
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -62,17 +62,17 @@
 #include "nsIMutableArray.h"
 #include "nsIObserverService.h"
 #include "nsIServiceManager.h"
 #include "nsWhitespaceTokenizer.h"
 #include "nsAttrName.h"
 #include "nsNetUtil.h"
 #include "nsEventStates.h"
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #include "nsIDOMCharacterData.h"
 #endif
 
 #include "mozilla/unused.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/Element.h"
 
 using namespace mozilla;
--- a/content/base/src/nsContentSink.cpp
+++ b/content/base/src/nsContentSink.cpp
@@ -115,17 +115,17 @@ nsContentSink::nsContentSink()
   NS_ASSERTION(!mParsing, "What?");
   NS_ASSERTION(mLastSampledUserEventTime == 0, "What?");
   NS_ASSERTION(mDeflectedCount == 0, "What?");
   NS_ASSERTION(!mDroppedTimer, "What?");
   NS_ASSERTION(mInMonolithicContainer == 0, "What?");
   NS_ASSERTION(mInNotification == 0, "What?");
   NS_ASSERTION(!mDeferredLayoutStart, "What?");
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (!gContentSinkLogModuleInfo) {
     gContentSinkLogModuleInfo = PR_NewLogModule("nscontentsink");
   }
 #endif
 }
 
 nsContentSink::~nsContentSink()
 {
@@ -920,17 +920,17 @@ nsContentSink::SelectDocAppCache(nsIAppl
       // entry. The entry will be marked as foreign to avoid loading it again.
 
       *aAction = CACHE_SELECTION_RELOAD;
     }
     else {
       // The http manifest attribute URI is equal to the manifest URI of
       // the cache the document was loaded from - associate the document with
       // that cache and invoke the cache update process.
-#ifdef NS_DEBUG
+#ifdef DEBUG
       nsCAutoString docURISpec, clientID;
       mDocumentURI->GetAsciiSpec(docURISpec);
       aLoadApplicationCache->GetClientID(clientID);
       SINK_TRACE(gContentSinkLogModuleInfo, SINK_TRACE_CALLS,
           ("Selection: assigning app cache %s to document %s", clientID.get(), docURISpec.get()));
 #endif
 
       rv = applicationCacheDocument->SetApplicationCache(aLoadApplicationCache);
@@ -974,17 +974,17 @@ nsContentSink::SelectDocAppCacheNoManife
   if (aLoadApplicationCache) {
     // The document was loaded from an application cache, use that
     // application cache as the document's application cache.
     nsCOMPtr<nsIApplicationCacheContainer> applicationCacheDocument =
       do_QueryInterface(mDocument);
     NS_ASSERTION(applicationCacheDocument,
                  "mDocument must implement nsIApplicationCacheContainer.");
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
     nsCAutoString docURISpec, clientID;
     mDocumentURI->GetAsciiSpec(docURISpec);
     aLoadApplicationCache->GetClientID(clientID);
     SINK_TRACE(gContentSinkLogModuleInfo, SINK_TRACE_CALLS,
         ("Selection, no manifest: assigning app cache %s to document %s", clientID.get(), docURISpec.get()));
 #endif
 
     rv = applicationCacheDocument->SetApplicationCache(aLoadApplicationCache);
--- a/content/base/src/nsContentSink.h
+++ b/content/base/src/nsContentSink.h
@@ -47,17 +47,17 @@ class nsScriptLoader;
 class nsIApplicationCache;
 
 namespace mozilla {
 namespace css {
 class Loader;
 }
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 
 extern PRLogModuleInfo* gContentSinkLogModuleInfo;
 
 #define SINK_TRACE_CALLS              0x1
 #define SINK_TRACE_REFLOW             0x2
 #define SINK_ALWAYS_REFLOW            0x4
 
 #define SINK_LOG_TEST(_lm, _bit) (PRIntn((_lm)->level) & (_bit))
--- a/content/html/document/src/nsHTMLContentSink.cpp
+++ b/content/html/document/src/nsHTMLContentSink.cpp
@@ -80,17 +80,17 @@
 #include "nsIElementObserver.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "mozAutoDocUpdate.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static PRLogModuleInfo* gSinkLogModuleInfo;
 
 #define SINK_TRACE_NODE(_bit, _msg, _tag, _sp, _obj) \
   _obj->SinkTraceNode(_bit, _msg, _tag, _sp, this)
 
 #else
 #define SINK_TRACE_NODE(_bit, _msg, _tag, _sp, _obj)
 #endif
@@ -183,17 +183,17 @@ protected:
   // If aCheckIfPresent is true, will only set an attribute in cases
   // when it's not already set.
   nsresult AddAttributes(const nsIParserNode& aNode, nsIContent* aContent,
                          bool aNotify = false,
                          bool aCheckIfPresent = false);
   already_AddRefed<nsGenericHTMLElement>
   CreateContentObject(const nsIParserNode& aNode, nsHTMLTag aNodeType);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   void SinkTraceNode(PRUint32 aBit,
                      const char* aMsg,
                      const nsHTMLTag aTag,
                      PRInt32 aStackPos,
                      void* aThis);
 #endif
 
   nsCOMPtr<nsIHTMLDocument> mHTMLDocument;
@@ -238,17 +238,17 @@ protected:
 
   void NotifyInsert(nsIContent* aContent,
                     nsIContent* aChildContent,
                     PRInt32 aIndexInContainer);
   void NotifyRootInsertion();
   
   bool IsMonolithicContainer(nsHTMLTag aTag);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   void ForceReflow();
 #endif
 };
 
 class SinkContext
 {
 public:
   SinkContext(HTMLContentSink* aSink);
@@ -308,17 +308,17 @@ public:
   PRInt32 mTextSize;
 
 private:
   bool mLastTextCharWasCR;
 };
 
 //----------------------------------------------------------------------
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 void
 HTMLContentSink::SinkTraceNode(PRUint32 aBit,
                                const char* aMsg,
                                const nsHTMLTag aTag,
                                PRInt32 aStackPos,
                                void* aThis)
 {
   if (SINK_LOG_TEST(gSinkLogModuleInfo, aBit)) {
@@ -577,17 +577,17 @@ SinkContext::DidAddContent(nsIContent* a
   // an insertion happen, we need to do an immediate
   // notification for that insertion.
   if (0 < mStackPos &&
       mStack[mStackPos - 1].mInsertionPoint != -1 &&
       mStack[mStackPos - 1].mNumFlushed <
       mStack[mStackPos - 1].mContent->GetChildCount()) {
     nsIContent* parent = mStack[mStackPos - 1].mContent;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
     // Tracing code
     nsIParserService *parserService = nsContentUtils::GetParserService();
     if (parserService) {
       nsHTMLTag tag = nsHTMLTag(mStack[mStackPos - 1].mType);
       NS_ConvertUTF16toUTF8 str(parserService->HTMLIdToStringTag(tag));
 
       SINK_TRACE(gSinkLogModuleInfo, SINK_TRACE_REFLOW,
                  ("SinkContext::DidAddContent: Insertion notification for "
@@ -752,17 +752,17 @@ SinkContext::CloseContainer(const nsHTML
   // If we're in a state where we do append notifications as
   // we go up the tree, and we're at the level where the next
   // notification needs to be done, do the notification.
   if (mNotifyLevel >= mStackPos) {
     // Check to see if new content has been added after our last
     // notification
 
     if (mStack[mStackPos].mNumFlushed < content->GetChildCount()) {
-#ifdef NS_DEBUG
+#ifdef DEBUG
       {
         // Tracing code
         SINK_TRACE(gSinkLogModuleInfo, SINK_TRACE_REFLOW,
                    ("SinkContext::CloseContainer: reflow on notifyImmediate "
                     "tag=%s newIndex=%d stackPos=%d",
                     nsAtomCString(mStack[mStackPos].mContent->Tag()).get(),
                     mStack[mStackPos].mNumFlushed, mStackPos));
       }
@@ -1063,17 +1063,17 @@ SinkContext::FlushTags()
     PRUint32 childCount;
     nsGenericHTMLElement* content;
 
     while (stackPos < mStackPos) {
       content = mStack[stackPos].mContent;
       childCount = content->GetChildCount();
 
       if (!flushed && (mStack[stackPos].mNumFlushed < childCount)) {
-#ifdef NS_DEBUG
+#ifdef DEBUG
         {
           // Tracing code
           SINK_TRACE(gSinkLogModuleInfo, SINK_TRACE_REFLOW,
                      ("SinkContext::FlushTags: tag=%s from newindex=%d at "
                       "stackPos=%d",
                       nsAtomCString(mStack[stackPos].mContent->Tag()).get(),
                       mStack[stackPos].mNumFlushed, stackPos));
         }
@@ -1237,17 +1237,17 @@ NS_NewHTMLContentSink(nsIHTMLContentSink
   return NS_OK;
 }
 
 HTMLContentSink::HTMLContentSink()
 {
   // Note: operator new zeros our memory
 
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (!gSinkLogModuleInfo) {
     gSinkLogModuleInfo = PR_NewLogModule("htmlcontentsink");
   }
 #endif
 }
 
 HTMLContentSink::~HTMLContentSink()
 {
@@ -1421,17 +1421,17 @@ HTMLContentSink::Init(nsIDocument* aDoc,
 
   mRoot->AppendChildTo(mHead, false);
 
   mCurrentContext = new SinkContext(this);
   NS_ENSURE_TRUE(mCurrentContext, NS_ERROR_OUT_OF_MEMORY);
   mCurrentContext->Begin(eHTMLTag_html, mRoot, 0, -1);
   mContextStack.AppendElement(mCurrentContext);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   nsCAutoString spec;
   (void)aURI->GetSpec(spec);
   SINK_TRACE(gSinkLogModuleInfo, SINK_TRACE_CALLS,
              ("HTMLContentSink::Init: this=%p url='%s'",
               this, spec.get()));
 #endif
   return NS_OK;
 }
--- a/content/xml/document/src/nsXMLContentSink.cpp
+++ b/content/xml/document/src/nsXMLContentSink.cpp
@@ -1209,17 +1209,17 @@ nsXMLContentSink::HandleDoctypeDecl(cons
   if (aCatalogData && mCSSLoader && mDocument) {
     // bug 124570 - we only expect additional agent sheets for now -- ignore
     // exit codes, error are not fatal here, just that the stylesheet won't apply
     nsCOMPtr<nsIURI> uri(do_QueryInterface(aCatalogData));
     if (uri) {
       nsRefPtr<nsCSSStyleSheet> sheet;
       mCSSLoader->LoadSheetSync(uri, true, true, getter_AddRefs(sheet));
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
       nsCAutoString uriStr;
       uri->GetSpec(uriStr);
       printf("Loading catalog stylesheet: %s ... %s\n", uriStr.get(), sheet.get() ? "Done" : "Failed");
 #endif
       if (sheet) {
         mDocument->BeginUpdate(UPDATE_STYLE);
         mDocument->AddCatalogStyleSheet(sheet);
         mDocument->EndUpdate(UPDATE_STYLE);
--- a/content/xul/document/src/nsXULCommandDispatcher.cpp
+++ b/content/xul/document/src/nsXULCommandDispatcher.cpp
@@ -266,17 +266,17 @@ nsXULCommandDispatcher::AddCommandUpdate
   }
 
   Updater* updater = mUpdaters;
   Updater** link = &mUpdaters;
 
   while (updater) {
     if (updater->mElement == aElement) {
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
       if (PR_LOG_TEST(gLog, PR_LOG_NOTICE)) {
         nsCAutoString eventsC, targetsC, aeventsC, atargetsC; 
         eventsC.AssignWithConversion(updater->mEvents);
         targetsC.AssignWithConversion(updater->mTargets);
         CopyUTF16toUTF8(aEvents, aeventsC);
         CopyUTF16toUTF8(aTargets, atargetsC);
         PR_LOG(gLog, PR_LOG_NOTICE,
                ("xulcmd[%p] replace %p(events=%s targets=%s) with (events=%s targets=%s)",
@@ -294,17 +294,17 @@ nsXULCommandDispatcher::AddCommandUpdate
       updater->mEvents  = aEvents;
       updater->mTargets = aTargets;
       return NS_OK;
     }
 
     link = &(updater->mNext);
     updater = updater->mNext;
   }
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (PR_LOG_TEST(gLog, PR_LOG_NOTICE)) {
     nsCAutoString aeventsC, atargetsC; 
     CopyUTF16toUTF8(aEvents, aeventsC);
     CopyUTF16toUTF8(aTargets, atargetsC);
 
     PR_LOG(gLog, PR_LOG_NOTICE,
            ("xulcmd[%p] add     %p(events=%s targets=%s)",
             this, aElement,
@@ -329,17 +329,17 @@ nsXULCommandDispatcher::RemoveCommandUpd
   if (! aElement)
     return NS_ERROR_NULL_POINTER;
 
   Updater* updater = mUpdaters;
   Updater** link = &mUpdaters;
 
   while (updater) {
     if (updater->mElement == aElement) {
-#ifdef NS_DEBUG
+#ifdef DEBUG
       if (PR_LOG_TEST(gLog, PR_LOG_NOTICE)) {
         nsCAutoString eventsC, targetsC; 
         eventsC.AssignWithConversion(updater->mEvents);
         targetsC.AssignWithConversion(updater->mTargets);
         PR_LOG(gLog, PR_LOG_NOTICE,
                ("xulcmd[%p] remove  %p(events=%s targets=%s)",
                 this, aElement,
                 eventsC.get(),
@@ -395,17 +395,17 @@ nsXULCommandDispatcher::UpdateCommands(c
     nsIContent* content = updaters[u];
 
     nsCOMPtr<nsIDocument> document = content->GetDocument();
 
     NS_ASSERTION(document != nsnull, "element has no document");
     if (! document)
       continue;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
     if (PR_LOG_TEST(gLog, PR_LOG_NOTICE)) {
       nsCAutoString aeventnameC; 
       CopyUTF16toUTF8(aEventName, aeventnameC);
       PR_LOG(gLog, PR_LOG_NOTICE,
              ("xulcmd[%p] update %p event=%s",
               this, content,
               aeventnameC.get()));
     }
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -10570,17 +10570,17 @@ nsDocShell::SetHistoryEntry(nsCOMPtr<nsI
             nsCOMPtr<nsIDocShell> rootShell = do_QueryInterface(rootAsItem);
             if (rootShell) { // if we're the root just set it, nothing to swap
                 SwapEntriesData data = { this, newRootEntry };
                 nsIDocShell *rootIDocShell =
                     static_cast<nsIDocShell*>(rootShell);
                 nsDocShell *rootDocShell = static_cast<nsDocShell*>
                                                       (rootIDocShell);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
                 nsresult rv =
 #endif
                 SetChildHistoryEntry(oldRootEntry, rootDocShell,
                                                    0, &data);
                 NS_ASSERTION(NS_SUCCEEDED(rv), "SetChildHistoryEntry failed");
             }
         }
     }
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -608,17 +608,17 @@ static const char kDOMStringBundleURL[] 
 
 #define IDBEVENTTARGET_SCRIPTABLE_FLAGS                                       \
   (EVENTTARGET_SCRIPTABLE_FLAGS)
 
 #define DOMCLASSINFO_STANDARD_FLAGS                                           \
   (nsIClassInfo::MAIN_THREAD_ONLY | nsIClassInfo::DOM_OBJECT)
 
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #define NS_DEFINE_CLASSINFO_DATA_DEBUG(_class)                                \
     eDOMClassInfo_##_class##_id,
 #else
 #define NS_DEFINE_CLASSINFO_DATA_DEBUG(_class)                                \
   // nothing
 #endif
 
 /**
@@ -4530,17 +4530,17 @@ nsDOMClassInfo::Init()
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMRequest)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(LockedFile, nsIDOMLockedFile)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMLockedFile)
   DOM_CLASSINFO_MAP_END
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   {
     PRUint32 i = ArrayLength(sClassInfoData);
 
     if (i != eDOMClassInfoIDCount) {
       NS_ERROR("The number of items in sClassInfoData doesn't match the "
                "number of nsIDOMClassInfo ID's, this is bad! Fix it!");
 
       return NS_ERROR_NOT_INITIALIZED;
@@ -5871,17 +5871,17 @@ DefineInterfaceConstants(JSContext *cx, 
       {
         if (!JS_NewNumberValue(cx, c->GetValue()->val.u32, &v)) {
           return NS_ERROR_UNEXPECTED;
         }
         break;
       }
       default:
       {
-#ifdef NS_DEBUG
+#ifdef DEBUG
         NS_ERROR("Non-numeric constant found in interface.");
 #endif
         continue;
       }
     }
 
     if (!::JS_DefineProperty(cx, obj, c->GetName(), v, nsnull, nsnull,
                              JSPROP_ENUMERATE | JSPROP_READONLY |
--- a/dom/base/nsDOMClassInfo.h
+++ b/dom/base/nsDOMClassInfo.h
@@ -66,17 +66,17 @@ struct nsDOMClassInfoData
                                   // so be sure to mask if necessary!
   const nsIID *mProtoChainInterface;
   const nsIID **mInterfaces;
   PRUint32 mScriptableFlags : 31; // flags must not use more than 31 bits!
   PRUint32 mHasClassInterface : 1;
   PRUint32 mInterfacesBitmap;
   bool mChromeOnly;
   bool mDisabled;
-#ifdef NS_DEBUG
+#ifdef DEBUG
   PRUint32 mDebugID;
 #endif
 };
 
 struct nsExternalDOMClassInfoData : public nsDOMClassInfoData
 {
   const nsCID *mConstructorCID;
 };
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -252,17 +252,17 @@ static PRUint32             gSerialCount
 static PRUint32             gTimeoutsRecentlySet       = 0;
 static TimeStamp            gLastRecordedRecentTimeouts;
 #define STATISTICS_INTERVAL (30 * PR_MSEC_PER_SEC)
 
 #ifdef DEBUG_jst
 PRInt32 gTimeoutCnt                                    = 0;
 #endif
 
-#if !(defined(NS_DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
+#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
 static bool                 gDOMWindowDumpEnabled      = false;
 #endif
 
 #if defined(DEBUG_bryner) || defined(DEBUG_chb)
 #define DEBUG_PAGE_CACHE
 #endif
 
 #define DOM_TOUCH_LISTENER_ADDED "dom-touch-listener-added"
@@ -708,17 +708,17 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalW
 
   // We could have failed the first time through trying
   // to create the entropy collector, so we should
   // try to get one until we succeed.
 
   gRefCnt++;
 
   if (gRefCnt == 1) {
-#if !(defined(NS_DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
+#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
     Preferences::AddBoolVarCache(&gDOMWindowDumpEnabled,
                                  "browser.dom.window.dump.enabled");
 #endif
     Preferences::AddIntVarCache(&gMinTimeoutValue,
                                 "dom.min_timeout_value",
                                 DEFAULT_MIN_TIMEOUT_VALUE);
     Preferences::AddIntVarCache(&gMinBackgroundTimeoutValue,
                                 "dom.min_background_timeout_value",
@@ -4459,17 +4459,17 @@ nsGlobalWindow::GetFullScreen(bool* aFul
   // We are the root window, or something went wrong. Return our internal value.
   *aFullScreen = mFullScreen;
   return NS_OK;
 }
 
 bool
 nsGlobalWindow::DOMWindowDumpEnabled()
 {
-#if !(defined(NS_DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
+#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
   // In optimized builds we check a pref that controls if we should
   // enable output from dump() or not, in debug builds it's always
   // enabled.
   return gDOMWindowDumpEnabled;
 #else
   return true;
 #endif
 }
@@ -8626,17 +8626,17 @@ nsGlobalWindow::OpenInternal(const nsASt
                              nsIDOMWindow **aReturn)
 {
   FORWARD_TO_OUTER(OpenInternal, (aUrl, aName, aOptions, aDialog,
                                   aContentModal, aCalledNoScript, aDoJSFixups,
                                   argv, aExtraArgument, aCalleePrincipal,
                                   aJSCallerContext, aReturn),
                    NS_ERROR_NOT_INITIALIZED);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   PRUint32 argc = 0;
   if (argv)
       argv->GetLength(&argc);
 #endif
   NS_PRECONDITION(!aExtraArgument || (!argv && argc == 0),
                   "Can't pass in arguments both ways");
   NS_PRECONDITION(!aCalledNoScript || (!argv && argc == 0),
                   "Can't pass JS args when called via the noscript methods");
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -1671,17 +1671,17 @@ nsJSContext::JSObjectFromInterface(nsISu
 
   // Get the jsobject associated with this target
   // We don't wrap here because we trust the JS engine to wrap the target
   // later.
   jsval v;
   nsresult rv = nsContentUtils::WrapNative(mContext, aScope, aTarget, &v);
   NS_ENSURE_SUCCESS(rv, rv);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   nsCOMPtr<nsISupports> targetSupp = do_QueryInterface(aTarget);
   nsCOMPtr<nsISupports> native =
     nsContentUtils::XPConnect()->GetNativeOfWrapper(mContext,
                                                     JSVAL_TO_OBJECT(v));
   NS_ASSERTION(native == targetSupp, "Native should be the target!");
 #endif
 
   *aRet = xpc_UnmarkGrayObject(JSVAL_TO_OBJECT(v));
@@ -2211,17 +2211,17 @@ nsJSContext::ConvertSupportsTojsvals(nsI
       } else {
         // And finally, support the nsISupportsPrimitives supplied
         // by the AppShell.  It generally will pass only strings, but
         // as we have code for handling all, we may as well use it.
         rv = AddSupportsPrimitiveTojsvals(arg, thisval);
         if (rv == NS_ERROR_NO_INTERFACE) {
           // something else - probably an event object or similar -
           // just wrap it.
-#ifdef NS_DEBUG
+#ifdef DEBUG
           // but first, check its not another nsISupportsPrimitive, as
           // these are now deprecated for use with script contexts.
           nsCOMPtr<nsISupportsPrimitive> prim(do_QueryInterface(arg));
           NS_ASSERTION(prim == nsnull,
                        "Don't pass nsISupportsPrimitives - use nsIVariant!");
 #endif
           nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper;
           jsval v;
--- a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp
+++ b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp
@@ -61,17 +61,17 @@ mOwner(owner)
   // create the file
   rv = NS_NewLocalFileOutputStream(getter_AddRefs(mOutputStream), mTempFile, -1, 00600);
   if (NS_FAILED(rv))
     return;
 	
   // construct the URL we'll use later in calls to GetURL()
   NS_GetURLSpecFromFile(mTempFile, mFileURL);
   
-#ifdef NS_DEBUG
+#ifdef DEBUG
   printf("File URL = %s\n", mFileURL.get());
 #endif
 }
 
 nsPluginStreamToFile::~nsPluginStreamToFile()
 {
   // should we be deleting mTempFile here?
   if (nsnull != mTarget)
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -1631,17 +1631,17 @@ nsresult nsPluginHost::GetPlugin(const c
 
   nsPluginTag* pluginTag = FindPluginForType(aMimeType, true);
   if (pluginTag) {
     rv = NS_OK;
     PLUGIN_LOG(PLUGIN_LOG_BASIC,
     ("nsPluginHost::GetPlugin Begin mime=%s, plugin=%s\n",
     aMimeType, pluginTag->mFileName.get()));
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
     if (aMimeType && !pluginTag->mFileName.IsEmpty())
       printf("For %s found plugin %s\n", aMimeType, pluginTag->mFileName.get());
 #endif
 
     rv = EnsurePluginLoaded(pluginTag);
     if (NS_FAILED(rv)) {
       return rv;
     }
--- a/dom/plugins/base/nsPluginNativeWindowGtk2.cpp
+++ b/dom/plugins/base/nsPluginNativeWindowGtk2.cpp
@@ -214,37 +214,37 @@ void nsPluginNativeWindowGtk2::SetAlloca
   new_allocation.width = width;
   new_allocation.height = height;
   gtk_widget_size_allocate(mSocketWidget, &new_allocation);
 }
 
 nsresult nsPluginNativeWindowGtk2::CreateXtWindow() {
   NS_ASSERTION(!mSocketWidget,"Already created a socket widget!");
 
-#ifdef NS_DEBUG      
+#ifdef DEBUG      
   printf("About to create new xtbin of %i X %i from %p...\n",
          width, height, (void*)window);
 #endif
   GdkWindow *gdkWindow = gdk_window_lookup((XID)window);
   mSocketWidget = gtk_xtbin_new(gdkWindow, 0);
   // Check to see if creating the xtbin failed for some reason.
   // if it did, we can't go any further.
   if (!mSocketWidget)
     return NS_ERROR_FAILURE;
 
   g_signal_connect(mSocketWidget, "destroy",
                    G_CALLBACK(gtk_widget_destroyed), &mSocketWidget);
 
   gtk_widget_set_size_request(mSocketWidget, width, height);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   printf("About to show xtbin(%p)...\n", (void*)mSocketWidget); fflush(NULL);
 #endif
   gtk_widget_show(mSocketWidget);
-#ifdef NS_DEBUG
+#ifdef DEBUG
   printf("completed gtk_widget_show(%p)\n", (void*)mSocketWidget); fflush(NULL);
 #endif
 
   // Fill out the ws_info structure.
   GtkXtBin* xtbin = GTK_XTBIN(mSocketWidget);
   // The xtbin has its own Display structure.
   mWsInfo.display = xtbin->xtdisplay;
   mWsInfo.colormap = xtbin->xtclient.xtcolormap;
--- a/dom/plugins/base/nsPluginsDirUnix.cpp
+++ b/dom/plugins/base/nsPluginsDirUnix.cpp
@@ -298,17 +298,17 @@ nsresult nsPluginFile::LoadPlugin(PRLibr
             return NS_ERROR_FAILURE;
         }
     }
 #else
     *outLibrary = PR_LoadLibraryWithFlags(libSpec, 0);
     pLibrary = *outLibrary;
 #endif  // MOZ_WIDGET_GTK2
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
     printf("LoadPlugin() %s returned %lx\n", 
            libSpec.value.pathname, (unsigned long)pLibrary);
 #endif
     
     return NS_OK;
 }
 
 nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
--- a/dom/src/events/nsJSEventListener.cpp
+++ b/dom/src/events/nsJSEventListener.cpp
@@ -19,17 +19,17 @@
 #include "nsVariant.h"
 #include "nsIDOMBeforeUnloadEvent.h"
 #include "nsGkAtoms.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIJSContextStack.h"
 #include "xpcpublic.h"
 #include "nsJSEnvironment.h"
 #include "nsDOMJSUtils.h"
-#ifdef NS_DEBUG
+#ifdef DEBUG
 
 #include "nspr.h" // PR_fprintf
 
 class EventListenerCounter
 {
 public:
   ~EventListenerCounter() {
   }
@@ -169,17 +169,17 @@ nsJSEventListener::HandleEvent(nsIDOMEve
     if (NS_FAILED(rv)) return rv;
     NS_ENSURE_TRUE(iargv != nsnull, NS_ERROR_OUT_OF_MEMORY);
     rv = iargv->AppendElement(aEvent, false);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   // mContext is the same context which event listener manager pushes
   // to JS context stack.
-#ifdef NS_DEBUG
+#ifdef DEBUG
   JSContext* cx = nsnull;
   nsCOMPtr<nsIJSContextStack> stack =
     do_GetService("@mozilla.org/js/xpc/ContextStack;1");
   NS_ASSERTION(stack && NS_SUCCEEDED(stack->Peek(&cx)) && cx &&
                GetScriptContextFromJSContext(cx) == mContext,
                "JSEventListener has wrong script context?");
 #endif
   nsCOMPtr<nsIVariant> vrv;
--- a/editor/libeditor/base/CreateElementTxn.cpp
+++ b/editor/libeditor/base/CreateElementTxn.cpp
@@ -8,17 +8,17 @@
 #include "nsIDOMDocument.h"
 #include "nsIDOMNodeList.h"
 #include "nsISelection.h"
 #include "nsIDOMElement.h"
 #include "nsReadableUtils.h"
 
 #include "mozilla/dom/Element.h"
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static bool gNoisy = false;
 #endif
 
 using namespace mozilla;
 
 CreateElementTxn::CreateElementTxn()
   : EditTxn()
 {
@@ -55,17 +55,17 @@ NS_IMETHODIMP CreateElementTxn::Init(nsE
   mParent = do_QueryInterface(aParent);
   mOffsetInParent = aOffsetInParent;
   return NS_OK;
 }
 
 
 NS_IMETHODIMP CreateElementTxn::DoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy)
   {
     char* nodename = ToNewCString(mTag);
     printf("Do Create Element parent = %p <%s>, offset = %d\n", 
            static_cast<void*>(mParent.get()), nodename, mOffsetInParent);
     nsMemory::Free(nodename);
   }
 #endif
@@ -79,17 +79,17 @@ NS_IMETHODIMP CreateElementTxn::DoTransa
   nsresult result = mEditor->CreateHTMLContent(mTag, getter_AddRefs(newContent));
   NS_ENSURE_SUCCESS(result, result);
   NS_ENSURE_STATE(newContent);
 
   mNewNode = newContent->AsDOMNode();
   // Try to insert formatting whitespace for the new node:
   mEditor->MarkNodeDirty(mNewNode);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy)
   {
     printf("  newNode = %p\n", static_cast<void*>(mNewNode.get()));
   }
 #endif
 
   // insert the new node
   if (CreateElementTxn::eAppend == PRInt32(mOffsetInParent)) {
@@ -129,17 +129,17 @@ NS_IMETHODIMP CreateElementTxn::DoTransa
   result = selection->CollapseNative(parentContent,
                                      parentContent->IndexOf(newContent) + 1);
   NS_ASSERTION((NS_SUCCEEDED(result)), "selection could not be collapsed after insert.");
   return result;
 }
 
 NS_IMETHODIMP CreateElementTxn::UndoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy)
   {
     printf("Undo Create Element, mParent = %p, node = %p\n",
            static_cast<void*>(mParent.get()),
            static_cast<void*>(mNewNode.get()));
   }
 #endif
 
@@ -147,17 +147,17 @@ NS_IMETHODIMP CreateElementTxn::UndoTran
   NS_ENSURE_TRUE(mEditor && mParent, NS_ERROR_NOT_INITIALIZED);
 
   nsCOMPtr<nsIDOMNode> resultNode;
   return mParent->RemoveChild(mNewNode, getter_AddRefs(resultNode));
 }
 
 NS_IMETHODIMP CreateElementTxn::RedoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy) { printf("Redo Create Element\n"); }
 #endif
 
   NS_ASSERTION(mEditor && mParent, "bad state");
   NS_ENSURE_TRUE(mEditor && mParent, NS_ERROR_NOT_INITIALIZED);
 
   // first, reset mNewNode so it has no attributes or content
   nsCOMPtr<nsIDOMCharacterData>nodeAsText = do_QueryInterface(mNewNode);
--- a/editor/libeditor/base/DeleteElementTxn.cpp
+++ b/editor/libeditor/base/DeleteElementTxn.cpp
@@ -3,21 +3,21 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsReadableUtils.h"
 #include "nsCRT.h"
 
 #include "DeleteElementTxn.h"
 #include "nsSelectionState.h"
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #include "nsIDOMElement.h"
 #endif
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static bool gNoisy = false;
 #endif
 
 
 DeleteElementTxn::DeleteElementTxn()
 : EditTxn()
 ,mElement()
 ,mParent()
@@ -62,30 +62,30 @@ NS_IMETHODIMP DeleteElementTxn::Init(nsI
 
   mRangeUpdater = aRangeUpdater;
   return NS_OK;
 }
 
 
 NS_IMETHODIMP DeleteElementTxn::DoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy)
   {
     printf("%p Do Delete Element element = %p\n",
            static_cast<void*>(this),
            static_cast<void*>(mElement.get()));
   }
 #endif
 
   NS_ENSURE_TRUE(mElement, NS_ERROR_NOT_INITIALIZED);
 
   if (!mParent) { return NS_OK; }  // this is a no-op, there's no parent to delete mElement from
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   // begin debug output
   nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mElement);
   nsAutoString elementTag(NS_LITERAL_STRING("text node"));
   if (element)
     element->GetTagName(elementTag);
   nsCOMPtr<nsIDOMElement> parentElement = do_QueryInterface(mParent);
   nsAutoString parentElementTag(NS_LITERAL_STRING("text node"));
   if (parentElement)
@@ -113,30 +113,30 @@ NS_IMETHODIMP DeleteElementTxn::DoTransa
     mRangeUpdater->SelAdjDeleteNode(mElement);
 
   nsCOMPtr<nsIDOMNode> resultNode;
   return mParent->RemoveChild(mElement, getter_AddRefs(resultNode));
 }
 
 NS_IMETHODIMP DeleteElementTxn::UndoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy)
   {
     printf("%p Undo Delete Element element = %p, parent = %p\n",
            static_cast<void*>(this),
            static_cast<void*>(mElement.get()),
            static_cast<void*>(mParent.get()));
   }
 #endif
 
   if (!mParent) { return NS_OK; } // this is a legal state, the txn is a no-op
   if (!mElement) { return NS_ERROR_NULL_POINTER; }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   // begin debug output
   nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mElement);
   nsAutoString elementTag(NS_LITERAL_STRING("text node"));
   if (element)
     element->GetTagName(elementTag);
   nsCOMPtr<nsIDOMElement> parentElement = do_QueryInterface(mParent);
   nsAutoString parentElementTag(NS_LITERAL_STRING("text node"));
   if (parentElement)
@@ -156,17 +156,17 @@ NS_IMETHODIMP DeleteElementTxn::UndoTran
 #endif
 
   nsCOMPtr<nsIDOMNode> resultNode;
   return mParent->InsertBefore(mElement, mRefNode, getter_AddRefs(resultNode));
 }
 
 NS_IMETHODIMP DeleteElementTxn::RedoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy)
   {
     printf("%p Redo Delete Element element = %p, parent = %p\n",
            static_cast<void*>(this),
            static_cast<void*>(mElement.get()),
            static_cast<void*>(mParent.get()));
   }
 #endif
--- a/editor/libeditor/base/DeleteRangeTxn.cpp
+++ b/editor/libeditor/base/DeleteRangeTxn.cpp
@@ -11,17 +11,17 @@
 #include "nsIContentIterator.h"
 #include "nsIContent.h"
 #include "nsComponentManagerUtils.h"
 
 #include "mozilla/Util.h"
 
 using namespace mozilla;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static bool gNoisy = false;
 #endif
 
 // note that aEditor is not refcounted
 DeleteRangeTxn::DeleteRangeTxn()
 : EditAggregateTxn()
 ,mRange()
 ,mStartParent()
@@ -105,17 +105,17 @@ NS_IMETHODIMP DeleteRangeTxn::Init(nsEdi
   }
 #endif // DEBUG
 
   return NS_OK;
 }
 
 NS_IMETHODIMP DeleteRangeTxn::DoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy) { printf("Do Delete Range\n"); }
 #endif
 
   NS_ENSURE_TRUE(mStartParent && mEndParent && mCommonParent && mEditor, NS_ERROR_NOT_INITIALIZED);
 
   nsresult result; 
   // build the child transactions
 
@@ -166,28 +166,28 @@ NS_IMETHODIMP DeleteRangeTxn::DoTransact
     // do nothing - dom range gravity will adjust selection
   }
 
   return result;
 }
 
 NS_IMETHODIMP DeleteRangeTxn::UndoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy) { printf("Undo Delete Range\n"); }
 #endif
 
   NS_ENSURE_TRUE(mStartParent && mEndParent && mCommonParent && mEditor, NS_ERROR_NOT_INITIALIZED);
 
   return EditAggregateTxn::UndoTransaction();
 }
 
 NS_IMETHODIMP DeleteRangeTxn::RedoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy) { printf("Redo Delete Range\n"); }
 #endif
 
   NS_ENSURE_TRUE(mStartParent && mEndParent && mCommonParent && mEditor, NS_ERROR_NOT_INITIALIZED);
 
   return EditAggregateTxn::RedoTransaction();
 }
 
--- a/editor/libeditor/base/InsertElementTxn.cpp
+++ b/editor/libeditor/base/InsertElementTxn.cpp
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "InsertElementTxn.h"
 #include "nsISelection.h"
 #include "nsIContent.h"
 #include "nsIDOMNodeList.h"
 #include "nsReadableUtils.h"
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static bool gNoisy = false;
 #endif
 
 
 InsertElementTxn::InsertElementTxn()
   : EditTxn()
 {
 }
@@ -50,17 +50,17 @@ NS_IMETHODIMP InsertElementTxn::Init(nsI
   mEditor = aEditor;
   NS_ENSURE_TRUE(mNode && mParent && mEditor, NS_ERROR_INVALID_ARG);
   return NS_OK;
 }
 
 
 NS_IMETHODIMP InsertElementTxn::DoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy) 
   { 
     nsCOMPtr<nsIContent>nodeAsContent = do_QueryInterface(mNode);
     nsCOMPtr<nsIContent>parentAsContent = do_QueryInterface(mParent);
     nsString namestr;
     mNode->GetNodeName(namestr);
     char* nodename = ToNewCString(namestr);
     printf("%p Do Insert Element of %p <%s> into parent %p at offset %d\n", 
@@ -111,17 +111,17 @@ NS_IMETHODIMP InsertElementTxn::DoTransa
   {
     // do nothing - dom range gravity will adjust selection
   }
   return result;
 }
 
 NS_IMETHODIMP InsertElementTxn::UndoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy)
   {
     printf("%p Undo Insert Element of %p into parent %p at offset %d\n",
            static_cast<void*>(this),
            static_cast<void*>(mNode.get()),
            static_cast<void*>(mParent.get()),
            mOffset);
   }
--- a/editor/libeditor/base/InsertTextTxn.cpp
+++ b/editor/libeditor/base/InsertTextTxn.cpp
@@ -3,17 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "InsertTextTxn.h"
 #include "nsIDOMCharacterData.h"
 #include "nsISelection.h"
 #include "EditAggregateTxn.h"
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static bool gNoisy = false;
 #endif
 
 InsertTextTxn::InsertTextTxn()
   : EditTxn()
 {
 }
 
@@ -57,17 +57,17 @@ NS_IMETHODIMP InsertTextTxn::Init(nsIDOM
   mOffset = aOffset;
   mStringToInsert = aStringToInsert;
   mEditor = aEditor;
   return NS_OK;
 }
 
 NS_IMETHODIMP InsertTextTxn::DoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy)
   {
     printf("Do Insert Text element = %p\n",
            static_cast<void*>(mElement.get()));
   }
 #endif
 
   NS_ASSERTION(mElement && mEditor, "bad state");
@@ -93,17 +93,17 @@ NS_IMETHODIMP InsertTextTxn::DoTransacti
     // do nothing - dom range gravity will adjust selection
   }
 
   return result;
 }
 
 NS_IMETHODIMP InsertTextTxn::UndoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy)
   {
     printf("Undo Insert Text element = %p\n",
            static_cast<void*>(mElement.get()));
   }
 #endif
 
   NS_ASSERTION(mElement && mEditor, "bad state");
@@ -128,17 +128,17 @@ NS_IMETHODIMP InsertTextTxn::Merge(nsITr
     if (otherInsTxn)
     {
       if (IsSequentialInsert(otherInsTxn))
       {
         nsAutoString otherData;
         otherInsTxn->GetData(otherData);
         mStringToInsert += otherData;
         *aDidMerge = true;
-#ifdef NS_DEBUG
+#ifdef DEBUG
         if (gNoisy)
         {
           printf("InsertTextTxn assimilated %p\n",
                  static_cast<void*>(aTransaction));
         }
 #endif
       }
       NS_RELEASE(otherInsTxn);
--- a/editor/libeditor/base/JoinElementTxn.cpp
+++ b/editor/libeditor/base/JoinElementTxn.cpp
@@ -3,17 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "JoinElementTxn.h"
 #include "nsEditor.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMCharacterData.h"
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static bool gNoisy = false;
 #endif
 
 JoinElementTxn::JoinElementTxn()
   : EditTxn()
 {
 }
 
@@ -51,17 +51,17 @@ NS_IMETHODIMP JoinElementTxn::Init(nsEdi
   mRightNode = do_QueryInterface(aRightNode);
   mOffset=0;
   return NS_OK;
 }
 
 // After DoTransaction() and RedoTransaction(), the left node is removed from the content tree and right node remains.
 NS_IMETHODIMP JoinElementTxn::DoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy)
   {
     printf("%p Do Join of %p and %p\n",
            static_cast<void*>(this),
            static_cast<void*>(mLeftNode.get()),
            static_cast<void*>(mRightNode.get()));
   }
 #endif
@@ -103,17 +103,17 @@ NS_IMETHODIMP JoinElementTxn::DoTransact
 
   return rv;
 }
 
 //XXX: what if instead of split, we just deleted the unneeded children of mRight
 //     and re-inserted mLeft?
 NS_IMETHODIMP JoinElementTxn::UndoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy)
   {
     printf("%p Undo Join, right node = %p\n",
            static_cast<void*>(this),
            static_cast<void*>(mRightNode.get()));
   }
 #endif
 
--- a/editor/libeditor/base/SplitElementTxn.cpp
+++ b/editor/libeditor/base/SplitElementTxn.cpp
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "SplitElementTxn.h"
 #include "nsEditor.h"
 #include "nsIDOMNode.h"
 #include "nsISelection.h"
 #include "nsIDOMCharacterData.h"
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static bool gNoisy = false;
 #endif
 
 
 // note that aEditor is not refcounted
 SplitElementTxn::SplitElementTxn()
   : EditTxn()
 {
@@ -47,17 +47,17 @@ NS_IMETHODIMP SplitElementTxn::Init(nsEd
   mEditor = aEditor;
   mExistingRightNode = do_QueryInterface(aNode);
   mOffset = aOffset;
   return NS_OK;
 }
 
 NS_IMETHODIMP SplitElementTxn::DoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy)
   {
     printf("%p Do Split of node %p offset %d\n",
            static_cast<void*>(this),
            static_cast<void*>(mExistingRightNode.get()),
            mOffset);
   }
 #endif
@@ -67,17 +67,17 @@ NS_IMETHODIMP SplitElementTxn::DoTransac
 
   // create a new node
   nsresult result = mExistingRightNode->CloneNode(false, 1, getter_AddRefs(mNewLeftNode));
   NS_ASSERTION(((NS_SUCCEEDED(result)) && (mNewLeftNode)), "could not create element.");
   NS_ENSURE_SUCCESS(result, result);
   NS_ENSURE_TRUE(mNewLeftNode, NS_ERROR_NULL_POINTER);
   mEditor->MarkNodeDirty(mExistingRightNode);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy)
   {
     printf("  created left node = %p\n",
            static_cast<void*>(mNewLeftNode.get()));
   }
 #endif
 
   // get the parent node
@@ -103,34 +103,34 @@ NS_IMETHODIMP SplitElementTxn::DoTransac
       // do nothing - dom range gravity will adjust selection
     }
   }
   return result;
 }
 
 NS_IMETHODIMP SplitElementTxn::UndoTransaction(void)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy) { 
     printf("%p Undo Split of existing node %p and new node %p offset %d\n",
            static_cast<void*>(this),
            static_cast<void*>(mExistingRightNode.get()),
            static_cast<void*>(mNewLeftNode.get()),
            mOffset);
   }
 #endif
 
   NS_ASSERTION(mEditor && mExistingRightNode && mNewLeftNode && mParent, "bad state");
   if (!mEditor || !mExistingRightNode || !mNewLeftNode || !mParent) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   // this assumes Do inserted the new node in front of the prior existing node
   nsresult result = mEditor->JoinNodesImpl(mExistingRightNode, mNewLeftNode, mParent, false);
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy) 
   { 
     printf("** after join left child node %p into right node %p\n",
            static_cast<void*>(mNewLeftNode.get()),
            static_cast<void*>(mExistingRightNode.get()));
     if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
   }
   if (NS_SUCCEEDED(result))
@@ -151,17 +151,17 @@ NS_IMETHODIMP SplitElementTxn::UndoTrans
  */
 NS_IMETHODIMP SplitElementTxn::RedoTransaction(void)
 {
   NS_ASSERTION(mEditor && mExistingRightNode && mNewLeftNode && mParent, "bad state");
   if (!mEditor || !mExistingRightNode || !mNewLeftNode || !mParent) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy) { 
     printf("%p Redo Split of existing node %p and new node %p offset %d\n",
            static_cast<void*>(this),
            static_cast<void*>(mExistingRightNode.get()),
            static_cast<void*>(mNewLeftNode.get()),
            mOffset);
     if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
   }
@@ -169,17 +169,17 @@ NS_IMETHODIMP SplitElementTxn::RedoTrans
 
   nsresult result;
   nsCOMPtr<nsIDOMNode>resultNode;
   // first, massage the existing node so it is in its post-split state
   nsCOMPtr<nsIDOMCharacterData>rightNodeAsText = do_QueryInterface(mExistingRightNode);
   if (rightNodeAsText)
   {
     result = rightNodeAsText->DeleteData(0, mOffset);
-#ifdef NS_DEBUG
+#ifdef DEBUG
     if (gNoisy) 
     { 
       printf("** after delete of text in right text node %p offset %d\n",
              static_cast<void*>(rightNodeAsText.get()),
              mOffset);
       mEditor->DebugDumpContent();  // DEBUG
     }
 #endif
@@ -194,33 +194,33 @@ NS_IMETHODIMP SplitElementTxn::RedoTrans
     {
       if (NS_FAILED(result)) {return result;}
       if (!child) {return NS_ERROR_NULL_POINTER;}
       child->GetNextSibling(getter_AddRefs(nextSibling));
       result = mExistingRightNode->RemoveChild(child, getter_AddRefs(resultNode));
       if (NS_SUCCEEDED(result)) 
       {
         result = mNewLeftNode->AppendChild(child, getter_AddRefs(resultNode));
-#ifdef NS_DEBUG
+#ifdef DEBUG
         if (gNoisy) 
         { 
           printf("** move child node %p from right node %p to left node %p\n",
                  static_cast<void*>(child.get()),
                  static_cast<void*>(mExistingRightNode.get()),
                  static_cast<void*>(mNewLeftNode.get()));
           if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
         }
 #endif
       }
       child = do_QueryInterface(nextSibling);
     }
   }
   // second, re-insert the left node into the tree 
   result = mParent->InsertBefore(mNewLeftNode, mExistingRightNode, getter_AddRefs(resultNode));
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gNoisy) 
   { 
     printf("** reinsert left child node %p before right node %p\n",
            static_cast<void*>(mNewLeftNode.get()),
            static_cast<void*>(mExistingRightNode.get()));
     if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
   }
 #endif
--- a/editor/libeditor/html/TextEditorTest.h
+++ b/editor/libeditor/html/TextEditorTest.h
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __TextEditorTest_h__
 #define __TextEditorTest_h__
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 
 #include "nsCOMPtr.h"
 #include "nsIEditor.h"
 #include "nsIPlaintextEditor.h"
 
 class TextEditorTest
 {
 public:
@@ -30,11 +30,11 @@ protected:
   nsresult TestInsertBreak();
 
   nsresult TestTextProperties();
 
   nsCOMPtr<nsIPlaintextEditor> mTextEditor;
   nsCOMPtr<nsIEditor> mEditor;
 };
 
-#endif /* NS_DEBUG */
+#endif /* DEBUG */
 
 #endif
--- a/embedding/components/appstartup/src/nsAppStartupNotifier.cpp
+++ b/embedding/components/appstartup/src/nsAppStartupNotifier.cpp
@@ -75,17 +75,17 @@ NS_IMETHODIMP nsAppStartupNotifier::Obse
                     if (NS_SUCCEEDED(rv)) {
                         rv = startupObserver->Observe(nsnull, aTopic, nsnull);
      
                         // mainly for debugging if you want to know if your observer worked.
                         NS_ASSERTION(NS_SUCCEEDED(rv), "Startup Observer failed!\n");
                     }
                 }
                 else {
-                  #ifdef NS_DEBUG
+                  #ifdef DEBUG
                     nsCAutoString warnStr("Cannot create startup observer : ");
                     warnStr += contractId.get();
                     NS_WARNING(warnStr.get());
                   #endif
                 }
 
                 NS_TIME_FUNCTION_MARK("observer: category: %s cid: %s", categoryEntry.get(), nsPromiseFlatCString(contractId).get());
 
--- a/image/src/imgRequest.cpp
+++ b/image/src/imgRequest.cpp
@@ -904,17 +904,17 @@ NS_IMETHODIMP imgRequest::OnDataAvailabl
     mGotData = true;
 
     /* look at the first few bytes and see if we can tell what the data is from that
      * since servers tend to lie. :(
      */
     PRUint32 out;
     inStr->ReadSegments(sniff_mimetype_callback, this, count, &out);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
     /* NS_WARNING if the content type from the channel isn't the same if the sniffing */
 #endif
 
     nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
     if (mContentType.IsEmpty()) {
       LOG_SCOPE(gImgLog, "imgRequest::OnDataAvailable |sniffing of mimetype failed|");
 
       rv = NS_ERROR_FAILURE;
--- a/intl/uconv/tests/TestUConv.cpp
+++ b/intl/uconv/tests/TestUConv.cpp
@@ -338,17 +338,17 @@ nsresult nsTestUConv::DisplayCharsets()
 
     nsCOMPtr<nsIUnicodeDecoder> dec = NULL;
     res = ccMan->GetUnicodeDecoder(charset.get(), getter_AddRefs(dec));
     if (NS_FAILED(res)) printf (" "); 
     else {
       printf("D");
       decCount++;
     }
-#ifdef NS_DEBUG
+#ifdef DEBUG
     // show the "basic" decoder classes
     if (dec) {
       nsCOMPtr<nsIBasicDecoder> isBasic = do_QueryInterface(dec);
       if (isBasic) {
         basicDecCount++;
         printf("b");
       }
       else printf(" ");
@@ -359,17 +359,17 @@ nsresult nsTestUConv::DisplayCharsets()
     nsCOMPtr<nsIUnicodeEncoder> enc = NULL;
     res = ccMan->GetUnicodeEncoder(charset.get(), getter_AddRefs(enc));
     if (NS_FAILED(res)) printf (" "); 
     else {
       printf("E");
       encCount++;
     }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
     if (enc) {
       nsCOMPtr<nsIBasicEncoder> isBasic = do_QueryInterface(enc);
       if (isBasic) {
         basicEncCount++;
         printf("b");
       }
       else printf(" ");
     }
--- a/intl/uconv/util/nsUCSupport.cpp
+++ b/intl/uconv/util/nsUCSupport.cpp
@@ -24,17 +24,17 @@ nsBasicDecoderSupport::nsBasicDecoderSup
 
 nsBasicDecoderSupport::~nsBasicDecoderSupport()
 {
 }
 
 //----------------------------------------------------------------------
 // Interface nsISupports [implementation]
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMPL_THREADSAFE_ISUPPORTS2(nsBasicDecoderSupport,
                               nsIUnicodeDecoder,
                               nsIBasicDecoder)
 #else
 NS_IMPL_THREADSAFE_ISUPPORTS1(nsBasicDecoderSupport, nsIUnicodeDecoder)
 #endif
 
 //----------------------------------------------------------------------
@@ -328,17 +328,17 @@ nsBasicEncoder::~nsBasicEncoder()
 {
 }
 
 //----------------------------------------------------------------------
 // Interface nsISupports [implementation]
 
 NS_IMPL_ADDREF(nsBasicEncoder)
 NS_IMPL_RELEASE(nsBasicEncoder)
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMPL_QUERY_INTERFACE2(nsBasicEncoder,
                          nsIUnicodeEncoder,
                          nsIBasicEncoder)
 #else
 NS_IMPL_QUERY_INTERFACE1(nsBasicEncoder,
                          nsIUnicodeEncoder)
 #endif
 //----------------------------------------------------------------------
--- a/intl/uconv/util/nsUCSupport.h
+++ b/intl/uconv/util/nsUCSupport.h
@@ -16,17 +16,17 @@
 
 inline bool WillOverrun(PRUnichar* aDest, PRUnichar* aDestEnd, PRUint32 aLength)
 {
   NS_ASSERTION(aDest <= aDestEnd, "Pointer overrun even before check");
   return (PRUint32(aDestEnd - aDest) < aLength);
 }
 #define CHECK_OVERRUN(dest, destEnd, length) (WillOverrun(dest, destEnd, length))
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 // {7AFC9F0A-CFE1-44ea-A755-E3B86AB1226E}
 #define NS_IBASICDECODER_IID \
 { 0x7afc9f0a, 0xcfe1, 0x44ea, { 0xa7, 0x55, 0xe3, 0xb8, 0x6a, 0xb1, 0x22, 0x6e } }
 
 // {65968A7B-6467-4c4a-B50A-3E0C97A32F07}
 #define NS_IBASICENCODER_IID \
 { 0x65968a7b, 0x6467, 0x4c4a, { 0xb5, 0xa, 0x3e, 0xc, 0x97, 0xa3, 0x2f, 0x7 } }
 
@@ -60,17 +60,17 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIBasicEn
  * This class implements:
  * - nsISupports
  * - nsIUnicodeDecoder
  *
  * @created         19/Apr/1999
  * @author  Catalin Rotaru [CATA]
  */
 class nsBasicDecoderSupport : public nsIUnicodeDecoder
-#ifdef NS_DEBUG
+#ifdef DEBUG
                               ,public nsIBasicDecoder
 #endif
 {
   NS_DECL_ISUPPORTS
 
 public:
 
   /**
@@ -265,17 +265,17 @@ protected:
       PRInt32 * aDestLength);
   NS_IMETHOD Reset();
 };
 
 //----------------------------------------------------------------------
 // Class nsBasicEncoder [declaration]
 
 class nsBasicEncoder : public nsIUnicodeEncoder
-#ifdef NS_DEBUG
+#ifdef DEBUG
                        ,public nsIBasicEncoder
 #endif
 {
   NS_DECL_ISUPPORTS
 
 public:
   /**
    * Class constructor.
--- a/ipc/glue/SharedMemorySysV.h
+++ b/ipc/glue/SharedMemorySysV.h
@@ -95,17 +95,17 @@ public:
     }
 
     // Mark the handle as deleted so that, should this process go away, the
     // segment is cleaned up.
     shmctl(mHandle, IPC_RMID, 0);
 
     mData = mem;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
     struct shmid_ds info;
     if (shmctl(mHandle, IPC_STAT, &info) < 0)
       return false;
 
     NS_ABORT_IF_FALSE(nBytes <= info.shm_segsz,
                       "Segment doesn't have enough space!");
 #endif
 
--- a/layout/base/nsDisplayItemTypes.h
+++ b/layout/base/nsDisplayItemTypes.h
@@ -90,22 +90,22 @@ enum Type {
 
   TYPE_MATHML_BAR,
   TYPE_MATHML_CHAR_BACKGROUND,
   TYPE_MATHML_CHAR_FOREGROUND,
   TYPE_MATHML_ERROR,
   TYPE_MATHML_MENCLOSE_NOTATION,
   TYPE_MATHML_SELECTION_RECT,
   TYPE_MATHML_SLASH,
-#ifdef NS_DEBUG
+#ifdef DEBUG
   TYPE_MATHML_BOUNDING_METRICS,
   TYPE_MATHML_CHAR_DEBUG,
 #endif
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   TYPE_DEBUG_BORDER,
   TYPE_DEBUG_IMAGE_MAP,
   TYPE_DEBUG_PLACEHOLDER,
   TYPE_EVENT_TARGET_BORDER,
 #endif
 
   TYPE_MAX
 };
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -154,17 +154,17 @@ static const char sPrintOptionsContractI
 #include "nsObserverService.h"
 
 #include "mozilla/dom/Element.h"
 
 #include "jsfriendapi.h"
 
 using namespace mozilla;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 
 #undef NOISY_VIEWER
 #else
 #undef NOISY_VIEWER
 #endif
 
 //-----------------------------------------------------
 // PR LOGGING
@@ -432,19 +432,19 @@ protected:
   nsCOMPtr<nsIPrintSettings>       mCachedPrintSettings;
   nsCOMPtr<nsIWebProgressListener> mCachedPrintWebProgressListner;
 
   nsCOMPtr<nsPrintEngine>          mPrintEngine;
   float                            mOriginalPrintPreviewScale;
   float                            mPrintPreviewZoom;
 #endif // NS_PRINT_PREVIEW
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   FILE* mDebugFile;
-#endif // NS_DEBUG
+#endif // DEBUG
 #endif // NS_PRINTING
 
   /* character set member data */
   PRInt32 mHintCharsetSource;
   nsCString mHintCharset;
   nsCString mDefaultCharacterSet;
   nsCString mForceCharacterSet;
   nsCString mPrevDocCharacterSet;
@@ -517,17 +517,17 @@ void DocumentViewerImpl::PrepareToStartL
   if (mPrintEngine) {
     mPrintEngine->Destroy();
     mPrintEngine = nsnull;
 #ifdef NS_PRINT_PREVIEW
     SetIsPrintPreview(false);
 #endif
   }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   mDebugFile = nsnull;
 #endif
 
 #endif // NS_PRINTING
 }
 
 // Note: operator new zeros our memory, so no need to init things to null.
 DocumentViewerImpl::DocumentViewerImpl()
@@ -2598,17 +2598,17 @@ NS_IMETHODIMP DocumentViewerImpl::GetCan
 NS_IMETHODIMP
 DocumentViewerImpl::Print(bool              aSilent,
                           FILE *            aDebugFile,
                           nsIPrintSettings* aPrintSettings)
 {
 #ifdef NS_PRINTING
   nsCOMPtr<nsIPrintSettings> printSettings;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   nsresult rv = NS_ERROR_FAILURE;
 
   mDebugFile = aDebugFile;
   // if they don't pass in a PrintSettings, then make one
   // it will have all the default values
   printSettings = aPrintSettings;
   nsCOMPtr<nsIPrintOptions> printOptions = do_GetService(sPrintOptionsContractID, &rv);
   if (NS_SUCCEEDED(rv)) {
@@ -3617,17 +3617,17 @@ DocumentViewerImpl::Print(nsIPrintSettin
   if (!mPrintEngine) {
     NS_ENSURE_STATE(mDeviceContext);
     mPrintEngine = new nsPrintEngine();
 
     rv = mPrintEngine->Initialize(this, mContainer, mDocument, 
                                   float(mDeviceContext->AppUnitsPerCSSInch()) /
                                   float(mDeviceContext->AppUnitsPerDevPixel()) /
                                   mPageZoom,
-#ifdef NS_DEBUG
+#ifdef DEBUG
                                   mDebugFile
 #else
                                   nsnull
 #endif
                                   );
     if (NS_FAILED(rv)) {
       mPrintEngine->Destroy();
       mPrintEngine = nsnull;
@@ -3684,17 +3684,17 @@ DocumentViewerImpl::PrintPreview(nsIPrin
   NS_ENSURE_STATE(!GetIsPrinting());
   if (!mPrintEngine) {
     mPrintEngine = new nsPrintEngine();
 
     rv = mPrintEngine->Initialize(this, mContainer, doc,
                                   float(mDeviceContext->AppUnitsPerCSSInch()) /
                                   float(mDeviceContext->AppUnitsPerDevPixel()) /
                                   mPageZoom,
-#ifdef NS_DEBUG
+#ifdef DEBUG
                                   mDebugFile
 #else
                                   nsnull
 #endif
                                   );
     if (NS_FAILED(rv)) {
       mPrintEngine->Destroy();
       mPrintEngine = nsnull;
--- a/layout/base/nsFrameManager.cpp
+++ b/layout/base/nsFrameManager.cpp
@@ -27,17 +27,17 @@
 #include "prthread.h"
 #include "plhash.h"
 #include "nsPlaceholderFrame.h"
 #include "nsContainerFrame.h"
 #include "nsBlockFrame.h"
 #include "nsGkAtoms.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsCSSPseudoElements.h"
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #include "nsIStyleRule.h"
 #endif
 #include "nsILayoutHistoryState.h"
 #include "nsPresState.h"
 #include "nsIContent.h"
 #include "nsINameSpaceManager.h"
 #include "nsIDocument.h"
 #include "nsIScrollableFrame.h"
@@ -512,17 +512,17 @@ void
 nsFrameManager::NotifyDestroyingFrame(nsIFrame* aFrame)
 {
   nsIContent* content = aFrame->GetContent();
   if (content && content->GetPrimaryFrame() == aFrame) {
     ClearAllUndisplayedContentIn(content);
   }
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static void
 DumpContext(nsIFrame* aFrame, nsStyleContext* aContext)
 {
   if (aFrame) {
     fputs("frame: ", stdout);
     nsAutoString  name;
     aFrame->GetFrameName(name);
     fputs(NS_LossyConvertUTF16toASCII(name).get(), stdout);
--- a/layout/base/nsFrameManager.h
+++ b/layout/base/nsFrameManager.h
@@ -150,17 +150,17 @@ public:
                                         nsIStatefulFrame::SpecialStateID aID =
                                                       nsIStatefulFrame::eNoID);
 
   NS_HIDDEN_(void) RestoreFrameStateFor(nsIFrame*              aFrame,
                                         nsILayoutHistoryState* aState,
                                         nsIStatefulFrame::SpecialStateID aID =
                                                       nsIStatefulFrame::eNoID);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   /**
    * DEBUG ONLY method to verify integrity of style tree versus frame tree
    */
   NS_HIDDEN_(void) DebugVerifyStyleTree(nsIFrame* aFrame);
 #endif
 
   NS_HIDDEN_(nsIPresShell*) GetPresShell() const { return mPresShell; }
   NS_HIDDEN_(nsPresContext*) GetPresContext() const {
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -1010,17 +1010,17 @@ public:
   {
 #ifdef _IMPL_NS_LAYOUT
     RemoveWeakFrameInternal(aWeakFrame);
 #else
     RemoveWeakFrameExternal(aWeakFrame);
 #endif
   }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   nsIFrame* GetDrawEventTargetFrame() { return mDrawEventTargetFrame; }
 #endif
 
   /**
    * Stop or restart non synthetic test mouse event handling on *all*
    * presShells.
    *
    * @param aDisable If true, disable all non synthetic test mouse
@@ -1319,17 +1319,17 @@ protected:
   nsIViewManager*           mViewManager;   // [WEAK] docViewer owns it so I don't have to
   nsPresArena               mFrameArena;
   nsFrameSelection*         mSelection;
   // Pointer into mFrameConstructor - this is purely so that FrameManager() and
   // GetRootFrame() can be inlined:
   nsFrameManagerBase*       mFrameManager;
   nsWeakPtr                 mForwardingContainer;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   nsIFrame*                 mDrawEventTargetFrame;
   // Ensure that every allocation from the PresArena is eventually freed.
   PRUint32                  mPresArenaAllocCount;
 #endif
 
   // Count of the number of times this presshell has been painted to a window.
   PRUint64                  mPaintCount;
 
--- a/layout/base/nsLayoutDebugger.cpp
+++ b/layout/base/nsLayoutDebugger.cpp
@@ -12,17 +12,17 @@
 #include "nsFrame.h"
 #include "nsDisplayList.h"
 #include "FrameLayerBuilder.h"
 
 #include <stdio.h>
 
 using namespace mozilla::layers;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 class nsLayoutDebugger : public nsILayoutDebugger {
 public:
   nsLayoutDebugger();
   virtual ~nsLayoutDebugger();
 
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD SetShowFrameBorders(bool aEnable);
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -384,17 +384,17 @@ nsLayoutUtils::GetChildListNameFor(nsIFr
       id = nsIFrame::kColGroupList;
     } else if (nsGkAtoms::tableCaptionFrame == aChildFrame->GetType()) {
       id = nsIFrame::kCaptionList;
     } else {
       id = nsIFrame::kPrincipalList;
     }
   }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   // Verify that the frame is actually in that child list or in the
   // corresponding overflow list.
   nsIFrame* parent = aChildFrame->GetParent();
   bool found = parent->GetChildList(id).ContainsFrame(aChildFrame);
   if (!found) {
     if (!(aChildFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
       found = parent->GetChildList(nsIFrame::kOverflowList)
                 .ContainsFrame(aChildFrame);
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -224,17 +224,17 @@ struct RangePaintInfo {
     MOZ_COUNT_DTOR(RangePaintInfo);
   }
 };
 
 #undef NOISY
 
 // ----------------------------------------------------------------------
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 // Set the environment variable GECKO_VERIFY_REFLOW_FLAGS to one or
 // more of the following flags (comma separated) for handy debug
 // output.
 static PRUint32 gVerifyReflowFlags;
 
 struct VerifyReflowFlags {
   const char*    name;
   PRUint32 bit;
@@ -506,17 +506,17 @@ private:
 };
 
 bool PresShell::sDisableNonTestMouseEvents = false;
 
 #ifdef PR_LOGGING
 PRLogModuleInfo* PresShell::gLog;
 #endif
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static void
 VerifyStyleTree(nsPresContext* aPresContext, nsFrameManager* aFrameManager)
 {
   if (nsFrame::GetVerifyStyleTreeEnable()) {
     nsIFrame* rootFrame = aFrameManager->GetRootFrame();
     aFrameManager->DebugVerifyStyleTree(rootFrame);
   }
 }
@@ -525,17 +525,17 @@ VerifyStyleTree(nsPresContext* aPresCont
 #define VERIFY_STYLE_TREE
 #endif
 
 static bool gVerifyReflowEnabled;
 
 bool
 nsIPresShell::GetVerifyReflowEnable()
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   static bool firstTime = true;
   if (firstTime) {
     firstTime = false;
     char* flags = PR_GetEnv("GECKO_VERIFY_REFLOW_FLAGS");
     if (flags) {
       bool error = false;
 
       for (;;) {
@@ -1138,17 +1138,17 @@ PresShell::SetPreferenceStyleRules(bool 
 nsresult PresShell::ClearPreferenceStyleRules(void)
 {
   nsresult result = NS_OK;
   if (mPrefStyleSheet) {
     NS_ASSERTION(mStyleSet, "null styleset entirely unexpected!");
     if (mStyleSet) {
       // remove the sheet from the styleset: 
       // - note that we have to check for success by comparing the count before and after...
-#ifdef NS_DEBUG
+#ifdef DEBUG
       PRInt32 numBefore = mStyleSet->SheetCount(nsStyleSet::eUserSheet);
       NS_ASSERTION(numBefore > 0, "no user stylesheets in styleset, but we have one!");
 #endif
       mStyleSet->RemoveStyleSheet(nsStyleSet::eUserSheet, mPrefStyleSheet);
 
 #ifdef DEBUG_attinasi
       NS_ASSERTION((numBefore - 1) == mStyleSet->GetNumberOfUserStyleSheets(),
                    "Pref stylesheet was not removed");
@@ -1588,17 +1588,17 @@ PresShell::InitialReflow(nscoord aWidth,
   NS_TIME_FUNCTION_WITH_DOCURL;
   mozilla::TimeStamp timerStart = mozilla::TimeStamp::Now();
 
   NS_ASSERTION(!mDidInitialReflow, "Why are we being called?");
 
   nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
   mDidInitialReflow = true;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) {
     if (mDocument) {
       nsIURI *uri = mDocument->GetDocumentURI();
       if (uri) {
         nsCAutoString url;
         uri->GetSpec(url);
         printf("*** PresShell::InitialReflow (this=%p, url='%s')\n", (void*)this, url.get());
       }
@@ -1941,17 +1941,17 @@ PresShell::NotifyDestroyingFrame(nsIFram
     // Remove frame properties
     mPresContext->NotifyDestroyingFrame(aFrame);
 
     if (aFrame == mCurrentEventFrame) {
       mCurrentEventContent = aFrame->GetContent();
       mCurrentEventFrame = nsnull;
     }
 
-  #ifdef NS_DEBUG
+  #ifdef DEBUG
     if (aFrame == mDrawEventTargetFrame) {
       mDrawEventTargetFrame = nsnull;
     }
   #endif
 
     for (unsigned int i=0; i < mCurrentEventFrameStack.Length(); i++) {
       if (aFrame == mCurrentEventFrameStack.ElementAt(i)) {
         //One of our stack frames was deleted.  Get its content so that when we
@@ -6018,17 +6018,17 @@ PresShell::HandleEvent(nsIFrame        *
       }
     } else {
       mCurrentEventFrame = frame;
     }
     if (GetCurrentEventFrame()) {
       rv = HandleEventInternal(aEvent, aEventStatus);
     }
   
-#ifdef NS_DEBUG
+#ifdef DEBUG
     ShowEventTargetDebug();
 #endif
     PopCurrentEventInfo();
   } else {
     // Activation events need to be dispatched even if no frame was found, since
     // we don't want the focus to be out of sync.
 
     if (!NS_EVENT_NEEDS_FRAME(aEvent)) {
@@ -6070,17 +6070,17 @@ PresShell::GetTouchEventTargetDocument()
   nsCOMPtr<nsIDocShellTreeItem> item;
   owner->GetPrimaryContentShell(getter_AddRefs(item));
   nsCOMPtr<nsIDocShell> childDocShell = do_QueryInterface(item);
   nsCOMPtr<nsIDocument> result = do_GetInterface(childDocShell);
   return result;
 }
 #endif
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 void
 PresShell::ShowEventTargetDebug()
 {
   if (nsFrame::GetShowEventTargetFrameBorder() &&
       GetCurrentEventFrame()) {
     if (mDrawEventTargetFrame) {
       mDrawEventTargetFrame->Invalidate(
           nsRect(nsPoint(0, 0), mDrawEventTargetFrame->GetSize()));
@@ -6134,17 +6134,17 @@ PresShell::HandlePositionedEvent(nsIFram
       }
     }
   }
 
   if (GetCurrentEventFrame()) {
     rv = HandleEventInternal(aEvent, aEventStatus);
   }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   ShowEventTargetDebug();
 #endif
   PopCurrentEventInfo();
   return rv;
 }
 
 nsresult
 PresShell::HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame,
@@ -7749,17 +7749,17 @@ nsIPresShell::RemoveRefreshObserverExter
 }
 
 //------------------------------------------------------
 // End of protected and private methods on the PresShell
 //------------------------------------------------------
 
 // Start of DEBUG only code
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #include "nsIURL.h"
 #include "nsILinkHandler.h"
 
 static NS_DEFINE_CID(kViewManagerCID, NS_VIEW_MANAGER_CID);
 
 static void
 LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg)
 {
--- a/layout/base/nsPresShell.h
+++ b/layout/base/nsPresShell.h
@@ -426,17 +426,17 @@ protected:
   }
 
 
   void SetRenderingState(const RenderingState& aState);
 
   friend class nsPresShellEventCB;
 
   bool mCaretEnabled;
-#ifdef NS_DEBUG
+#ifdef DEBUG
   nsStyleSet* CloneStyleSet(nsStyleSet* aSet);
   bool VerifyIncrementalReflow();
   bool mInVerifyReflow;
   void ShowEventTargetDebug();
 #endif
 
     /**
     * methods that manage rules that are used to implement the associated preferences
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -366,17 +366,17 @@ Shutdown()
   if (!gInitialized)
     return;
 
   gInitialized = false;
 
   nsLayoutStatics::Release();
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 nsresult NS_NewFrameUtil(nsIFrameUtil** aResult);
 nsresult NS_NewLayoutDebugger(nsILayoutDebugger** aResult);
 #endif
 
 nsresult NS_NewBoxObject(nsIBoxObject** aResult);
 
 #ifdef MOZ_XUL
 nsresult NS_NewListBoxObject(nsIBoxObject** aResult);
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -941,17 +941,17 @@ nsComboboxControlFrame::Reflow(nsPresCon
 //--------------------------------------------------------------
 
 nsIAtom*
 nsComboboxControlFrame::GetType() const
 {
   return nsGkAtoms::comboboxControlFrame; 
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMETHODIMP
 nsComboboxControlFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("ComboboxControl"), aResult);
 }
 #endif
 
 
--- a/layout/forms/nsComboboxControlFrame.h
+++ b/layout/forms/nsComboboxControlFrame.h
@@ -96,17 +96,17 @@ public:
     return nsBlockFrame::IsFrameOfType(aFlags &
       ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
   }
 
   virtual nsIScrollableFrame* GetScrollTargetFrame() {
     return do_QueryFrame(mDropdownFrame);
   }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
   NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
   virtual const nsFrameList& GetChildList(ChildListID aListID) const;
   virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
 
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -550,17 +550,17 @@ nsFileControlFrame::ContentStatesChanged
 }
 
 bool
 nsFileControlFrame::IsLeaf() const
 {
   return true;
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMETHODIMP
 nsFileControlFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("FileControl"), aResult);
 }
 #endif
 
 nsresult
--- a/layout/forms/nsFileControlFrame.h
+++ b/layout/forms/nsFileControlFrame.h
@@ -38,17 +38,17 @@ public:
   virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue);
   virtual nsresult GetFormProperty(nsIAtom* aName, nsAString& aValue) const;
   virtual void SetFocus(bool aOn, bool aRepaint);
 
   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
   
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
   NS_IMETHOD AttributeChanged(PRInt32         aNameSpaceID,
                               nsIAtom*        aAttribute,
                               PRInt32         aModType);
   virtual void ContentStatesChanged(nsEventStates aStates);
   virtual bool IsLeaf() const;
--- a/layout/forms/nsLegendFrame.cpp
+++ b/layout/forms/nsLegendFrame.cpp
@@ -78,15 +78,15 @@ PRInt32 nsLegendFrame::GetAlign()
     const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::align);
     if (attr && attr->Type() == nsAttrValue::eEnum) {
       intValue = attr->GetEnumValue();
     }
   }
   return intValue;
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMETHODIMP
 nsLegendFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("Legend"), aResult);
 }
 #endif
--- a/layout/forms/nsLegendFrame.h
+++ b/layout/forms/nsLegendFrame.h
@@ -20,17 +20,17 @@ public:
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
 
   virtual nsIAtom* GetType() const;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
   PRInt32 GetAlign();
 };
 
 
 #endif // guard
--- a/layout/forms/nsMeterFrame.h
+++ b/layout/forms/nsMeterFrame.h
@@ -24,17 +24,17 @@ public:
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
 
   NS_IMETHOD Reflow(nsPresContext*           aCX,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const {
     return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult);
   }
 #endif
 
   virtual bool IsLeaf() const { return true; }
 
   // nsIAnonymousContentCreator
--- a/layout/forms/nsProgressFrame.h
+++ b/layout/forms/nsProgressFrame.h
@@ -29,17 +29,17 @@ public:
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
   NS_IMETHOD Reflow(nsPresContext*           aCX,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const {
     return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult);
   }
 #endif
 
   virtual bool IsLeaf() const { return true; }
 
   // nsIAnonymousContentCreator
--- a/layout/forms/nsTextControlFrame.h
+++ b/layout/forms/nsTextControlFrame.h
@@ -72,17 +72,17 @@ public:
   DECL_DO_GLOBAL_REFLOW_COUNT_DSP(nsTextControlFrame, nsContainerFrame)
 
   virtual bool IsLeaf() const;
   
 #ifdef ACCESSIBILITY
   virtual already_AddRefed<Accessible> CreateAccessible();
 #endif
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const
   {
     aResult.AssignLiteral("nsTextControlFrame");
     return NS_OK;
   }
 #endif
 
   virtual bool IsFrameOfType(PRUint32 aFlags) const
--- a/layout/generic/nsAbsoluteContainingBlock.cpp
+++ b/layout/generic/nsAbsoluteContainingBlock.cpp
@@ -22,32 +22,32 @@
 #endif
 
 nsresult
 nsAbsoluteContainingBlock::SetInitialChildList(nsIFrame*       aDelegatingFrame,
                                                ChildListID     aListID,
                                                nsFrameList&    aChildList)
 {
   NS_PRECONDITION(GetChildListID() == aListID, "unexpected child list name");
-#ifdef NS_DEBUG
+#ifdef DEBUG
   nsFrame::VerifyDirtyBitSet(aChildList);
 #endif
   mAbsoluteFrames.SetFrames(aChildList);
   return NS_OK;
 }
 
 nsresult
 nsAbsoluteContainingBlock::AppendFrames(nsIFrame*      aDelegatingFrame,
                                         ChildListID    aListID,
                                         nsFrameList&   aFrameList)
 {
   NS_ASSERTION(GetChildListID() == aListID, "unexpected child list");
 
   // Append the frames to our list of absolutely positioned frames
-#ifdef NS_DEBUG
+#ifdef DEBUG
   nsFrame::VerifyDirtyBitSet(aFrameList);
 #endif
   mAbsoluteFrames.AppendFrames(nsnull, aFrameList);
 
   // no damage to intrinsic widths, since absolutely positioned frames can't
   // change them
   aDelegatingFrame->PresContext()->PresShell()->
     FrameNeedsReflow(aDelegatingFrame, nsIPresShell::eResize,
@@ -61,17 +61,17 @@ nsAbsoluteContainingBlock::InsertFrames(
                                         ChildListID    aListID,
                                         nsIFrame*      aPrevFrame,
                                         nsFrameList&   aFrameList)
 {
   NS_ASSERTION(GetChildListID() == aListID, "unexpected child list");
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == aDelegatingFrame,
                "inserting after sibling frame with different parent");
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   nsFrame::VerifyDirtyBitSet(aFrameList);
 #endif
   mAbsoluteFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
 
   // no damage to intrinsic widths, since absolutely positioned frames can't
   // change them
   aDelegatingFrame->PresContext()->PresShell()->
     FrameNeedsReflow(aDelegatingFrame, nsIPresShell::eResize,
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -776,17 +776,17 @@ protected:
   // Get the pushed floats list
   nsFrameList* GetPushedFloats() const;
   // Get the pushed floats list, or if there is not currently one,
   // make a new empty one.
   nsFrameList* EnsurePushedFloats();
   // Remove and return the pushed floats list.
   nsFrameList* RemovePushedFloats();
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   void VerifyLines(bool aFinalCheckOK);
   void VerifyOverflowSituation();
   PRInt32 GetDepth() const;
 #endif
 
   nscoord mMinWidth, mPrefWidth;
 
   nsLineList mLines;
--- a/layout/generic/nsBlockReflowContext.cpp
+++ b/layout/generic/nsBlockReflowContext.cpp
@@ -17,17 +17,17 @@
 #include "nsBlockFrame.h"
 #include "nsLineBox.h"
 #include "nsIDOMHTMLTableCellElement.h"
 #include "nsIDOMHTMLBodyElement.h"
 #include "nsGkAtoms.h"
 #include "nsCOMPtr.h"
 #include "nsLayoutUtils.h"
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #undef  NOISY_MAX_ELEMENT_SIZE
 #undef   REALLY_NOISY_MAX_ELEMENT_SIZE
 #undef  NOISY_VERTICAL_MARGINS
 #else
 #undef  NOISY_MAX_ELEMENT_SIZE
 #undef   REALLY_NOISY_MAX_ELEMENT_SIZE
 #undef  NOISY_VERTICAL_MARGINS
 #endif
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -58,17 +58,17 @@ nsBulletFrame::DestroyFrom(nsIFrame* aDe
   if (mListener) {
     mListener->SetFrame(nsnull);
   }
 
   // Let base class do the rest
   nsFrame::DestroyFrom(aDestructRoot);
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMETHODIMP
 nsBulletFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("Bullet"), aResult);
 }
 #endif
 
 nsIAtom*
--- a/layout/generic/nsBulletFrame.h
+++ b/layout/generic/nsBulletFrame.h
@@ -62,17 +62,17 @@ public:
 
   // nsIFrame
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
   virtual nsIAtom* GetType() const;
   virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
   // nsIHTMLReflow
   NS_IMETHOD Reflow(nsPresContext* aPresContext,
                     nsHTMLReflowMetrics& aMetrics,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus& aStatus);
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -111,17 +111,17 @@ nsCanvasFrame::AppendFrames(ChildListID 
   if (!mFrames.IsEmpty()) {
     // We only allow a single principal child frame.
     return NS_ERROR_INVALID_ARG;
   }
 
   // Insert the new frames
   NS_ASSERTION(aFrameList.FirstChild() == aFrameList.LastChild(),
                "Only one principal child frame allowed");
-#ifdef NS_DEBUG
+#ifdef DEBUG
   nsFrame::VerifyDirtyBitSet(aFrameList);
 #endif
   mFrames.AppendFrames(nsnull, aFrameList);
 
   PresContext()->PresShell()->
     FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                      NS_FRAME_HAS_DIRTY_CHILDREN);
 
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -32,17 +32,17 @@
 #include "nsDisplayList.h"
 #include "nsContentErrors.h"
 #include "nsListControlFrame.h"
 #include "nsIBaseWindow.h"
 #include "nsThemeConstants.h"
 #include "nsCSSFrameConstructor.h"
 #include "mozilla/dom/Element.h"
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #undef NOISY
 #else
 #undef NOISY
 #endif
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
@@ -82,17 +82,17 @@ nsContainerFrame::SetInitialChildList(Ch
     // initialized
     NS_NOTREACHED("unexpected second call to SetInitialChildList");
     result = NS_ERROR_UNEXPECTED;
   } else if (aListID != kPrincipalList) {
     // All we know about is the principal child list.
     NS_NOTREACHED("unknown frame list");
     result = NS_ERROR_INVALID_ARG;
   } else {
-#ifdef NS_DEBUG
+#ifdef DEBUG
     nsFrame::VerifyDirtyBitSet(aChildList);
 #endif
     mFrames.SetFrames(aChildList);
     result = NS_OK;
   }
   return result;
 }
 
@@ -1710,17 +1710,17 @@ nsOverflowContinuationTracker::Finish(ns
     }
     f = nif;
   }
 }
 
 /////////////////////////////////////////////////////////////////////////////
 // Debugging
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMETHODIMP
 nsContainerFrame::List(FILE* out, PRInt32 aIndent) const
 {
   IndentBy(out, aIndent);
   ListTag(out);
 #ifdef DEBUG_waterson
   fprintf(out, " [parent=%p]", static_cast<void*>(mParent));
 #endif
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -27,17 +27,17 @@ NS_NewFirstLetterFrame(nsIPresShell* aPr
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsFirstLetterFrame)
 
 NS_QUERYFRAME_HEAD(nsFirstLetterFrame)
   NS_QUERYFRAME_ENTRY(nsFirstLetterFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMETHODIMP
 nsFirstLetterFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("Letter"), aResult);
 }
 #endif
 
 nsIAtom*
--- a/layout/generic/nsFirstLetterFrame.h
+++ b/layout/generic/nsFirstLetterFrame.h
@@ -22,17 +22,17 @@ public:
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        aPrevInFlow);
   NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
   virtual nsIAtom* GetType() const;
 
   bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; }
 
   virtual bool IsFrameOfType(PRUint32 aFlags) const
   {
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -135,17 +135,17 @@ struct nsContentAndOffset
 #if 0
 static void RefreshContentFrames(nsPresContext* aPresContext, nsIContent * aStartContent, nsIContent * aEndContent);
 #endif
 
 #include "prenv.h"
 
 // Formerly the nsIFrameDebug interface
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static bool gShowFrameBorders = false;
 
 void nsFrame::ShowFrameBorders(bool aEnable)
 {
   gShowFrameBorders = aEnable;
 }
 
 bool nsFrame::GetShowFrameBorders()
@@ -1602,17 +1602,17 @@ BuildDisplayListWithOverflowClip(nsDispl
   nsresult rv = aFrame->BuildDisplayList(aBuilder, aDirtyRect, set);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = aBuilder->DisplayCaret(aFrame, aDirtyRect, aSet.Content());
   NS_ENSURE_SUCCESS(rv, rv);
 
   return aFrame->OverflowClip(aBuilder, set, aSet, aClipRect, aClipRadii);
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static void PaintDebugBorder(nsIFrame* aFrame, nsRenderingContext* aCtx,
      const nsRect& aDirtyRect, nsPoint aPt) {
   nsRect r(aPt, aFrame->GetSize());
   if (aFrame->HasView()) {
     aCtx->SetColor(NS_RGB(0,0,255));
   } else {
     aCtx->SetColor(NS_RGB(255,0,0));
   }
@@ -1868,17 +1868,17 @@ nsIFrame::BuildDisplayListForStackingCon
   // 7: general content
   resultList.AppendToTop(set.Content());
   // 7.5: outlines, in content tree order. We need to sort by content order
   // because an element with outline that breaks and has children with outline
   // might have placed child outline items between its own outline items.
   // The element's outline items need to all come before any child outline
   // items.
   set.Outlines()->SortByContentOrder(aBuilder, GetContent());
-#ifdef NS_DEBUG
+#ifdef DEBUG
   DisplayDebugBorders(aBuilder, this, set);
 #endif
   resultList.AppendToTop(set.Outlines());
   // 8, 9: non-negative z-index children
   resultList.AppendToTop(set.PositionedDescendants());
 
   /* If we have absolute position clipping and we have, or will have, items to
    * be clipped, wrap the list in a clip wrapper.
@@ -2096,17 +2096,17 @@ nsIFrame::BuildDisplayListForChild(nsDis
       rv = BuildDisplayListWithOverflowClip(aBuilder, child, dirty, aLists,
                                             overflowClip, overflowClipRadii);
     } else {
       rv = child->BuildDisplayList(aBuilder, dirty, aLists);
       if (NS_SUCCEEDED(rv)) {
         rv = aBuilder->DisplayCaret(child, dirty, aLists.Content());
       }
     }
-#ifdef NS_DEBUG
+#ifdef DEBUG
     DisplayDebugBorders(aBuilder, child, aLists);
 #endif
     return rv;
   }
   
   nsDisplayList list;
   nsDisplayList extraPositionedDescendants;
   const nsStylePosition* pos = child->GetStylePosition();
@@ -2152,17 +2152,17 @@ nsIFrame::BuildDisplayListForChild(nsDis
       }
     }
     list.AppendToTop(pseudoStack.BorderBackground());
     list.AppendToTop(pseudoStack.BlockBorderBackgrounds());
     list.AppendToTop(pseudoStack.Floats());
     list.AppendToTop(pseudoStack.Content());
     list.AppendToTop(pseudoStack.Outlines());
     extraPositionedDescendants.AppendToTop(pseudoStack.PositionedDescendants());
-#ifdef NS_DEBUG
+#ifdef DEBUG
     DisplayDebugBorders(aBuilder, child, aLists);
 #endif
   }
   NS_ENSURE_SUCCESS(rv, rv);
     
   if (isPositioned || isVisuallyAtomic ||
       (aFlags & DISPLAY_CHILD_FORCE_STACKING_CONTEXT)) {
     // Genuine stacking contexts, and positioned pseudo-stacking-contexts,
@@ -5203,17 +5203,17 @@ nsIFrame::GetContainingBlock() const
   // is really out-of-flow too.
   if (GetStyleDisplay()->IsAbsolutelyPositioned() &&
       (GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
     return GetParent(); // the parent is always the containing block
   }
   return GetNearestBlockContainer(GetParent());
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 
 PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame)
 {
   PRInt32 result = -1;
 
   nsIContent* content = aFrame->GetContent();
   if (content) {
     nsIContent* parentContent = content->GetParent();
@@ -5455,17 +5455,17 @@ nsIFrame::GetConstFrameSelection() const
       return tcf->GetOwnedFrameSelection();
     }
     frame = frame->GetParent();
   }
 
   return PresContext()->PresShell()->ConstFrameSelection();
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMETHODIMP
 nsFrame::DumpRegressionData(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent)
 {
   IndentBy(out, aIndent);
   fprintf(out, "<frame va=\"%ld\" type=\"", PRUptrdiff(this));
   nsAutoString name;
   GetFrameName(name);
   XMLQuote(name);
@@ -8030,17 +8030,17 @@ nsAdaptorPrintReason(nsHTMLReflowState& 
 #ifdef DEBUG_LAYOUT
 void
 nsFrame::GetBoxName(nsAutoString& aName)
 {
   GetFrameName(aName);
 }
 #endif
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static void
 GetTagName(nsFrame* aFrame, nsIContent* aContent, PRIntn aResultSize,
            char* aResult)
 {
   if (aContent) {
     PR_snprintf(aResult, aResultSize, "%s@%p",
                 nsAtomCString(aContent->Tag()).get(), aFrame);
   }
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -27,29 +27,29 @@
  */
 #define NS_FRAME_TRACE_CALLS        0x1
 #define NS_FRAME_TRACE_PUSH_PULL    0x2
 #define NS_FRAME_TRACE_CHILD_REFLOW 0x4
 #define NS_FRAME_TRACE_NEW_FRAMES   0x8
 
 #define NS_FRAME_LOG_TEST(_lm,_bit) (PRIntn((_lm)->level) & (_bit))
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #define NS_FRAME_LOG(_bit,_args)                                \
   PR_BEGIN_MACRO                                                \
     if (NS_FRAME_LOG_TEST(nsFrame::GetLogModuleInfo(),_bit)) {  \
       PR_LogPrint _args;                                        \
     }                                                           \
   PR_END_MACRO
 #else
 #define NS_FRAME_LOG(_bit,_args)
 #endif
 
 // XXX Need to rework this so that logging is free when it's off
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #define NS_FRAME_TRACE_IN(_method) Trace(_method, true)
 
 #define NS_FRAME_TRACE_OUT(_method) Trace(_method, false)
 
 // XXX remove me
 #define NS_FRAME_TRACE_MSG(_bit,_args)                          \
   PR_BEGIN_MACRO                                                \
     if (NS_FRAME_LOG_TEST(nsFrame::GetLogModuleInfo(),_bit)) {  \
@@ -385,17 +385,17 @@ public:
   // Incorporate the child overflow areas into aOverflowAreas.
   // If the child does not have a overflow, use the child area.
   void ConsiderChildOverflow(nsOverflowAreas& aOverflowAreas,
                              nsIFrame* aChildFrame);
 
   virtual const void* GetStyleDataExternal(nsStyleStructID aSID) const;
 
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   /**
    * Tracing method that writes a method enter/exit routine to the
    * nspr log using the nsIFrame log module. The tracing is only
    * done when the NS_FRAME_TRACE_CALLS bit is set in the log module's
    * level field.
    */
   void Trace(const char* aMethod, bool aEnter);
   void Trace(const char* aMethod, bool aEnter, nsReflowStatus aStatus);
@@ -624,17 +624,17 @@ private:
                      nscoord aWidth,
                      nscoord aHeight,
                      bool aMoveFrame = true);
 
   NS_IMETHODIMP RefreshSizeCache(nsBoxLayoutState& aState);
 
   virtual nsILineIterator* GetLineIterator();
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 public:
   // Formerly the nsIFrameDebug interface
 
   NS_IMETHOD  List(FILE* out, PRInt32 aIndent) const;
   /**
    * lists the frames beginning from the root frame
    * - calls root frame's List(...)
    */
--- a/layout/generic/nsFrameUtil.cpp
+++ b/layout/generic/nsFrameUtil.cpp
@@ -8,17 +8,17 @@
 #include "nsIFrameUtil.h"
 #include "nsFrame.h"
 #include "nsString.h"
 #include "nsRect.h"
 #include <stdlib.h>
 #include "plstr.h"
 
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 class nsFrameUtil : public nsIFrameUtil {
 public:
   nsFrameUtil();
   virtual ~nsFrameUtil();
 
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD CompareRegressionData(FILE* aFile1, FILE* aFile2,PRInt32 aRegressionOutput=0);
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -925,17 +925,17 @@ nsHTMLScrollFrame::Reflow(nsPresContext*
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
   mInner.PostOverflowEvent();
   return rv;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMETHODIMP
 nsHTMLScrollFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("HTMLScroll"), aResult);
 }
 #endif
 
 #ifdef ACCESSIBILITY
@@ -1244,17 +1244,17 @@ nsXULScrollFrame::GetMaxSize(nsBoxLayout
   nsSize maxSize(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
 
   AddBorderAndPadding(maxSize);
   bool widthSet, heightSet;
   nsIBox::AddCSSMaxSize(this, maxSize, widthSet, heightSet);
   return maxSize;
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMETHODIMP
 nsXULScrollFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("XULScroll"), aResult);
 }
 #endif
 
 NS_IMETHODIMP
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -520,17 +520,17 @@ public:
 
   /**
    * Get the "type" of the frame
    *
    * @see nsGkAtoms::scrollFrame
    */
   virtual nsIAtom* GetType() const;
   
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
   bool DidHistoryRestore() { return mInner.mDidHistoryRestore; }
 
 #ifdef ACCESSIBILITY
   virtual already_AddRefed<Accessible> CreateAccessible();
 #endif
@@ -773,17 +773,17 @@ public:
   virtual bool IsFrameOfType(PRUint32 aFlags) const
   {
     // Override bogus IsFrameOfType in nsBoxFrame.
     if (aFlags & (nsIFrame::eReplacedContainsBlock | nsIFrame::eReplaced))
       return false;
     return nsBoxFrame::IsFrameOfType(aFlags);
   }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
 protected:
   nsXULScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, bool aIsRoot);
   virtual PRIntn GetSkipSides() const;
 
   void ClampAndSetBounds(nsBoxLayoutState& aState, 
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -21,17 +21,17 @@
 #include "nsTableCellFrame.h"
 #include "nsIServiceManager.h"
 #include "nsIPercentHeightObserver.h"
 #include "nsLayoutUtils.h"
 #include "mozilla/Preferences.h"
 #include "nsBidiUtils.h"
 #include "nsFontInflationData.h"
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #undef NOISY_VERTICAL_ALIGN
 #else
 #undef NOISY_VERTICAL_ALIGN
 #endif
 
 using namespace mozilla;
 using namespace mozilla::layout;
 
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -2987,17 +2987,17 @@ private:
                                  mOverflow.mVisualDeltas.mTop);
   }
   /**
    * Returns true if any overflow changed.
    */
   bool SetOverflowAreas(const nsOverflowAreas& aOverflowAreas);
   nsPoint GetOffsetToCrossDoc(const nsIFrame* aOther, const PRInt32 aAPD) const;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 public:
   // Formerly nsIFrameDebug
   NS_IMETHOD  List(FILE* out, PRInt32 aIndent) const = 0;
   NS_IMETHOD  GetFrameName(nsAString& aResult) const = 0;
   NS_IMETHOD_(nsFrameState)  GetDebugStateBits() const = 0;
   NS_IMETHOD  DumpRegressionData(nsPresContext* aPresContext,
                                  FILE* out, PRInt32 aIndent) = 0;
 #endif
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1166,17 +1166,17 @@ static void PaintAltFeedback(nsIFrame* a
   f->DisplayAltFeedback(*aCtx,
                         aDirtyRect,
                         IMAGE_OK(state, true)
                            ? nsImageFrame::gIconLoad->mLoadingImage
                            : nsImageFrame::gIconLoad->mBrokenImage,
                         aPt);
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static void PaintDebugImageMap(nsIFrame* aFrame, nsRenderingContext* aCtx,
      const nsRect& aDirtyRect, nsPoint aPt) {
   nsImageFrame* f = static_cast<nsImageFrame*>(aFrame);
   nsRect inner = f->GetInnerArea() + aPt;
 
   aCtx->SetColor(NS_RGB(0, 0, 0));
   aCtx->PushState();
   aCtx->Translate(inner.TopLeft());
--- a/layout/generic/nsLineBox.h
+++ b/layout/generic/nsLineBox.h
@@ -627,17 +627,17 @@ class nsLineList_iterator {
     typedef nsLineBox*                  pointer;
     typedef const nsLineBox*            const_pointer;
 
     typedef PRUint32                    size_type;
     typedef PRInt32                     difference_type;
 
     typedef nsLineLink                  link_type;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
     nsLineList_iterator() { memset(&mCurrent, 0xcd, sizeof(mCurrent)); }
 #else
     // Auto generated default constructor OK.
 #endif
     // Auto generated copy-constructor OK.
 
     inline iterator_self_type&
         operator=(const iterator_self_type& aOther);
@@ -786,17 +786,17 @@ class nsLineList_reverse_iterator {
     typedef nsLineBox*                  pointer;
     typedef const nsLineBox*            const_pointer;
 
     typedef PRUint32                    size_type;
     typedef PRInt32                     difference_type;
 
     typedef nsLineLink                  link_type;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
     nsLineList_reverse_iterator() { memset(&mCurrent, 0xcd, sizeof(mCurrent)); }
 #else
     // Auto generated default constructor OK.
 #endif
     // Auto generated copy-constructor OK.
 
     inline iterator_self_type&
         operator=(const iterator_reverse_type& aOther);
--- a/layout/generic/nsPageContentFrame.h
+++ b/layout/generic/nsPageContentFrame.h
@@ -43,17 +43,17 @@ public:
 
   /**
    * Get the "type" of the frame
    *
    * @see nsGkAtoms::pageContentFrame
    */
   virtual nsIAtom* GetType() const;
   
-#ifdef NS_DEBUG
+#ifdef DEBUG
   // Debugging
   NS_IMETHOD  GetFrameName(nsAString& aResult) const;
 #endif
 
 protected:
   nsPageContentFrame(nsStyleContext* aContext) : ViewportFrame(aContext) {}
 
   nsSharedPageData*         mPD;
--- a/layout/generic/nsPageFrame.h
+++ b/layout/generic/nsPageFrame.h
@@ -29,17 +29,17 @@ public:
 
   /**
    * Get the "type" of the frame
    *
    * @see nsGkAtoms::pageFrame
    */
   virtual nsIAtom* GetType() const;
   
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD  GetFrameName(nsAString& aResult) const;
 #endif
 
   //////////////////
   // For Printing
   //////////////////
 
   // Tell the page which page number it is out of how many
@@ -107,17 +107,17 @@ class nsPageBreakFrame : public nsLeafFr
 
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
   virtual nsIAtom* GetType() const;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD  GetFrameName(nsAString& aResult) const;
 #endif
 
 protected:
 
   virtual nscoord GetIntrinsicWidth();
   virtual nscoord GetIntrinsicHeight();
 
--- a/layout/generic/nsSimplePageSequence.h
+++ b/layout/generic/nsSimplePageSequence.h
@@ -89,17 +89,17 @@ public:
 
   /**
    * Get the "type" of the frame
    *
    * @see nsGkAtoms::sequenceFrame
    */
   virtual nsIAtom* GetType() const;
   
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD  GetFrameName(nsAString& aResult) const;
 #endif
 
   void PaintPageSequence(nsRenderingContext& aRenderingContext,
                          const nsRect&        aDirtyRect,
                          nsPoint              aPt);
 
 protected:
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -70,17 +70,17 @@
 
 #include "mozilla/dom/Element.h"
 #include "mozilla/Util.h" // for DebugOnly
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/Attributes.h"
 
 #include "sampler.h"
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #undef NOISY_BLINK
 #undef NOISY_REFLOW
 #undef NOISY_TRIM
 #else
 #undef NOISY_BLINK
 #undef NOISY_REFLOW
 #undef NOISY_TRIM
 #endif
--- a/layout/generic/nsViewportFrame.cpp
+++ b/layout/generic/nsViewportFrame.cpp
@@ -44,17 +44,17 @@ ViewportFrame::DestroyFrom(nsIFrame* aDe
   nsContainerFrame::DestroyFrom(aDestructRoot);
 }
 
 NS_IMETHODIMP
 ViewportFrame::SetInitialChildList(ChildListID     aListID,
                                    nsFrameList&    aChildList)
 {
   // See which child list to add the frames to
-#ifdef NS_DEBUG
+#ifdef DEBUG
   nsFrame::VerifyDirtyBitSet(aChildList);
 #endif
   return nsContainerFrame::SetInitialChildList(aListID, aChildList);
 }
 
 NS_IMETHODIMP
 ViewportFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                 const nsRect&           aDirtyRect,
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -223,17 +223,17 @@ private:
 
 nsGlyphCode
 nsGlyphTable::ElementAt(nsPresContext* aPresContext, nsMathMLChar* aChar, PRUint32 aPosition)
 {
   if (mState == NS_TABLE_STATE_ERROR) return kNullGlyph;
   // Load glyph properties if this is the first time we have been here
   if (mState == NS_TABLE_STATE_EMPTY) {
     nsresult rv = LoadProperties(mFontName[0], mGlyphProperties);
-#ifdef NS_DEBUG
+#ifdef DEBUG
     nsCAutoString uriStr;
     uriStr.AssignLiteral("resource://gre/res/fonts/mathfont");
     LossyAppendUTF16toASCII(mFontName[0], uriStr);
     uriStr.StripWhitespace(); // that may come from mFontName
     uriStr.AppendLiteral(".properties");
     printf("Loading %s ... %s\n",
             uriStr.get(),
             (NS_FAILED(rv)) ? "Failed" : "Done");
@@ -1901,17 +1901,17 @@ public:
   virtual PRUint32 GetPerFrameKey() { return (mIndex << nsDisplayItem::TYPE_BITS) | nsDisplayItem::GetPerFrameKey(); }
 
 private:
   nsMathMLChar* mChar;
   PRUint32      mIndex;
   bool          mIsSelected;
 };
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 class nsDisplayMathMLCharDebug : public nsDisplayItem {
 public:
   nsDisplayMathMLCharDebug(nsDisplayListBuilder* aBuilder,
                            nsIFrame* aFrame, const nsRect& aRect)
     : nsDisplayItem(aBuilder, aFrame), mRect(aRect) {
     MOZ_COUNT_CTOR(nsDisplayMathMLCharDebug);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
@@ -1979,17 +1979,17 @@ nsMathMLChar::Display(nsDisplayListBuild
         NS_GET_A(backg->mBackgroundColor) > 0) {
       rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
           nsDisplayMathMLCharBackground(aBuilder, aForFrame, mRect, styleContext));
       NS_ENSURE_SUCCESS(rv, rv);
     }
     //else
     //  our container frame will take care of painting its background
 
-#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
+#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
     // for visual debug
     rv = aLists.BorderBackground()->AppendToTop(new (aBuilder)
         nsDisplayMathMLCharDebug(aBuilder, aForFrame, mRect));
     NS_ENSURE_SUCCESS(rv, rv);
 #endif
   }
   return aLists.Content()->AppendNewToTop(new (aBuilder)
         nsDisplayMathMLCharForeground(aBuilder, aForFrame, this,
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -515,17 +515,17 @@ nsMathMLContainerFrame::FinalizeReflow(n
       }
       else { /* case of <msup><mo>...</mo>...</msup> or friends */
         // compute a size that doesn't include embellishments
         GetPreferredStretchSize(aRenderingContext, 0, mEmbellishData.direction,
                                 defaultSize);
       }
       Stretch(aRenderingContext, NS_STRETCH_DIRECTION_DEFAULT, defaultSize,
               aDesiredSize);
-#ifdef NS_DEBUG
+#ifdef DEBUG
       {
         // The Place() call above didn't request FinishReflowChild(),
         // so let's check that we eventually did through Stretch().
         nsIFrame* childFrame = GetFirstPrincipalChild();
         for ( ; childFrame; childFrame = childFrame->GetNextSibling()) {
           NS_ASSERTION(!(childFrame->GetStateBits() & NS_FRAME_IN_REFLOW),
                        "DidReflow() was never called");
         }
@@ -634,17 +634,17 @@ nsMathMLContainerFrame::BuildDisplayList
 
   nsresult rv = DisplayBorderBackgroundOutline(aBuilder, aLists);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = BuildDisplayListForNonBlockChildren(aBuilder, aDirtyRect, aLists,
                                            DISPLAY_CHILD_INLINE);
   NS_ENSURE_SUCCESS(rv, rv);
 
-#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
+#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
   // for visual debug
   // ----------------
   // if you want to see your bounding box, make sure to properly fill
   // your mBoundingMetrics and mReference point, and set
   // mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS
   // in the Init() of your sub-class
   rv = DisplayBoundingMetrics(aBuilder, this, mReference, mBoundingMetrics, aLists);
 #endif
--- a/layout/mathml/nsMathMLFrame.cpp
+++ b/layout/mathml/nsMathMLFrame.cpp
@@ -105,17 +105,17 @@ nsMathMLFrame::InheritAutomaticData(nsIF
   mPresentationData.mstyle = parentData.mstyle;
   if (NS_MATHML_IS_DISPLAYSTYLE(parentData.flags)) {
     mPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
   }
   if (NS_MATHML_IS_RTL(parentData.flags)) {
     mPresentationData.flags |= NS_MATHML_RTL;
   }
 
-#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
+#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
   mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
 #endif
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMathMLFrame::UpdatePresentationData(PRUint32        aFlagsValues,
@@ -385,17 +385,17 @@ static const PRInt32 kMathMLversion2 = 2
 
 struct
 nsCSSMapping {
   PRInt32        compatibility;
   const nsIAtom* attrAtom;
   const char*    cssProperty;
 };
 
-#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
+#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
 class nsDisplayMathMLBoundingMetrics : public nsDisplayItem {
 public:
   nsDisplayMathMLBoundingMetrics(nsDisplayListBuilder* aBuilder,
                                  nsIFrame* aFrame, const nsRect& aRect)
     : nsDisplayItem(aBuilder, aFrame), mRect(aRect) {
     MOZ_COUNT_CTOR(nsDisplayMathMLBoundingMetrics);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
--- a/layout/mathml/nsMathMLFrame.h
+++ b/layout/mathml/nsMathMLFrame.h
@@ -346,17 +346,17 @@ public:
                    nscoord&             aRuleThickness);
 
   static void
   GetAxisHeight(nsRenderingContext& aRenderingContext, 
                 nsFontMetrics*      aFontMetrics,
                 nscoord&             aAxisHeight);
 
 protected:
-#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
+#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
   nsresult DisplayBoundingMetrics(nsDisplayListBuilder* aBuilder,
                                   nsIFrame* aFrame, const nsPoint& aPt,
                                   const nsBoundingMetrics& aMetrics,
                                   const nsDisplayListSet& aLists);
 #endif
 
   /**
    * Display a solid rectangle in the frame's text color. Used for drawing
--- a/layout/mathml/nsMathMLOperators.cpp
+++ b/layout/mathml/nsMathMLOperators.cpp
@@ -182,17 +182,17 @@ SetOperator(OperatorData*   aOperatorDat
 
   // Add operator to hash table
   aOperatorData->mFlags |= aForm;
   aOperatorData->mStr.Assign(value);
   value.AppendInt(aForm, 10);
   nsStringKey key(value);
   gOperatorTable->Put(&key, aOperatorData);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_LossyConvertUTF16toASCII str(aAttributes);
 #endif
   // Loop over the space-delimited list of attributes to get the name:value pairs
   aAttributes.Append(kNullCh);  // put an extra null at the end
   PRUnichar* start = aAttributes.BeginWriting();
   PRUnichar* end   = start;
   while ((kNullCh != *start) && (kDashCh != *start)) {
     name.SetLength(0);
--- a/layout/mathml/nsMathMLmactionFrame.cpp
+++ b/layout/mathml/nsMathMLmactionFrame.cpp
@@ -290,17 +290,17 @@ nsMathMLmactionFrame::BuildDisplayList(n
   if (childFrame) {
     // Put the child's background directly onto the content list
     nsDisplayListSet set(aLists, aLists.Content());
     // The children should be in content order
     rv = BuildDisplayListForChild(aBuilder, childFrame, aDirtyRect, set);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
+#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
   // visual debug
   rv = DisplayBoundingMetrics(aBuilder, this, mReference, mBoundingMetrics, aLists);
 #endif
   return rv;
 }
 
 // Only reflow the selected child ...
 NS_IMETHODIMP
--- a/layout/mathml/nsMathMLmoFrame.cpp
+++ b/layout/mathml/nsMathMLmoFrame.cpp
@@ -101,17 +101,17 @@ nsMathMLmoFrame::BuildDisplayList(nsDisp
     nsIFrame* firstChild = mFrames.FirstChild();
     if (IsFrameInSelection(firstChild)) {
       selectedRect = firstChild->GetRect();
       isSelected = true;
     }
     rv = mMathMLChar.Display(aBuilder, this, aLists, 0, isSelected ? &selectedRect : nsnull);
     NS_ENSURE_SUCCESS(rv, rv);
   
-#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
+#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
     // for visual debug
     rv = DisplayBoundingMetrics(aBuilder, this, mReference, mBoundingMetrics, aLists);
 #endif
   }
   return rv;
 }
 
 // get the text that we enclose and setup our nsMathMLChar
--- a/layout/mathml/nsMathMLmpaddedFrame.cpp
+++ b/layout/mathml/nsMathMLmpaddedFrame.cpp
@@ -169,17 +169,17 @@ nsMathMLmpaddedFrame::ParseAttribute(nsS
     }
     number.Append(c);
   }
 
   // catch error if we didn't enter the loop above... we could simply initialize
   // floatValue = 1, to cater for cases such as width="height", but that wouldn't
   // be in line with the spec which requires an explicit number
   if (number.IsEmpty()) {
-#ifdef NS_DEBUG
+#ifdef DEBUG
     printf("mpadded: attribute with bad numeric value: %s\n",
             NS_LossyConvertUTF16toASCII(aString).get());
 #endif
     aSign = NS_MATHML_SIGN_INVALID;
     return false;
   }
 
   PRInt32 errorCode;
@@ -244,17 +244,17 @@ nsMathMLmpaddedFrame::ParseAttribute(nsS
       aCSSValue.SetPercentValue(floatValue / 100.0f);
     else
       aCSSValue.SetFloatValue(floatValue, eCSSUnit_Number);
 
     return true;
   }
 
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   printf("mpadded: attribute with bad numeric value: %s\n",
           NS_LossyConvertUTF16toASCII(aString).get());
 #endif
   // if we reach here, it means we encounter an unexpected input
   aSign = NS_MATHML_SIGN_INVALID;
   return false;
 }
 
--- a/layout/mathml/nsMathMLmrootFrame.cpp
+++ b/layout/mathml/nsMathMLmrootFrame.cpp
@@ -99,17 +99,17 @@ nsMathMLmrootFrame::BuildDisplayList(nsD
   // paint the sqrt symbol
   if (!NS_MATHML_HAS_ERROR(mPresentationData.flags)) {
     rv = mSqrChar.Display(aBuilder, this, aLists, 0);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = DisplayBar(aBuilder, this, mBarRect, aLists);
     NS_ENSURE_SUCCESS(rv, rv);
 
-#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
+#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
     // for visual debug
     nsRect rect;
     mSqrChar.GetRect(rect);
     nsBoundingMetrics bm;
     mSqrChar.GetBoundingMetrics(bm);
     rv = DisplayBoundingMetrics(aBuilder, this, rect.TopLeft(), bm, aLists);
 #endif
   }
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -124,17 +124,17 @@ GetValueAt(nsIFrame*                    
     props.Set(aProperty, valueList);
   }
   PRInt32 count = valueList->mArray.Length();
   return (aRowOrColIndex < count)
          ? valueList->mArray[aRowOrColIndex]
          : valueList->mArray[count-1];
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 static bool
 IsTable(PRUint8 aDisplay)
 {
   if ((aDisplay == NS_STYLE_DISPLAY_TABLE) ||
       (aDisplay == NS_STYLE_DISPLAY_INLINE_TABLE))
     return true;
   return false;
 }
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -133,17 +133,17 @@ using namespace mozilla::dom;
 #ifdef MOZ_LOGGING
 #define FORCE_PR_LOG /* Allow logging in the release build */
 #endif
 
 #include "prlog.h"
 
 #ifdef PR_LOGGING
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 // PR_LOGGING is force to always be on (even in release builds)
 // but we only want some of it on,
 //#define EXTENDED_DEBUG_PRINTING 
 #endif
 
 #define DUMP_LAYOUT_LEVEL 9 // this turns on the dumping of each doucment's layout info
 
 static PRLogModuleInfo * kPrintingLogMod = PR_NewLogModule("printing");
@@ -544,17 +544,17 @@ nsPrintEngine::DoCommonPrint(bool       
   mPrt->mPrintSettings->SetPrintOptions(nsIPrintSettings::kEnableSelectionRB, isSelection || mPrt->mIsIFrameSelected);
 
   nsCOMPtr<nsIDeviceContextSpec> devspec
     (do_CreateInstance("@mozilla.org/gfx/devicecontextspec;1", &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsScriptSuppressor scriptSuppressor(this);
   if (!aIsPrintPreview) {
-#ifdef NS_DEBUG
+#ifdef DEBUG
     mPrt->mDebugFilePtr = mDebugFile;
 #endif
 
     scriptSuppressor.Suppress();
     bool printSilently;
     mPrt->mPrintSettings->GetPrintSilent(&printSilently);
 
     // Check prefs for a default setting as to whether we should print silently
@@ -2217,17 +2217,17 @@ nsPrintEngine::DoPrint(nsPrintObject * a
     nsIPageSequenceFrame* pageSequence = poPresShell->GetPageSequenceFrame();
     NS_ASSERTION(nsnull != pageSequence, "no page sequence frame");
 
     // We are done preparing for printing, so we can turn this off
     mPrt->mPreparingForPrint = false;
 
     // mPrt->mDebugFilePtr this is onlu non-null when compiled for debugging
     if (nsnull != mPrt->mDebugFilePtr) {
-#ifdef NS_DEBUG
+#ifdef DEBUG
       // output the regression test
       nsIFrame* root = poPresShell->FrameManager()->GetRootFrame();
       root->DumpRegressionData(poPresContext, mPrt->mDebugFilePtr, 0);
       fclose(mPrt->mDebugFilePtr);
       SetIsPrinting(false);
 #endif
     } else {
 #ifdef EXTENDED_DEBUG_PRINTING
--- a/layout/tables/nsCellMap.cpp
+++ b/layout/tables/nsCellMap.cpp
@@ -693,17 +693,17 @@ nsTableCellMap::GetNumCellsOriginatingIn
     return mCols.ElementAt(aColIndex).mNumCellsOrig;
   }
   else {
     NS_ERROR("nsCellMap::GetNumCellsOriginatingInCol - bad col index");
     return 0;
   }
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 void
 nsTableCellMap::Dump(char* aString) const
 {
   if (aString)
     printf("%s \n", aString);
   printf("***** START TABLE CELL MAP DUMP ***** %p\n", (void*)this);
   // output col info
   PRInt32 colCount = mCols.Length();
@@ -2521,17 +2521,17 @@ void nsCellMap::ExpandZeroColSpans(nsTab
             SetDataAt(aMap, *newData, rowX, colX);
           }
           colX++;
         }  // while (colX <= endColIndex)
       } // if zerocolspan
     }
   }
 }
-#ifdef NS_DEBUG
+#ifdef DEBUG
 void nsCellMap::Dump(bool aIsBorderCollapse) const
 {
   printf("\n  ***** START GROUP CELL MAP DUMP ***** %p\n", (void*)this);
   nsTableRowGroupFrame* rg = GetRowGroup();
   const nsStyleDisplay* display = rg->GetStyleDisplay();
   switch (display->mDisplay) {
   case NS_STYLE_DISPLAY_TABLE_HEADER_GROUP:
     printf("  thead ");
--- a/layout/tables/nsCellMap.h
+++ b/layout/tables/nsCellMap.h
@@ -219,17 +219,17 @@ public:
                          PRUint32    aYPos,
                          PRUint32    aXPos,
                          mozilla::css::Side aOwner,
                          nscoord     aSubSize,
                          bool        aBevel,
                          bool        aIsBottomRight = false);
 
   /** dump a representation of the cell map to stdout for debugging */
-#ifdef NS_DEBUG
+#ifdef DEBUG
   void Dump(char* aString = nsnull) const;
 #endif
 
 protected:
   BCData* GetRightMostBorder(PRInt32 aRowIndex);
   BCData* GetBottomMostBorder(PRInt32 aColIndex);
 
   friend class nsCellMap;
@@ -431,17 +431,17 @@ public:
   PRInt32 GetEffectiveColSpan(const nsTableCellMap& aMap,
                               PRInt32     aRowIndex,
                               PRInt32     aColIndex,
                               bool&     aIsZeroColSpan) const;
 
   typedef nsTArray<CellData*> CellDataArray;
 
   /** dump a representation of the cell map to stdout for debugging */
-#ifdef NS_DEBUG
+#ifdef DEBUG
   void Dump(bool aIsBorderCollapse) const;
 #endif
 
 protected:
   friend class nsTableCellMap;
   friend class BCMapCellIterator;
   friend class BCPaintBorderIterator;
   friend class nsTableFrame;
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -884,17 +884,17 @@ NS_METHOD nsTableCellFrame::Reflow(nsPre
     printf("Set table cell incomplete %p\n", static_cast<void*>(this));
   }
 
   // XXXbz is this invalidate actually needed, really?
   if (GetStateBits() & NS_FRAME_IS_DIRTY) {
     InvalidateFrameSubtree();
   }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   DebugCheckChildSize(firstKid, kidSize, availSize);
 #endif
 
   // 0 dimensioned cells need to be treated specially in Standard/NavQuirks mode
   // see testcase "emptyCells.html"
   nsIFrame* prevInFlow = GetPrevInFlow();
   bool isEmpty;
   if (prevInFlow) {
--- a/layout/tables/nsTableOuterFrame.cpp
+++ b/layout/tables/nsTableOuterFrame.cpp
@@ -124,17 +124,17 @@ nsTableCaptionFrame::CreateAccessible()
                                                      PresContext()->PresShell());
     }
   }
 
   return nsnull;
 }
 #endif
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMETHODIMP
 nsTableCaptionFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("Caption"), aResult);
 }
 #endif
 
 nsIFrame* 
--- a/layout/tables/nsTableOuterFrame.h
+++ b/layout/tables/nsTableOuterFrame.h
@@ -26,17 +26,17 @@ public:
                                  nsSize aPadding, bool aShrinkWrap);
 
   virtual nsIFrame* GetParentStyleContextFrame() const;
 
 #ifdef ACCESSIBILITY
   virtual already_AddRefed<Accessible> CreateAccessible();
 #endif
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
 protected:
   nsTableCaptionFrame(nsStyleContext*  aContext);
   virtual ~nsTableCaptionFrame();
 };
 
--- a/layout/xul/base/src/grid/nsGridRowGroupFrame.h
+++ b/layout/xul/base/src/grid/nsGridRowGroupFrame.h
@@ -22,17 +22,17 @@
  * all the columns).  However, multiple levels of groups are allowed, so
  * the parent or child could instead be another group.
  */
 class nsGridRowGroupFrame : public nsBoxFrame
 {
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const
   {
       return MakeFrameName(NS_LITERAL_STRING("nsGridRowGroup"), aResult);
   }
 #endif
 
   nsGridRowGroupFrame(nsIPresShell* aPresShell,
                       nsStyleContext* aContext,
--- a/layout/xul/base/src/grid/nsGridRowLeafFrame.h
+++ b/layout/xul/base/src/grid/nsGridRowLeafFrame.h
@@ -26,17 +26,17 @@
 class nsGridRowLeafFrame : public nsBoxFrame
 {
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
   friend nsIFrame* NS_NewGridRowLeafFrame(nsIPresShell* aPresShell,
                                           nsStyleContext* aContext);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const
   {
       return MakeFrameName(NS_LITERAL_STRING("nsGridRowLeaf"), aResult);
   }
 #endif
 
   nsGridRowLeafFrame(nsIPresShell* aPresShell,
                      nsStyleContext* aContext,
--- a/layout/xul/base/src/nsDeckFrame.h
+++ b/layout/xul/base/src/nsDeckFrame.h
@@ -41,17 +41,17 @@ public:
                                          const nsDisplayListSet& aLists);
                                          
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        aPrevInFlow);
 
   virtual nsIAtom* GetType() const;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const
   {
       return MakeFrameName(NS_LITERAL_STRING("Deck"), aResult);
   }
 #endif
 
   nsDeckFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
--- a/layout/xul/base/src/nsProgressMeterFrame.cpp
+++ b/layout/xul/base/src/nsProgressMeterFrame.cpp
@@ -135,15 +135,15 @@ nsProgressMeterFrame::AttributeChanged(P
     nsContentUtils::AddScriptRunner(new nsSetAttrRunnable(
       remainderContent, nsGkAtoms::flex, maxFlex - flex));
     nsContentUtils::AddScriptRunner(new nsReflowFrameRunnable(
       this, nsIPresShell::eTreeChange, NS_FRAME_IS_DIRTY));
   }
   return NS_OK;
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMETHODIMP
 nsProgressMeterFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("ProgressMeter"), aResult);
 }
 #endif
--- a/layout/xul/base/src/nsProgressMeterFrame.h
+++ b/layout/xul/base/src/nsProgressMeterFrame.h
@@ -27,17 +27,17 @@ public:
   friend nsIFrame* NS_NewProgressMeterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
   NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
 
   NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
                               nsIAtom* aAttribute,
                               PRInt32 aModType);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
 protected:
   nsProgressMeterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) :
     nsBoxFrame(aPresShell, aContext), mNeedsReflowCallback(true) {}
   virtual ~nsProgressMeterFrame();
 
--- a/layout/xul/base/src/nsStackFrame.h
+++ b/layout/xul/base/src/nsStackFrame.h
@@ -19,17 +19,17 @@
 class nsStackFrame : public nsBoxFrame
 {
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
   friend nsIFrame* NS_NewStackFrame(nsIPresShell* aPresShell,
                                     nsStyleContext* aContext);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const
   {
     return MakeFrameName(NS_LITERAL_STRING("Stack"), aResult);
   }
 #endif
 
   NS_IMETHOD BuildDisplayListForChildren(nsDisplayListBuilder*   aBuilder,
                                          const nsRect&           aDirtyRect,
--- a/layout/xul/base/src/nsXULLabelFrame.cpp
+++ b/layout/xul/base/src/nsXULLabelFrame.cpp
@@ -103,15 +103,15 @@ nsIAtom*
 nsXULLabelFrame::GetType() const
 {
   return nsGkAtoms::XULLabelFrame;
 }
 
 /////////////////////////////////////////////////////////////////////////////
 // Diagnostics
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 NS_IMETHODIMP
 nsXULLabelFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("XULLabel"), aResult);
 }
 #endif
--- a/parser/htmlparser/src/nsDTDUtils.cpp
+++ b/parser/htmlparser/src/nsDTDUtils.cpp
@@ -451,55 +451,55 @@ bool nsDTDContext::HasOpenContainer(eHTM
 /**
  * 
  * @update  gess7/9/98
  */
 void nsDTDContext::Push(nsCParserNode* aNode,
                         nsEntryStack* aStyleStack, 
                         bool aRefCntNode) {
   if(aNode) {
-#ifdef  NS_DEBUG
+#ifdef  DEBUG
     eHTMLTags theTag = (eHTMLTags)aNode->GetNodeType();
     int size = mStack.mCount;
     if (size < eMaxTags)
       mXTags[size] = theTag;
 #endif
     mStack.Push(aNode, aStyleStack, aRefCntNode);
   }
 }
 
 void nsDTDContext::PushTag(eHTMLTags aTag)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (mStack.mCount < eMaxTags) {
     mXTags[mStack.mCount] = aTag;
   }
 #endif
 
   mStack.PushTag(aTag);
 }
 
 nsTagEntry*
 nsDTDContext::PopEntry()
 {
   PRInt32 theSize = mStack.mCount;
   if(0<theSize) {
-#ifdef  NS_DEBUG
+#ifdef  DEBUG
     if (theSize <= eMaxTags)
       mXTags[theSize-1]=eHTMLTag_unknown;
 #endif
     return mStack.PopEntry();
   }
   return 0;
 }
 
 void nsDTDContext::PushEntry(nsTagEntry* aEntry, 
                              bool aRefCntNode)
 {
-#ifdef  NS_DEBUG
+#ifdef  DEBUG
     int size=mStack.mCount;
     if(size< eMaxTags && aEntry)
       mXTags[size]=aEntry->mTag;
 #endif
     mStack.PushEntry(aEntry, aRefCntNode);
 }
 
 /* This method will move the top entries, in the entry-stack, into dest context.
@@ -509,17 +509,17 @@ void nsDTDContext::PushEntry(nsTagEntry*
 void 
 nsDTDContext::MoveEntries(nsDTDContext& aDest,
                           PRInt32 aCount)
 {
   NS_ASSERTION(aCount > 0 && mStack.mCount >= aCount, "cannot move entries");
   if (aCount > 0 && mStack.mCount >= aCount) {
     while (aCount) {
       aDest.PushEntry(&mStack.mEntries[--mStack.mCount], false);
-#ifdef  NS_DEBUG
+#ifdef  DEBUG
       if (mStack.mCount < eMaxTags) {
         mXTags[mStack.mCount] = eHTMLTag_unknown;
       }
 #endif
       --aCount;
     }
   }
 }
@@ -530,17 +530,17 @@ nsDTDContext::MoveEntries(nsDTDContext& 
  */
 nsCParserNode* nsDTDContext::Pop(nsEntryStack *&aChildStyleStack) {
 
   PRInt32         theSize=mStack.mCount;
   nsCParserNode*  result=0;
 
   if(0<theSize) {
 
-#ifdef  NS_DEBUG
+#ifdef  DEBUG
     if ((theSize>0) && (theSize <= eMaxTags))
       mXTags[theSize-1]=eHTMLTag_unknown;
 #endif
 
 
     nsTagEntry* theEntry=mStack.EntryAt(mStack.mCount-1);
     aChildStyleStack=theEntry->mStyles;
 
@@ -769,17 +769,17 @@ static const PRInt32 kInitialTokenPoolSi
  * @param 
  */
 nsTokenAllocator::nsTokenAllocator() {
 
   MOZ_COUNT_CTOR(nsTokenAllocator);
 
   mArenaPool.Init("TokenPool", kTokenBuckets, kNumTokenBuckets, kInitialTokenPoolSize);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   int i=0;
   for(i=0;i<eToken_last-1;++i) {
     mTotals[i]=0;
   }
 #endif
 
 }
 
@@ -814,17 +814,17 @@ public:
  * @param   aString -- gives a default string value for the token
  *
  * @return  ptr to new token (or 0).
  */
 CToken* nsTokenAllocator::CreateTokenOfType(eHTMLTokenTypes aType,eHTMLTags aTag, const nsAString& aString) {
 
   CToken* result=0;
 
-#ifdef  NS_DEBUG
+#ifdef  DEBUG
     mTotals[aType-1]++;
 #endif
   switch(aType){
     case eToken_start:            result=new(mArenaPool) CStartToken(aString, aTag); break;
     case eToken_end:              result=new(mArenaPool) CEndToken(aString, aTag); break;
     case eToken_comment:          result=new(mArenaPool) CCommentToken(aString); break;
     case eToken_entity:           result=new(mArenaPool) CEntityToken(aString); break;
     case eToken_whitespace:       result=new(mArenaPool) CWhitespaceToken(aString); break;
@@ -851,17 +851,17 @@ CToken* nsTokenAllocator::CreateTokenOfT
  * @param   aTag  -- tells you the type of tag to init with this token
  *
  * @return  ptr to new token (or 0).
  */
 CToken* nsTokenAllocator::CreateTokenOfType(eHTMLTokenTypes aType,eHTMLTags aTag) {
 
   CToken* result=0;
 
-#ifdef  NS_DEBUG
+#ifdef  DEBUG
     mTotals[aType-1]++;
 #endif
   switch(aType){
     case eToken_start:            result=new(mArenaPool) CStartToken(aTag); break;
     case eToken_end:              result=new(mArenaPool) CEndToken(aTag); break;
     case eToken_comment:          result=new(mArenaPool) CCommentToken(); break;
     case eToken_attribute:        result=new(mArenaPool) CAttributeToken(); break;
     case eToken_entity:           result=new(mArenaPool) CEntityToken(); break;
--- a/parser/htmlparser/src/nsDTDUtils.h
+++ b/parser/htmlparser/src/nsDTDUtils.h
@@ -221,17 +221,17 @@ public:
   ~nsTokenAllocator();
   CToken* CreateTokenOfType(eHTMLTokenTypes aType,eHTMLTags aTag, const nsAString& aString);
   CToken* CreateTokenOfType(eHTMLTokenTypes aType,eHTMLTags aTag);
 
   nsFixedSizeAllocator& GetArenaPool() { return mArenaPool; }
 
 protected:
   nsFixedSizeAllocator mArenaPool;
-#ifdef  NS_DEBUG
+#ifdef  DEBUG
   int mTotals[eToken_last-1];
 #endif
 };
 
 /************************************************************************
   CNodeRecycler class implementation.
   This class is used to recycle nodes. 
   By using this simple class, we cut down on the number of nodes
@@ -309,17 +309,17 @@ public:
 
   nsEntryStack    mStack; //this will hold a list of tagentries...
   PRInt32         mResidualStyleCount;
   PRInt32         mContextTopIndex;
 
   nsTokenAllocator  *mTokenAllocator;
   nsNodeAllocator   *mNodeAllocator;
 
-#ifdef  NS_DEBUG
+#ifdef  DEBUG
   enum { eMaxTags = MAX_REFLOW_DEPTH };
   eHTMLTags       mXTags[eMaxTags];
 #endif
 };
 
 /**************************************************************
   Now define the token deallocator class...
  **************************************************************/
--- a/parser/htmlparser/src/nsElementTable.cpp
+++ b/parser/htmlparser/src/nsElementTable.cpp
@@ -1369,17 +1369,17 @@ const nsHTMLElement gHTMLElements[] = {
     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
     /*autoclose starttags and endtags*/ &gBodyAutoClose,0,0,0,
     /*parent,incl,exclgroups*/          (kFlowEntity|kHeadMisc), (kInlineEntity|kSelf), kNone,  // Treat userdefined as inline element - Ref bug 56245,66772
     /*special props, prop-range*/       kPreferBody, kBodyPropRange,
     /*special parents,kids*/            &gInNoframes,&gBodyKids,
   }
 };
 
-#ifdef NS_DEBUG  
+#ifdef DEBUG  
 void CheckElementTable() {
   for (eHTMLTags t = eHTMLTag_unknown; t <= eHTMLTag_userdefined; t = eHTMLTags(t + 1)) {
     NS_ASSERTION(gHTMLElements[t].mTagID == t, "gHTMLElements entries does match tag list.");
   }
 }
 #endif
 
 /**
--- a/parser/htmlparser/src/nsElementTable.h
+++ b/parser/htmlparser/src/nsElementTable.h
@@ -55,17 +55,17 @@ static const int kFlowEntity    = (kBloc
 static const int kAllTags       = 0xffffff;
 
 
 //*********************************************************************************************
 // The following ints define the standard groups of HTML elements...
 //*********************************************************************************************
 
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 extern void CheckElementTable();
 #endif
 
 
 /**
  * We're asking the question: is aTest a member of bitset. 
  *
  * @update	gess 01/04/99
--- a/parser/htmlparser/src/nsHTMLEntities.cpp
+++ b/parser/htmlparser/src/nsHTMLEntities.cpp
@@ -201,17 +201,17 @@ nsHTMLEntities::UnicodeToEntity(PRInt32 
                (PL_DHashTableOperate(&gUnicodeToEntity, NS_INT32_TO_PTR(aUnicode), PL_DHASH_LOOKUP));
                    
   if (!entry || PL_DHASH_ENTRY_IS_FREE(entry))
   return nsnull;
     
   return entry->node->mStr;
 }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #include <stdio.h>
 
 class nsTestEntityTable {
 public:
    nsTestEntityTable() {
      PRInt32 value;
      nsHTMLEntities::AddRefTable();
 
--- a/parser/htmlparser/src/nsParser.cpp
+++ b/parser/htmlparser/src/nsParser.cpp
@@ -174,17 +174,17 @@ nsParser::nsParser()
 nsParser::~nsParser()
 {
   Cleanup();
 }
 
 void
 nsParser::Initialize(bool aConstructor)
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (!gDumpContent) {
     gDumpContent = PR_GetEnv("PARSER_DUMP_CONTENT") != nsnull;
   }
 #endif
 
   if (aConstructor) {
     // Raw pointer
     mParserContext = 0;
@@ -207,17 +207,17 @@ nsParser::Initialize(bool aConstructor)
 
   mProcessingNetworkData = false;
   mIsAboutBlank = false;
 }
 
 void
 nsParser::Cleanup()
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (gDumpContent) {
     if (mSink) {
       // Sink (HTMLContentSink at this time) supports nsIDebugDumpContent
       // interface. We can get to the content model through the sink.
       nsresult result = NS_OK;
       nsCOMPtr<nsIDebugDumpContent> trigger = do_QueryInterface(mSink, &result);
       if (NS_SUCCEEDED(result)) {
         trigger->DumpContentModel();
--- a/parser/htmlparser/src/nsParserModule.cpp
+++ b/parser/htmlparser/src/nsParserModule.cpp
@@ -15,44 +15,44 @@
 #include "nsHTMLTokenizer.h"
 //#include "nsTextTokenizer.h"
 #include "nsElementTable.h"
 #include "nsParserService.h"
 #include "nsSAXAttributes.h"
 #include "nsSAXLocator.h"
 #include "nsSAXXMLReader.h"
 
-#if defined(NS_DEBUG)
+#if defined(DEBUG)
 #include "nsExpatDriver.h"
 #endif
 
 //----------------------------------------------------------------------
 
-#if defined(NS_DEBUG)
+#if defined(DEBUG)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsExpatDriver)
 #endif
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser)
 NS_GENERIC_FACTORY_CONSTRUCTOR(CNavDTD)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserService)
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXAttributes)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXXMLReader)
 
-#if defined(NS_DEBUG)
+#if defined(DEBUG)
 NS_DEFINE_NAMED_CID(NS_EXPAT_DRIVER_CID);
 #endif
 NS_DEFINE_NAMED_CID(NS_PARSER_CID);
 NS_DEFINE_NAMED_CID(NS_CNAVDTD_CID);
 NS_DEFINE_NAMED_CID(NS_PARSERSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_SAXATTRIBUTES_CID);
 NS_DEFINE_NAMED_CID(NS_SAXXMLREADER_CID);
 
 static const mozilla::Module::CIDEntry kParserCIDs[] = {
-#if defined(NS_DEBUG)
+#if defined(DEBUG)
   { &kNS_EXPAT_DRIVER_CID, false, NULL, nsExpatDriverConstructor },
 #endif
   { &kNS_PARSER_CID, false, NULL, nsParserConstructor },
   { &kNS_CNAVDTD_CID, false, NULL, CNavDTDConstructor },
   { &kNS_PARSERSERVICE_CID, false, NULL, nsParserServiceConstructor },
   { &kNS_SAXATTRIBUTES_CID, false, NULL, nsSAXAttributesConstructor },
   { &kNS_SAXXMLREADER_CID, false, NULL, nsSAXXMLReaderConstructor },
   { NULL }
@@ -71,17 +71,17 @@ Initialize()
   nsresult rv = nsHTMLTags::AddRefTable();
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = nsHTMLEntities::AddRefTable();
   if (NS_FAILED(rv)) {
     nsHTMLTags::ReleaseTable();
     return rv;
   }
-#ifdef NS_DEBUG
+#ifdef DEBUG
   CheckElementTable();
 #endif
   CNewlineToken::AllocNewline();
 
 #ifdef DEBUG
   nsHTMLTags::TestTagTable();
 #endif
 
--- a/parser/htmlparser/src/nsToken.cpp
+++ b/parser/htmlparser/src/nsToken.cpp
@@ -32,17 +32,17 @@ CToken::CToken(PRInt32 aTag) {
   // Note that the use count starts with 1 instead of 0. This
   // is because of the assumption that any token created is in
   // use and therefore does not require an explicit addref, or
   // rather IF_HOLD. This, also, will make sure that tokens created 
   // on the stack do not accidently hit the arena recycler.
   mUseCount=1;
   NS_LOG_ADDREF(this, 1, "CToken", sizeof(*this));
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   ++TokenCount;
 #endif
 }
 
 /**
  *  Decstructor
  *  
  *  @update gess 3/25/98
--- a/rdf/base/src/nsCompositeDataSource.cpp
+++ b/rdf/base/src/nsCompositeDataSource.cpp
@@ -40,17 +40,17 @@
 #include "nsCOMArray.h"
 #include "nsArrayEnumerator.h"
 #include "nsXPIDLString.h"
 #include "rdf.h"
 #include "nsCycleCollectionParticipant.h"
 
 #include "nsEnumeratorUtils.h"
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #include "prlog.h"
 #include "prprf.h"
 #include <stdio.h>
 PRLogModuleInfo* nsRDFLog = nsnull;
 #endif
 
 static NS_DEFINE_IID(kISupportsIID,           NS_ISUPPORTS_IID);
 
--- a/rdf/tests/dsds/nsRDFDataSourceDS.cpp
+++ b/rdf/tests/dsds/nsRDFDataSourceDS.cpp
@@ -14,17 +14,17 @@
 #include "rdf.h"
 
 #include "nsIServiceManager.h"
 
 #include "nsEnumeratorUtils.h"
 
 #include "nsXPIDLString.h"
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #include <stdio.h>
 #endif
 
 /**
  * RDF vocabulary describing assertions in inner datasource
  *
  * For a particular resource, we want to provide all arcs out and
  * in that the inner datasource has.
--- a/rdf/tests/dsds/nsRDFDataSourceFactory.cpp
+++ b/rdf/tests/dsds/nsRDFDataSourceFactory.cpp
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIGenericFactory.h"
 #include "nsRDFDataSourceDS.h"
 #include "nsIComponentManager.h"
 #include "nsIServiceManager.h"
 #include "rdf.h"
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 #include <stdio.h>
 #endif
 
 static NS_DEFINE_CID(kRDFDataSourceCID, NS_RDFDATASOURCEDATASOURCE_CID);
 static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
 
 nsresult
 NSGetFactory(nsISupports* aServMgr,
--- a/view/src/nsView.cpp
+++ b/view/src/nsView.cpp
@@ -525,17 +525,17 @@ void nsView::InvalidateHierarchy(nsViewM
 void nsView::InsertChild(nsView *aChild, nsView *aSibling)
 {
   NS_PRECONDITION(nsnull != aChild, "null ptr");
 
   if (nsnull != aChild)
   {
     if (nsnull != aSibling)
     {
-#ifdef NS_DEBUG
+#ifdef DEBUG
       NS_ASSERTION(aSibling->GetParent() == this, "tried to insert view with invalid sibling");
 #endif
       //insert after sibling
       aChild->SetNextSibling(aSibling->GetNextSibling());
       aSibling->SetNextSibling(aChild);
     }
     else
     {
--- a/widget/nsGUIEvent.h
+++ b/widget/nsGUIEvent.h
@@ -992,17 +992,17 @@ public:
       case NS_CONTEXTMENU:
         button = (context == eNormal) ? eRightButton : eLeftButton;
         break;
       default:
         break;
     }
   }
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   ~nsMouseEvent() {
     NS_WARN_IF_FALSE(message != NS_CONTEXTMENU ||
                      button ==
                        ((context == eNormal) ? eRightButton : eLeftButton),
                      "Wrong button set to NS_CONTEXTMENU event?");
   }
 #endif
 
--- a/widget/windows/nsClipboard.cpp
+++ b/widget/windows/nsClipboard.cpp
@@ -925,17 +925,17 @@ NS_IMETHODIMP nsClipboard::HasDataMatchi
                                                   PRInt32 aWhichClipboard,
                                                   bool *_retval)
 {
   *_retval = false;
   if (aWhichClipboard != kGlobalClipboard || !aFlavorList)
     return NS_OK;
 
   for (PRUint32 i = 0;i < aLength; ++i) {
-#ifdef NS_DEBUG
+#ifdef DEBUG
     if (strcmp(aFlavorList[i], kTextMime) == 0)
       NS_WARNING ( "DO NOT USE THE text/plain DATA FLAVOR ANY MORE. USE text/unicode INSTEAD" );
 #endif
 
     UINT format = GetFormat(aFlavorList[i]);
     if (IsClipboardFormatAvailable(format)) {
       *_retval = true;
       break;
--- a/widget/windows/nsDragService.cpp
+++ b/widget/windows/nsDragService.cpp
@@ -446,17 +446,17 @@ nsDragService::SetDroppedLocal()
 
 //-------------------------------------------------------------------------
 NS_IMETHODIMP
 nsDragService::IsDataFlavorSupported(const char *aDataFlavor, bool *_retval)
 {
   if (!aDataFlavor || !mDataObject || !_retval)
     return NS_ERROR_FAILURE;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (strcmp(aDataFlavor, kTextMime) == 0)
     NS_WARNING("DO NOT USE THE text/plain DATA FLAVOR ANY MORE. USE text/unicode INSTEAD");
 #endif
 
   *_retval = false;
 
   FORMATETC fe;
   UINT format = 0;
--- a/widget/xpwidgets/nsPrintOptionsImpl.cpp
+++ b/widget/xpwidgets/nsPrintOptionsImpl.cpp
@@ -899,17 +899,17 @@ nsPrintOptions::GetDefaultPrinterName(PR
 
 NS_IMETHODIMP
 nsPrintOptions::InitPrintSettingsFromPrinter(const PRUnichar *aPrinterName,
                                              nsIPrintSettings *aPrintSettings)
 {
   NS_ENSURE_ARG_POINTER(aPrintSettings);
   NS_ENSURE_ARG_POINTER(aPrinterName);
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   nsXPIDLString printerName;
   aPrintSettings->GetPrinterName(getter_Copies(printerName));
   if (!printerName.Equals(aPrinterName)) {
     NS_WARNING("Printer names should match!");
   }
 #endif
 
   bool isInitialized;
--- a/xpcom/base/nsExceptionService.cpp
+++ b/xpcom/base/nsExceptionService.cpp
@@ -44,51 +44,51 @@ public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIEXCEPTIONMANAGER
 
   nsExceptionManager(nsExceptionService *svc);
   /* additional members */
   nsCOMPtr<nsIException> mCurrentException;
   nsExceptionManager *mNextThread; // not ref-counted.
   nsExceptionService *mService; // not ref-counted
-#ifdef NS_DEBUG
+#ifdef DEBUG
   static PRInt32 totalInstances;
 #endif
 
 private:
   ~nsExceptionManager();
 };
 
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 PRInt32 nsExceptionManager::totalInstances = 0;
 #endif
 
 // Note this object is single threaded - the service itself ensures
 // one per thread.
 // An exception if the destructor, which may be called on
 // the thread shutting down xpcom
 NS_IMPL_THREADSAFE_ISUPPORTS1(nsExceptionManager, nsIExceptionManager)
 
 nsExceptionManager::nsExceptionManager(nsExceptionService *svc) :
   mNextThread(nsnull),
   mService(svc)
 {
   /* member initializers and constructor code */
-#ifdef NS_DEBUG
+#ifdef DEBUG
   PR_ATOMIC_INCREMENT(&totalInstances);
 #endif
 }
 
 nsExceptionManager::~nsExceptionManager()
 {
   /* destructor code */
-#ifdef NS_DEBUG
+#ifdef DEBUG
   PR_ATOMIC_DECREMENT(&totalInstances);
-#endif // NS_DEBUG
+#endif // DEBUG
 }
 
 /* void setCurrentException (in nsIException error); */
 NS_IMETHODIMP nsExceptionManager::SetCurrentException(nsIException *error)
 {
     CHECK_MANAGER_USE_OK();
     mCurrentException = error;
     return NS_OK;
@@ -112,29 +112,29 @@ NS_IMETHODIMP nsExceptionManager::GetExc
 }
 
 /* The Exception Service */
 
 PRUintn nsExceptionService::tlsIndex = BAD_TLS_INDEX;
 Mutex *nsExceptionService::sLock = nsnull;
 nsExceptionManager *nsExceptionService::firstThread = nsnull;
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
 PRInt32 nsExceptionService::totalInstances = 0;
 #endif
 
 NS_IMPL_THREADSAFE_ISUPPORTS3(nsExceptionService,
                               nsIExceptionService,
                               nsIExceptionManager,
                               nsIObserver)
 
 nsExceptionService::nsExceptionService()
   : mProviders(4, true) /* small, thread-safe hashtable */
 {
-#ifdef NS_DEBUG
+#ifdef DEBUG
   if (PR_ATOMIC_INCREMENT(&totalInstances)!=1) {
     NS_ERROR("The nsExceptionService is a singleton!");
   }
 #endif
   /* member initializers and constructor code */
   if (tlsIndex == BAD_TLS_INDEX) {
     PRStatus status;
     status = PR_NewThreadPrivateIndex( &tlsIndex, ThreadDestruct );
@@ -149,17 +149,17 @@ nsExceptionService::nsExceptionService()
   if (observerService)
     observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
 }
 
 nsExceptionService::~nsExceptionService()
 {
   Shutdown();
   /* destructor code */
-#ifdef NS_DEBUG
+#ifdef DEBUG
   PR_ATOMIC_DECREMENT(&totalInstances);
 #endif
 }
 
 /*static*/
 void nsExceptionService::ThreadDestruct( void *data )
 {
   if (!sLock) {
--- a/xpcom/base/nsExceptionService.h
+++ b/xpcom/base/nsExceptionService.h
@@ -46,17 +46,17 @@ public:
   nsSupportsHashtable mProviders;
 
   /* single lock protects both providers hashtable
      and thread list */
   static mozilla::Mutex* sLock;
 
   static PRUintn tlsIndex;
   static void ThreadDestruct( void *data );
-#ifdef NS_DEBUG
+#ifdef DEBUG
   static PRInt32 totalInstances;
 #endif
 
 private:
   ~nsExceptionService();
 };
 
 
--- a/xpcom/base/nsISupportsObsolete.h
+++ b/xpcom/base/nsISupportsObsolete.h
@@ -187,17 +187,17 @@ NS_IMPL_SETTER_STR(_class::Set##_postfix
  * class in question implements nsISupports and its own interface and
  * nothing else. Second, the implementation of the class's primary
  * inheritance chain leads to its own interface.
  *
  * @param _class The name of the class implementing the method
  * @param _classiiddef The name of the #define symbol that defines the IID
  * for the class (e.g. NS_ISUPPORTS_IID)
  */
-#if defined(NS_DEBUG)
+#if defined(DEBUG)
 #define NS_VERIFY_THREADSAFE_INTERFACE(_iface)                                \
  if (NULL != (_iface)) {                                                      \
    nsISupports* tmp;                                                          \
    static NS_DEFINE_IID(kIsThreadsafeIID, NS_ISTHREADSAFE_IID);               \
    NS_PRECONDITION((NS_OK == _iface->QueryInterface(kIsThreadsafeIID,         \
                                                     (void**)&tmp)),           \
                    "Interface is not threadsafe");                            \
  }
--- a/xpcom/glue/nsCOMPtr.h
+++ b/xpcom/glue/nsCOMPtr.h
@@ -53,17 +53,17 @@
     // Also under VC++, at the highest warning level, we are overwhelmed  with warnings
     //  about (unused) inline functions being removed.  This is to be expected with
     //  templates, so we disable the warning.
   #pragma warning( disable: 4514 )
 #endif
 
 #define NSCAP_FEATURE_USE_BASE
 
-#ifdef NS_DEBUG
+#ifdef DEBUG
   #define NSCAP_FEATURE_TEST_DONTQUERY_CASES
   #undef NSCAP_FEATURE_USE_BASE
 //#define NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
 #endif
 
   /*
     |...TEST_DONTQUERY_CASES| and |...DEBUG_PTR_TYPES| introduce some code that is 
     problematic on a select few of our platforms, e.g., QNX.  Therefore, I'm providing
--- a/xpcom/glue/nsDebug.h
+++ b/xpcom/glue/nsDebug.h
@@ -12,17 +12,16 @@
 
 #ifndef nsError_h__
 #include "nsError.h"
 #endif 
 
 #include "nsXPCOM.h"
 
 #ifdef DEBUG
-#define NS_DEBUG
 #include "prprf.h"
 #endif
 
 #ifdef DEBUG
 
 /**
  * Abort the execution of the program if the expression evaluates to
  * false.
@@ -127,17 +126,17 @@
   NS_DebugBreak(NS_DEBUG_ABORT, nsnull, nsnull, __FILE__, __LINE__)
 
 /**
  * Cause a break
  */
 #define NS_BREAK()                                            \
   NS_DebugBreak(NS_DEBUG_BREAK, nsnull, nsnull, __FILE__, __LINE__)
 
-#else /* NS_DEBUG */
+#else /* DEBUG */
 
 /**
  * The non-debug version of these macros do not evaluate the
  * expression or the message arguments to the macro.
  */
 #define NS_ABORT_IF_FALSE(_expr, _msg) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
 #define NS_WARN_IF_FALSE(_expr, _msg)  PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
 #define NS_PRECONDITION(expr, str)     PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
@@ -145,17 +144,17 @@
 #define NS_POSTCONDITION(expr, str)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
 #define NS_NOTYETIMPLEMENTED(str)      PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
 #define NS_NOTREACHED(str)             PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
 #define NS_ERROR(str)                  PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
 #define NS_WARNING(str)                PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
 #define NS_ABORT()                     PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
 #define NS_BREAK()                     PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
 
-#endif /* ! NS_DEBUG */
+#endif /* ! DEBUG */
 
 /******************************************************************************
 ** Macros for static assertions.  These are used by the sixgill tool.
 ** When the tool is not running these macros are no-ops.
 ******************************************************************************/
 
 /* Avoid name collision if included with other headers defining annotations. */
 #ifndef HAVE_STATIC_ANNOTATIONS
@@ -224,31 +223,31 @@
 #define NS_PRECONDITION(expr, str)   STATIC_ASSERT_RUNTIME(expr)
 #define NS_ASSERTION(expr, str)      STATIC_ASSERT_RUNTIME(expr)
 #define NS_POSTCONDITION(expr, str)  STATIC_ASSERT_RUNTIME(expr)
 
 #endif /* XGILL_PLUGIN */
 
 /******************************************************************************
 ** Macros for terminating execution when an unrecoverable condition is
-** reached.  These need to be compiled regardless of the NS_DEBUG flag. 
+** reached.  These need to be compiled regardless of the DEBUG flag. 
 ******************************************************************************/
 
 /**
  * Terminate execution <i>immediately</i>, and if possible on the current
  * platform, in such a way that execution can't be continued by other
  * code (e.g., by intercepting a signal).
  */
 #define NS_RUNTIMEABORT(msg)                                    \
   NS_DebugBreak(NS_DEBUG_ABORT, msg, nsnull, __FILE__, __LINE__)
 
 
 /* Macros for checking the trueness of an expression passed in within an 
  * interface implementation.  These need to be compiled regardless of the */
-/* NS_DEBUG flag
+/* DEBUG flag
 ******************************************************************************/
 
 #define NS_ENSURE_TRUE(x, ret)                                \
   PR_BEGIN_MACRO                                              \
     if (NS_UNLIKELY(!(x))) {                                  \
        NS_WARNING("NS_ENSURE_TRUE(" #x ") failed");           \
        return ret;                                            \
     }                                                         \
--- a/xpcom/glue/nsHashKeys.h
+++ b/xpcom/glue/nsHashKeys.h
@@ -482,17 +482,17 @@ public:
             return eq;
         }
         return false;
     }
 
     static const nsIHashable* KeyToPointer(nsIHashable* aKey) { return aKey; }
     static PLDHashNumber HashKey(const nsIHashable* aKey) {
         PRUint32 code = 8888; // magic number if GetHashCode fails :-(
-#ifdef NS_DEBUG
+#ifdef DEBUG
         nsresult rv =
 #endif
         const_cast<nsIHashable*>(aKey)->GetHashCode(&code);
         NS_ASSERTION(NS_SUCCEEDED(rv), "GetHashCode should not throw!");
         return code;
     }
     
     enum { ALLOW_MEMMOVE = true };
--- a/xpcom/glue/nsISupportsImpl.h
+++ b/xpcom/glue/nsISupportsImpl.h
@@ -28,17 +28,17 @@
 #include "nsDebug.h"
 #include "nsTraceRefcnt.h"
 #include "nsCycleCollector.h"
 #include "nsCycleCollectorUtils.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 // Macros to help detect thread-safety:
 
-#if defined(NS_DEBUG) && !defined(XPCOM_GLUE_AVOID_NSPR)
+#if defined(DEBUG) && !defined(XPCOM_GLUE_AVOID_NSPR)
 
 class nsAutoOwningThread {
 public:
     nsAutoOwningThread() { mThread = PR_GetCurrentThread(); }
     void *GetThread() const { return mThread; }
 
 private:
     void *mThread;
@@ -53,23 +53,23 @@ private:
       NS_ERROR("Changing refcount of " #_class " object during Traverse is " \
                "not permitted!"); \
     } \
     else { \
       NS_ASSERT_OWNINGTHREAD(_class); \
     } \
   } while (0)
 
-#else // !NS_DEBUG
+#else // !DEBUG
 
 #define NS_DECL_OWNINGTHREAD            /* nothing */
 #define NS_ASSERT_OWNINGTHREAD(_class)  ((void)0)
 #define NS_ASSERT_OWNINGTHREAD_AND_NOT_CCTHREAD(_class)  ((void)0)
 
-#endif // NS_DEBUG
+#endif // DEBUG
 
 #define NS_CCAR_REFCNT_BIT 1
 #define NS_CCAR_REFCNT_TO_TAGGED(rc_) \
   NS_INT32_TO_PTR((rc_ << 1) | NS_CCAR_REFCNT_BIT)
 #define NS_CCAR_PURPLE_ENTRY_TO_TAGGED(pe_) \
   static_cast<void*>(pe_)
 #define NS_CCAR_TAGGED_TO_REFCNT(tagged_) \
   nsrefcnt(NS_PTR_TO_INT32(tagged_) >> 1)
--- a/xpcom/string/src/nsStringObsolete.cpp
+++ b/xpcom/string/src/nsStringObsolete.cpp
@@ -326,17 +326,17 @@ Compare2To1(const PRUnichar* aStr1,const
   if (aStr1 && aStr2) {
     if (aCount != 0) {
       do {
 
         PRUnichar c1 = *s1++;
         PRUnichar c2 = PRUnichar((unsigned char)*s2++);
         
         if (c1 != c2) {
-#ifdef NS_DEBUG
+#ifdef DEBUG
           // we won't warn on c1>=128 (the 2-byte value) because often
           // it is just fine to compare an constant, ascii value (i.e. "body")
           // against some non-ascii value (i.e. a unicode string that
           // was downloaded from a web page)
           if (aIgnoreCase && c2>=128)
             NS_WARNING("got a non-ASCII string, but we can't do an accurate case conversion!");
 #endif