tor-browser

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

test_escaping_badEscapedURI.js (1176B)


      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/. */
      4 
      5 /**
      6 * Test bug 422277 to make sure bad escaped uris don't get escaped. This makes
      7 * sure we don't hit an assertion for "not a UTF8 string".
      8 */
      9 
     10 testEngine_setup();
     11 
     12 add_task(async function test() {
     13  Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
     14  Services.prefs.setBoolPref("browser.urlbar.suggest.searches", false);
     15  registerCleanupFunction(() => {
     16    Services.prefs.clearUserPref("browser.urlbar.suggest.searches");
     17  });
     18 
     19  info("Bad escaped uri stays escaped");
     20  let uri1 = Services.io.newURI("http://site/%EAid");
     21  await PlacesTestUtils.addVisits([{ uri: uri1, title: "title" }]);
     22  let context = createContext("site", { isPrivate: false });
     23  await check_results({
     24    context,
     25    matches: [
     26      makeSearchResult(context, {
     27        engineName: SUGGESTIONS_ENGINE_NAME,
     28        heuristic: true,
     29      }),
     30      makeVisitResult(context, {
     31        uri: uri1.spec,
     32        title: "title",
     33      }),
     34    ],
     35  });
     36  await cleanupPlaces();
     37 });