Bug 794757 - add build config option to enable logging on release build, r=surkov
authorTrevor Saunders <trev.saunders@gmail.com>
Thu, 04 Oct 2012 18:57:09 +0900
changeset 116102 38b9f2f85de0a615e784a99612323e478a25d708
parent 116101 3ce909bed24a824050f69bc0649c71309fae1767
child 116103 a055a290f2662d4b1e48a65c763b79e02af5353b
push id239
push userakeybl@mozilla.com
push dateThu, 03 Jan 2013 21:54:43 +0000
treeherdermozilla-release@3a7b66445659 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs794757
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 794757 - add build config option to enable logging on release build, r=surkov
accessible/src/Makefile.in
accessible/src/atk/Makefile.in
accessible/src/base/FocusManager.cpp
accessible/src/base/Makefile.in
accessible/src/base/NotificationController.cpp
accessible/src/base/NotificationController.h
accessible/src/base/nsAccDocManager.cpp
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsCaretAccessible.cpp
accessible/src/generic/DocAccessible.cpp
accessible/src/generic/DocAccessible.h
accessible/src/generic/Makefile.in
accessible/src/generic/OuterDocAccessible.cpp
accessible/src/generic/RootAccessible.cpp
accessible/src/html/Makefile.in
accessible/src/mac/Makefile.in
accessible/src/msaa/AccessibleWrap.cpp
accessible/src/msaa/Makefile.in
accessible/src/other/Makefile.in
accessible/src/windows/Makefile.in
accessible/src/windows/uia/Makefile.in
accessible/src/xforms/Makefile.in
accessible/src/xpcom/Makefile.in
accessible/src/xul/Makefile.in
--- a/accessible/src/Makefile.in
+++ b/accessible/src/Makefile.in
@@ -5,16 +5,25 @@
 
 DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
+A11Y_LOG = 0
+ifdef MOZ_DEBUG
+  A11Y_LOG = 1
+endif
+ifeq (,$(filter aurora beta release esr,$(MOZ_UPDATE_CHANNEL)))
+  A11Y_LOG = 1
+endif
+export A11Y_LOG
+
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 PLATFORM_DIR = atk
 else
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 PLATFORM_DIR = \
   msaa \
   windows \
   $(null)
--- a/accessible/src/atk/Makefile.in
+++ b/accessible/src/atk/Makefile.in
@@ -63,8 +63,12 @@ LOCAL_INCLUDES += \
   -I$(srcdir) \
   -I$(srcdir)/../base \
   -I$(srcdir)/../generic \
   -I$(srcdir)/../html \
   -I$(srcdir)/../xpcom \
   -I$(srcdir)/../xul \
   -I$(topsrcdir)/other-licenses/atk-1.0 \
   $(NULL)
+
+ifneq ($(A11Y_LOG),0)
+  DEFINES += -DA11Y_LOG
+endif
--- a/accessible/src/base/FocusManager.cpp
+++ b/accessible/src/base/FocusManager.cpp
@@ -109,17 +109,17 @@ FocusManager::IsInOrContainsFocus(const 
   }
 
   return eNone;
 }
 
 void
 FocusManager::NotifyOfDOMFocus(nsISupports* aTarget)
 {
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eFocus))
     logging::FocusNotificationTarget("DOM focus", "Target", aTarget);
 #endif
 
   mActiveItem = nullptr;
 
   nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTarget));
   if (targetNode) {
@@ -137,17 +137,17 @@ FocusManager::NotifyOfDOMFocus(nsISuppor
         (this, &FocusManager::ProcessDOMFocus, targetNode);
     }
   }
 }
 
 void
 FocusManager::NotifyOfDOMBlur(nsISupports* aTarget)
 {
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eFocus))
     logging::FocusNotificationTarget("DOM blur", "Target", aTarget);
 #endif
 
   mActiveItem = nullptr;
 
   // If DOM document stays focused then fire accessible focus event to process
   // the case when no element within this DOM document will be focused.
@@ -161,30 +161,30 @@ FocusManager::NotifyOfDOMBlur(nsISupport
         (this, &FocusManager::ProcessDOMFocus, DOMDoc);
     }
   }
 }
 
 void
 FocusManager::ActiveItemChanged(Accessible* aItem, bool aCheckIfActive)
 {
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eFocus))
     logging::FocusNotificationTarget("active item changed", "Item", aItem);
 #endif
 
   // Nothing changed, happens for XUL trees and HTML selects.
   if (aItem && aItem == mActiveItem)
     return;
 
   mActiveItem = nullptr;
 
   if (aItem && aCheckIfActive) {
     Accessible* widget = aItem->ContainerWidget();
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eFocus))
       logging::ActiveWidget(widget);
 #endif
     if (!widget || !widget->IsActiveWidget() || !widget->AreItemsOperable())
       return;
   }
   mActiveItem = aItem;
 
