tor-browser

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

test_bug549491.xhtml (2650B)


      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/tree-icons.css"?>
     14 
     15 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     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"
     20          src="chrome://browser/content/places/places-tree.js"/>
     21  <script 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        is="places-tree"
     28        flatList="true"
     29        flex="1">
     30    <treecols>
     31      <treecol label="Title" id="title" anonid="title" primary="true" style="order: 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    function runTest() {
     48      SimpleTest.waitForExplicitFinish();
     49 
     50      (async function() {
     51        await PlacesUtils.history.clear();
     52 
     53        await PlacesTestUtils.addVisits({
     54          uri: Services.io.newURI("https://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>