toolkit/components/places/tests/autocomplete/test_multi_word_search.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 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 /**
michael@0 6 * Test for bug 401869 to allow multiple words separated by spaces to match in
michael@0 7 * the page title, page url, or bookmark title to be considered a match. All
michael@0 8 * terms must match but not all terms need to be in the title, etc.
michael@0 9 *
michael@0 10 * Test bug 424216 by making sure bookmark titles are always shown if one is
michael@0 11 * available. Also bug 425056 makes sure matches aren't found partially in the
michael@0 12 * page title and partially in the bookmark.
michael@0 13 */
michael@0 14
michael@0 15 // Define some shared uris and titles (each page needs its own uri)
michael@0 16 let kURIs = [
michael@0 17 "http://a.b.c/d-e_f/h/t/p",
michael@0 18 "http://d.e.f/g-h_i/h/t/p",
michael@0 19 "http://g.h.i/j-k_l/h/t/p",
michael@0 20 "http://j.k.l/m-n_o/h/t/p",
michael@0 21 ];
michael@0 22 let kTitles = [
michael@0 23 "f(o)o b<a>r",
michael@0 24 "b(a)r b<a>z",
michael@0 25 ];
michael@0 26
michael@0 27 // Regular pages
michael@0 28 addPageBook(0, 0);
michael@0 29 addPageBook(1, 1);
michael@0 30 // Bookmarked pages
michael@0 31 addPageBook(2, 0, 0);
michael@0 32 addPageBook(3, 0, 1);
michael@0 33
michael@0 34 // Provide for each test: description; search terms; array of gPages indices of
michael@0 35 // pages that should match; optional function to be run before the test
michael@0 36 let gTests = [
michael@0 37 ["0: Match 2 terms all in url",
michael@0 38 "c d", [0]],
michael@0 39 ["1: Match 1 term in url and 1 term in title",
michael@0 40 "b e", [0,1]],
michael@0 41 ["2: Match 3 terms all in title; display bookmark title if matched",
michael@0 42 "b a z", [1,3]],
michael@0 43 ["3: Match 2 terms in url and 1 in title; make sure bookmark title is used for search",
michael@0 44 "k f t", [2]],
michael@0 45 ["4: Match 3 terms in url and 1 in title",
michael@0 46 "d i g z", [1]],
michael@0 47 ["5: Match nothing",
michael@0 48 "m o z i", []],
michael@0 49 ];

mercurial