@@ -216,27 +216,27 @@ FocusManager::DispatchFocusEvent(DocAcce
 {
   NS_PRECONDITION(aDocument, "No document for focused accessible!");
   if (aDocument) {
     nsRefPtr<AccEvent> event =
       new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, aTarget,
                    eAutoDetect, AccEvent::eCoalesceOfSameType);
     aDocument->FireDelayedAccessibleEvent(event);
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eFocus))
       logging::FocusDispatched(aTarget);
 #endif
   }
 }
 
 void
 FocusManager::ProcessDOMFocus(nsINode* aTarget)
 {
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eFocus))
     logging::FocusNotificationTarget("process DOM focus", "Target", aTarget);
 #endif
 
   DocAccessible* document =
     GetAccService()->GetDocAccessible(aTarget->OwnerDoc());
 
   Accessible* target = document->GetAccessibleOrContainer(aTarget);
@@ -317,17 +317,17 @@ FocusManager::ProcessFocusEvent(AccEvent
     nsRefPtr<AccEvent> menuEndEvent =
       new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mActiveARIAMenubar,
                    fromUserInputFlag);
     nsEventShell::FireEvent(menuEndEvent);
 
     mActiveARIAMenubar = nullptr;
   }
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eFocus))
     logging::FocusNotificationTarget("fire focus event", "Target", target);
 #endif
 
   nsRefPtr<AccEvent> focusEvent =
     new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, target, fromUserInputFlag);
   nsEventShell::FireEvent(focusEvent);
 
--- a/accessible/src/base/Makefile.in
+++ b/accessible/src/base/Makefile.in
@@ -35,17 +35,17 @@ CPPSRCS = \
   nsCaretAccessible.cpp \
   nsTextEquivUtils.cpp \
   RoleAsserts.cpp \
   StyleInfo.cpp \
   TextAttrs.cpp \
   TextUpdater.cpp \
   $(NULL)
 
-ifdef MOZ_DEBUG
+ifneq ($(A11Y_LOG),0)
 CPPSRCS += \
   Logging.cpp \
   $(NULL)
 endif
 
 EXPORTS = \
   a11yGeneric.h \
   AccEvent.h \
@@ -101,8 +101,12 @@ LOCAL_INCLUDES += \
   $(NULL)
 else
 LOCAL_INCLUDES += \
   -I$(srcdir)/../other \
   $(NULL)
 endif
 endif
 endif
+
+ifneq ($(A11Y_LOG),0)
+  DEFINES += -DA11Y_LOG
+endif
--- a/accessible/src/base/NotificationController.cpp
+++ b/accessible/src/base/NotificationController.cpp
@@ -11,17 +11,17 @@
 #include "nsCoreUtils.h"
 #include "DocAccessible.h"
 #include "nsEventShell.h"
 #include "FocusManager.h"
 #include "Role.h"
 #include "TextLeafAccessible.h"
 #include "TextUpdater.h"
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
 #include "Logging.h"
 #endif
 
 #include "mozilla/dom/Element.h"
 #include "mozilla/Telemetry.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
@@ -193,17 +193,17 @@ NotificationController::WillRefresh(mozi
   if (!mDocument->HasLoadState(DocAccessible::eTreeConstructed)) {
     // If document is not bound to parent at this point then the document is not
     // ready yet (process notifications later).
     if (!mDocument->IsBoundToParent()) {
       mObservingState = eRefreshObserving;
       return;
     }
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eTree)) {
       logging::MsgBegin("TREE", "initial tree created");
       logging::Address("document", mDocument);
       logging::MsgEnd();
     }
 #endif
 
     mDocument->DoInitialUpdate();
