2012-05-23 13:21:40 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#include "Logging.h"
|
|
|
|
|
2012-09-27 03:53:23 +04:00
|
|
|
#include "Accessible-inl.h"
|
2012-05-23 13:21:40 +04:00
|
|
|
#include "AccEvent.h"
|
2012-06-01 08:26:28 +04:00
|
|
|
#include "DocAccessible.h"
|
2012-05-23 13:21:40 +04:00
|
|
|
#include "nsAccessibilityService.h"
|
|
|
|
#include "nsCoreUtils.h"
|
2012-06-01 08:26:28 +04:00
|
|
|
#include "OuterDocAccessible.h"
|
2012-05-23 13:21:40 +04:00
|
|
|
|
|
|
|
#include "nsDocShellLoadTypes.h"
|
|
|
|
#include "nsIChannel.h"
|
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
2012-06-02 05:58:44 +04:00
|
|
|
#include "nsISelectionPrivate.h"
|
2014-02-27 01:36:36 +04:00
|
|
|
#include "nsTraceRefcnt.h"
|
2012-05-23 13:21:40 +04:00
|
|
|
#include "nsIWebProgress.h"
|
|
|
|
#include "prenv.h"
|
2012-08-01 22:31:10 +04:00
|
|
|
#include "nsIDocShellTreeItem.h"
|
2013-09-07 17:01:08 +04:00
|
|
|
#include "nsIURI.h"
|
2013-09-11 02:18:59 +04:00
|
|
|
#include "mozilla/dom/Element.h"
|
2012-05-23 13:21:40 +04:00
|
|
|
|
|
|
|
using namespace mozilla;
|
|
|
|
using namespace mozilla::a11y;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Logging helpers
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static uint32_t sModules = 0;
|
2012-05-23 13:21:40 +04:00
|
|
|
|
|
|
|
struct ModuleRep {
|
|
|
|
const char* mStr;
|
|
|
|
logging::EModules mModule;
|
|
|
|
};
|
|
|
|
|
2012-11-04 06:19:56 +04:00
|
|
|
static ModuleRep sModuleMap[] = {
|
|
|
|
{ "docload", logging::eDocLoad },
|
|
|
|
{ "doccreate", logging::eDocCreate },
|
|
|
|
{ "docdestroy", logging::eDocDestroy },
|
|
|
|
{ "doclifecycle", logging::eDocLifeCycle },
|
|
|
|
|
|
|
|
{ "events", logging::eEvents },
|
|
|
|
{ "platforms", logging::ePlatforms },
|
|
|
|
{ "text", logging::eText },
|
|
|
|
{ "tree", logging::eTree },
|
|
|
|
|
|
|
|
{ "DOMEvents", logging::eDOMEvents },
|
|
|
|
{ "focus", logging::eFocus },
|
|
|
|
{ "selection", logging::eSelection },
|
2016-03-01 21:07:20 +03:00
|
|
|
{ "notifications", logging::eNotifications },
|
|
|
|
|
|
|
|
{ "stack", logging::eStack },
|
|
|
|
{ "verbose", logging::eVerbose }
|
2012-11-04 06:19:56 +04:00
|
|
|
};
|
|
|
|
|
2012-05-23 13:21:40 +04:00
|
|
|
static void
|
|
|
|
EnableLogging(const char* aModulesStr)
|
|
|
|
{
|
|
|
|
sModules = 0;
|
|
|
|
if (!aModulesStr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
const char* token = aModulesStr;
|
|
|
|
while (*token != '\0') {
|
|
|
|
size_t tokenLen = strcspn(token, ",");
|
2012-11-04 06:19:56 +04:00
|
|
|
for (unsigned int idx = 0; idx < ArrayLength(sModuleMap); idx++) {
|
|
|
|
if (strncmp(token, sModuleMap[idx].mStr, tokenLen) == 0) {
|
2013-03-01 08:06:16 +04:00
|
|
|
#if !defined(MOZ_PROFILING) && (!defined(DEBUG) || defined(MOZ_OPTIMIZE))
|
2012-11-04 06:19:56 +04:00
|
|
|
// Stack tracing on profiling enabled or debug not optimized builds.
|
|
|
|
if (strncmp(token, "stack", tokenLen) == 0)
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
sModules |= sModuleMap[idx].mModule;
|
|
|
|
printf("\n\nmodule enabled: %s\n", sModuleMap[idx].mStr);
|
2012-05-23 13:21:40 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
token += tokenLen;
|
|
|
|
|
|
|
|
if (*token == ',')
|
|
|
|
token++; // skip ',' char
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
LogDocURI(nsIDocument* aDocumentNode)
|
|
|
|
{
|
|
|
|
nsIURI* uri = aDocumentNode->GetDocumentURI();
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString spec;
|
2012-05-23 13:21:40 +04:00
|
|
|
uri->GetSpec(spec);
|
|
|
|
printf("uri: %s", spec.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
LogDocShellState(nsIDocument* aDocumentNode)
|
|
|
|
{
|
|
|
|
printf("docshell busy: ");
|
|
|
|
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString docShellBusy;
|
2013-11-15 20:32:12 +04:00
|
|
|
nsCOMPtr<nsIDocShell> docShell = aDocumentNode->GetDocShell();
|
|
|
|
uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
|
|
|
|
docShell->GetBusyFlags(&busyFlags);
|
|
|
|
if (busyFlags == nsIDocShell::BUSY_FLAGS_NONE)
|
|
|
|
printf("'none'");
|
|
|
|
if (busyFlags & nsIDocShell::BUSY_FLAGS_BUSY)
|
|
|
|
printf("'busy'");
|
|
|
|
if (busyFlags & nsIDocShell::BUSY_FLAGS_BEFORE_PAGE_LOAD)
|
|
|
|
printf(", 'before page load'");
|
|
|
|
if (busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING)
|
|
|
|
printf(", 'page loading'");
|
|
|
|
|
2012-05-23 13:21:40 +04:00
|
|
|
printf("[failed]");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
LogDocType(nsIDocument* aDocumentNode)
|
|
|
|
{
|
|
|
|
if (aDocumentNode->IsActive()) {
|
|
|
|
bool isContent = nsCoreUtils::IsContentDocument(aDocumentNode);
|
|
|
|
printf("%s document", (isContent ? "content" : "chrome"));
|
|
|
|
} else {
|
|
|
|
printf("document type: [failed]");\
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
LogDocShellTree(nsIDocument* aDocumentNode)
|
|
|
|
{
|
|
|
|
if (aDocumentNode->IsActive()) {
|
2013-11-15 20:32:12 +04:00
|
|
|
nsCOMPtr<nsIDocShellTreeItem> treeItem(aDocumentNode->GetDocShell());
|
2012-05-23 13:21:40 +04:00
|
|
|
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
|
|
|
|
treeItem->GetParent(getter_AddRefs(parentTreeItem));
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
|
|
|
|
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
|
|
|
|
printf("docshell hierarchy, parent: %p, root: %p, is tab document: %s;",
|
|
|
|
static_cast<void*>(parentTreeItem), static_cast<void*>(rootTreeItem),
|
|
|
|
(nsCoreUtils::IsTabDocument(aDocumentNode) ? "yes" : "no"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
LogDocState(nsIDocument* aDocumentNode)
|
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
const char* docState = nullptr;
|
2012-05-23 13:21:40 +04:00
|
|
|
nsIDocument::ReadyState docStateFlag = aDocumentNode->GetReadyStateEnum();
|
|
|
|
switch (docStateFlag) {
|
|
|
|
case nsIDocument::READYSTATE_UNINITIALIZED:
|
|
|
|
docState = "uninitialized";
|
|
|
|
break;
|
|
|
|
case nsIDocument::READYSTATE_LOADING:
|
|
|
|
docState = "loading";
|
|
|
|
break;
|
|
|
|
case nsIDocument::READYSTATE_INTERACTIVE:
|
|
|
|
docState = "interactive";
|
|
|
|
break;
|
|
|
|
case nsIDocument::READYSTATE_COMPLETE:
|
|
|
|
docState = "complete";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("doc state: %s", docState);
|
|
|
|
printf(", %sinitial", aDocumentNode->IsInitialDocument() ? "" : "not ");
|
|
|
|
printf(", %sshowing", aDocumentNode->IsShowing() ? "" : "not ");
|
|
|
|
printf(", %svisible", aDocumentNode->IsVisible() ? "" : "not ");
|
2013-03-16 08:13:38 +04:00
|
|
|
printf(", %svisible considering ancestors", aDocumentNode->IsVisibleConsideringAncestors() ? "" : "not ");
|
2012-05-23 13:21:40 +04:00
|
|
|
printf(", %sactive", aDocumentNode->IsActive() ? "" : "not ");
|
2012-10-11 19:13:18 +04:00
|
|
|
printf(", %sresource", aDocumentNode->IsResourceDoc() ? "" : "not ");
|
|
|
|
printf(", has %srole content",
|
|
|
|
nsCoreUtils::GetRoleContent(aDocumentNode) ? "" : "no ");
|
2012-05-23 13:21:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
LogPresShell(nsIDocument* aDocumentNode)
|
|
|
|
{
|
|
|
|
nsIPresShell* ps = aDocumentNode->GetShell();
|
2012-11-30 06:09:41 +04:00
|
|
|
printf("presshell: %p", static_cast<void*>(ps));
|
|
|
|
|
|
|
|
nsIScrollableFrame* sf = nullptr;
|
|
|
|
if (ps) {
|
|
|
|
printf(", is %s destroying", (ps->IsDestroying() ? "" : "not"));
|
|
|
|
sf = ps->GetRootScrollFrameAsScrollable();
|
|
|
|
}
|
2012-05-23 13:21:40 +04:00
|
|
|
printf(", root scroll frame: %p", static_cast<void*>(sf));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
LogDocLoadGroup(nsIDocument* aDocumentNode)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsILoadGroup> loadGroup = aDocumentNode->GetDocumentLoadGroup();
|
|
|
|
printf("load group: %p", static_cast<void*>(loadGroup));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
LogDocParent(nsIDocument* aDocumentNode)
|
|
|
|
{
|
|
|
|
nsIDocument* parentDoc = aDocumentNode->GetParentDocument();
|
2014-08-16 00:24:22 +04:00
|
|
|
printf("parent DOM document: %p", static_cast<void*>(parentDoc));
|
2012-05-23 13:21:40 +04:00
|
|
|
if (parentDoc) {
|
2014-08-16 00:24:22 +04:00
|
|
|
printf(", parent acc document: %p",
|
|
|
|
static_cast<void*>(GetExistingDocAccessible(parentDoc)));
|
2012-05-23 13:21:40 +04:00
|
|
|
printf("\n parent ");
|
|
|
|
LogDocURI(parentDoc);
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-05-27 13:01:40 +04:00
|
|
|
LogDocInfo(nsIDocument* aDocumentNode, DocAccessible* aDocument)
|
2012-05-23 13:21:40 +04:00
|
|
|
{
|
2012-10-10 05:01:46 +04:00
|
|
|
printf(" DOM document: %p, acc document: %p\n ",
|
2012-05-23 13:21:40 +04:00
|
|
|
static_cast<void*>(aDocumentNode), static_cast<void*>(aDocument));
|
|
|
|
|
|
|
|
// log document info
|
|
|
|
if (aDocumentNode) {
|
|
|
|
LogDocURI(aDocumentNode);
|
|
|
|
printf("\n ");
|
|
|
|
LogDocShellState(aDocumentNode);
|
|
|
|
printf("; ");
|
|
|
|
LogDocType(aDocumentNode);
|
|
|
|
printf("\n ");
|
|
|
|
LogDocShellTree(aDocumentNode);
|
|
|
|
printf("\n ");
|
|
|
|
LogDocState(aDocumentNode);
|
|
|
|
printf("\n ");
|
|
|
|
LogPresShell(aDocumentNode);
|
|
|
|
printf("\n ");
|
|
|
|
LogDocLoadGroup(aDocumentNode);
|
|
|
|
printf(", ");
|
|
|
|
LogDocParent(aDocumentNode);
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
LogShellLoadType(nsIDocShell* aDocShell)
|
|
|
|
{
|
|
|
|
printf("load type: ");
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t loadType = 0;
|
2012-05-23 13:21:40 +04:00
|
|
|
aDocShell->GetLoadType(&loadType);
|
|
|
|
switch (loadType) {
|
|
|
|
case LOAD_NORMAL:
|
|
|
|
printf("normal; ");
|
|
|
|
break;
|
|
|
|
case LOAD_NORMAL_REPLACE:
|
|
|
|
printf("normal replace; ");
|
|
|
|
break;
|
|
|
|
case LOAD_NORMAL_EXTERNAL:
|
|
|
|
printf("normal external; ");
|
|
|
|
break;
|
|
|
|
case LOAD_HISTORY:
|
|
|
|
printf("history; ");
|
|
|
|
break;
|
|
|
|
case LOAD_NORMAL_BYPASS_CACHE:
|
|
|
|
printf("normal bypass cache; ");
|
|
|
|
break;
|
|
|
|
case LOAD_NORMAL_BYPASS_PROXY:
|
|
|
|
printf("normal bypass proxy; ");
|
|
|
|
break;
|
|
|
|
case LOAD_NORMAL_BYPASS_PROXY_AND_CACHE:
|
|
|
|
printf("normal bypass proxy and cache; ");
|
|
|
|
break;
|
2013-08-23 02:13:16 +04:00
|
|
|
case LOAD_NORMAL_ALLOW_MIXED_CONTENT:
|
|
|
|
printf("normal allow mixed content; ");
|
|
|
|
break;
|
2012-05-23 13:21:40 +04:00
|
|
|
case LOAD_RELOAD_NORMAL:
|
|
|
|
printf("reload normal; ");
|
|
|
|
break;
|
|
|
|
case LOAD_RELOAD_BYPASS_CACHE:
|
|
|
|
printf("reload bypass cache; ");
|
|
|
|
break;
|
|
|
|
case LOAD_RELOAD_BYPASS_PROXY:
|
|
|
|
printf("reload bypass proxy; ");
|
|
|
|
break;
|
|
|
|
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
|
|
|
|
printf("reload bypass proxy and cache; ");
|
|
|
|
break;
|
2013-01-30 12:04:34 +04:00
|
|
|
case LOAD_RELOAD_ALLOW_MIXED_CONTENT:
|
|
|
|
printf("reload allow mixed content; ");
|
|
|
|
break;
|
2012-05-23 13:21:40 +04:00
|
|
|
case LOAD_LINK:
|
|
|
|
printf("link; ");
|
|
|
|
break;
|
|
|
|
case LOAD_REFRESH:
|
|
|
|
printf("refresh; ");
|
|
|
|
break;
|
|
|
|
case LOAD_RELOAD_CHARSET_CHANGE:
|
|
|
|
printf("reload charset change; ");
|
|
|
|
break;
|
|
|
|
case LOAD_BYPASS_HISTORY:
|
|
|
|
printf("bypass history; ");
|
|
|
|
break;
|
|
|
|
case LOAD_STOP_CONTENT:
|
|
|
|
printf("stop content; ");
|
|
|
|
break;
|
|
|
|
case LOAD_STOP_CONTENT_AND_REPLACE:
|
|
|
|
printf("stop content and replace; ");
|
|
|
|
break;
|
|
|
|
case LOAD_PUSHSTATE:
|
|
|
|
printf("load pushstate; ");
|
|
|
|
break;
|
2012-06-21 21:31:07 +04:00
|
|
|
case LOAD_REPLACE_BYPASS_CACHE:
|
|
|
|
printf("replace bypass cache; ");
|
2012-06-22 01:03:44 +04:00
|
|
|
break;
|
2012-05-23 13:21:40 +04:00
|
|
|
case LOAD_ERROR_PAGE:
|
|
|
|
printf("error page;");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printf("unknown");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
LogRequest(nsIRequest* aRequest)
|
|
|
|
{
|
|
|
|
if (aRequest) {
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString name;
|
2012-05-23 13:21:40 +04:00
|
|
|
aRequest->GetName(name);
|
|
|
|
printf(" request spec: %s\n", name.get());
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t loadFlags = 0;
|
2012-05-23 13:21:40 +04:00
|
|
|
aRequest->GetLoadFlags(&loadFlags);
|
|
|
|
printf(" request load flags: %x; ", loadFlags);
|
|
|
|
if (loadFlags & nsIChannel::LOAD_DOCUMENT_URI)
|
|
|
|
printf("document uri; ");
|
|
|
|
if (loadFlags & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI)
|
|
|
|
printf("retargeted document uri; ");
|
|
|
|
if (loadFlags & nsIChannel::LOAD_REPLACE)
|
|
|
|
printf("replace; ");
|
|
|
|
if (loadFlags & nsIChannel::LOAD_INITIAL_DOCUMENT_URI)
|
|
|
|
printf("initial document uri; ");
|
|
|
|
if (loadFlags & nsIChannel::LOAD_TARGETED)
|
|
|
|
printf("targeted; ");
|
|
|
|
if (loadFlags & nsIChannel::LOAD_CALL_CONTENT_SNIFFERS)
|
|
|
|
printf("call content sniffers; ");
|
|
|
|
if (loadFlags & nsIChannel::LOAD_CLASSIFY_URI)
|
|
|
|
printf("classify uri; ");
|
|
|
|
} else {
|
|
|
|
printf(" no request");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-10 05:01:46 +04:00
|
|
|
static void
|
|
|
|
LogDocAccState(DocAccessible* aDocument)
|
|
|
|
{
|
|
|
|
printf("document acc state: ");
|
|
|
|
if (aDocument->HasLoadState(DocAccessible::eCompletelyLoaded))
|
|
|
|
printf("completely loaded;");
|
|
|
|
else if (aDocument->HasLoadState(DocAccessible::eReady))
|
|
|
|
printf("ready;");
|
|
|
|
else if (aDocument->HasLoadState(DocAccessible::eDOMLoaded))
|
|
|
|
printf("DOM loaded;");
|
|
|
|
else if (aDocument->HasLoadState(DocAccessible::eTreeConstructed))
|
|
|
|
printf("tree constructed;");
|
|
|
|
}
|
|
|
|
|
2012-05-23 13:21:40 +04:00
|
|
|
static void
|
|
|
|
GetDocLoadEventType(AccEvent* aEvent, nsACString& aEventType)
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t type = aEvent->GetEventType();
|
2012-05-23 13:21:40 +04:00
|
|
|
if (type == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED) {
|
|
|
|
aEventType.AssignLiteral("load stopped");
|
|
|
|
} else if (type == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE) {
|
|
|
|
aEventType.AssignLiteral("load complete");
|
|
|
|
} else if (type == nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD) {
|
|
|
|
aEventType.AssignLiteral("reload");
|
|
|
|
} else if (type == nsIAccessibleEvent::EVENT_STATE_CHANGE) {
|
|
|
|
AccStateChangeEvent* event = downcast_accEvent(aEvent);
|
|
|
|
if (event->GetState() == states::BUSY) {
|
|
|
|
aEventType.AssignLiteral("busy ");
|
|
|
|
if (event->IsStateEnabled())
|
|
|
|
aEventType.AppendLiteral("true");
|
|
|
|
else
|
|
|
|
aEventType.AppendLiteral("false");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// namespace logging:: document life cycle logging methods
|
|
|
|
|
2012-06-01 08:26:28 +04:00
|
|
|
static const char* sDocLoadTitle = "DOCLOAD";
|
|
|
|
static const char* sDocCreateTitle = "DOCCREATE";
|
|
|
|
static const char* sDocDestroyTitle = "DOCDESTROY";
|
|
|
|
static const char* sDocEventTitle = "DOCEVENT";
|
2012-09-27 03:53:23 +04:00
|
|
|
static const char* sFocusTitle = "FOCUS";
|
2012-06-01 08:26:28 +04:00
|
|
|
|
2012-05-23 13:21:40 +04:00
|
|
|
void
|
|
|
|
logging::DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
|
2012-08-22 19:56:38 +04:00
|
|
|
nsIRequest* aRequest, uint32_t aStateFlags)
|
2012-05-23 13:21:40 +04:00
|
|
|
{
|
2012-06-01 08:26:28 +04:00
|
|
|
MsgBegin(sDocLoadTitle, aMsg);
|
2012-05-23 13:21:40 +04:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<mozIDOMWindowProxy> DOMWindow;
|
2012-05-23 13:21:40 +04:00
|
|
|
aWebProgress->GetDOMWindow(getter_AddRefs(DOMWindow));
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowOuter* window = nsPIDOMWindowOuter::From(DOMWindow);
|
2013-08-14 11:01:27 +04:00
|
|
|
if (!window) {
|
2012-06-01 08:26:28 +04:00
|
|
|
MsgEnd();
|
2012-05-23 13:21:40 +04:00
|
|
|
return;
|
2012-06-01 08:26:28 +04:00
|
|
|
}
|
2012-05-23 13:21:40 +04:00
|
|
|
|
2013-08-14 11:01:27 +04:00
|
|
|
nsCOMPtr<nsIDocument> documentNode = window->GetDoc();
|
|
|
|
if (!documentNode) {
|
2012-06-01 08:26:28 +04:00
|
|
|
MsgEnd();
|
2012-05-23 13:21:40 +04:00
|
|
|
return;
|
2012-06-01 08:26:28 +04:00
|
|
|
}
|
2012-05-23 13:21:40 +04:00
|
|
|
|
2012-11-03 03:57:58 +04:00
|
|
|
DocAccessible* document = GetExistingDocAccessible(documentNode);
|
2012-05-23 13:21:40 +04:00
|
|
|
|
|
|
|
LogDocInfo(documentNode, document);
|
|
|
|
|
2014-01-10 06:03:47 +04:00
|
|
|
nsCOMPtr<nsIDocShell> docShell = window->GetDocShell();
|
2012-06-01 08:26:28 +04:00
|
|
|
printf("\n ");
|
2012-05-23 13:21:40 +04:00
|
|
|
LogShellLoadType(docShell);
|
|
|
|
printf("\n");
|
|
|
|
LogRequest(aRequest);
|
|
|
|
printf("\n");
|
|
|
|
printf(" state flags: %x", aStateFlags);
|
|
|
|
bool isDocLoading;
|
|
|
|
aWebProgress->GetIsLoadingDocument(&isDocLoading);
|
|
|
|
printf(", document is %sloading\n", (isDocLoading ? "" : "not "));
|
2012-06-01 08:26:28 +04:00
|
|
|
|
|
|
|
MsgEnd();
|
2012-05-23 13:21:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::DocLoad(const char* aMsg, nsIDocument* aDocumentNode)
|
|
|
|
{
|
2012-06-01 08:26:28 +04:00
|
|
|
MsgBegin(sDocLoadTitle, aMsg);
|
2012-05-23 13:21:40 +04:00
|
|
|
|
2012-11-03 03:57:58 +04:00
|
|
|
DocAccessible* document = GetExistingDocAccessible(aDocumentNode);
|
2012-05-23 13:21:40 +04:00
|
|
|
LogDocInfo(aDocumentNode, document);
|
2012-06-01 08:26:28 +04:00
|
|
|
|
|
|
|
MsgEnd();
|
2012-05-23 13:21:40 +04:00
|
|
|
}
|
|
|
|
|
2012-10-10 05:01:46 +04:00
|
|
|
void
|
|
|
|
logging::DocCompleteLoad(DocAccessible* aDocument, bool aIsLoadEventTarget)
|
|
|
|
{
|
|
|
|
MsgBegin(sDocLoadTitle, "document loaded *completely*");
|
|
|
|
|
|
|
|
printf(" DOM document: %p, acc document: %p\n",
|
2012-10-12 06:25:34 +04:00
|
|
|
static_cast<void*>(aDocument->DocumentNode()),
|
2012-10-10 05:01:46 +04:00
|
|
|
static_cast<void*>(aDocument));
|
|
|
|
|
|
|
|
printf(" ");
|
2012-10-12 06:25:34 +04:00
|
|
|
LogDocURI(aDocument->DocumentNode());
|
2012-10-10 05:01:46 +04:00
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
LogDocAccState(aDocument);
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
printf(" document is load event target: %s\n",
|
|
|
|
(aIsLoadEventTarget ? "true" : "false"));
|
|
|
|
|
|
|
|
MsgEnd();
|
|
|
|
}
|
|
|
|
|
2012-05-23 13:21:40 +04:00
|
|
|
void
|
|
|
|
logging::DocLoadEventFired(AccEvent* aEvent)
|
|
|
|
{
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString strEventType;
|
2012-05-23 13:21:40 +04:00
|
|
|
GetDocLoadEventType(aEvent, strEventType);
|
|
|
|
if (!strEventType.IsEmpty())
|
|
|
|
printf(" fire: %s\n", strEventType.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::DocLoadEventHandled(AccEvent* aEvent)
|
|
|
|
{
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString strEventType;
|
2012-05-23 13:21:40 +04:00
|
|
|
GetDocLoadEventType(aEvent, strEventType);
|
2012-06-01 08:26:28 +04:00
|
|
|
if (strEventType.IsEmpty())
|
|
|
|
return;
|
2012-05-23 13:21:40 +04:00
|
|
|
|
2012-06-01 08:26:28 +04:00
|
|
|
MsgBegin(sDocEventTitle, "handled '%s' event", strEventType.get());
|
|
|
|
|
2012-11-20 08:53:38 +04:00
|
|
|
DocAccessible* document = aEvent->GetAccessible()->AsDoc();
|
|
|
|
if (document)
|
|
|
|
LogDocInfo(document->DocumentNode(), document);
|
2012-06-01 08:26:28 +04:00
|
|
|
|
|
|
|
MsgEnd();
|
2012-05-23 13:21:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::DocCreate(const char* aMsg, nsIDocument* aDocumentNode,
|
2012-05-27 13:01:40 +04:00
|
|
|
DocAccessible* aDocument)
|
2012-05-23 13:21:40 +04:00
|
|
|
{
|
2012-05-27 13:01:40 +04:00
|
|
|
DocAccessible* document = aDocument ?
|
2012-11-03 03:57:58 +04:00
|
|
|
aDocument : GetExistingDocAccessible(aDocumentNode);
|
2012-05-23 13:21:40 +04:00
|
|
|
|
2012-06-01 08:26:28 +04:00
|
|
|
MsgBegin(sDocCreateTitle, aMsg);
|
2012-05-23 13:21:40 +04:00
|
|
|
LogDocInfo(aDocumentNode, document);
|
2012-06-01 08:26:28 +04:00
|
|
|
MsgEnd();
|
2012-05-23 13:21:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::DocDestroy(const char* aMsg, nsIDocument* aDocumentNode,
|
2012-05-27 13:01:40 +04:00
|
|
|
DocAccessible* aDocument)
|
2012-05-23 13:21:40 +04:00
|
|
|
{
|
2012-05-27 13:01:40 +04:00
|
|
|
DocAccessible* document = aDocument ?
|
2012-11-03 03:57:58 +04:00
|
|
|
aDocument : GetExistingDocAccessible(aDocumentNode);
|
2012-05-23 13:21:40 +04:00
|
|
|
|
2012-06-01 08:26:28 +04:00
|
|
|
MsgBegin(sDocDestroyTitle, aMsg);
|
2012-05-23 13:21:40 +04:00
|
|
|
LogDocInfo(aDocumentNode, document);
|
2012-06-01 08:26:28 +04:00
|
|
|
MsgEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::OuterDocDestroy(OuterDocAccessible* aOuterDoc)
|
|
|
|
{
|
|
|
|
MsgBegin(sDocDestroyTitle, "outerdoc shutdown");
|
|
|
|
logging::Address("outerdoc", aOuterDoc);
|
|
|
|
MsgEnd();
|
2012-05-23 13:21:40 +04:00
|
|
|
}
|
|
|
|
|
2012-09-27 03:53:23 +04:00
|
|
|
void
|
|
|
|
logging::FocusNotificationTarget(const char* aMsg, const char* aTargetDescr,
|
|
|
|
Accessible* aTarget)
|
|
|
|
{
|
|
|
|
MsgBegin(sFocusTitle, aMsg);
|
|
|
|
AccessibleNNode(aTargetDescr, aTarget);
|
|
|
|
MsgEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::FocusNotificationTarget(const char* aMsg, const char* aTargetDescr,
|
|
|
|
nsINode* aTargetNode)
|
|
|
|
{
|
|
|
|
MsgBegin(sFocusTitle, aMsg);
|
|
|
|
Node(aTargetDescr, aTargetNode);
|
|
|
|
MsgEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::FocusNotificationTarget(const char* aMsg, const char* aTargetDescr,
|
|
|
|
nsISupports* aTargetThing)
|
|
|
|
{
|
|
|
|
MsgBegin(sFocusTitle, aMsg);
|
|
|
|
|
|
|
|
if (aTargetThing) {
|
|
|
|
nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTargetThing));
|
|
|
|
if (targetNode)
|
2012-10-11 19:13:18 +04:00
|
|
|
AccessibleNNode(aTargetDescr, targetNode);
|
2012-09-27 03:53:23 +04:00
|
|
|
else
|
|
|
|
printf(" %s: %p, window\n", aTargetDescr,
|
|
|
|
static_cast<void*>(aTargetThing));
|
|
|
|
}
|
|
|
|
|
|
|
|
MsgEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::ActiveItemChangeCausedBy(const char* aCause, Accessible* aTarget)
|
|
|
|
{
|
|
|
|
SubMsgBegin();
|
|
|
|
printf(" Caused by: %s\n", aCause);
|
|
|
|
AccessibleNNode("Item", aTarget);
|
|
|
|
SubMsgEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::ActiveWidget(Accessible* aWidget)
|
|
|
|
{
|
|
|
|
SubMsgBegin();
|
|
|
|
|
|
|
|
AccessibleNNode("Widget", aWidget);
|
|
|
|
printf(" Widget is active: %s, has operable items: %s\n",
|
|
|
|
(aWidget && aWidget->IsActiveWidget() ? "true" : "false"),
|
|
|
|
(aWidget && aWidget->AreItemsOperable() ? "true" : "false"));
|
|
|
|
|
|
|
|
SubMsgEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::FocusDispatched(Accessible* aTarget)
|
|
|
|
{
|
|
|
|
SubMsgBegin();
|
|
|
|
AccessibleNNode("A11y target", aTarget);
|
|
|
|
SubMsgEnd();
|
|
|
|
}
|
|
|
|
|
2012-06-02 05:58:44 +04:00
|
|
|
void
|
2014-02-12 05:18:31 +04:00
|
|
|
logging::SelChange(nsISelection* aSelection, DocAccessible* aDocument,
|
|
|
|
int16_t aReason)
|
2012-06-02 05:58:44 +04:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(aSelection));
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int16_t type = 0;
|
2012-06-02 05:58:44 +04:00
|
|
|
privSel->GetType(&type);
|
|
|
|
|
|
|
|
const char* strType = 0;
|
|
|
|
if (type == nsISelectionController::SELECTION_NORMAL)
|
|
|
|
strType = "normal";
|
|
|
|
else if (type == nsISelectionController::SELECTION_SPELLCHECK)
|
|
|
|
strType = "spellcheck";
|
|
|
|
else
|
|
|
|
strType = "unknown";
|
|
|
|
|
|
|
|
bool isIgnored = !aDocument || !aDocument->IsContentLoaded();
|
2014-02-12 05:18:31 +04:00
|
|
|
printf("\nSelection changed, selection type: %s, notification %s, reason: %d\n",
|
|
|
|
strType, (isIgnored ? "ignored" : "pending"), aReason);
|
|
|
|
|
|
|
|
Stack();
|
2012-06-02 05:58:44 +04:00
|
|
|
}
|
|
|
|
|
2016-03-01 21:07:20 +03:00
|
|
|
void
|
|
|
|
logging::TreeInfo(const char* aMsg, uint32_t aExtraFlags, ...)
|
|
|
|
{
|
|
|
|
if (IsEnabledAll(logging::eTree | aExtraFlags)) {
|
|
|
|
MsgBegin("TREE", aMsg);
|
|
|
|
|
|
|
|
va_list vl;
|
|
|
|
va_start(vl, aExtraFlags);
|
|
|
|
const char* descr = nullptr;
|
|
|
|
while ((descr = va_arg(vl, const char*))) {
|
|
|
|
AccessibleInfo(descr, va_arg(vl, Accessible*));
|
|
|
|
}
|
|
|
|
va_end(vl);
|
|
|
|
|
|
|
|
MsgEnd();
|
|
|
|
|
|
|
|
if (aExtraFlags & eStack) {
|
|
|
|
Stack();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::TreeInfo(const char* aMsg, uint32_t aExtraFlags,
|
|
|
|
const char* aMsg1, Accessible* aAcc,
|
|
|
|
const char* aMsg2, nsINode* aNode)
|
|
|
|
{
|
|
|
|
if (IsEnabledAll(logging::eTree | logging::eVerbose)) {
|
|
|
|
MsgBegin("TREE", aMsg);
|
|
|
|
AccessibleInfo(aMsg1, aAcc);
|
|
|
|
Accessible* acc = aAcc->Document()->GetAccessible(aNode);
|
|
|
|
if (acc) {
|
|
|
|
AccessibleInfo(aMsg2, acc);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Node(aMsg2, aNode);
|
|
|
|
}
|
|
|
|
MsgEnd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::TreeInfo(const char* aMsg, uint32_t aExtraFlags, Accessible* aParent)
|
|
|
|
{
|
|
|
|
if (IsEnabledAll(logging::eTree | aExtraFlags)) {
|
|
|
|
MsgBegin("TREE", aMsg);
|
|
|
|
AccessibleInfo("container", aParent);
|
|
|
|
for (uint32_t idx = 0; idx < aParent->ChildCount(); idx++) {
|
|
|
|
AccessibleInfo("child", aParent->GetChildAt(idx));
|
|
|
|
}
|
|
|
|
MsgEnd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-23 13:21:40 +04:00
|
|
|
void
|
2012-06-01 08:26:28 +04:00
|
|
|
logging::MsgBegin(const char* aTitle, const char* aMsgText, ...)
|
2012-05-23 13:21:40 +04:00
|
|
|
{
|
2012-06-01 08:26:28 +04:00
|
|
|
printf("\nA11Y %s: ", aTitle);
|
|
|
|
|
|
|
|
va_list argptr;
|
|
|
|
va_start(argptr, aMsgText);
|
|
|
|
vprintf(aMsgText, argptr);
|
|
|
|
va_end(argptr);
|
|
|
|
|
2012-09-27 03:53:23 +04:00
|
|
|
PRIntervalTime time = PR_IntervalNow();
|
|
|
|
uint32_t mins = (PR_IntervalToSeconds(time) / 60) % 60;
|
|
|
|
uint32_t secs = PR_IntervalToSeconds(time) % 60;
|
|
|
|
uint32_t msecs = PR_IntervalToMilliseconds(time) % 1000;
|
|
|
|
printf("; %02d:%02d.%03d", mins, secs, msecs);
|
|
|
|
|
2012-06-01 08:26:28 +04:00
|
|
|
printf("\n {\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::MsgEnd()
|
|
|
|
{
|
|
|
|
printf(" }\n");
|
2012-05-23 13:21:40 +04:00
|
|
|
}
|
|
|
|
|
2012-09-27 03:53:23 +04:00
|
|
|
void
|
|
|
|
logging::SubMsgBegin()
|
|
|
|
{
|
|
|
|
printf(" {\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::SubMsgEnd()
|
|
|
|
{
|
|
|
|
printf(" }\n");
|
|
|
|
}
|
|
|
|
|
2012-06-01 08:27:25 +04:00
|
|
|
void
|
|
|
|
logging::MsgEntry(const char* aEntryText, ...)
|
|
|
|
{
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
va_list argptr;
|
|
|
|
va_start(argptr, aEntryText);
|
|
|
|
vprintf(aEntryText, argptr);
|
|
|
|
va_end(argptr);
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
|
2012-05-23 13:21:40 +04:00
|
|
|
void
|
|
|
|
logging::Text(const char* aText)
|
|
|
|
{
|
|
|
|
printf(" %s\n", aText);
|
|
|
|
}
|
|
|
|
|
2012-06-01 08:27:25 +04:00
|
|
|
void
|
|
|
|
logging::Address(const char* aDescr, Accessible* aAcc)
|
|
|
|
{
|
2012-06-02 05:58:44 +04:00
|
|
|
if (!aAcc->IsDoc()) {
|
|
|
|
printf(" %s accessible: %p, node: %p\n", aDescr,
|
|
|
|
static_cast<void*>(aAcc), static_cast<void*>(aAcc->GetNode()));
|
|
|
|
}
|
|
|
|
|
|
|
|
DocAccessible* doc = aAcc->Document();
|
2012-10-12 06:25:34 +04:00
|
|
|
nsIDocument* docNode = doc->DocumentNode();
|
2012-06-02 05:58:44 +04:00
|
|
|
printf(" document: %p, node: %p\n",
|
2012-06-01 08:27:25 +04:00
|
|
|
static_cast<void*>(doc), static_cast<void*>(docNode));
|
2012-06-02 05:58:44 +04:00
|
|
|
|
2012-06-01 08:27:25 +04:00
|
|
|
printf(" ");
|
|
|
|
LogDocURI(docNode);
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::Node(const char* aDescr, nsINode* aNode)
|
|
|
|
{
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
if (!aNode) {
|
|
|
|
printf("%s: null\n", aDescr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aNode->IsNodeOfType(nsINode::eDOCUMENT)) {
|
|
|
|
printf("%s: %p, document\n", aDescr, static_cast<void*>(aNode));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-10-09 16:31:24 +04:00
|
|
|
nsINode* parentNode = aNode->GetParentNode();
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t idxInParent = parentNode ? parentNode->IndexOf(aNode) : - 1;
|
2012-06-01 08:27:25 +04:00
|
|
|
|
|
|
|
if (aNode->IsNodeOfType(nsINode::eTEXT)) {
|
|
|
|
printf("%s: %p, text node, idx in parent: %d\n",
|
|
|
|
aDescr, static_cast<void*>(aNode), idxInParent);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!aNode->IsElement()) {
|
|
|
|
printf("%s: %p, not accessible node type, idx in parent: %d\n",
|
|
|
|
aDescr, static_cast<void*>(aNode), idxInParent);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dom::Element* elm = aNode->AsElement();
|
|
|
|
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString tag;
|
2015-03-03 14:08:59 +03:00
|
|
|
elm->NodeInfo()->NameAtom()->ToUTF8String(tag);
|
2012-06-01 08:27:25 +04:00
|
|
|
|
|
|
|
nsIAtom* idAtom = elm->GetID();
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString id;
|
2012-06-01 08:27:25 +04:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2012-10-11 19:13:18 +04:00
|
|
|
void
|
|
|
|
logging::Document(DocAccessible* aDocument)
|
|
|
|
{
|
|
|
|
printf(" Document: %p, document node: %p\n",
|
|
|
|
static_cast<void*>(aDocument),
|
2012-10-12 06:25:34 +04:00
|
|
|
static_cast<void*>(aDocument->DocumentNode()));
|
2012-10-11 19:13:18 +04:00
|
|
|
|
|
|
|
printf(" Document ");
|
2012-10-12 06:25:34 +04:00
|
|
|
LogDocURI(aDocument->DocumentNode());
|
2012-10-11 19:13:18 +04:00
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
|
2016-03-01 21:07:20 +03:00
|
|
|
void
|
|
|
|
logging::AccessibleInfo(const char* aDescr, Accessible* aAccessible)
|
|
|
|
{
|
|
|
|
printf(" %s: %p; ", aDescr, static_cast<void*>(aAccessible));
|
|
|
|
if (!aAccessible) {
|
|
|
|
printf("\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (aAccessible->IsDefunct()) {
|
|
|
|
printf("defunct\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!aAccessible->Document() || aAccessible->Document()->IsDefunct()) {
|
|
|
|
printf("document is shutting down, no info\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAutoString role;
|
|
|
|
GetAccService()->GetStringRole(aAccessible->Role(), role);
|
|
|
|
printf("role: %s", NS_ConvertUTF16toUTF8(role).get());
|
|
|
|
|
|
|
|
nsAutoString name;
|
|
|
|
aAccessible->Name(name);
|
|
|
|
if (!name.IsEmpty()) {
|
|
|
|
printf(", name: '%s'", NS_ConvertUTF16toUTF8(name).get());
|
|
|
|
}
|
|
|
|
|
|
|
|
printf(", idx: %d", aAccessible->IndexInParent());
|
|
|
|
|
|
|
|
nsINode* node = aAccessible->GetNode();
|
|
|
|
if (!node) {
|
|
|
|
printf(", node: null\n");
|
|
|
|
}
|
|
|
|
else if (node->IsNodeOfType(nsINode::eDOCUMENT)) {
|
|
|
|
printf(", document node: %p\n", static_cast<void*>(node));
|
|
|
|
}
|
|
|
|
else if (node->IsNodeOfType(nsINode::eTEXT)) {
|
|
|
|
printf(", text node: %p\n", static_cast<void*>(node));
|
|
|
|
}
|
|
|
|
else if (node->IsElement()) {
|
|
|
|
dom::Element* el = node->AsElement();
|
|
|
|
|
|
|
|
nsAutoCString tag;
|
|
|
|
el->NodeInfo()->NameAtom()->ToUTF8String(tag);
|
|
|
|
|
|
|
|
nsIAtom* idAtom = el->GetID();
|
|
|
|
nsAutoCString id;
|
|
|
|
if (idAtom) {
|
|
|
|
idAtom->ToUTF8String(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
printf(", element node: %p, %s@id='%s'\n",
|
|
|
|
static_cast<void*>(el), tag.get(), id.get());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-27 03:53:23 +04:00
|
|
|
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);
|
|
|
|
nsAutoString name;
|
|
|
|
aAccessible->Name(name);
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
2012-10-11 19:13:18 +04:00
|
|
|
Document(aAccessible->Document());
|
2012-09-27 03:53:23 +04:00
|
|
|
}
|
|
|
|
|
2012-10-05 17:00:28 +04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-11 19:13:18 +04:00
|
|
|
nsAutoCString nodeDescr("[not accessible] ");
|
2012-10-05 17:00:28 +04:00
|
|
|
nodeDescr.Append(aDescr);
|
|
|
|
Node(nodeDescr.get(), aNode);
|
2012-10-11 19:13:18 +04:00
|
|
|
|
|
|
|
if (document) {
|
|
|
|
Document(document);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
printf(" [contained by not accessible document]:\n");
|
|
|
|
LogDocInfo(aNode->OwnerDoc(), document);
|
|
|
|
printf("\n");
|
2012-10-05 17:00:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::DOMEvent(const char* aDescr, nsINode* aOrigTarget,
|
|
|
|
const nsAString& aEventType)
|
|
|
|
{
|
|
|
|
logging::MsgBegin("DOMEvents", "event '%s' %s",
|
|
|
|
NS_ConvertUTF16toUTF8(aEventType).get(), aDescr);
|
|
|
|
logging::AccessibleNNode("Target", aOrigTarget);
|
|
|
|
logging::MsgEnd();
|
|
|
|
}
|
|
|
|
|
2012-05-23 13:21:40 +04:00
|
|
|
void
|
|
|
|
logging::Stack()
|
|
|
|
{
|
2012-06-01 08:26:28 +04:00
|
|
|
if (IsEnabled(eStack)) {
|
|
|
|
printf(" stack: \n");
|
2014-02-27 01:36:36 +04:00
|
|
|
nsTraceRefcnt::WalkTheStack(stdout);
|
2012-06-01 08:26:28 +04:00
|
|
|
}
|
2012-05-23 13:21:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// namespace logging:: initialization
|
|
|
|
|
|
|
|
bool
|
2012-08-22 19:56:38 +04:00
|
|
|
logging::IsEnabled(uint32_t aModules)
|
2012-05-23 13:21:40 +04:00
|
|
|
{
|
|
|
|
return sModules & aModules;
|
|
|
|
}
|
|
|
|
|
2016-03-01 21:07:20 +03:00
|
|
|
bool
|
|
|
|
logging::IsEnabledAll(uint32_t aModules)
|
|
|
|
{
|
|
|
|
return (sModules & aModules) == aModules;
|
|
|
|
}
|
|
|
|
|
2012-11-04 06:19:56 +04:00
|
|
|
bool
|
|
|
|
logging::IsEnabled(const nsAString& aModuleStr)
|
|
|
|
{
|
|
|
|
for (unsigned int idx = 0; idx < ArrayLength(sModuleMap); idx++) {
|
|
|
|
if (aModuleStr.EqualsASCII(sModuleMap[idx].mStr))
|
|
|
|
return sModules & sModuleMap[idx].mModule;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-05-23 13:21:40 +04:00
|
|
|
void
|
|
|
|
logging::Enable(const nsAFlatCString& aModules)
|
|
|
|
{
|
|
|
|
EnableLogging(aModules.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
logging::CheckEnv()
|
|
|
|
{
|
|
|
|
EnableLogging(PR_GetEnv("A11YLOG"));
|
|
|
|
}
|