Bug 677467 - focusedChild crashes on application accessible, r=tbsaunde

This commit is contained in:
Alexander Surkov committed 2011-08-09 18:31:31 +09:00
1 parent 329d813347
commit 11325229a3
6 files changed
+158 -4

No files matched your search

@@ -170,6 +170,18 @@ nsApplicationAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
return nsnull;
}
nsAccessible*
nsApplicationAccessible::FocusedChild()
{
if (gLastFocusedNode) {
nsAccessible* focusedChild =
GetAccService()->GetAccessible(gLastFocusedNode);
if (focusedChild && focusedChild->Parent() == this)
return focusedChild;
}
return nsnull;
}
NS_IMETHODIMP
nsApplicationAccessible::GetRelationByType(PRUint32 aRelationType,
nsIAccessibleRelation **aRelation)
@@ -122,8 +122,10 @@ public:
virtual PRUint32 NativeRole();
virtual PRUint64 State();
virtual PRUint64 NativeState();
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
EWhichChildAtPoint aWhichChild);
virtual nsAccessible* FocusedChild();
virtual void InvalidateChildren();
+1 -1
View File
@@ -47,6 +47,7 @@ DIRS = \
attributes \
editabletext \
events \
focus \
hyperlink \
hypertext \
name \
@@ -103,7 +104,6 @@ _TEST_FILES =\
test_nsIAccessNode_utils.html \
test_nsOuterDocAccessible.html \
test_role_nsHyperTextAcc.html \
test_takeFocus.html \
test_text_caret.html \
test_textboxes.html \
test_textboxes.xul \
@@ -0,0 +1,54 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Alexander Surkov <[email protected]> (original author)
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = accessible/focus
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES =\
test_focusedChild.html \
test_takeFocus.html \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
@@ -0,0 +1,85 @@
<html>
<head>
<title>nsIAccessible::focusedChild testing</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../states.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript">
function openWnd()
{
this.eventSeq = [ new invokerChecker(EVENT_FOCUS,
getDialogAccessible,
this) ];
this.invoke = function openWnd_invoke()
{
this.dialog = window.openDialog("about:mozilla",
"AboutMozilla",
"chrome,width=600,height=600");
}
this.finalCheck = function openWnd_finalCheck()
{
var app = getApplicationAccessible();
is(app.focusedChild, getDialogAccessible(this),
"Wrong focused child");
this.dialog.close();
}
this.getID = function openWnd_getID()
{
return "focusedChild for application accessible";
}
function getDialogAccessible(aInvoker)
{
return getAccessible(aInvoker.dialog.document);
}
}
//gA11yEventDumpToConsole = true;
var gQueue = null;
function doTest()
{
gQueue = new eventQueue();
gQueue.push(new openWnd());
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=677467"
title="focusedChild crashes on application accessible">
Mozilla Bug 677467
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
</body>
</html>
@@ -10,12 +10,13 @@
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="common.js"></script>
src="../common.js"></script>
<script type="application/javascript"
src="states.js"></script>
src="../states.js"></script>
<script type="application/javascript"
src="events.js"></script>
src="../events.js"></script>
<script type="application/javascript">
////////////////////////////////////////////////////////////////////////////