Bug 708927 - enable events/test_focus_menu.xul partially, add more logging capabilities, r=tbsaunde

This commit is contained in:
Alexander Surkov 2012-10-05 22:00:28 +09:00
parent 73c1ee9ba7
commit 9b29da90ae
4 changed files with 62 additions and 21 deletions

View File

@ -695,11 +695,40 @@ logging::AccessibleNNode(const char* aDescr, Accessible* aAccessible)
static_cast<void*>(aAccessible->Document()),
static_cast<void*>(aAccessible->GetDocumentNode()));
printf(" Document");
printf(" Document ");
LogDocURI(static_cast<nsIDocument*>(aAccessible->GetDocumentNode()));
printf("\n");
}
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 ");
nodeDescr.Append(aDescr);
Node(nodeDescr.get(), aNode);
}
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();
}
void
logging::Stack()
{

View File

@ -153,6 +153,13 @@ void Node(const char* aDescr, nsINode* aNode);
* 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.
*/
void DOMEvent(const char* aDescr, nsINode* aOrigTarget,
const nsAString& aEventType);
/**
* Log the call stack, two spaces offset is used.

View File

@ -258,22 +258,18 @@ RootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
if (!origTargetNode)
return NS_OK;
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eDOMEvents)) {
nsAutoString eventType;
aDOMEvent->GetType(eventType);
logging::DOMEvent("handled", origTargetNode, eventType);
}
#endif
DocAccessible* document =
GetAccService()->GetDocAccessible(origTargetNode->OwnerDoc());
if (document) {
#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();
}
#endif
// Root accessible exists longer than any of its descendant documents so
// that we are guaranteed notification is processed before root accessible
// is destroyed.
@ -296,6 +292,11 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
nsAutoString eventType;
aDOMEvent->GetType(eventType);
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eDOMEvents))
logging::DOMEvent("processed", origTargetNode, eventType);
#endif
if (eventType.EqualsLiteral("popuphiding")) {
HandlePopupHidingEvent(origTargetNode);
return;

View File

@ -21,19 +21,11 @@
src="../events.js" />
<script type="application/javascript">
//gA11yEventDumpID = "eventdump"; // debug stuff
//gA11yEventDumpToConsole = true; // debug stuff
var gQueue = null;
function doTests()
{
// bug 708927 - test times out on Linux
if (LINUX) {
todo(false, "Reenable on Linux after fixing bug 708927!");
SimpleTest.finish();
return;
}
// Test focus events.
gQueue = new eventQueue();
@ -67,6 +59,13 @@
gQueue.push(new synthClick("vehicle", new focusChecker("vehicle")));
gQueue.push(new synthMouseMove("cycle", new focusChecker("cycle")));
// XXXbug708927 - test times out on Linux, see more info at
// https://bugzilla.mozilla.org/show_bug.cgi?id=708927#c360. If needed
// then enable logging below.
if (LINUX) {
todo(false, "Reenable on Linux after fixing bug 708927!");
} else {
// open submenu
gQueue.push(new synthRightKey("cycle", new focusChecker("tricycle")));
@ -78,6 +77,11 @@
// click menuitem to close menu, focus gets back to document
gQueue.push(new synthClick("tricycle", new focusChecker(document)));
}
//enableLogging("focus,DOMEvents,tree"); // logging for bug708927
//gQueue.onFinish = function() { disableLogging(); }
gQueue.invoke(); // Will call SimpleTest.finish();
}