зеркало из https://github.com/mozilla/pjs.git
Bug 471493 - crash [@ nsPropertyTable::GetPropertyInternal], r=marcoz, davidb, rcampbell
This commit is contained in:
Родитель
e80b724768
Коммит
bcf9d02f7b
|
@ -318,10 +318,10 @@ NS_IMETHODIMP nsXULTreeAccessible::GetFocusedChild(nsIAccessible **aFocusedChild
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIAccessible::getChildAtPoint(in long x, in long y)
|
||||
// nsIAccessible::getDeepestChildAtPoint(in long x, in long y)
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
nsIAccessible **aAccessible)
|
||||
nsXULTreeAccessible::GetDeepestChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
nsIAccessible **aAccessible)
|
||||
{
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (!frame)
|
||||
|
@ -349,20 +349,12 @@ nsXULTreeAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
|||
// If we failed to find tree cell for the given point then it might be
|
||||
// tree columns.
|
||||
if (row == -1 || !column)
|
||||
return nsXULSelectableAccessible::GetChildAtPoint(aX, aY, aAccessible);
|
||||
return nsXULSelectableAccessible::
|
||||
GetDeepestChildAtPoint(aX, aY, aAccessible);
|
||||
|
||||
return GetCachedTreeitemAccessible(row, column, aAccessible);
|
||||
}
|
||||
|
||||
// nsIAccessible::getDeepestChildAtPoint(in long x, in long y)
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeAccessible::GetDeepestChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
nsIAccessible **aAccessible)
|
||||
{
|
||||
// Call getChildAtPoint until tree doesn't support complex content.
|
||||
return GetChildAtPoint(aX, aY, aAccessible);
|
||||
}
|
||||
|
||||
// Ask treeselection to get all selected children
|
||||
NS_IMETHODIMP nsXULTreeAccessible::GetSelectedChildren(nsIArray **_retval)
|
||||
{
|
||||
|
|
|
@ -70,8 +70,6 @@ public:
|
|||
NS_IMETHOD GetChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
|
||||
|
||||
NS_IMETHOD GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
nsIAccessible **aAccessible);
|
||||
NS_IMETHOD GetDeepestChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
nsIAccessible **aAccessible);
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="bug 471493 'crash [@ nsPropertyTable::GetPropertyInternal]'"
|
||||
onload="doTest();">
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
function doTest()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var accRetrieval = Components.classes["@mozilla.org/accessibleRetrieval;1"].
|
||||
getService(Components.interfaces.nsIAccessibleRetrieval);
|
||||
|
||||
var treecol = document.getElementById("col");
|
||||
var x = treecol.boxObject.screenX;
|
||||
var y = treecol.boxObject.screenY;
|
||||
|
||||
var tree = document.getElementById("tree");
|
||||
var treeAcc = accRetrieval.getAccessibleFor(tree);
|
||||
treeAcc.getChildAtPoint(x + 1, y + 1);
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<tree id="tree" flex="1">
|
||||
<treecols>
|
||||
<treecol id="col" flex="1" primary="true" label="column"/>
|
||||
<treecol id="scol" flex="1" label="column 2"/>
|
||||
</treecols>
|
||||
<treechildren id="treechildren"/>
|
||||
</tree>
|
||||
|
||||
</window>
|
||||
|
|
@ -0,0 +1 @@
|
|||
load 471493.xul
|
|
@ -51,6 +51,7 @@ _TEST_FILES =\
|
|||
attributes.js \
|
||||
common.js \
|
||||
events.js \
|
||||
layout.js \
|
||||
namerules.xml \
|
||||
nsIAccessible_actions.js \
|
||||
nsIAccessible_name.css \
|
||||
|
@ -66,6 +67,7 @@ _TEST_FILES =\
|
|||
test_aria_role_equation.html \
|
||||
test_aria_token_attrs.html \
|
||||
test_bug420863.html \
|
||||
test_childAtPoint.xul \
|
||||
test_cssattrs.html \
|
||||
test_events_caretmove.html \
|
||||
test_events_mutation.html \
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* Tests if the given accessible at the given point is expected.
|
||||
*
|
||||
* @param aIdentifier [in] accessible identifier
|
||||
* @param aX [in] x coordinate of the point relative accessible
|
||||
* @param aY [in] y coordinate of the point relative accessible
|
||||
* @param aFindDeepestChild [in] points whether deepest or nearest child should
|
||||
* be returned
|
||||
* @param aChildIdentifier [in] expected child accessible
|
||||
*/
|
||||
function testChildAtPoint(aIdentifier, aX, aY, aFindDeepestChild,
|
||||
aChildIdentifier)
|
||||
{
|
||||
var childAcc = getAccessible(aChildIdentifier);
|
||||
if (!childAcc)
|
||||
return;
|
||||
|
||||
var actualChildAcc = getChildAtPoint(aIdentifier, aX, aY, aFindDeepestChild);
|
||||
is(childAcc, actualChildAcc,
|
||||
"Wrong child accessible at the point (" + aX + ", " + aY + ") of accessible '" + prettyName(aIdentifier)) + "'";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return child accessible at the given point.
|
||||
*
|
||||
* @param aIdentifier [in] accessible identifier
|
||||
* @param aX [in] x coordinate of the point relative accessible
|
||||
* @param aY [in] y coordinate of the point relative accessible
|
||||
* @param aFindDeepestChild [in] points whether deepest or nearest child should
|
||||
* be returned
|
||||
* @return the child accessible at the given point
|
||||
*/
|
||||
function getChildAtPoint(aIdentifier, aX, aY, aFindDeepestChild)
|
||||
{
|
||||
var nodeObj = { value: null };
|
||||
var acc = getAccessible(aIdentifier, null, nodeObj);
|
||||
var node = nodeObj.value;
|
||||
|
||||
if (!acc || !node)
|
||||
return;
|
||||
|
||||
var deltaX = node.boxObject.screenX;
|
||||
var deltaY = node.boxObject.screenY;
|
||||
|
||||
var x = deltaX + aX;
|
||||
var y = deltaY + aY;
|
||||
|
||||
try {
|
||||
if (aFindDeepestChild)
|
||||
return acc.getDeepestChildAtPoint(x, y);
|
||||
return acc.getChildAtPoint(x, y);
|
||||
} catch (e) { }
|
||||
|
||||
return null;
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="nsIAccessible::getChildAtPoint and getDeepestChildAtPoint">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/treeview.js" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/layout.js" />
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
function doTest()
|
||||
{
|
||||
// Initialize the tree
|
||||
var view = new inTreeView();
|
||||
view.mRowCount = 5;
|
||||
|
||||
var tree = getNode("tree");
|
||||
var treeBox = tree.treeBoxObject;
|
||||
treeBox.view = view;
|
||||
|
||||
// Tests
|
||||
var treecols = getNode("treecols");
|
||||
var x = treecols.boxObject.x;
|
||||
var y = treecols.boxObject.y;
|
||||
|
||||
testChildAtPoint(tree, x, y, false, treecols);
|
||||
testChildAtPoint(tree, x, y, true, "col1");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<hbox flex="1" style="overflow: auto;">
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=471493"
|
||||
title=" crash [@ nsPropertyTable::GetPropertyInternal]">
|
||||
Mozilla Bug 471493
|
||||
</a><br/>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<tree id="tree" flex="1">
|
||||
<treecols id="treecols">
|
||||
<treecol id="col1" flex="1" primary="true" label="column"/>
|
||||
<treecol id="col2" flex="1" label="column 2"/>
|
||||
</treecols>
|
||||
<treechildren id="treechildren"/>
|
||||
</tree>
|
||||
</hbox>
|
||||
|
||||
</window>
|
||||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
include ../../testing/crashtest/sanity/crashtests.list
|
||||
|
||||
include ../../accessible/tests/crashtests/crashtests.list
|
||||
|
||||
include ../../content/base/crashtests/crashtests.list
|
||||
include ../../content/canvas/crashtests/crashtests.list
|
||||
include ../../content/events/crashtests/crashtests.list
|
||||
|
|
Загрузка…
Ссылка в новой задаче