toolkit/components/places/tests/bookmarks/test_997030-bookmarks-html-encode.js

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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 /**
     6  * Checks that we don't encodeURI twice when creating bookmarks.html.
     7  */
     9 function run_test() {
    10   run_next_test();
    11 }
    13 add_task(function() {
    14   let uri = NetUtil.newURI("http://bt.ktxp.com/search.php?keyword=%E5%A6%84%E6%83%B3%E5%AD%A6%E7%94%9F%E4%BC%9A");
    15   let bm = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
    16                                                 uri,
    17                                                 PlacesUtils.bookmarks.DEFAULT_INDEX,
    18                                                 "bookmark");
    20   let file =  OS.Path.join(OS.Constants.Path.profileDir, "bookmarks.exported.997030.html");
    21   if ((yield OS.File.exists(file))) {
    22     yield OS.File.remove(file);
    23   }
    24   yield BookmarkHTMLUtils.exportToFile(file);
    26   // Remove the bookmarks, then restore the backup.
    27   PlacesUtils.bookmarks.removeItem(bm);
    28   yield BookmarkHTMLUtils.importFromFile(file, true);
    30   do_log_info("Checking first level");
    31   let root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
    32   let node = root.getChild(0);
    33   do_check_eq(node.uri, uri.spec);
    35   root.containerOpen = false;
    36   PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
    37 });

mercurial