toolkit/components/places/tests/unit/test_placeURIs.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/. */
     8 // Get history service
     9 try {
    10   var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsINavHistoryService);
    11 } catch(ex) {
    12   do_throw("Could not get history service\n");
    13 } 
    15 // main
    16 function run_test() {
    17   // XXX Full testing coverage for QueriesToQueryString and
    18   // QueryStringToQueries
    20   var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
    21            getService(Ci.nsINavBookmarksService);
    22   const NHQO = Ci.nsINavHistoryQueryOptions;
    23   // Bug 376798
    24   var query = histsvc.getNewQuery();
    25   query.setFolders([bs.placesRoot], 1);
    26   do_check_eq(histsvc.queriesToQueryString([query], 1, histsvc.getNewQueryOptions()),
    27               "place:folder=PLACES_ROOT");
    29   // Bug 378828
    30   var options = histsvc.getNewQueryOptions();
    31   options.sortingAnnotation = "test anno";
    32   options.sortingMode = NHQO.SORT_BY_ANNOTATION_DESCENDING;
    33   var placeURI =
    34     "place:folder=PLACES_ROOT&sort=" + NHQO.SORT_BY_ANNOTATION_DESCENDING +
    35     "&sortingAnnotation=test%20anno";
    36   do_check_eq(histsvc.queriesToQueryString([query], 1, options),
    37               placeURI);
    38   var options = {};
    39   histsvc.queryStringToQueries(placeURI, { }, {}, options);
    40   do_check_eq(options.value.sortingAnnotation, "test anno");
    41   do_check_eq(options.value.sortingMode, NHQO.SORT_BY_ANNOTATION_DESCENDING);
    42 }

mercurial