Bug 799133 - more logging for focus and doclifecycle modules, r=tbsaunde
authorAlexander Surkov <surkov.alexander@gmail.com>
Fri, 12 Oct 2012 00:13:18 +0900
changeset 110085 b7d112dee89c5033c6f19ff86183987d4ad0b79b
parent 110084 06eb83abf17f70e8cbae0d738bda4f2042421414
child 110086 139b4d452d8168f34c4050dd9e8a9223002c93ed
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewerstbsaunde
bugs799133
milestone19.0a1
Bug 799133 - more logging for focus and doclifecycle modules, r=tbsaunde
accessible/src/base/Logging.cpp
accessible/src/base/Logging.h
--- a/accessible/src/base/Logging.cpp
+++ b/accessible/src/base/Logging.cpp
@@ -157,23 +157,27 @@ LogDocState(nsIDocument* aDocumentNode)
       break;
   }
 
   printf("doc state: %s", docState);
   printf(", %sinitial", aDocumentNode->IsInitialDocument() ? "" : "not ");
   printf(", %sshowing", aDocumentNode->IsShowing() ? "" : "not ");
   printf(", %svisible", aDocumentNode->IsVisible() ? "" : "not ");
   printf(", %sactive", aDocumentNode->IsActive() ? "" : "not ");
+  printf(", %sresource", aDocumentNode->IsResourceDoc() ? "" : "not ");
+  printf(", has %srole content",
+         nsCoreUtils::GetRoleContent(aDocumentNode) ? "" : "no ");
 }
 
 static void
 LogPresShell(nsIDocument* aDocumentNode)
 {
   nsIPresShell* ps = aDocumentNode->GetShell();
-  printf("presshell: %p", static_cast<void*>(ps));
+  printf("presshell: %p, is %s destroying", static_cast<void*>(ps),
+         (ps->IsDestroying() ? "" : "not"));
   nsIScrollableFrame *sf = ps ?
     ps->GetRootScrollFrameAsScrollableExternal() : nullptr;
   printf(", root scroll frame: %p", static_cast<void*>(sf));
 }
 
 static void
 LogDocLoadGroup(nsIDocument* aDocumentNode)
 {
@@ -526,17 +530,17 @@ void
 logging::FocusNotificationTarget(const char* aMsg, const char* aTargetDescr,
                                  nsISupports* aTargetThing)
 {
   MsgBegin(sFocusTitle, aMsg);
 
   if (aTargetThing) {
     nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTargetThing));
     if (targetNode)
-      Node(aTargetDescr, targetNode);
+      AccessibleNNode(aTargetDescr, targetNode);
     else
       printf("    %s: %p, window\n", aTargetDescr,
              static_cast<void*>(aTargetThing));
   }
 
   MsgEnd();
 }
 
@@ -705,16 +709,28 @@ logging::Node(const char* aDescr, nsINod
   if (idAtom)
     idAtom->ToUTF8String(id);
 
   printf("%s: %p, %s@id='%s', idx in parent: %d\n",
          aDescr, static_cast<void*>(elm), tag.get(), id.get(), idxInParent);
 }
 
 void
+logging::Document(DocAccessible* aDocument)
+{
+  printf("    Document: %p, document node: %p\n",
+         static_cast<void*>(aDocument),
+         static_cast<void*>(aDocument->GetDocumentNode()));
+
+  printf("    Document ");
+  LogDocURI(aDocument->GetDocumentNode());
+  printf("\n");
+}
+
+void
 logging::AccessibleNNode(const char* aDescr, Accessible* aAccessible)
 {
   printf("    %s: %p; ", aDescr, static_cast<void*>(aAccessible));
   if (!aAccessible)
     return;
 
   nsAutoString role;
   GetAccService()->GetStringRole(aAccessible->Role(), role);
@@ -723,42 +739,45 @@ logging::AccessibleNNode(const char* aDe
 
   printf("role: %s, name: '%s';\n", NS_ConvertUTF16toUTF8(role).get(),
          NS_ConvertUTF16toUTF8(name).get());
 
   nsAutoCString nodeDescr(aDescr);
   nodeDescr.AppendLiteral(" node");
   Node(nodeDescr.get(), aAccessible->GetNode());
 
-  printf("    Document: %p, document node: %p\n",
-         static_cast<void*>(aAccessible->Document()),
-         static_cast<void*>(aAccessible->GetDocumentNode()));
-
-  printf("    Document ");
-  LogDocURI(static_cast<nsIDocument*>(aAccessible->GetDocumentNode()));
-  printf("\n");
+  Document(aAccessible->Document());
 }
 
 void
 logging::AccessibleNNode(const char* aDescr, nsINode* aNode)
 {
   DocAccessible* document =
     GetAccService()->GetDocAccessible(aNode->OwnerDoc());
 
   if (document) {
     Accessible* accessible = document->GetAccessible(aNode);
     if (accessible) {
       AccessibleNNode(aDescr, accessible);
       return;
     }
   }
 
-  nsAutoCString nodeDescr("Not accessible ");
+  nsAutoCString nodeDescr("[not accessible] ");
   nodeDescr.Append(aDescr);
   Node(nodeDescr.get(), aNode);
+
+  if (document) {
+    Document(document);
+    return;
+  }
+
+  printf("    [contained by not accessible document]:\n");
+  LogDocInfo(aNode->OwnerDoc(), document);
+  printf("\n");
 }
 
 void
 logging::DOMEvent(const char* aDescr, nsINode* aOrigTarget,
                   const nsAString& aEventType)
 {
   logging::MsgBegin("DOMEvents", "event '%s' %s",
                     NS_ConvertUTF16toUTF8(aEventType).get(), aDescr);
--- a/accessible/src/base/Logging.h
+++ b/accessible/src/base/Logging.h
@@ -146,16 +146,21 @@ void Text(const char* aText);
 void Address(const char* aDescr, Accessible* aAcc);
 
 /**
  * Log the DOM node info as message entry.
  */
 void Node(const char* aDescr, nsINode* aNode);
 
 /**
+ * Log the document accessible info as message entry.
+ */
+void Document(DocAccessible* aDocument);
+
+/**
  * Log the accessible and its DOM node as a message entry.
  */
 void AccessibleNNode(const char* aDescr, Accessible* aAccessible);
 void AccessibleNNode(const char* aDescr, nsINode* aNode);
 
 /**
  * Log the DOM event.
  */