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 | function run_test() |
michael@0 | 8 | { |
michael@0 | 9 | run_next_test(); |
michael@0 | 10 | } |
michael@0 | 11 | |
michael@0 | 12 | add_task(function test_execute() |
michael@0 | 13 | { |
michael@0 | 14 | let count_visited_URIs = ["http://www.test-link.com/", |
michael@0 | 15 | "http://www.test-typed.com/", |
michael@0 | 16 | "http://www.test-bookmark.com/", |
michael@0 | 17 | "http://www.test-redirect-permanent.com/", |
michael@0 | 18 | "http://www.test-redirect-temporary.com/"]; |
michael@0 | 19 | |
michael@0 | 20 | let notcount_visited_URIs = ["http://www.test-embed.com/", |
michael@0 | 21 | "http://www.test-download.com/", |
michael@0 | 22 | "http://www.test-framed.com/"]; |
michael@0 | 23 | |
michael@0 | 24 | // add visits, one for each transition type |
michael@0 | 25 | yield promiseAddVisits([ |
michael@0 | 26 | { uri: uri("http://www.test-link.com/"), |
michael@0 | 27 | transition: TRANSITION_LINK }, |
michael@0 | 28 | { uri: uri("http://www.test-typed.com/"), |
michael@0 | 29 | transition: TRANSITION_TYPED }, |
michael@0 | 30 | { uri: uri("http://www.test-bookmark.com/"), |
michael@0 | 31 | transition: TRANSITION_BOOKMARK }, |
michael@0 | 32 | { uri: uri("http://www.test-embed.com/"), |
michael@0 | 33 | transition: TRANSITION_EMBED }, |
michael@0 | 34 | { uri: uri("http://www.test-framed.com/"), |
michael@0 | 35 | transition: TRANSITION_FRAMED_LINK }, |
michael@0 | 36 | { uri: uri("http://www.test-redirect-permanent.com/"), |
michael@0 | 37 | transition: TRANSITION_REDIRECT_PERMANENT }, |
michael@0 | 38 | { uri: uri("http://www.test-redirect-temporary.com/"), |
michael@0 | 39 | transition: TRANSITION_REDIRECT_TEMPORARY }, |
michael@0 | 40 | { uri: uri("http://www.test-download.com/"), |
michael@0 | 41 | transition: TRANSITION_DOWNLOAD }, |
michael@0 | 42 | ]); |
michael@0 | 43 | |
michael@0 | 44 | // check that all links are marked as visited |
michael@0 | 45 | count_visited_URIs.forEach(function (visited_uri) { |
michael@0 | 46 | do_check_true(yield promiseIsURIVisited(uri(visited_uri))); |
michael@0 | 47 | }); |
michael@0 | 48 | notcount_visited_URIs.forEach(function (visited_uri) { |
michael@0 | 49 | do_check_true(yield promiseIsURIVisited(uri(visited_uri))); |
michael@0 | 50 | }); |
michael@0 | 51 | |
michael@0 | 52 | // check that visit_count does not take in count embed and downloads |
michael@0 | 53 | // maxVisits query are directly binded to visit_count |
michael@0 | 54 | let options = PlacesUtils.history.getNewQueryOptions(); |
michael@0 | 55 | options.sortingMode = options.SORT_BY_VISITCOUNT_DESCENDING; |
michael@0 | 56 | options.resultType = options.RESULTS_AS_VISIT; |
michael@0 | 57 | options.includeHidden = true; |
michael@0 | 58 | let query = PlacesUtils.history.getNewQuery(); |
michael@0 | 59 | query.minVisits = 1; |
michael@0 | 60 | let root = PlacesUtils.history.executeQuery(query, options).root; |
michael@0 | 61 | |
michael@0 | 62 | root.containerOpen = true; |
michael@0 | 63 | let cc = root.childCount; |
michael@0 | 64 | do_check_eq(cc, count_visited_URIs.length); |
michael@0 | 65 | |
michael@0 | 66 | for (let i = 0; i < cc; i++) { |
michael@0 | 67 | let node = root.getChild(i); |
michael@0 | 68 | do_check_neq(count_visited_URIs.indexOf(node.uri), -1); |
michael@0 | 69 | } |
michael@0 | 70 | root.containerOpen = false; |
michael@0 | 71 | }); |