browser/components/places/tests/chrome/test_selectItems_on_nested_tree.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="549192:  History view not updated after deleting entry"
    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         flex="1">
    29     <treecols>
    30       <treecol label="Title" id="title" anonid="title" primary="true" ordinal="1" flex="1"/>
    31     </treecols>
    32     <treechildren flex="1"/>
    33   </tree>
    35   <script type="application/javascript"><![CDATA[
    36     /**
    37      * Ensure that selectItems doesn't recurse infinitely in nested trees.
    38      */
    40     function runTest() {
    41       PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
    42                                            NetUtil.newURI("place:folder=UNFILED_BOOKMARKS"),
    43                                            PlacesUtils.bookmarks.DEFAULT_INDEX,
    44                                            "shortcut");
    45       PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
    46                                            NetUtil.newURI("place:folder=UNFILED_BOOKMARKS&maxResults=10"),
    47                                            PlacesUtils.bookmarks.DEFAULT_INDEX,
    48                                            "query");
    49       let folderId = PlacesUtils.bookmarks.createFolder(PlacesUtils.unfiledBookmarksFolderId,
    50                                                         "folder",
    51                                                         PlacesUtils.bookmarks.DEFAULT_INDEX);
    52       let itemId = PlacesUtils.bookmarks.insertBookmark(folderId,
    53                                                         NetUtil.newURI("http://www.mozilla.org/"),
    54                                                         PlacesUtils.bookmarks.DEFAULT_INDEX,
    55                                                         "bookmark");
    56       // Setup the places tree contents.
    57       var tree = document.getElementById("tree");
    58       tree.place = "place:folder=UNFILED_BOOKMARKS";
    60       // Select the last bookmark.
    61       tree.selectItems([itemId]);
    62       is (tree.selectedNode.itemId, itemId, "The right node was selected");
    63     }
    65   ]]></script>
    66 </window>

mercurial