|
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/. */ |
|
4 |
|
5 /** |
|
6 * Checks that we don't encodeURI twice when creating bookmarks.html. |
|
7 */ |
|
8 |
|
9 function run_test() { |
|
10 run_next_test(); |
|
11 } |
|
12 |
|
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"); |
|
19 |
|
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); |
|
25 |
|
26 // Remove the bookmarks, then restore the backup. |
|
27 PlacesUtils.bookmarks.removeItem(bm); |
|
28 yield BookmarkHTMLUtils.importFromFile(file, true); |
|
29 |
|
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); |
|
34 |
|
35 root.containerOpen = false; |
|
36 PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId); |
|
37 }); |