@@ -298,17 +298,17 @@ NotificationController::WillRefresh(mozi
   // process it synchronously.
   mObservingState = eRefreshObserving;
 
   // Process only currently queued events.
   nsTArray<nsRefPtr<AccEvent> > events;
   events.SwapElements(mEvents);
 
   uint32_t eventCount = events.Length();
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (eventCount > 0 && logging::IsEnabled(logging::eEvents)) {
     logging::MsgBegin("EVENTS", "events processing");
     logging::Address("document", mDocument);
     logging::MsgEnd();
   }
 #endif
 
   for (uint32_t idx = 0; idx < eventCount; idx++) {
@@ -723,31 +723,31 @@ NotificationController::TextEnumerator(n
     containerNode->AsElement() : nullptr;
 
   nsAutoString text;
   textFrame->GetRenderedText(&text);
 
   // Remove text accessible if rendered text is empty.
   if (textAcc) {
     if (text.IsEmpty()) {
-#ifdef DEBUG
+#ifdef A11Y_LOG
       if (logging::IsEnabled(logging::eTree | logging::eText)) {
         logging::MsgBegin("TREE", "text node lost its content");
         logging::Node("container", containerElm);
         logging::Node("content", textNode);
         logging::MsgEnd();
       }
 #endif
 
       document->ContentRemoved(containerElm, textNode);
       return PL_DHASH_NEXT;
     }
 
     // Update text of the accessible and fire text change events.
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eText)) {
       logging::MsgBegin("TEXT", "text may be changed");
       logging::Node("container", containerElm);
       logging::Node("content", textNode);
       logging::MsgEntry("old text '%s'",
                         NS_ConvertUTF16toUTF8(textAcc->AsTextLeaf()->Text()).get());
       logging::MsgEntry("new text: '%s'",
                         NS_ConvertUTF16toUTF8(text).get());
@@ -756,17 +756,17 @@ NotificationController::TextEnumerator(n
 #endif
 
     TextUpdater::Run(document, textAcc->AsTextLeaf(), text);
     return PL_DHASH_NEXT;
   }
 
   // Append an accessible if rendered text is not empty.
   if (!text.IsEmpty()) {
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eTree | logging::eText)) {
       logging::MsgBegin("TREE", "text node gains new content");
       logging::Node("container", containerElm);
       logging::Node("content", textNode);
       logging::MsgEnd();
     }
 #endif
 
--- a/accessible/src/base/NotificationController.h
+++ b/accessible/src/base/NotificationController.h
@@ -5,17 +5,17 @@
 
 #ifndef NotificationController_h_
 #define NotificationController_h_
 
 #include "AccEvent.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsRefreshDriver.h"
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
 #include "Logging.h"
 #endif
 
 class Accessible;
 class DocAccessible;
 class nsIContent;
 
 /**
@@ -131,17 +131,17 @@ public:
    *        the notification is processed.
    */
   template<class Class, class Arg>
   inline void HandleNotification(Class* aInstance,
                                  typename TNotification<Class, Arg>::Callback aMethod,
                                  Arg* aArg)
   {
     if (!IsUpdatePending()) {
-#ifdef DEBUG
+#ifdef A11Y_LOG
       if (mozilla::a11y::logging::IsEnabled(mozilla::a11y::logging::eNotifications))
         mozilla::a11y::logging::Text("sync notification processing");
 #endif
       (aInstance->*aMethod)(aArg);
       return;
     }
 
     nsRefPtr<Notification> notification =
--- a/accessible/src/base/nsAccDocManager.cpp
+++ b/accessible/src/base/nsAccDocManager.cpp
@@ -8,17 +8,17 @@
 #include "ApplicationAccessible.h"
 #include "DocAccessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsARIAMap.h"
 #include "RootAccessibleWrap.h"
 #include "States.h"
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
 #include "Logging.h"
 #endif
 
 #include "nsCURILoader.h"
 #include "nsDocShellLoadTypes.h"
 #include "nsIChannel.h"
 #include "nsIContentViewer.h"
 #include "nsIDOMDocument.h"
@@ -140,17 +140,17 @@ nsAccDocManager::OnStateChange(nsIWebPro
   nsCOMPtr<nsIDOMDocument> DOMDocument;
   DOMWindow->GetDocument(getter_AddRefs(DOMDocument));
   NS_ENSURE_STATE(DOMDocument);
 
   nsCOMPtr<nsIDocument> document(do_QueryInterface(DOMDocument));
 
   // Document was loaded.
   if (aStateFlags & STATE_STOP) {
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eDocLoad))
       logging::DocLoad("document loaded", aWebProgress, aRequest, aStateFlags);
 #endif
 
     // Figure out an event type to notify the document has been loaded.
     uint32_t eventType = nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED;
 
     // Some XUL documents get start state and then stop state with failure
@@ -169,17 +169,17 @@ nsAccDocManager::OnStateChange(nsIWebPro
         eventType = 0;
     }
 
     HandleDOMDocumentLoad(document, eventType);
     return NS_OK;
   }
 
   // Document loading was started.
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocLoad))
     logging::DocLoad("start document loading", aWebProgress, aRequest, aStateFlags);
 #endif
 
   DocAccessible* docAcc = mDocAccessibleCache.GetWeak(document);
   if (!docAcc)
     return NS_OK;
 
@@ -258,17 +258,17 @@ nsAccDocManager::HandleEvent(nsIDOMEvent
     return NS_OK;
 
   if (type.EqualsLiteral("pagehide")) {
     // 'pagehide' event is registered on every DOM document we create an
     // accessible for, process the event for the target. This document
     // accessible and all its sub document accessible are shutdown as result of
     // processing.
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eDocDestroy))
       logging::DocDestroy("received 'pagehide' event", document);
 #endif
 
     // Ignore 'pagehide' on temporary documents since we ignore them entirely in
     // accessibility.
     if (document->IsInitialDocument())
       return NS_OK;
@@ -284,17 +284,17 @@ nsAccDocManager::HandleEvent(nsIDOMEvent
 
     return NS_OK;
   }
 
   // XXX: handle error pages loading separately since they get neither
   // webprogress notifications nor 'pageshow' event.
   if (type.EqualsLiteral("DOMContentLoaded") &&
       nsCoreUtils::IsErrorPage(document)) {
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eDocLoad))
       logging::DocLoad("handled 'DOMContentLoaded' event", document);
 #endif
 
     HandleDOMDocumentLoad(document,
                           nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE);
   }
 
