test_protocol_ignore.js (1233B)
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 424509 to make sure searching for "h" doesn't match "http" of urls. 7 */ 8 9 testEngine_setup(); 10 11 add_task(async function test_escape() { 12 Services.prefs.setBoolPref("browser.urlbar.autoFill", false); 13 Services.prefs.setBoolPref("browser.urlbar.suggest.searches", false); 14 registerCleanupFunction(() => { 15 Services.prefs.clearUserPref("browser.urlbar.suggest.searches"); 16 }); 17 18 let uri1 = Services.io.newURI("http://site/"); 19 let uri2 = Services.io.newURI("http://happytimes/"); 20 await PlacesTestUtils.addVisits([ 21 { uri: uri1, title: "title" }, 22 { uri: uri2, title: "title" }, 23 ]); 24 25 info("Searching for h matches site and not http://"); 26 let context = createContext("h", { isPrivate: false }); 27 await check_results({ 28 context, 29 matches: [ 30 makeSearchResult(context, { 31 engineName: SUGGESTIONS_ENGINE_NAME, 32 heuristic: true, 33 }), 34 makeVisitResult(context, { 35 uri: uri2.spec, 36 title: "title", 37 }), 38 ], 39 }); 40 41 await cleanupPlaces(); 42 });