tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_0_bug510634.xhtml (3443B)


      1 <?xml version="1.0"?>
      2 
      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/. -->
      6 
      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"?>
     10 
     11 <?xml-stylesheet href="chrome://browser/content/places/places.css"?>
     12 <?xml-stylesheet href="chrome://browser/skin/places/tree-icons.css"?>
     13 
     14 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     15        title="510634: Wrong icons on bookmarks sidebar"
     16        onload="runTest();">
     17 
     18  <script type="application/javascript"
     19          src="chrome://browser/content/places/places-tree.js"/>
     20  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
     21  <script type="application/javascript" src="head.js" />
     22 
     23  <body xmlns="http://www.w3.org/1999/xhtml" />
     24 
     25  <tree id="tree"
     26        is="places-tree"
     27        flex="1">
     28    <treecols>
     29      <treecol label="Title" id="title" anonid="title" primary="true" style="order: 1;" flex="1"/>
     30    </treecols>
     31    <treechildren flex="1"/>
     32  </tree>
     33 
     34  <script type="application/javascript">
     35  <![CDATA[
     36 
     37    /**
     38     * Bug 510634 -  Wrong icons on bookmarks sidebar
     39     * https://bugzilla.mozilla.org/show_bug.cgi?id=510634
     40     *
     41     * Ensures that properties for special queries are set on their tree nodes.
     42     */
     43 
     44    SimpleTest.waitForExplicitFinish();
     45 
     46    function runTest() {
     47      // Setup the places tree contents.
     48      let tree = document.getElementById("tree");
     49      tree.place = `place:type=${Ci.nsINavHistoryQueryOptions.RESULTS_AS_LEFT_PANE_QUERY}&excludeItems=1&expandQueries=0`;
     50 
     51      // The query-property is set on the title column for each row.
     52      let titleColumn = tree.columns.getColumnAt(0);
     53 
     54      // Open All Bookmarks
     55      tree.selectItems([PlacesUtils.virtualAllBookmarksGuid]);
     56      PlacesUtils.asContainer(tree.selectedNode).containerOpen = true;
     57      is(tree.selectedNode.uri,
     58         "place:type=" + Ci.nsINavHistoryQueryOptions.RESULTS_AS_ROOTS_QUERY,
     59         "Opened All Bookmarks");
     60 
     61      const topLevelGuids = [
     62        PlacesUtils.virtualHistoryGuid,
     63        PlacesUtils.virtualDownloadsGuid,
     64        PlacesUtils.virtualTagsGuid,
     65        PlacesUtils.virtualAllBookmarksGuid
     66      ];
     67 
     68      for (let queryName of topLevelGuids) {
     69        let found = false;
     70        for (let i = 0; i < tree.view.rowCount && !found; i++) {
     71          let rowProperties = tree.view.getCellProperties(i, titleColumn).split(" ");
     72          found = rowProperties.includes("OrganizerQuery_" + queryName);
     73        }
     74        ok(found, `OrganizerQuery_${queryName} is set`);
     75      }
     76 
     77      const folderGuids = [
     78        PlacesUtils.bookmarks.toolbarGuid,
     79        PlacesUtils.bookmarks.menuGuid,
     80        PlacesUtils.bookmarks.unfiledGuid,
     81      ];
     82 
     83      for (let guid of folderGuids) {
     84        let found = false;
     85        for (let i = 0; i < tree.view.rowCount && !found; i++) {
     86          let rowProperties = tree.view.getCellProperties(i, titleColumn).split(" ");
     87          found = rowProperties.includes("queryFolder_" + guid);
     88        }
     89        ok(found, `queryFolder_${guid} is set`);
     90      }
     91 
     92      // Close the root node
     93      tree.result.root.containerOpen = false;
     94 
     95      SimpleTest.finish();
     96    }
     97 
     98  ]]>
     99  </script>
    100 </window>