@@ -325,25 +325,25 @@ nsAccDocManager::AddListeners(nsIDocumen
                               bool aAddDOMContentLoadedListener)
 {
   nsPIDOMWindow *window = aDocument->GetWindow();
   nsIDOMEventTarget *target = window->GetChromeEventHandler();
   nsEventListenerManager* elm = target->GetListenerManager(true);
   elm->AddEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
                               NS_EVENT_FLAG_CAPTURE);
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocCreate))
     logging::Text("added 'pagehide' listener");
 #endif
 
   if (aAddDOMContentLoadedListener) {
     elm->AddEventListenerByType(this, NS_LITERAL_STRING("DOMContentLoaded"),
                                 NS_EVENT_FLAG_CAPTURE);
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eDocCreate))
       logging::Text("added 'DOMContentLoaded' listener");
 #endif
   }
 }
 
 DocAccessible*
 nsAccDocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
@@ -406,17 +406,17 @@ nsAccDocManager::CreateDocOrRootAccessib
       new AccEvent(nsIAccessibleEvent::EVENT_REORDER, ApplicationAcc(),
                    eAutoDetect, AccEvent::eCoalesceFromSameSubtree);
     docAcc->FireDelayedAccessibleEvent(reorderEvent);
 
   } else {
     parentDocAcc->BindChildDocument(docAcc);
   }
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocCreate)) {
     logging::DocCreate("document creation finished", aDocument);
     logging::Stack();
   }
 #endif
 
   AddListeners(aDocument, isRootDoc);
   return docAcc;
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -34,17 +34,17 @@
 #include "RootAccessibleWrap.h"
 #include "States.h"
 #include "Statistics.h"
 #ifdef XP_WIN
 #include "nsHTMLWin32ObjectAccessible.h"
 #endif
 #include "TextLeafAccessibleWrap.h"
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
 #include "Logging.h"
 #endif
 
 #ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #endif
 
 #include "nsIDOMDocument.h"
@@ -465,17 +465,17 @@ nsAccessibilityService::CreateHTMLCaptio
 }
 
 void
 nsAccessibilityService::ContentRangeInserted(nsIPresShell* aPresShell,
                                              nsIContent* aContainer,
                                              nsIContent* aStartChild,
                                              nsIContent* aEndChild)
 {
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eTree)) {
     logging::MsgBegin("TREE", "content inserted");
     logging::Node("container", aContainer);
     for (nsIContent* child = aStartChild; child != aEndChild;
          child = child->GetNextSibling()) {
       logging::Node("content", child);
     }
     logging::MsgEnd();
@@ -487,17 +487,17 @@ nsAccessibilityService::ContentRangeInse
     docAccessible->ContentInserted(aContainer, aStartChild, aEndChild);
 }
 
 void
 nsAccessibilityService::ContentRemoved(nsIPresShell* aPresShell,
                                        nsIContent* aContainer,
                                        nsIContent* aChild)
 {
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eTree)) {
     logging::MsgBegin("TREE", "content removed");
     logging::Node("container", aContainer);
     logging::Node("content", aChild);
     logging::MsgEnd();
   }
 #endif
 
