Bug 587960. XUL trees can have their methods called at werid times, so guard against that in test. r=roc

This commit is contained in:
Timothy Nikkel 2010-08-27 18:15:08 -05:00
Родитель 1fb49cac3b
Коммит db81d9e871
1 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -25,9 +25,9 @@ var view =
{
value: "",
rowCount: 8,
getCellText: function(row, column) { return treeData[row % 4][column.index]; },
getCellText: function(row, column) { return ((typeof treeData) != "undefined") ? treeData[row % 4][column.index] : ""; },
getCellValue: function(row, column) { return this.value; },
setCellText: function(row, column, val) { treeData[row % 4][column.index] = val; },
setCellText: function(row, column, val) { if ((typeof treeData) != "undefined") treeData[row % 4][column.index] = val; },
setCellValue: function(row, column, val) { this.value = val; },
setTree: function(tree) { this.tree = tree; },
isContainer: function(row) { return false; },
@ -37,7 +37,7 @@ var view =
isSorted: function(row) { return false; },
isSelectable: function(row, column) { return true; },
isEditable: function(row, column) { return row != 2 || column.index != 1; },
getProgressMode: function(row, column) { return Components.interfaces.nsITreeView.PROGRESS_NORMAL; },
getProgressMode: function(row, column) { return ((typeof Components) != "undefined") ? Components.interfaces.nsITreeView.PROGRESS_NORMAL : null; },
getParentIndex: function(row, column) { return -1; },
getLevel: function(row) { return 0; },
hasNextSibling: function(row, column) { return row != this.rowCount - 1; },
@ -47,6 +47,9 @@ var view =
getCellProperties: function(row, column, props) { },
getColumnProperties: function(column, props)
{
if ((typeof netscape) == "undefined")
return;
if (!column.index) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var atomService = Components.classes["@mozilla.org/atom-service;1"].
@ -61,6 +64,9 @@ function getCustomTreeViewCellInfo()
{
var obj = { rows: [] };
if ((typeof view) == "undefined" || (typeof treeData) == "undefined")
return;
for (var row = 0; row < view.rowCount; row++) {
var cellInfo = [ ];
for (var column = 0; column < 1; column++) {