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

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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

mercurial