@@ -838,17 +838,17 @@ nsAccessibilityService::CreateAccessible
   NS_ADDREF(*aPivot = pivot);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccessibilityService::SetLogging(const nsACString& aModules)
 {
-#ifdef DEBUG
+#ifdef A11Y_LOG
   logging::Enable(PromiseFlatCString(aModules));
 #endif
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessibilityService public
 
@@ -1176,17 +1176,17 @@ nsAccessibilityService::Init()
   if (!observerService)
     return false;
 
   observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
 
   static const PRUnichar kInitIndicator[] = { '1', 0 };
   observerService->NotifyObservers(nullptr, "a11y-init-or-shutdown", kInitIndicator);
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
   logging::CheckEnv();
 #endif
 
   // Create and initialize the application accessible.
   ApplicationAccessibleWrap::PreCreate();
   gApplicationAccessible = new ApplicationAccessibleWrap();
   NS_ADDREF(gApplicationAccessible); // will release in Shutdown()
   gApplicationAccessible->Init();
--- a/accessible/src/base/nsCaretAccessible.cpp
+++ b/accessible/src/base/nsCaretAccessible.cpp
@@ -90,20 +90,18 @@ nsCaretAccessible::SetControlSelectionLi
   mLastTextAccessible = nullptr;
 
   // When focus moves such that the caret is part of a new frame selection
   // this removes the old selection listener and attaches a new one for
   // the current focus.
 
   nsCOMPtr<nsISelectionController> controller =
     GetSelectionControllerForNode(mCurrentControl);
-#ifdef DEBUG
   NS_ASSERTION(controller || aCurrentNode->IsNodeOfType(nsINode::eDOCUMENT),
                "No selection controller for non document node!");
-#endif
   if (!controller)
     return NS_OK;
 
   // Register 'this' as selection listener for the normal selection.
   nsCOMPtr<nsISelection> normalSel;
   controller->GetSelection(nsISelectionController::SELECTION_NORMAL,
                            getter_AddRefs(normalSel));
   nsCOMPtr<nsISelectionPrivate> selPrivate(do_QueryInterface(normalSel));
@@ -175,17 +173,17 @@ nsCaretAccessible::NotifySelectionChange
                                           int16_t aReason)
 {
   NS_ENSURE_ARG(aDOMDocument);
   NS_ENSURE_STATE(mRootAccessible);
 
   nsCOMPtr<nsIDocument> documentNode(do_QueryInterface(aDOMDocument));
   DocAccessible* document = GetAccService()->GetDocAccessible(documentNode);
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eSelection))
     logging::SelChange(aSelection, document);
 #endif
 
   // Don't fire events until document is loaded.
   if (document && document->IsContentLoaded()) {
     // The caret accessible has the same lifetime as the root accessible, and
     // this outlives all its descendant document accessibles, so that we are
--- a/accessible/src/generic/DocAccessible.cpp
+++ b/accessible/src/generic/DocAccessible.cpp
@@ -40,17 +40,17 @@
 #include "nsIViewManager.h"
 #include "nsIScrollableFrame.h"
 #include "nsUnicharUtils.h"
 #include "nsIURI.h"
 #include "nsIWebNavigation.h"
 #include "nsFocusManager.h"
 #include "mozilla/dom/Element.h"
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
 #include "Logging.h"
 #endif
 
 #ifdef MOZ_XUL
 #include "nsIXULDocument.h"
 #endif
 
 using namespace mozilla;
@@ -602,17 +602,17 @@ DocAccessible::GetAccessible(nsINode* aN
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessNode
 
 void
 DocAccessible::Init()
 {
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocCreate))
     logging::DocCreate("document initialize", mDocument, this);
 #endif
 
   // Initialize notification controller.
   mNotificationController = new NotificationController(this, mPresShell);
 
   // Mark the document accessible as loaded if its DOM document was loaded at
@@ -625,17 +625,17 @@ DocAccessible::Init()
 }
 
 void
 DocAccessible::Shutdown()
 {
   if (!mPresShell) // already shutdown
     return;
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocDestroy))
     logging::DocDestroy("document shutdown", mDocument, this);
 #endif
 
   mPresShell->SetAccDocument(nullptr);
 
   if (mNotificationController) {
     mNotificationController->Shutdown();
@@ -851,17 +851,17 @@ void
 DocAccessible::AddScrollListener()
 {
   if (!mPresShell)
     return;
 
   nsIScrollableFrame* sf = mPresShell->GetRootScrollFrameAsScrollableExternal();
   if (sf) {
     sf->AddScrollPositionListener(this);
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eDocCreate))
       logging::Text("add scroll listener");
 #endif
   }
 }
 
 // DocAccessible protected member
 void
@@ -1225,17 +1225,17 @@ DocAccessible::ARIAActiveDescendantChang
   if (widget && widget->IsActiveWidget()) {
     nsAutoString id;
     if (aElm->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant, id)) {
       dom::Element* activeDescendantElm = aElm->OwnerDoc()->GetElementById(id);
       if (activeDescendantElm) {
         Accessible* activeDescendant = GetAccessible(activeDescendantElm);
         if (activeDescendant) {
           FocusMgr()->ActiveItemChanged(activeDescendant, false);
-#ifdef DEBUG
+#ifdef A11Y_LOG
           if (logging::IsEnabled(logging::eFocus))
             logging::ActiveItemChangeCausedBy("ARIA activedescedant changed",
                                               activeDescendant);
 #endif
         }
       }
     }
   }
