browser/components/places/tests/chrome/test_bug549491.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 <!--
     4     Any copyright is dedicated to the Public Domain.
     5     http://creativecommons.org/licenses/publicdomain/
     6    -->
     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"?>
    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"?>
    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();">
    20   <script type="application/javascript"
    21           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    22   <script type="application/javascript" src="head.js" />
    24   <body xmlns="http://www.w3.org/1999/xhtml" />
    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>
    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      */
    47     SimpleTest.waitForExplicitFinish();
    49     function runTest() {
    50       // The mochitest page is added to history.
    51       waitForClearHistory(continue_test);
    52     }
    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);
    64           // Setup the places tree contents.
    65           let tree = document.getElementById("tree");
    66           tree.place = queryURI;
    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");
    74           // Cleanup.
    75           waitForClearHistory(SimpleTest.finish);
    76         });
    77     }
    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    }
    96   ]]></script>
    97 </window>

mercurial