toolkit/components/places/tests/unit/test_463863.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 /* -*- 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 /*
michael@0 8 * TEST DESCRIPTION:
michael@0 9 *
michael@0 10 * This test checks that in a basic history query all transition types visits
michael@0 11 * appear but TRANSITION_EMBED and TRANSITION_FRAMED_LINK ones.
michael@0 12 */
michael@0 13
michael@0 14 let transitions = [
michael@0 15 TRANSITION_LINK
michael@0 16 , TRANSITION_TYPED
michael@0 17 , TRANSITION_BOOKMARK
michael@0 18 , TRANSITION_EMBED
michael@0 19 , TRANSITION_FRAMED_LINK
michael@0 20 , TRANSITION_REDIRECT_PERMANENT
michael@0 21 , TRANSITION_REDIRECT_TEMPORARY
michael@0 22 , TRANSITION_DOWNLOAD
michael@0 23 ];
michael@0 24
michael@0 25 function runQuery(aResultType) {
michael@0 26 let options = PlacesUtils.history.getNewQueryOptions();
michael@0 27 options.resultType = aResultType;
michael@0 28 let root = PlacesUtils.history.executeQuery(PlacesUtils.history.getNewQuery(),
michael@0 29 options).root;
michael@0 30 root.containerOpen = true;
michael@0 31 let cc = root.childCount;
michael@0 32 do_check_eq(cc, transitions.length - 2);
michael@0 33
michael@0 34 for (let i = 0; i < cc; i++) {
michael@0 35 let node = root.getChild(i);
michael@0 36 // Check that all transition types but EMBED and FRAMED appear in results
michael@0 37 do_check_neq(node.uri.substr(6,1), TRANSITION_EMBED);
michael@0 38 do_check_neq(node.uri.substr(6,1), TRANSITION_FRAMED_LINK);
michael@0 39 }
michael@0 40 root.containerOpen = false;
michael@0 41 }
michael@0 42
michael@0 43 function run_test()
michael@0 44 {
michael@0 45 run_next_test();
michael@0 46 }
michael@0 47
michael@0 48 add_task(function test_execute()
michael@0 49 {
michael@0 50 // add visits, one for each transition type
michael@0 51 for (let [, transition] in Iterator(transitions)) {
michael@0 52 yield promiseAddVisits({
michael@0 53 uri: uri("http://" + transition + ".mozilla.org/"),
michael@0 54 transition: transition
michael@0 55 });
michael@0 56 }
michael@0 57
michael@0 58 runQuery(Ci.nsINavHistoryQueryOptions.RESULTS_AS_VISIT);
michael@0 59 runQuery(Ci.nsINavHistoryQueryOptions.RESULTS_AS_URI);
michael@0 60 });

mercurial