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