|
1 <?xml version="1.0"?> |
|
2 |
|
3 <!-- |
|
4 Any copyright is dedicated to the Public Domain. |
|
5 http://creativecommons.org/licenses/publicdomain/ |
|
6 --> |
|
7 |
|
8 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
|
9 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
|
10 type="text/css"?> |
|
11 |
|
12 <?xml-stylesheet href="chrome://browser/content/places/places.css"?> |
|
13 <?xml-stylesheet href="chrome://browser/skin/places/places.css"?> |
|
14 <?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?> |
|
15 |
|
16 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
|
17 title="549491: 'The root node is never visible' exception when details of the root node are modified " |
|
18 onload="runTest();"> |
|
19 |
|
20 <script type="application/javascript" |
|
21 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
|
22 <script type="application/javascript" src="head.js" /> |
|
23 |
|
24 <body xmlns="http://www.w3.org/1999/xhtml" /> |
|
25 |
|
26 <tree id="tree" |
|
27 type="places" |
|
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 |
|
41 * https://bugzilla.mozilla.org/show_bug.cgi?id=549491 |
|
42 * |
|
43 * Ensures that changing the details of places tree's root-node doesn't |
|
44 * throw. |
|
45 */ |
|
46 |
|
47 SimpleTest.waitForExplicitFinish(); |
|
48 |
|
49 function runTest() { |
|
50 // The mochitest page is added to history. |
|
51 waitForClearHistory(continue_test); |
|
52 } |
|
53 |
|
54 function continue_test() { |
|
55 addVisits( |
|
56 {uri: Services.io.newURI("http://example.tld/", null, null), |
|
57 transition: PlacesUtils.history.TRANSITION_TYPED}, |
|
58 function() { |
|
59 // Make a history query. |
|
60 let query = PlacesUtils.history.getNewQuery(); |
|
61 let opts = PlacesUtils.history.getNewQueryOptions(); |
|
62 let queryURI = PlacesUtils.history.queriesToQueryString([query], 1, opts); |
|
63 |
|
64 // Setup the places tree contents. |
|
65 let tree = document.getElementById("tree"); |
|
66 tree.place = queryURI; |
|
67 |
|
68 let rootNode = tree.result.root; |
|
69 let obs = tree.view.QueryInterface(Ci.nsINavHistoryResultObserver); |
|
70 obs.nodeHistoryDetailsChanged(rootNode, rootNode.time, rootNode.accessCount); |
|
71 obs.nodeTitleChanged(rootNode, rootNode.title); |
|
72 ok(true, "No exceptions thrown"); |
|
73 |
|
74 // Cleanup. |
|
75 waitForClearHistory(SimpleTest.finish); |
|
76 }); |
|
77 } |
|
78 |
|
79 /** |
|
80 * Clears history invoking callback when done. |
|
81 */ |
|
82 function waitForClearHistory(aCallback) { |
|
83 const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished"; |
|
84 let observer = { |
|
85 observe: function(aSubject, aTopic, aData) { |
|
86 Services.obs.removeObserver(this, TOPIC_EXPIRATION_FINISHED); |
|
87 aCallback(); |
|
88 } |
|
89 }; |
|
90 Services.obs.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false); |
|
91 let hs = Cc["@mozilla.org/browser/nav-history-service;1"]. |
|
92 getService(Ci.nsINavHistoryService); |
|
93 hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages(); |
|
94 } |
|
95 |
|
96 ]]></script> |
|
97 </window> |