Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <?xml version="1.0"?>
3 <!-- This Source Code Form is subject to the terms of the Mozilla Public
4 - License, v. 2.0. If a copy of the MPL was not distributed with this
5 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
7 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
8 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
9 type="text/css"?>
11 <?xml-stylesheet href="chrome://browser/content/places/places.css"?>
12 <?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
13 <?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
15 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
16 title="510634: Wrong icons on bookmarks sidebar"
17 onload="runTest();">
19 <script type="application/javascript"
20 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
22 <body xmlns="http://www.w3.org/1999/xhtml" />
24 <tree id="tree"
25 type="places"
26 flex="1">
27 <treecols>
28 <treecol label="Title" id="title" anonid="title" primary="true" ordinal="1" flex="1"/>
29 </treecols>
30 <treechildren flex="1"/>
31 </tree>
33 <script type="application/javascript">
34 <![CDATA[
36 /**
37 * Bug 510634 - Wrong icons on bookmarks sidebar
38 * https://bugzilla.mozilla.org/show_bug.cgi?id=510634
39 *
40 * Ensures that properties for special queries are set on their tree nodes,
41 * even if PlacesUIUtils.leftPaneFolderId was not initialized.
42 */
44 SimpleTest.waitForExplicitFinish();
46 // converts nsISupportsArray of atoms to a simple JS-strings array
47 function runTest() {
48 // We need to cache and restore this getter in order to simulate
49 // Bug 510634
50 let cachedLeftPaneFolderIdGetter =
51 PlacesUIUtils.__lookupGetter__("leftPaneFolderId");
52 // Must also cache and restore this getter as it is affected by
53 // leftPaneFolderId, from bug 564900.
54 let cachedAllBookmarksFolderIdGetter =
55 PlacesUIUtils.__lookupGetter__("allBookmarksFolderId");
57 let leftPaneFolderId = PlacesUIUtils.leftPaneFolderId;
59 // restore the getter
60 PlacesUIUtils.__defineGetter__("leftPaneFolderId", cachedLeftPaneFolderIdGetter);
62 // Setup the places tree contents.
63 let tree = document.getElementById("tree");
64 tree.place = "place:queryType=1&folder=" + leftPaneFolderId;
66 // The query-property is set on the title column for each row.
67 let titleColumn = tree.treeBoxObject.columns.getColumnAt(0);
69 // Open All Bookmarks
70 tree.selectItems([PlacesUIUtils.leftPaneQueries["AllBookmarks"]]);
71 PlacesUtils.asContainer(tree.selectedNode).containerOpen = true;
72 is(PlacesUIUtils.allBookmarksFolderId, tree.selectedNode.itemId,
73 "Opened All Bookmarks");
75 ["History", "Downloads", "Tags", "AllBookmarks", "BookmarksToolbar",
76 "BookmarksMenu", "UnfiledBookmarks"].forEach(
77 function(aQueryName, aRow) {
78 let found = false;
79 for (let i = 0; i < tree.view.rowCount && !found; i++) {
80 rowProperties = tree.view.getCellProperties(i, titleColumn).split(" ");
81 found = rowProperties.indexOf("OrganizerQuery_" + aQueryName) != -1;
82 }
83 ok(found, "OrganizerQuery_" + aQueryName + " is set");
84 }
85 );
87 // Close the root node
88 tree.result.root.containerOpen = false;
90 // Restore the getters for the next test.
91 PlacesUIUtils.__defineGetter__("leftPaneFolderId", cachedLeftPaneFolderIdGetter);
92 PlacesUIUtils.__defineGetter__("allBookmarksFolderId",
93 cachedAllBookmarksFolderIdGetter);
95 SimpleTest.finish();
96 }
98 ]]>
99 </script>
100 </window>