@@ -1313,17 +1313,17 @@ void
 DocAccessible::ParentChainChanged(nsIContent* aContent)
 {
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
 nsresult
 DocAccessible::HandleAccEvent(AccEvent* aEvent)
 {
   if (logging::IsEnabled(logging::eDocLoad))
     logging::DocLoadEventHandled(aEvent);
 
   return HyperTextAccessible::HandleAccEvent(aEvent);
 }
@@ -1411,17 +1411,17 @@ DocAccessible::UnbindFromDocument(Access
 {
   NS_ASSERTION(mAccessibleCache.GetWeak(aAccessible->UniqueID()),
                "Unbinding the unbound accessible!");
 
   // Fire focus event on accessible having DOM focus if active item was removed
   // from the tree.
   if (FocusMgr()->IsActiveItem(aAccessible)) {
     FocusMgr()->ActiveItemChanged(nullptr);
-#ifdef DEBUG
+#ifdef A11Y_LOG
           if (logging::IsEnabled(logging::eFocus))
             logging::ActiveItemChangeCausedBy("tree shutdown", aAccessible);
 #endif
   }
 
   // Remove an accessible from node-to-accessible map if it exists there.
   if (aAccessible->IsPrimaryForNode() &&
       mNodeToAccessibleMap.Get(aAccessible->GetNode()) == aAccessible)
@@ -1759,17 +1759,17 @@ DocAccessible::FireDelayedAccessibleEven
 }
 
 // DocAccessible public member
 nsresult
 DocAccessible::FireDelayedAccessibleEvent(AccEvent* aEvent)
 {
   NS_ENSURE_ARG(aEvent);
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocLoad))
     logging::DocLoadEventFired(aEvent);
 #endif
 
   if (mNotificationController)
     mNotificationController->QueueEvent(aEvent);
 
   return NS_OK;
@@ -1850,17 +1850,17 @@ DocAccessible::ProcessContentInserted(Ac
 void
 DocAccessible::UpdateTree(Accessible* aContainer, nsIContent* aChildNode,
                           bool aIsInsert)
 {
   uint32_t updateFlags = eNoAccessible;
 
   // If child node is not accessible then look for its accessible children.
   Accessible* child = GetAccessible(aChildNode);
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eTree)) {
     logging::MsgBegin("TREE", "process content %s",
                       (aIsInsert ? "insertion" : "removal"));
     logging::Node("container", aContainer->GetNode());
     logging::Node("child", aChildNode);
     if (child)
       logging::Address("child", child);
     else
--- a/accessible/src/generic/DocAccessible.h
+++ b/accessible/src/generic/DocAccessible.h
@@ -92,17 +92,17 @@ public:
   virtual mozilla::a11y::role NativeRole();
   virtual uint64_t NativeState();
   virtual uint64_t NativeInteractiveState() const;
   virtual bool NativelyUnavailable() const;
   virtual void ApplyARIAState(uint64_t* aState) const;
 
   virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
   virtual nsresult HandleAccEvent(AccEvent* aEvent);
 #endif
 
   virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame);
 
   // HyperTextAccessible
   virtual already_AddRefed<nsIEditor> GetEditor() const;
 
--- a/accessible/src/generic/Makefile.in
+++ b/accessible/src/generic/Makefile.in
@@ -69,8 +69,12 @@ LOCAL_INCLUDES += \
   $(NULL)
 else
 LOCAL_INCLUDES += \
   -I$(srcdir)/../other \
   $(NULL)
 endif
 endif
 endif
+
+ifneq ($(A11Y_LOG),0)
+  DEFINES += -DA11Y_LOG
+endif
--- a/accessible/src/generic/OuterDocAccessible.cpp
+++ b/accessible/src/generic/OuterDocAccessible.cpp
@@ -5,17 +5,17 @@
 
 #include "OuterDocAccessible.h"
 
 #include "nsAccUtils.h"
 #include "DocAccessible.h"
 #include "Role.h"
 #include "States.h"
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
 #include "Logging.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // OuterDocAccessible
@@ -118,24 +118,24 @@ OuterDocAccessible::DoAction(uint8_t aIn
 
 void
 OuterDocAccessible::Shutdown()
 {
   // XXX: sometimes outerdoc accessible is shutdown because of layout style
   // change however the presshell of underlying document isn't destroyed and
   // the document doesn't get pagehide events. Shutdown underlying document if
   // any to avoid hanging document accessible.
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocDestroy))
     logging::OuterDocDestroy(this);
 #endif
 
   Accessible* childAcc = mChildren.SafeElementAt(0, nullptr);
   if (childAcc) {
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eDocDestroy)) {
       logging::DocDestroy("outerdoc's child document shutdown",
                           childAcc->GetDocumentNode());
     }
 #endif
     childAcc->Shutdown();
   }
 
@@ -169,17 +169,17 @@ OuterDocAccessible::AppendChild(Accessib
   // The old viewer will be destroyed after the new one is created.
   // For a11y, it should be safe to shut down the old document now.
   if (mChildren.Length())
     mChildren[0]->Shutdown();
 
   if (!AccessibleWrap::AppendChild(aAccessible))
     return false;
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocCreate)) {
     logging::DocCreate("append document to outerdoc",
                        aAccessible->GetDocumentNode());
     logging::Address("outerdoc", this);
   }
 #endif
 
   return true;
@@ -189,17 +189,17 @@ bool
 OuterDocAccessible::RemoveChild(Accessible* aAccessible)
 {
   Accessible* child = mChildren.SafeElementAt(0, nullptr);
   if (child != aAccessible) {
     NS_ERROR("Wrong child to remove!");
     return false;
   }
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocDestroy)) {
     logging::DocDestroy("remove document from outerdoc", child->GetDocumentNode(),
                         child->AsDoc());
     logging::Address("outerdoc", this);
   }
 #endif
 
   bool wasRemoved = AccessibleWrap::RemoveChild(child);
