michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /** michael@0: * Checks that we don't encodeURI twice when creating bookmarks.html. michael@0: */ michael@0: michael@0: function run_test() { michael@0: run_next_test(); michael@0: } michael@0: michael@0: add_task(function() { michael@0: 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"); michael@0: let bm = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId, michael@0: uri, michael@0: PlacesUtils.bookmarks.DEFAULT_INDEX, michael@0: "bookmark"); michael@0: michael@0: let file = OS.Path.join(OS.Constants.Path.profileDir, "bookmarks.exported.997030.html"); michael@0: if ((yield OS.File.exists(file))) { michael@0: yield OS.File.remove(file); michael@0: } michael@0: yield BookmarkHTMLUtils.exportToFile(file); michael@0: michael@0: // Remove the bookmarks, then restore the backup. michael@0: PlacesUtils.bookmarks.removeItem(bm); michael@0: yield BookmarkHTMLUtils.importFromFile(file, true); michael@0: michael@0: do_log_info("Checking first level"); michael@0: let root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root; michael@0: let node = root.getChild(0); michael@0: do_check_eq(node.uri, uri.spec); michael@0: michael@0: root.containerOpen = false; michael@0: PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId); michael@0: });