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.
michael@0 | 1 | /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim:set ts=2 sw=2 sts=2 et: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | // The test data for our database, note that the ordering of the results that |
michael@0 | 8 | // will be returned by the query (the isInQuery: true objects) is IMPORTANT. |
michael@0 | 9 | // see compareArrayToResult in head_queries.js for more info. |
michael@0 | 10 | var testData = [ |
michael@0 | 11 | // Normal folder |
michael@0 | 12 | { isInQuery: true, isFolder: true, title: "Folder 1", |
michael@0 | 13 | parentFolder: PlacesUtils.toolbarFolderId }, |
michael@0 | 14 | |
michael@0 | 15 | // Read only folder |
michael@0 | 16 | { isInQuery: false, isFolder: true, title: "Folder 2 RO", |
michael@0 | 17 | parentFolder: PlacesUtils.toolbarFolderId, readOnly: true } |
michael@0 | 18 | ]; |
michael@0 | 19 | |
michael@0 | 20 | function run_test() |
michael@0 | 21 | { |
michael@0 | 22 | run_next_test(); |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | add_task(function test_excludeReadOnlyFolders() |
michael@0 | 26 | { |
michael@0 | 27 | yield task_populateDB(testData); |
michael@0 | 28 | |
michael@0 | 29 | var query = PlacesUtils.history.getNewQuery(); |
michael@0 | 30 | query.setFolders([PlacesUtils.toolbarFolderId], 1); |
michael@0 | 31 | |
michael@0 | 32 | // Options |
michael@0 | 33 | var options = PlacesUtils.history.getNewQueryOptions(); |
michael@0 | 34 | options.excludeQueries = true; |
michael@0 | 35 | options.excludeReadOnlyFolders = true; |
michael@0 | 36 | |
michael@0 | 37 | // Results |
michael@0 | 38 | var result = PlacesUtils.history.executeQuery(query, options); |
michael@0 | 39 | var root = result.root; |
michael@0 | 40 | root.containerOpen = true; |
michael@0 | 41 | |
michael@0 | 42 | displayResultSet(root); |
michael@0 | 43 | // The readonly folder should not be in our result set. |
michael@0 | 44 | do_check_eq(1, root.childCount); |
michael@0 | 45 | do_check_eq("Folder 1", root.getChild(0).title); |
michael@0 | 46 | |
michael@0 | 47 | root.containerOpen = false; |
michael@0 | 48 | }); |