tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_encoded_urls.js (2479B)


      1 add_setup(() => {
      2  UrlbarPrefs.set("suggest.quickactions", false);
      3 });
      4 
      5 add_task(async function test_encoded() {
      6  info("Searching for over encoded url should not break it");
      7  let url = "https://www.mozilla.com/search/top/?q=%25%32%35";
      8  await PlacesTestUtils.addVisits({
      9    uri: Services.io.newURI(url),
     10    title: url,
     11  });
     12  let context = createContext(url, { isPrivate: false });
     13  await check_results({
     14    context,
     15    autofilled: url,
     16    completed: url,
     17    matches: [
     18      makeVisitResult(context, {
     19        uri: url,
     20        title: url,
     21        heuristic: true,
     22      }),
     23    ],
     24  });
     25  await cleanupPlaces();
     26 });
     27 
     28 add_task(async function test_encoded_trimmed() {
     29  info("Searching for over encoded url should not break it");
     30  let url = "https://www.mozilla.com/search/top/?q=%25%32%35";
     31  await PlacesTestUtils.addVisits({
     32    uri: Services.io.newURI(url),
     33    title: url,
     34  });
     35  let context = createContext("mozilla.com/search/top/?q=%25%32%35", {
     36    isPrivate: false,
     37  });
     38  await check_results({
     39    context,
     40    autofilled: "mozilla.com/search/top/?q=%25%32%35",
     41    completed: url,
     42    matches: [
     43      makeVisitResult(context, {
     44        uri: url,
     45        title: url,
     46        heuristic: true,
     47      }),
     48    ],
     49  });
     50  await cleanupPlaces();
     51 });
     52 
     53 add_task(async function test_encoded_partial() {
     54  info("Searching for over encoded url should not break it");
     55  let url = "https://www.mozilla.com/search/top/?q=%25%32%35";
     56  await PlacesTestUtils.addVisits({
     57    uri: Services.io.newURI(url),
     58    title: url,
     59  });
     60  let context = createContext("https://www.mozilla.com/search/top/?q=%25", {
     61    isPrivate: false,
     62  });
     63  await check_results({
     64    context,
     65    autofilled: url,
     66    completed: url,
     67    matches: [
     68      makeVisitResult(context, {
     69        uri: url,
     70        title: url,
     71        heuristic: true,
     72      }),
     73    ],
     74  });
     75  await cleanupPlaces();
     76 });
     77 
     78 add_task(async function test_encoded_path() {
     79  info("Searching for over encoded url should not break it");
     80  let url = "https://www.mozilla.com/%25%32%35/top/";
     81  await PlacesTestUtils.addVisits({
     82    uri: Services.io.newURI(url),
     83    title: url,
     84  });
     85  let context = createContext("https://www.mozilla.com/%25%32%35/t", {
     86    isPrivate: false,
     87  });
     88  await check_results({
     89    context,
     90    autofilled: url,
     91    completed: url,
     92    matches: [
     93      makeVisitResult(context, {
     94        uri: url,
     95        title: url,
     96        heuristic: true,
     97      }),
     98    ],
     99  });
    100  await cleanupPlaces();
    101 });