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 * Obtains the id of the folder obtained from the query.
9 *
10 * @param aFolderID
11 * The id of the folder we want to generate a query for.
12 * @returns the string representation of the query for the given folder.
13 */
14 function query_string(aFolderID)
15 {
16 var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
17 getService(Ci.nsINavHistoryService);
19 var query = hs.getNewQuery();
20 query.setFolders([aFolderID], 1);
21 var options = hs.getNewQueryOptions();
22 return hs.queriesToQueryString([query], 1, options);
23 }
25 function run_test()
26 {
27 var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
28 getService(Ci.nsINavHistoryService);
29 var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
30 getService(Ci.nsINavBookmarksService);
32 const QUERIES = [
33 "folder=PLACES_ROOT"
34 , "folder=BOOKMARKS_MENU"
35 , "folder=TAGS"
36 , "folder=UNFILED_BOOKMARKS"
37 , "folder=TOOLBAR"
38 ];
39 const FOLDER_IDS = [
40 bs.placesRoot
41 , bs.bookmarksMenuFolder
42 , bs.tagsFolder
43 , bs.unfiledBookmarksFolder
44 , bs.toolbarFolder
45 ];
48 for (var i = 0; i < QUERIES.length; i++) {
49 var result = query_string(FOLDER_IDS[i]);
50 dump("Looking for '" + QUERIES[i] + "' in '" + result + "'\n");
51 do_check_neq(-1, result.indexOf(QUERIES[i]));
52 }
53 }