--- a/accessible/src/generic/RootAccessible.cpp
+++ b/accessible/src/generic/RootAccessible.cpp
@@ -257,17 +257,17 @@ RootAccessible::HandleEvent(nsIDOMEvent*
   nsCOMPtr<nsINode> origTargetNode(do_QueryInterface(DOMEventTarget));
   if (!origTargetNode)
     return NS_OK;
 
   DocAccessible* document =
     GetAccService()->GetDocAccessible(origTargetNode->OwnerDoc());
 
   if (document) {
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eDOMEvents)) {
       nsAutoString eventType;
       aDOMEvent->GetType(eventType);
 
       logging::MsgBegin("DOMEvents", "event '%s' handled",
                         NS_ConvertUTF16toUTF8(eventType).get());
       logging::Node("target", origTargetNode);
       logging::MsgEnd();
@@ -337,17 +337,17 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv
     bool isEnabled = (state & (states::CHECKED | states::SELECTED)) != 0;
 
     nsRefPtr<AccEvent> accEvent =
       new AccStateChangeEvent(accessible, states::CHECKED, isEnabled);
     nsEventShell::FireEvent(accEvent);
 
     if (isEnabled) {
       FocusMgr()->ActiveItemChanged(accessible);
-#ifdef DEBUG
+#ifdef A11Y_LOG
       if (logging::IsEnabled(logging::eFocus))
         logging::ActiveItemChangeCausedBy("RadioStateChange", accessible);
 #endif
     }
 
     return;
   }
 
@@ -419,31 +419,31 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv
   else if (eventType.EqualsLiteral("DOMMenuInactive")) {
     if (accessible->Role() == roles::MENUPOPUP) {
       nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
                               accessible);
     }
   }
   else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
     FocusMgr()->ActiveItemChanged(accessible);
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eFocus))
       logging::ActiveItemChangeCausedBy("DOMMenuItemActive", accessible);
 #endif
   }
   else if (eventType.EqualsLiteral("DOMMenuItemInactive")) {
     // Process DOMMenuItemInactive event for autocomplete only because this is
     // unique widget that may acquire focus from autocomplete popup while popup
     // stays open and has no active item. In case of XUL tree autocomplete
     // popup this event is fired for tree accessible.
     Accessible* widget =
       accessible->IsWidget() ? accessible : accessible->ContainerWidget();
     if (widget && widget->IsAutoCompletePopup()) {
       FocusMgr()->ActiveItemChanged(nullptr);
-#ifdef DEBUG
+#ifdef A11Y_LOG
       if (logging::IsEnabled(logging::eFocus))
         logging::ActiveItemChangeCausedBy("DOMMenuItemInactive", accessible);
 #endif
     }
   }
   else if (eventType.EqualsLiteral("DOMMenuBarActive")) {  // Always from user input
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_START,
                             accessible, eFromUserInput);
@@ -452,28 +452,28 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv
     // current item. This is a case of mouseover (set current menuitem) and
     // mouse click (activate the menubar). If menubar doesn't have current item
     // (can be a case of menubar activation from keyboard) then ignore this
     // notification because later we'll receive DOMMenuItemActive event after
     // current menuitem is set.
     Accessible* activeItem = accessible->CurrentItem();
     if (activeItem) {
       FocusMgr()->ActiveItemChanged(activeItem);
-#ifdef DEBUG
+#ifdef A11Y_LOG
       if (logging::IsEnabled(logging::eFocus))
         logging::ActiveItemChangeCausedBy("DOMMenuBarActive", accessible);
 #endif
     }
   }
   else if (eventType.EqualsLiteral("DOMMenuBarInactive")) {  // Always from user input
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_END,
                             accessible, eFromUserInput);
 
     FocusMgr()->ActiveItemChanged(nullptr);
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eFocus))
       logging::ActiveItemChangeCausedBy("DOMMenuBarInactive", accessible);
 #endif
   }
   else if (eventType.EqualsLiteral("ValueChange")) {
     targetDocument->
       FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
                                  targetNode, AccEvent::eRemoveDupes);
