Sat, 03 Jan 2015 20:18:00 +0100
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.
1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /**
8 * Both SetItemtitle and insertBookmark should allow for null titles.
9 */
11 const bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
12 getService(Ci.nsINavBookmarksService);
14 const TEST_URL = "http://www.mozilla.org";
16 function run_test() {
17 // Insert a bookmark with an empty title.
18 var itemId = bs.insertBookmark(bs.toolbarFolder,
19 uri(TEST_URL),
20 bs.DEFAULT_INDEX,
21 "");
22 // Check returned title is an empty string.
23 do_check_eq(bs.getItemTitle(itemId), "");
24 // Set title to null.
25 bs.setItemTitle(itemId, null);
26 // Check returned title is null.
27 do_check_eq(bs.getItemTitle(itemId), null);
28 // Cleanup.
29 bs.removeItem(itemId);
31 // Insert a bookmark with a null title.
32 itemId = bs.insertBookmark(bs.toolbarFolder,
33 uri(TEST_URL),
34 bs.DEFAULT_INDEX,
35 null);
36 // Check returned title is null.
37 do_check_eq(bs.getItemTitle(itemId), null);
38 // Set title to an empty string.
39 bs.setItemTitle(itemId, "");
40 // Check returned title is an empty string.
41 do_check_eq(bs.getItemTitle(itemId), "");
42 // Cleanup.
43 bs.removeItem(itemId);
44 }