toolkit/components/places/tests/autocomplete/test_swap_protocol.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 /**
     6  * Test bug 424717 to make sure searching with an existing location like
     7  * http://site/ also matches https://site/ or ftp://site/. Same thing for
     8  * ftp://site/ and https://site/.
     9  *
    10  * Test bug 461483 to make sure a search for "w" doesn't match the "www." from
    11  * site subdomains.
    12  */
    14 // Define some shared uris and titles (each page needs its own uri)
    15 let kURIs = [
    16   "http://www.site/",
    17   "http://site/",
    18   "ftp://ftp.site/",
    19   "ftp://site/",
    20   "https://www.site/",
    21   "https://site/",
    22   "http://woohoo/",
    23   "http://wwwwwwacko/",
    24 ];
    25 let kTitles = [
    26   "title",
    27 ];
    29 // Add various protocols of site
    30 addPageBook(0, 0);
    31 addPageBook(1, 0);
    32 addPageBook(2, 0);
    33 addPageBook(3, 0);
    34 addPageBook(4, 0);
    35 addPageBook(5, 0);
    36 addPageBook(6, 0);
    37 addPageBook(7, 0);
    39 let allSite = [0,1,2,3,4,5];
    41 // Provide for each test: description; search terms; array of gPages indices of
    42 // pages that should match; optional function to be run before the test
    43 let gTests = [
    44   ["0: http://www.site matches all site", "http://www.site", allSite],
    45   ["1: http://site matches all site", "http://site", allSite],
    46   ["2: ftp://ftp.site matches itself", "ftp://ftp.site", [2]],
    47   ["3: ftp://site matches all site", "ftp://site", allSite],
    48   ["4: https://www.site matches all site", "https://www.site", allSite],
    49   ["5: https://site matches all site", "https://site", allSite],
    50   ["6: www.site matches all site", "www.site", allSite],
    52   ["7: w matches none of www.", "w", [6,7]],
    53   ["8: http://w matches none of www.", "w", [6,7]],
    54   ["9: http://www.w matches none of www.", "w", [6,7]],
    56   ["10: ww matches none of www.", "ww", [7]],
    57   ["11: http://ww matches none of www.", "http://ww", [7]],
    58   ["12: http://www.ww matches none of www.", "http://www.ww", [7]],
    60   ["13: www matches none of www.", "www", [7]],
    61   ["14: http://www matches none of www.", "http://www", [7]],
    62   ["15: http://www.www matches none of www.", "http://www.www", [7]],
    63 ];

mercurial