зеркало из https://github.com/mozilla/pjs.git
Bug 738635 - fix XUL tree accessible leak and add XUL tree mochitest sugar, r=marcoz
This commit is contained in:
Родитель
750cb23e3c
Коммит
1a037afb2c
|
@ -92,12 +92,16 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULTreeAccessible)
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULTreeAccessible,
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULTreeAccessible,
|
||||||
nsAccessible)
|
nsAccessible)
|
||||||
CycleCollectorTraverseCache(tmp->mAccessibleCache, &cb);
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTree)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTreeView)
|
||||||
|
CycleCollectorTraverseCache(tmp->mAccessibleCache, &cb);
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeAccessible,
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeAccessible,
|
||||||
nsAccessible)
|
nsAccessible)
|
||||||
ClearCache(tmp->mAccessibleCache);
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTree)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTreeView)
|
||||||
|
ClearCache(tmp->mAccessibleCache);
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsXULTreeAccessible)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsXULTreeAccessible)
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
// gA11yEventDumpID = "debug";
|
// gA11yEventDumpID = "debug";
|
||||||
//gA11yEventDumpToConsole = true; // debug
|
//gA11yEventDumpToConsole = true; // debug
|
||||||
|
|
||||||
function doTestActions()
|
function doTest()
|
||||||
{
|
{
|
||||||
var treeNode = getNode("tree");
|
var treeNode = getNode("tree");
|
||||||
|
|
||||||
|
@ -91,15 +91,8 @@
|
||||||
testActions(actions); // Will call SimpleTest.finish();
|
testActions(actions); // Will call SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
function doTest()
|
|
||||||
{
|
|
||||||
var treeNode = getNode("tree");
|
|
||||||
waitForEvent(EVENT_REORDER, treeNode, doTestActions);
|
|
||||||
treeNode.view = new nsTreeTreeView();
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
addA11yLoadEvent(doTest);
|
addA11yXULTreeLoadEvent(doTest, "tree", new nsTreeTreeView());
|
||||||
]]>
|
]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Test
|
// Test
|
||||||
|
|
||||||
function doTestAttrs()
|
function doTest()
|
||||||
{
|
{
|
||||||
var treeNode = getNode("tree");
|
var treeNode = getNode("tree");
|
||||||
|
|
||||||
|
@ -50,15 +50,8 @@
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
function doTest()
|
|
||||||
{
|
|
||||||
var treeNode = getNode("tree");
|
|
||||||
waitForEvent(EVENT_REORDER, treeNode, doTestAttrs);
|
|
||||||
treeNode.view = new nsTreeTreeView();
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
addA11yLoadEvent(doTest);
|
addA11yXULTreeLoadEvent(doTest, "tree", new nsTreeTreeView());
|
||||||
]]>
|
]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -29,23 +29,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Invokers
|
// Invokers
|
||||||
|
|
||||||
function setTreeView(aTreeID, aView)
|
|
||||||
{
|
|
||||||
this.DOMNode = getNode(aTreeID);
|
|
||||||
|
|
||||||
this.eventSeq = [
|
|
||||||
new invokerChecker(EVENT_REORDER, this.DOMNode)
|
|
||||||
];
|
|
||||||
|
|
||||||
this.invoke = function setTreeView_invoke()
|
|
||||||
{
|
|
||||||
this.DOMNode.treeBoxObject.view = aView;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.getID = function setTreeView_getID()
|
|
||||||
{ return "set tree view for " + prettyName(aTreeID); }
|
|
||||||
};
|
|
||||||
|
|
||||||
function focusTree(aTreeID)
|
function focusTree(aTreeID)
|
||||||
{
|
{
|
||||||
var checker = new focusChecker(getFirstTreeItem, aTreeID);
|
var checker = new focusChecker(getFirstTreeItem, aTreeID);
|
||||||
|
@ -82,7 +65,6 @@
|
||||||
{
|
{
|
||||||
gQueue = new eventQueue();
|
gQueue = new eventQueue();
|
||||||
|
|
||||||
gQueue.push(new setTreeView("tree", new nsTableTreeView(5)));
|
|
||||||
gQueue.push(new focusTree("tree"));
|
gQueue.push(new focusTree("tree"));
|
||||||
gQueue.push(new moveToNextItem("tree"));
|
gQueue.push(new moveToNextItem("tree"));
|
||||||
gQueue.push(new synthFocus("emptytree"));
|
gQueue.push(new synthFocus("emptytree"));
|
||||||
|
@ -94,7 +76,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
addA11yLoadEvent(doTest);
|
addA11yXULTreeLoadEvent(doTest, "tree", new nsTableTreeView(5));
|
||||||
]]>
|
]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -26,23 +26,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Invokers
|
// Invokers
|
||||||
|
|
||||||
function setTreeView(aTreeID, aView)
|
|
||||||
{
|
|
||||||
this.DOMNode = getNode(aTreeID);
|
|
||||||
|
|
||||||
this.eventSeq = [
|
|
||||||
new invokerChecker(EVENT_REORDER, this.DOMNode)
|
|
||||||
];
|
|
||||||
|
|
||||||
this.invoke = function setTreeView_invoke()
|
|
||||||
{
|
|
||||||
this.DOMNode.treeBoxObject.view = aView;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.getID = function setTreeView_getID()
|
|
||||||
{ return "set tree view for " + prettyName(aTreeID); }
|
|
||||||
};
|
|
||||||
|
|
||||||
function takeFocusInvoker(aID, aArgConverterFunc)
|
function takeFocusInvoker(aID, aArgConverterFunc)
|
||||||
{
|
{
|
||||||
this.targetFunc = aArgConverterFunc ? aArgConverterFunc : getAccessible;
|
this.targetFunc = aArgConverterFunc ? aArgConverterFunc : getAccessible;
|
||||||
|
@ -77,7 +60,6 @@
|
||||||
// Test focus events.
|
// Test focus events.
|
||||||
gQueue = new eventQueue();
|
gQueue = new eventQueue();
|
||||||
|
|
||||||
gQueue.push(new setTreeView("tree", new nsTableTreeView(5)));
|
|
||||||
gQueue.push(new takeFocusInvoker("tree", getLastChild));
|
gQueue.push(new takeFocusInvoker("tree", getLastChild));
|
||||||
gQueue.push(new takeFocusInvoker("listitem2"));
|
gQueue.push(new takeFocusInvoker("listitem2"));
|
||||||
|
|
||||||
|
@ -85,7 +67,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
addA11yLoadEvent(doTests);
|
addA11yXULTreeLoadEvent(doTests, "tree", new nsTableTreeView(5));
|
||||||
]]>
|
]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="../common.js" />
|
src="../common.js" />
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="../events.js" />
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="../layout.js" />
|
src="../layout.js" />
|
||||||
|
|
||||||
|
@ -21,26 +23,13 @@
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
function doTest()
|
function doTest()
|
||||||
{
|
{
|
||||||
// Initialize the tree
|
hitTest("tree", "treecols", "col1");
|
||||||
var view = new nsTableTreeView(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.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
addA11yLoadEvent(doTest);
|
addA11yXULTreeLoadEvent(doTest, "tree", new nsTableTreeView(5));
|
||||||
]]>
|
]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Test
|
// Test
|
||||||
|
|
||||||
function doTestRelations()
|
function doTest()
|
||||||
{
|
{
|
||||||
var treeNode = getNode("tree");
|
var treeNode = getNode("tree");
|
||||||
|
|
||||||
|
@ -54,15 +54,8 @@
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
function doTest()
|
|
||||||
{
|
|
||||||
var treeNode = getNode("tree");
|
|
||||||
waitForEvent(EVENT_REORDER, treeNode, doTestRelations);
|
|
||||||
treeNode.view = new nsTreeTreeView();
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
addA11yLoadEvent(doTest);
|
addA11yXULTreeLoadEvent(doTest, "tree", new nsTreeTreeView());
|
||||||
]]>
|
]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -24,26 +24,11 @@
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Test
|
// Test
|
||||||
|
|
||||||
var gTree = null;
|
|
||||||
var gTreeBox = null;
|
|
||||||
var gTreeView = null;
|
|
||||||
|
|
||||||
// gA11yEventDumpID = "debug";
|
// gA11yEventDumpID = "debug";
|
||||||
|
|
||||||
function doTest()
|
function doTest()
|
||||||
{
|
{
|
||||||
// Initialize the tree
|
var treeAcc = getAccessible("tree", [nsIAccessibleTable]);
|
||||||
gTree = document.getElementById("tree");
|
|
||||||
gTreeBox = gTree.treeBoxObject;
|
|
||||||
gView = new nsTableTreeView(3);
|
|
||||||
|
|
||||||
waitForEvent(EVENT_REORDER, gTree, continueTest);
|
|
||||||
gTreeBox.view = gView;
|
|
||||||
}
|
|
||||||
|
|
||||||
function continueTest()
|
|
||||||
{
|
|
||||||
var treeAcc = getAccessible(gTree, [nsIAccessibleTable]);
|
|
||||||
|
|
||||||
var headerInfoMap = [
|
var headerInfoMap = [
|
||||||
{
|
{
|
||||||
|
@ -84,7 +69,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
addA11yLoadEvent(doTest);
|
addA11yXULTreeLoadEvent(doTest, "tree", new nsTableTreeView(3));
|
||||||
]]>
|
]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -24,37 +24,22 @@
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Test
|
// Test
|
||||||
|
|
||||||
var gTree = null;
|
|
||||||
var gTreeBox = null;
|
|
||||||
var gTreeView = null;
|
|
||||||
|
|
||||||
// gA11yEventDumpID = "debug";
|
// gA11yEventDumpID = "debug";
|
||||||
|
|
||||||
function doTest()
|
function doTest()
|
||||||
{
|
|
||||||
// Initialize the tree
|
|
||||||
gTree = document.getElementById("tree");
|
|
||||||
gTreeBox = gTree.treeBoxObject;
|
|
||||||
gView = new nsTableTreeView(3);
|
|
||||||
|
|
||||||
waitForEvent(EVENT_REORDER, gTree, continueTest);
|
|
||||||
gTreeBox.view = gView;
|
|
||||||
}
|
|
||||||
|
|
||||||
function continueTest()
|
|
||||||
{
|
{
|
||||||
var idxes = [
|
var idxes = [
|
||||||
[0, 1],
|
[0, 1],
|
||||||
[2, 3],
|
[2, 3],
|
||||||
[4, 5]
|
[4, 5]
|
||||||
];
|
];
|
||||||
testTableIndexes(gTree, idxes);
|
testTableIndexes("tree", idxes);
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
addA11yLoadEvent(doTest);
|
addA11yXULTreeLoadEvent(doTest, "tree", new nsTableTreeView(3));
|
||||||
]]>
|
]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -26,24 +26,9 @@
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Test
|
// Test
|
||||||
|
|
||||||
var gTree = null;
|
|
||||||
var gTreeBox = null;
|
|
||||||
var gTreeView = null;
|
|
||||||
|
|
||||||
// gA11yEventDumpID = "debug";
|
// gA11yEventDumpID = "debug";
|
||||||
|
|
||||||
function doTest()
|
function doTest()
|
||||||
{
|
|
||||||
// Initialize the tree
|
|
||||||
gTree = document.getElementById("tree");
|
|
||||||
gTreeBox = gTree.treeBoxObject;
|
|
||||||
gView = new nsTableTreeView(3);
|
|
||||||
|
|
||||||
waitForEvent(EVENT_REORDER, gTree, continueTest);
|
|
||||||
gTreeBox.view = gView;
|
|
||||||
}
|
|
||||||
|
|
||||||
function continueTest()
|
|
||||||
{
|
{
|
||||||
var cellsArray =
|
var cellsArray =
|
||||||
[
|
[
|
||||||
|
@ -52,15 +37,15 @@
|
||||||
[false, false]
|
[false, false]
|
||||||
];
|
];
|
||||||
|
|
||||||
testTableSelection(gTree, cellsArray);
|
testTableSelection("tree", cellsArray);
|
||||||
testSelectTableRow(gTree, 0, cellsArray);
|
testSelectTableRow("tree", 0, cellsArray);
|
||||||
testUnselectTableRow(gTree, 0, cellsArray);
|
testUnselectTableRow("tree", 0, cellsArray);
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
addA11yLoadEvent(doTest);
|
addA11yXULTreeLoadEvent(doTest, "tree", new nsTableTreeView(3));
|
||||||
]]>
|
]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -26,24 +26,9 @@
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Test
|
// Test
|
||||||
|
|
||||||
var gTree = null;
|
|
||||||
var gTreeBox = null;
|
|
||||||
var gTreeView = null;
|
|
||||||
|
|
||||||
// gA11yEventDumpID = "debug";
|
// gA11yEventDumpID = "debug";
|
||||||
|
|
||||||
function doTest()
|
function doTest()
|
||||||
{
|
|
||||||
// Initialize the tree
|
|
||||||
gTree = document.getElementById("table");
|
|
||||||
gTreeBox = gTree.treeBoxObject;
|
|
||||||
gView = new nsTableTreeView(3);
|
|
||||||
|
|
||||||
waitForEvent(EVENT_REORDER, gTree, continueTest);
|
|
||||||
gTreeBox.view = gView;
|
|
||||||
}
|
|
||||||
|
|
||||||
function continueTest()
|
|
||||||
{
|
{
|
||||||
var cellsArray = [
|
var cellsArray = [
|
||||||
[kDataCell, kDataCell],
|
[kDataCell, kDataCell],
|
||||||
|
@ -51,13 +36,13 @@
|
||||||
[kDataCell, kDataCell]
|
[kDataCell, kDataCell]
|
||||||
];
|
];
|
||||||
|
|
||||||
testTableStruct(gTree, cellsArray, kTreeColumnHeader);
|
testTableStruct("table", cellsArray, kTreeColumnHeader);
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
addA11yLoadEvent(doTest);
|
addA11yXULTreeLoadEvent(doTest, "table", new nsTableTreeView(3));
|
||||||
]]>
|
]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,44 @@
|
||||||
|
/**
|
||||||
|
* Helper method to start a single XUL tree test.
|
||||||
|
*/
|
||||||
|
var gXULTreeLoadQueue = null;
|
||||||
|
function addA11yXULTreeLoadEvent(aDoTestFunc, aTreeID, aTreeView)
|
||||||
|
{
|
||||||
|
function loadXULTree(aTreeID, aTreeView)
|
||||||
|
{
|
||||||
|
this.treeNode = getNode(aTreeID);
|
||||||
|
|
||||||
|
this.eventSeq = [
|
||||||
|
new invokerChecker(EVENT_REORDER, this.treeNode)
|
||||||
|
];
|
||||||
|
|
||||||
|
this.invoke = function loadXULTree_invoke()
|
||||||
|
{
|
||||||
|
this.treeNode.treeBoxObject.view = aTreeView;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getID = function loadXULTree_getID()
|
||||||
|
{
|
||||||
|
return "Load XUL tree " + prettyName(aTreeID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function doXULTreeTest()
|
||||||
|
{
|
||||||
|
gXULTreeLoadQueue = new eventQueue();
|
||||||
|
gXULTreeLoadQueue.push(new loadXULTree(aTreeID, aTreeView));
|
||||||
|
gXULTreeLoadQueue.onFinish = function()
|
||||||
|
{
|
||||||
|
SimpleTest.executeSoon(aDoTestFunc);
|
||||||
|
return DO_NOT_FINISH_TEST;
|
||||||
|
}
|
||||||
|
gXULTreeLoadQueue.invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
addA11yLoadEvent(doXULTreeTest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function nsTableTreeView(aRowCount)
|
function nsTableTreeView(aRowCount)
|
||||||
{
|
{
|
||||||
this.__proto__ = new nsTreeView();
|
this.__proto__ = new nsTreeView();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче