Bug 746221 - Pull properties for comparison off the prototype to avoid mismatches with expandos. r=past a=test-only

This commit is contained in:
Bobby Holley 2012-04-18 10:09:07 +02:00
parent f4b524921e
commit f7ec058d6b

View File

@ -70,13 +70,18 @@ function autocompletePopupHidden()
is(completeNode.value, testStr + "dy", "completeNode is empty");
jsterm.setInputValue("");
// Check the property panel as well.
// Check the property panel as well. It's a bit gross to parse the properties
// out of the treeView cell text, but nsITreeView doesn't give us a good
// structured way to get at the data. :-(
let propPanel = jsterm.openPropertyPanel("Test", content.document);
let docProps = 0;
for (let prop in content.document) {
docProps++;
}
is (propPanel.treeView.rowCount, docProps, "all document properties shown in propertyPanel");
let propPanelProps = [];
for (let idx = 0; idx < propPanel.treeView.rowCount; ++idx)
propPanelProps.push(propPanel.treeView.getCellText(idx, null).split(':')[0]);
// NB: We pull the properties off the prototype, rather than off object itself,
// so that expandos like |constructor|, which the propPanel can't see, are not
// included.
for (let prop in Object.getPrototypeOf(content.document))
ok(propPanelProps.indexOf(prop) != -1, "Property |" + prop + "| should be reflected in propertyPanel");
let treeRows = propPanel.treeView._rows;
is (treeRows[30].display, "body: Object", "found document.body");