@@ -657,17 +657,17 @@ RootAccessible::HandlePopupHidingEvent(n
     // For menubars processing we listen DOMMenubarActive/Inactive
     // notifications.
     notifyOf = kNotifyOfFocus;
   }
 
   // Restore focus to where it was.
   if (notifyOf & kNotifyOfFocus) {
     FocusMgr()->ActiveItemChanged(nullptr);
-#ifdef DEBUG
+#ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eFocus))
       logging::ActiveItemChangeCausedBy("popuphiding", popup);
 #endif
   }
 
   // Fire expanded state change event.
   if (notifyOf & kNotifyOfState) {
     nsRefPtr<AccEvent> event =
--- a/accessible/src/html/Makefile.in
+++ b/accessible/src/html/Makefile.in
@@ -58,8 +58,12 @@ LOCAL_INCLUDES += \
   $(NULL)
 else
 LOCAL_INCLUDES += \
   -I$(srcdir)/../other \
   $(NULL)
 endif
 endif
 endif
+
+ifneq ($(A11Y_LOG),0)
+  DEFINES += -DA11Y_LOG
+endif
--- a/accessible/src/mac/Makefile.in
+++ b/accessible/src/mac/Makefile.in
@@ -52,8 +52,11 @@ LOCAL_INCLUDES += \
   -I$(srcdir)/../html \
   -I$(srcdir)/../xul \
   -I$(topsrcdir)/widget/cocoa \
   -I$(topsrcdir)/widget/xpwidgets \
   -I$(topsrcdir)/layout/xul/base/src \
   -I$(topsrcdir)/layout/generic \
   $(NULL)
 
+ifneq ($(A11Y_LOG),0)
+  DEFINES += -DA11Y_LOG
+endif
--- a/accessible/src/msaa/AccessibleWrap.cpp
+++ b/accessible/src/msaa/AccessibleWrap.cpp
@@ -15,17 +15,17 @@
 #include "nsIAccessibleRelation.h"
 #include "nsWinUtils.h"
 #include "Relation.h"
 #include "Role.h"
 #include "RootAccessible.h"
 #include "States.h"
 #include "uiaRawElmProvider.h"
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
 #include "Logging.h"
 #endif
 
 #include "nsIMutableArray.h"
 #include "nsIFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsINameSpaceManager.h"
 #include "nsINodeInfo.h"
@@ -1572,17 +1572,17 @@ AccessibleWrap::FirePlatformEvent(AccEve
   nsIContent* cnt = accessible->GetContent();
   if (cnt) {
     cnt->Tag()->ToString(tag);
     nsIAtom* aid = cnt->GetID();
     if (aid)
       aid->ToUTF8String(id);
   }
 
-#ifdef DEBUG
+#ifdef A11Y_LOG
   if (logging::IsEnabled(logging::ePlatforms)) {
     printf("\n\nMSAA event: event: %d, target: %s@id='%s', childid: %d, hwnd: %d\n\n",
            eventType, NS_ConvertUTF16toUTF8(tag).get(), id.get(),
            childID, hWnd);
   }
 #endif
 
   // Fire MSAA event for client area window.
--- a/accessible/src/msaa/Makefile.in
+++ b/accessible/src/msaa/Makefile.in
@@ -83,8 +83,12 @@ LOCAL_INCLUDES += \
   -I$(srcdir)/../generic \
   -I$(srcdir)/../html \
   -I$(srcdir)/../xpcom \
   -I$(srcdir)/../xul \
   -I$(srcdir)/../windows/uia \
   -I$(srcdir)/../../../content/base/src \
   -I$(srcdir)/../../../content/events/src \
   $(NULL)
+
+ifneq ($(A11Y_LOG),0)
+  DEFINES += -DA11Y_LOG
+endif
--- a/accessible/src/other/Makefile.in
+++ b/accessible/src/other/Makefile.in
@@ -39,8 +39,11 @@ include $(topsrcdir)/config/rules.mk
 LOCAL_INCLUDES += \
   -I$(srcdir) \
   -I$(srcdir)/../base \
   -I$(srcdir)/../generic \
   -I$(srcdir)/../html \
   -I$(srcdir)/../xul \
   $(NULL)
 
+ifneq ($(A11Y_LOG),0)
+  DEFINES += -DA11Y_LOG
+endif
--- a/accessible/src/windows/Makefile.in
+++ b/accessible/src/windows/Makefile.in
@@ -9,8 +9,12 @@ srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS += uia \
   $(null)
 
 include $(topsrcdir)/config/rules.mk
+
+ifneq ($(A11Y_LOG),0)
+  DEFINES += -DA11Y_LOG
+endif
--- a/accessible/src/windows/uia/Makefile.in
+++ b/accessible/src/windows/uia/Makefile.in
@@ -29,8 +29,12 @@ LOCAL_INCLUDES += \
   -I$(srcdir) \
   -I$(srcdir)/../../base \
   -I$(srcdir)/../../generic \
   -I$(srcdir)/../../html \
   -I$(srcdir)/../../msaa \
   -I$(srcdir)/../../xpcom \
   -I$(srcdir)/../../xul \
   $(NULL)
+
+ifdef A11Y_LOG
+  DEFINES += -DA11Y_LOG
+endif
--- a/accessible/src/xforms/Makefile.in
+++ b/accessible/src/xforms/Makefile.in
@@ -50,8 +50,12 @@ LOCAL_INCLUDES += \
   $(NULL)
 else
 LOCAL_INCLUDES += \
   -I$(srcdir)/../other \
   $(NULL)
 endif
 endif
 endif
+
+ifneq ($(A11Y_LOG),0)
+  DEFINES += -DA11Y_LOG
+endif
--- a/accessible/src/xpcom/Makefile.in
+++ b/accessible/src/xpcom/Makefile.in
@@ -47,8 +47,12 @@ LOCAL_INCLUDES += \
   $(NULL)
 else
 LOCAL_INCLUDES += \
   -I$(srcdir)/../other \
   $(NULL)
 endif
 endif
 endif
+
+ifneq ($(A11Y_LOG),0)
+  DEFINES += -DA11Y_LOG
+endif
--- a/accessible/src/xul/Makefile.in
+++ b/accessible/src/xul/Makefile.in
@@ -62,8 +62,12 @@ LOCAL_INCLUDES += \
   $(NULL)
 else
 LOCAL_INCLUDES += \
   -I$(srcdir)/../other \
   $(NULL)
 endif
 endif
 endif
+
+ifneq ($(A11Y_LOG),0)
+  DEFINES += -DA11Y_LOG
+endif