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.

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

mercurial