Source code

Revision control

Other Tools

1
<?xml version="1.0"?>
2
3
<!--
4
Any copyright is dedicated to the Public Domain.
6
-->
7
8
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
10
type="text/css"?>
11
12
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
13
<?xml-stylesheet href="chrome://browser/skin/places/tree-icons.css"?>
14
16
title="549491: 'The root node is never visible' exception when details of the root node are modified "
17
onload="runTest();">
18
19
<script type="application/javascript"
22
<script type="application/javascript" src="head.js" />
23
24
<body xmlns="http://www.w3.org/1999/xhtml" />
25
26
<tree id="tree"
27
is="places-tree"
28
flatList="true"
29
flex="1">
30
<treecols>
31
<treecol label="Title" id="title" anonid="title" primary="true" ordinal="1" flex="1"/>
32
<splitter class="tree-splitter"/>
33
<treecol label="Date" anonid="date" flex="1"/>
34
</treecols>
35
<treechildren flex="1"/>
36
</tree>
37
38
<script type="application/javascript"><![CDATA[
39
/**
40
* Bug 549491
42
*
43
* Ensures that changing the details of places tree's root-node doesn't
44
* throw.
45
*/
46
47
function runTest() {
48
SimpleTest.waitForExplicitFinish();
49
50
(async function() {
51
await PlacesUtils.history.clear();
52
53
await PlacesTestUtils.addVisits({
54
uri: Services.io.newURI("http://example.tld/"),
55
transition: PlacesUtils.history.TRANSITION_TYPED
56
});
57
58
// Make a history query.
59
let query = PlacesUtils.history.getNewQuery();
60
let opts = PlacesUtils.history.getNewQueryOptions();
61
let queryURI = PlacesUtils.history.queryToQueryString(query, opts);
62
63
// Setup the places tree contents.
64
let tree = document.getElementById("tree");
65
tree.place = queryURI;
66
67
let rootNode = tree.result.root;
68
let obs = tree.view.QueryInterface(Ci.nsINavHistoryResultObserver);
69
obs.nodeHistoryDetailsChanged(rootNode, rootNode.time, rootNode.accessCount);
70
obs.nodeTitleChanged(rootNode, rootNode.title);
71
ok(true, "No exceptions thrown");
72
73
// Cleanup.
74
await PlacesUtils.history.clear();
75
})().then(SimpleTest.finish);
76
}
77
]]></script>
78
</window>