зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1125117 - Use the new keywords API in autocomplete. r=ttaubert
This commit is contained in:
Родитель
7e6dfb40de
Коммит
80a46b8d07
|
@ -13,34 +13,34 @@ function* promise_first_result(inputText) {
|
||||||
|
|
||||||
add_task(function*() {
|
add_task(function*() {
|
||||||
// This test is only relevant if UnifiedComplete is enabled.
|
// This test is only relevant if UnifiedComplete is enabled.
|
||||||
if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) {
|
let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
|
||||||
todo(false, "Stop supporting old autocomplete components.");
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
|
||||||
return;
|
registerCleanupFunction(() => {
|
||||||
}
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
|
||||||
|
});
|
||||||
|
|
||||||
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla");
|
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla");
|
||||||
let tabs = [tab];
|
let tabs = [tab];
|
||||||
registerCleanupFunction(() => {
|
registerCleanupFunction(function* () {
|
||||||
for (let tab of tabs)
|
for (let tab of tabs)
|
||||||
gBrowser.removeTab(tab);
|
gBrowser.removeTab(tab);
|
||||||
PlacesUtils.bookmarks.removeItem(itemId);
|
yield PlacesUtils.bookmarks.remove(bm);
|
||||||
});
|
});
|
||||||
|
|
||||||
yield promiseTabLoadEvent(tab);
|
yield promiseTabLoadEvent(tab);
|
||||||
|
|
||||||
let itemId =
|
let bm = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
|
url: "http://example.com/?q=%s",
|
||||||
NetUtil.newURI("http://example.com/?q=%s"),
|
title: "test" });
|
||||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
yield PlacesUtils.keywords.insert({ keyword: "keyword",
|
||||||
"test");
|
url: "http://example.com/?q=%s" });
|
||||||
PlacesUtils.bookmarks.setKeywordForBookmark(itemId, "keyword");
|
|
||||||
|
|
||||||
let result = yield promise_first_result("keyword something");
|
let result = yield promise_first_result("keyword something");
|
||||||
isnot(result, null, "Expect a keyword result");
|
isnot(result, null, "Expect a keyword result");
|
||||||
|
|
||||||
is(result.getAttribute("type"), "action keyword", "Expect correct `type` attribute");
|
is(result.getAttribute("type"), "action keyword", "Expect correct `type` attribute");
|
||||||
is(result.getAttribute("actiontype"), "keyword", "Expect correct `actiontype` attribute");
|
is(result.getAttribute("actiontype"), "keyword", "Expect correct `actiontype` attribute");
|
||||||
is(result.getAttribute("title"), "test", "Expect correct title");
|
is(result.getAttribute("title"), "example.com", "Expect correct title");
|
||||||
|
|
||||||
// We need to make a real URI out of this to ensure it's normalised for
|
// We need to make a real URI out of this to ensure it's normalised for
|
||||||
// comparison.
|
// comparison.
|
||||||
|
@ -50,9 +50,9 @@ add_task(function*() {
|
||||||
is_element_visible(result._title, "Title element should be visible");
|
is_element_visible(result._title, "Title element should be visible");
|
||||||
is(result._title.childNodes.length, 1, "Title element should have 1 child");
|
is(result._title.childNodes.length, 1, "Title element should have 1 child");
|
||||||
is(result._title.childNodes[0].nodeName, "#text", "That child should be a text node");
|
is(result._title.childNodes[0].nodeName, "#text", "That child should be a text node");
|
||||||
is(result._title.childNodes[0].data, "test", "Node should contain the name of the bookmark");
|
is(result._title.childNodes[0].data, "example.com", "Node should contain the name of the bookmark");
|
||||||
|
|
||||||
is_element_visible(result._extra, "Extra element should be visible");
|
is_element_visible(result._extraBox, "Extra element should be visible");
|
||||||
is(result._extra.childNodes.length, 1, "Title element should have 1 child");
|
is(result._extra.childNodes.length, 1, "Title element should have 1 child");
|
||||||
is(result._extra.childNodes[0].nodeName, "span", "That child should be a span node");
|
is(result._extra.childNodes[0].nodeName, "span", "That child should be a span node");
|
||||||
let span = result._extra.childNodes[0];
|
let span = result._extra.childNodes[0];
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
add_task(function*() {
|
add_task(function*() {
|
||||||
// This test is only relevant if UnifiedComplete is enabled.
|
// This test is only relevant if UnifiedComplete is enabled.
|
||||||
if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) {
|
let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
|
||||||
todo(false, "Stop supporting old autocomplete components.");
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let itemId =
|
|
||||||
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
|
|
||||||
NetUtil.newURI("http://example.com/?q=%s"),
|
|
||||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
|
||||||
"test");
|
|
||||||
PlacesUtils.bookmarks.setKeywordForBookmark(itemId, "keyword");
|
|
||||||
|
|
||||||
registerCleanupFunction(() => {
|
registerCleanupFunction(() => {
|
||||||
PlacesUtils.bookmarks.removeItem(itemId);
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
|
||||||
|
});
|
||||||
|
|
||||||
|
let bm = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
|
url: "http://example.com/?q=%s",
|
||||||
|
title: "test" });
|
||||||
|
yield PlacesUtils.keywords.insert({ keyword: "keyword",
|
||||||
|
url: "http://example.com/?q=%s" })
|
||||||
|
|
||||||
|
registerCleanupFunction(function* () {
|
||||||
|
yield PlacesUtils.bookmarks.remove(bm);
|
||||||
});
|
});
|
||||||
|
|
||||||
yield promiseAutocompleteResultPopup("keyword search");
|
yield promiseAutocompleteResultPopup("keyword search");
|
||||||
|
@ -21,12 +21,12 @@ add_task(function*() {
|
||||||
|
|
||||||
info("Before override");
|
info("Before override");
|
||||||
is_element_hidden(result._url, "URL element should be hidden");
|
is_element_hidden(result._url, "URL element should be hidden");
|
||||||
is_element_visible(result._extra, "Extra element should be visible");
|
is_element_visible(result._extraBox, "Extra element should be visible");
|
||||||
|
|
||||||
info("During override");
|
info("During override");
|
||||||
EventUtils.synthesizeKey("VK_SHIFT" , { type: "keydown" });
|
EventUtils.synthesizeKey("VK_SHIFT" , { type: "keydown" });
|
||||||
is_element_hidden(result._url, "URL element should be hidden");
|
is_element_hidden(result._url, "URL element should be hidden");
|
||||||
is_element_visible(result._extra, "Extra element should be visible");
|
is_element_visible(result._extraBox, "Extra element should be visible");
|
||||||
|
|
||||||
EventUtils.synthesizeKey("VK_SHIFT" , { type: "keyup" });
|
EventUtils.synthesizeKey("VK_SHIFT" , { type: "keyup" });
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
// This test is only relevant if UnifiedComplete is enabled.
|
// This test is only relevant if UnifiedComplete is enabled.
|
||||||
if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) {
|
let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
|
||||||
todo(false, "Stop supporting old autocomplete components.");
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
|
||||||
return;
|
registerCleanupFunction(() => {
|
||||||
}
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
|
||||||
|
});
|
||||||
|
|
||||||
Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
|
Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
|
||||||
"http://example.com/?q={searchTerms}");
|
"http://example.com/?q={searchTerms}");
|
||||||
|
|
|
@ -4,7 +4,12 @@
|
||||||
**/
|
**/
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
|
// This test is only relevant if UnifiedComplete is enabled.
|
||||||
|
let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
|
||||||
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
|
||||||
|
registerCleanupFunction(() => {
|
||||||
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
|
||||||
|
});
|
||||||
|
|
||||||
let iconURI = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC";
|
let iconURI = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC";
|
||||||
Services.search.addEngineWithDetails("MozSearch", iconURI, "moz", "", "GET",
|
Services.search.addEngineWithDetails("MozSearch", iconURI, "moz", "", "GET",
|
||||||
|
@ -20,7 +25,6 @@ add_task(function* () {
|
||||||
Services.search.currentEngine = originalEngine;
|
Services.search.currentEngine = originalEngine;
|
||||||
let engine = Services.search.getEngineByName("MozSearch");
|
let engine = Services.search.getEngineByName("MozSearch");
|
||||||
Services.search.removeEngine(engine);
|
Services.search.removeEngine(engine);
|
||||||
Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gBrowser.removeTab(tab);
|
gBrowser.removeTab(tab);
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
|
|
||||||
add_task(function*() {
|
add_task(function*() {
|
||||||
// This test is only relevant if UnifiedComplete is enabled.
|
// This test is only relevant if UnifiedComplete is enabled.
|
||||||
if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) {
|
let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
|
||||||
todo(false, "Stop supporting old autocomplete components.");
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
|
||||||
return;
|
registerCleanupFunction(() => {
|
||||||
}
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
|
||||||
|
});
|
||||||
|
|
||||||
let tab = gBrowser.addTab("about:about");
|
let tab = gBrowser.addTab("about:about");
|
||||||
yield promiseTabLoaded(tab);
|
yield promiseTabLoaded(tab);
|
||||||
|
|
|
@ -10,12 +10,15 @@ function is_selected(index) {
|
||||||
|
|
||||||
add_task(function*() {
|
add_task(function*() {
|
||||||
// This test is only relevant if UnifiedComplete is enabled.
|
// This test is only relevant if UnifiedComplete is enabled.
|
||||||
if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) {
|
let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
|
||||||
todo(false, "Stop supporting old autocomplete components.");
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
|
||||||
return;
|
registerCleanupFunction(() => {
|
||||||
}
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
|
||||||
|
});
|
||||||
|
|
||||||
registerCleanupFunction(() => PlacesTestUtils.clearHistory());
|
registerCleanupFunction(function* () {
|
||||||
|
yield PlacesTestUtils.clearHistory();
|
||||||
|
});
|
||||||
|
|
||||||
let visits = [];
|
let visits = [];
|
||||||
repeat(10, i => {
|
repeat(10, i => {
|
||||||
|
|
|
@ -3,16 +3,15 @@ add_task(function*() {
|
||||||
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
|
||||||
|
|
||||||
registerCleanupFunction(() => {
|
registerCleanupFunction(() => {
|
||||||
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
|
|
||||||
Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
|
Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
|
||||||
|
yield PlacesUtils.bookmarks.remove(bm);
|
||||||
});
|
});
|
||||||
|
|
||||||
let itemId =
|
let bm = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.unfiledGuid,
|
||||||
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
|
url: "http://example.com/?q=%s",
|
||||||
NetUtil.newURI("http://example.com/?q=%s"),
|
title: "test" });
|
||||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
yield PlacesUtils.keywords.insert({ keyword: "keyword",
|
||||||
"test");
|
url: "http://example.com/?q=%s" });
|
||||||
PlacesUtils.bookmarks.setKeywordForBookmark(itemId, "keyword");
|
|
||||||
|
|
||||||
yield new Promise(resolve => waitForFocus(resolve, window));
|
yield new Promise(resolve => waitForFocus(resolve, window));
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
|
|
||||||
add_task(function*() {
|
add_task(function*() {
|
||||||
// This test is only relevant if UnifiedComplete is enabled.
|
// This test is only relevant if UnifiedComplete is enabled.
|
||||||
if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) {
|
let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
|
||||||
todo(false, "Stop supporting old autocomplete components.");
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
|
||||||
return;
|
registerCleanupFunction(() => {
|
||||||
}
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
|
||||||
|
});
|
||||||
|
|
||||||
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
|
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
|
||||||
yield promiseTabLoaded(tab);
|
yield promiseTabLoaded(tab);
|
||||||
|
|
|
@ -15,8 +15,7 @@ add_task(function*() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
registerCleanupFunction(() => PlacesTestUtils.clearHistory());
|
yield PlacesTestUtils.clearHistory();
|
||||||
|
|
||||||
let visits = [];
|
let visits = [];
|
||||||
repeat(10, i => {
|
repeat(10, i => {
|
||||||
visits.push({
|
visits.push({
|
||||||
|
@ -25,13 +24,18 @@ add_task(function*() {
|
||||||
});
|
});
|
||||||
yield PlacesTestUtils.addVisits(visits);
|
yield PlacesTestUtils.addVisits(visits);
|
||||||
|
|
||||||
|
registerCleanupFunction(function* () {
|
||||||
|
yield PlacesTestUtils.clearHistory();
|
||||||
|
});
|
||||||
|
|
||||||
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
|
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
|
||||||
yield promiseTabLoaded(tab);
|
yield promiseTabLoaded(tab);
|
||||||
yield promiseAutocompleteResultPopup("example.com/autocomplete");
|
yield promiseAutocompleteResultPopup("example.com/autocomplete");
|
||||||
|
|
||||||
let popup = gURLBar.popup;
|
let popup = gURLBar.popup;
|
||||||
let results = popup.richlistbox.children;
|
let results = popup.richlistbox.children.filter(is_visible);
|
||||||
is(results.length, 10, "Should get 11 results");
|
|
||||||
|
is(results.length, 10, "Should get 10 results");
|
||||||
is_selected(-1);
|
is_selected(-1);
|
||||||
|
|
||||||
info("Key Down to select the next item");
|
info("Key Down to select the next item");
|
||||||
|
|
|
@ -4,10 +4,11 @@
|
||||||
|
|
||||||
add_task(function* test_switchtab_override() {
|
add_task(function* test_switchtab_override() {
|
||||||
// This test is only relevant if UnifiedComplete is enabled.
|
// This test is only relevant if UnifiedComplete is enabled.
|
||||||
if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) {
|
let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
|
||||||
todo(false, "Stop supporting old autocomplete components.");
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
|
||||||
return;
|
registerCleanupFunction(() => {
|
||||||
}
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
|
||||||
|
});
|
||||||
|
|
||||||
let testURL = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
|
let testURL = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
|
||||||
|
|
||||||
|
|
|
@ -7,29 +7,32 @@ function is_selected(index) {
|
||||||
|
|
||||||
add_task(function*() {
|
add_task(function*() {
|
||||||
// This test is only relevant if UnifiedComplete is enabled.
|
// This test is only relevant if UnifiedComplete is enabled.
|
||||||
if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) {
|
let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
|
||||||
todo(false, "Stop supporting old autocomplete components.");
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
registerCleanupFunction(() => {
|
registerCleanupFunction(() => {
|
||||||
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
|
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
|
||||||
});
|
});
|
||||||
|
|
||||||
let itemId =
|
let bookmarks = [];
|
||||||
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
|
bookmarks.push((yield PlacesUtils.bookmarks
|
||||||
NetUtil.newURI("http://example.com/?q=%s"),
|
.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
url: "http://example.com/?q=%s",
|
||||||
"test");
|
title: "test" })));
|
||||||
PlacesUtils.bookmarks.setKeywordForBookmark(itemId, "keyword");
|
yield PlacesUtils.keywords.insert({ keyword: "keyword",
|
||||||
|
url: "http://example.com/?q=%s" });
|
||||||
|
|
||||||
// This item only needed so we can select the keyword item, select something
|
// This item only needed so we can select the keyword item, select something
|
||||||
// else, then select the keyword item again.
|
// else, then select the keyword item again.
|
||||||
itemId =
|
bookmarks.push((yield PlacesUtils.bookmarks
|
||||||
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
|
.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
NetUtil.newURI("http://example.com/keyword"),
|
url: "http://example.com/keyword",
|
||||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
title: "keyword abc" })));
|
||||||
"keyword abc");
|
|
||||||
|
registerCleanupFunction(function* () {
|
||||||
|
for (let bm of bookmarks) {
|
||||||
|
yield PlacesUtils.bookmarks.remove(bm);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
|
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
|
||||||
yield promiseTabLoaded(tab);
|
yield promiseTabLoaded(tab);
|
||||||
|
|
|
@ -16,7 +16,9 @@ function is_selected(index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
add_task(function*() {
|
add_task(function*() {
|
||||||
registerCleanupFunction(() => PlacesTestUtils.clearHistory());
|
registerCleanupFunction(function* () {
|
||||||
|
yield PlacesTestUtils.clearHistory();
|
||||||
|
});
|
||||||
|
|
||||||
yield PlacesTestUtils.clearHistory();
|
yield PlacesTestUtils.clearHistory();
|
||||||
let tabCount = gBrowser.tabs.length;
|
let tabCount = gBrowser.tabs.length;
|
||||||
|
|
|
@ -46,11 +46,10 @@ const MATCH_BEGINNING_CASE_SENSITIVE = Ci.mozIPlacesAutoComplete.MATCH_BEGINNING
|
||||||
|
|
||||||
// AutoComplete query type constants.
|
// AutoComplete query type constants.
|
||||||
// Describes the various types of queries that we can process rows for.
|
// Describes the various types of queries that we can process rows for.
|
||||||
const QUERYTYPE_KEYWORD = 0;
|
const QUERYTYPE_FILTERED = 0;
|
||||||
const QUERYTYPE_FILTERED = 1;
|
const QUERYTYPE_AUTOFILL_HOST = 1;
|
||||||
const QUERYTYPE_AUTOFILL_HOST = 2;
|
const QUERYTYPE_AUTOFILL_URL = 2;
|
||||||
const QUERYTYPE_AUTOFILL_URL = 3;
|
const QUERYTYPE_AUTOFILL_PREDICTURL = 3;
|
||||||
const QUERYTYPE_AUTOFILL_PREDICTURL = 4;
|
|
||||||
|
|
||||||
// This separator is used as an RTL-friendly way to split the title and tags.
|
// This separator is used as an RTL-friendly way to split the title and tags.
|
||||||
// It can also be used by an nsIAutoCompleteResult consumer to re-split the
|
// It can also be used by an nsIAutoCompleteResult consumer to re-split the
|
||||||
|
@ -64,7 +63,7 @@ const TITLE_SEARCH_ENGINE_SEPARATOR = " \u00B7\u2013\u00B7 ";
|
||||||
const TELEMETRY_1ST_RESULT = "PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS";
|
const TELEMETRY_1ST_RESULT = "PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS";
|
||||||
const TELEMETRY_6_FIRST_RESULTS = "PLACES_AUTOCOMPLETE_6_FIRST_RESULTS_TIME_MS";
|
const TELEMETRY_6_FIRST_RESULTS = "PLACES_AUTOCOMPLETE_6_FIRST_RESULTS_TIME_MS";
|
||||||
// The default frecency value used when inserting matches with unknown frecency.
|
// The default frecency value used when inserting matches with unknown frecency.
|
||||||
const FRECENCY_SEARCHENGINES_DEFAULT = 1000;
|
const FRECENCY_DEFAULT = 1000;
|
||||||
|
|
||||||
// Sqlite result row index constants.
|
// Sqlite result row index constants.
|
||||||
const QUERYINDEX_QUERYTYPE = 0;
|
const QUERYINDEX_QUERYTYPE = 0;
|
||||||
|
@ -149,23 +148,6 @@ const SQL_ADAPTIVE_QUERY =
|
||||||
:matchBehavior, :searchBehavior)
|
:matchBehavior, :searchBehavior)
|
||||||
ORDER BY rank DESC, h.frecency DESC`;
|
ORDER BY rank DESC, h.frecency DESC`;
|
||||||
|
|
||||||
const SQL_KEYWORD_QUERY =
|
|
||||||
`/* do not warn (bug 487787) */
|
|
||||||
SELECT :query_type,
|
|
||||||
REPLACE(h.url, '%s', :query_string) AS search_url, h.title,
|
|
||||||
IFNULL(f.url, (SELECT f.url
|
|
||||||
FROM moz_places
|
|
||||||
JOIN moz_favicons f ON f.id = favicon_id
|
|
||||||
WHERE rev_host = h.rev_host
|
|
||||||
ORDER BY frecency DESC
|
|
||||||
LIMIT 1)
|
|
||||||
),
|
|
||||||
1, NULL, NULL, h.visit_count, h.typed, h.id, t.open_count, h.frecency
|
|
||||||
FROM moz_keywords k
|
|
||||||
JOIN moz_places h ON k.place_id = h.id
|
|
||||||
LEFT JOIN moz_favicons f ON f.id = h.favicon_id
|
|
||||||
LEFT JOIN moz_openpages_temp t ON t.url = search_url
|
|
||||||
WHERE k.keyword = LOWER(:keyword)`;
|
|
||||||
|
|
||||||
function hostQuery(conditions = "") {
|
function hostQuery(conditions = "") {
|
||||||
let query =
|
let query =
|
||||||
|
@ -731,6 +713,8 @@ Search.prototype = {
|
||||||
// Since we call the synchronous parseSubmissionURL function later, we must
|
// Since we call the synchronous parseSubmissionURL function later, we must
|
||||||
// wait for the initialization of PlacesSearchAutocompleteProvider first.
|
// wait for the initialization of PlacesSearchAutocompleteProvider first.
|
||||||
yield PlacesSearchAutocompleteProvider.ensureInitialized();
|
yield PlacesSearchAutocompleteProvider.ensureInitialized();
|
||||||
|
if (!this.pending)
|
||||||
|
return;
|
||||||
|
|
||||||
// For any given search, we run many queries/heuristics:
|
// For any given search, we run many queries/heuristics:
|
||||||
// 1) by alias (as defined in SearchService)
|
// 1) by alias (as defined in SearchService)
|
||||||
|
@ -738,7 +722,7 @@ Search.prototype = {
|
||||||
// 3) inline completion for hosts (this._hostQuery) or urls (this._urlQuery)
|
// 3) inline completion for hosts (this._hostQuery) or urls (this._urlQuery)
|
||||||
// 4) directly typed in url (ie, can be navigated to as-is)
|
// 4) directly typed in url (ie, can be navigated to as-is)
|
||||||
// 5) submission for the current search engine
|
// 5) submission for the current search engine
|
||||||
// 6) keywords (this._keywordQuery)
|
// 6) Places keywords
|
||||||
// 7) adaptive learning (this._adaptiveQuery)
|
// 7) adaptive learning (this._adaptiveQuery)
|
||||||
// 8) open pages not supported by history (this._switchToTabQuery)
|
// 8) open pages not supported by history (this._switchToTabQuery)
|
||||||
// 9) query based on match behavior
|
// 9) query based on match behavior
|
||||||
|
@ -772,15 +756,13 @@ Search.prototype = {
|
||||||
// special results.
|
// special results.
|
||||||
let hasFirstResult = false;
|
let hasFirstResult = false;
|
||||||
|
|
||||||
if (this._searchTokens.length > 0 &&
|
if (this._searchTokens.length > 0) {
|
||||||
PlacesUtils.bookmarks.getURIForKeyword(this._searchTokens[0])) {
|
// This may be a Places keyword.
|
||||||
// This may be a keyword of a bookmark.
|
hasFirstResult = yield this._matchPlacesKeyword();
|
||||||
queries.unshift(this._keywordQuery);
|
|
||||||
hasFirstResult = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._enableActions && !hasFirstResult) {
|
if (this.pending && this._enableActions && !hasFirstResult) {
|
||||||
// If it's not a bookmarked keyword, then it may be a search engine
|
// If it's not a Places keyword, then it may be a search engine
|
||||||
// with an alias - which works like a keyword.
|
// with an alias - which works like a keyword.
|
||||||
hasFirstResult = yield this._matchSearchEngineAlias();
|
hasFirstResult = yield this._matchSearchEngineAlias();
|
||||||
}
|
}
|
||||||
|
@ -875,6 +857,35 @@ Search.prototype = {
|
||||||
return gotResult;
|
return gotResult;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_matchPlacesKeyword: function* () {
|
||||||
|
// The first word could be a keyword, so that's what we'll search.
|
||||||
|
let keyword = this._searchTokens[0];
|
||||||
|
let entry = yield PlacesUtils.keywords.fetch(this._searchTokens[0]);
|
||||||
|
if (!entry)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Build the url.
|
||||||
|
let searchString = this._trimmedOriginalSearchString;
|
||||||
|
let queryString = "";
|
||||||
|
let queryIndex = searchString.indexOf(" ");
|
||||||
|
if (queryIndex != -1) {
|
||||||
|
queryString = searchString.substring(queryIndex + 1);
|
||||||
|
}
|
||||||
|
// We need to escape the parameters as if they were the query in a URL
|
||||||
|
queryString = encodeURIComponent(queryString).replace(/%20/g, "+");
|
||||||
|
let escapedURL = entry.url.href.replace("%s", queryString);
|
||||||
|
|
||||||
|
let style = (this._enableActions ? "action " : "") + "keyword";
|
||||||
|
let actionURL = makeActionURL("keyword", { url: escapedURL,
|
||||||
|
input: this._originalSearchString });
|
||||||
|
let value = this._enableActions ? actionURL : escapedURL;
|
||||||
|
// The title will end up being "host: queryString"
|
||||||
|
let comment = entry.url.host;
|
||||||
|
|
||||||
|
this._addMatch({ value, comment, style, frecency: FRECENCY_DEFAULT });
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
_matchSearchEngineUrl: function* () {
|
_matchSearchEngineUrl: function* () {
|
||||||
if (!Prefs.autofillSearchEngines)
|
if (!Prefs.autofillSearchEngines)
|
||||||
return false;
|
return false;
|
||||||
|
@ -922,7 +933,7 @@ Search.prototype = {
|
||||||
icon: match.iconUrl,
|
icon: match.iconUrl,
|
||||||
style: "priority-search",
|
style: "priority-search",
|
||||||
finalCompleteValue: match.url,
|
finalCompleteValue: match.url,
|
||||||
frecency: FRECENCY_SEARCHENGINES_DEFAULT
|
frecency: FRECENCY_DEFAULT
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
@ -969,7 +980,7 @@ Search.prototype = {
|
||||||
comment: match.engineName,
|
comment: match.engineName,
|
||||||
icon: match.iconUrl,
|
icon: match.iconUrl,
|
||||||
style: "action searchengine",
|
style: "action searchengine",
|
||||||
frecency: FRECENCY_SEARCHENGINES_DEFAULT,
|
frecency: FRECENCY_DEFAULT,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1052,7 +1063,6 @@ Search.prototype = {
|
||||||
match = this._processUrlRow(row);
|
match = this._processUrlRow(row);
|
||||||
break;
|
break;
|
||||||
case QUERYTYPE_FILTERED:
|
case QUERYTYPE_FILTERED:
|
||||||
case QUERYTYPE_KEYWORD:
|
|
||||||
match = this._processRow(row);
|
match = this._processRow(row);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1236,17 +1246,6 @@ Search.prototype = {
|
||||||
// Always prefer the bookmark title unless it is empty
|
// Always prefer the bookmark title unless it is empty
|
||||||
let title = bookmarkTitle || historyTitle;
|
let title = bookmarkTitle || historyTitle;
|
||||||
|
|
||||||
if (queryType == QUERYTYPE_KEYWORD) {
|
|
||||||
match.style = "keyword";
|
|
||||||
if (this._enableActions) {
|
|
||||||
url = makeActionURL("keyword", {
|
|
||||||
url: escapedURL,
|
|
||||||
input: this._originalSearchString,
|
|
||||||
});
|
|
||||||
action = "keyword";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We will always prefer to show tags if we have them.
|
// We will always prefer to show tags if we have them.
|
||||||
let showTags = !!tags;
|
let showTags = !!tags;
|
||||||
|
|
||||||
|
@ -1352,37 +1351,6 @@ Search.prototype = {
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtains the query to search for keywords.
|
|
||||||
*
|
|
||||||
* @return an array consisting of the correctly optimized query to search the
|
|
||||||
* database with and an object containing the params to bound.
|
|
||||||
*/
|
|
||||||
get _keywordQuery() {
|
|
||||||
// The keyword is the first word in the search string, with the parameters
|
|
||||||
// following it.
|
|
||||||
let searchString = this._trimmedOriginalSearchString;
|
|
||||||
let queryString = "";
|
|
||||||
let queryIndex = searchString.indexOf(" ");
|
|
||||||
if (queryIndex != -1) {
|
|
||||||
queryString = searchString.substring(queryIndex + 1);
|
|
||||||
}
|
|
||||||
// We need to escape the parameters as if they were the query in a URL
|
|
||||||
queryString = encodeURIComponent(queryString).replace(/%20/g, "+");
|
|
||||||
|
|
||||||
// The first word could be a keyword, so that's what we'll search.
|
|
||||||
let keyword = this._searchTokens[0];
|
|
||||||
|
|
||||||
return [
|
|
||||||
SQL_KEYWORD_QUERY,
|
|
||||||
{
|
|
||||||
keyword: keyword,
|
|
||||||
query_string: queryString,
|
|
||||||
query_type: QUERYTYPE_KEYWORD
|
|
||||||
}
|
|
||||||
];
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtains the query to search for switch-to-tab entries.
|
* Obtains the query to search for switch-to-tab entries.
|
||||||
*
|
*
|
||||||
|
|
|
@ -12,6 +12,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
|
||||||
"resource://gre/modules/TelemetryStopwatch.jsm");
|
"resource://gre/modules/TelemetryStopwatch.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
||||||
"resource://gre/modules/NetUtil.jsm");
|
"resource://gre/modules/NetUtil.jsm");
|
||||||
|
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||||
|
"resource://gre/modules/Task.jsm");
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//// Constants
|
//// Constants
|
||||||
|
@ -1168,16 +1170,8 @@ nsPlacesAutoComplete.prototype = {
|
||||||
|
|
||||||
let style;
|
let style;
|
||||||
if (aRow.getResultByIndex(kQueryIndexQueryType) == kQueryTypeKeyword) {
|
if (aRow.getResultByIndex(kQueryIndexQueryType) == kQueryTypeKeyword) {
|
||||||
// If we do not have a title, then we must have a keyword, so let the UI
|
style = "keyword";
|
||||||
// know it is a keyword. Otherwise, we found an exact page match, so just
|
title = NetUtil.newURI(escapedEntryURL).host;
|
||||||
// show the page like a regular result. Because the page title is likely
|
|
||||||
// going to be more specific than the bookmark title (keyword title).
|
|
||||||
if (!entryTitle) {
|
|
||||||
style = "keyword";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
title = entryTitle;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We will always prefer to show tags if we have them.
|
// We will always prefer to show tags if we have them.
|
||||||
|
@ -1432,6 +1426,8 @@ urlInlineComplete.prototype = {
|
||||||
this.stopSearch();
|
this.stopSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let pendingSearch = this._pendingSearch = {};
|
||||||
|
|
||||||
// We want to store the original string with no leading or trailing
|
// We want to store the original string with no leading or trailing
|
||||||
// whitespace for case sensitive searches.
|
// whitespace for case sensitive searches.
|
||||||
this._originalSearchString = aSearchString;
|
this._originalSearchString = aSearchString;
|
||||||
|
@ -1450,74 +1446,82 @@ urlInlineComplete.prototype = {
|
||||||
|
|
||||||
this._listener = aListener;
|
this._listener = aListener;
|
||||||
|
|
||||||
// Don't autoFill if the search term is recognized as a keyword, otherwise
|
Task.spawn(function* () {
|
||||||
// it will override default keywords behavior. Note that keywords are
|
// Don't autoFill if the search term is recognized as a keyword, otherwise
|
||||||
// hashed on first use, so while the first query may delay a little bit,
|
// it will override default keywords behavior. Note that keywords are
|
||||||
// next ones will just hit the memory hash.
|
// hashed on first use, so while the first query may delay a little bit,
|
||||||
if (this._currentSearchString.length == 0 || !this._db ||
|
// next ones will just hit the memory hash.
|
||||||
PlacesUtils.bookmarks.getURIForKeyword(this._currentSearchString)) {
|
let dontAutoFill = this._currentSearchString.length == 0 || !this._db ||
|
||||||
this._finishSearch();
|
(yield PlacesUtils.keywords.fetch(this._currentSearchString));
|
||||||
return;
|
if (this._pendingSearch != pendingSearch)
|
||||||
}
|
return;
|
||||||
|
if (dontAutoFill) {
|
||||||
// Don't try to autofill if the search term includes any whitespace.
|
|
||||||
// This may confuse completeDefaultIndex cause the AUTOCOMPLETE_MATCH
|
|
||||||
// tokenizer ends up trimming the search string and returning a value
|
|
||||||
// that doesn't match it, or is even shorter.
|
|
||||||
if (/\s/.test(this._currentSearchString)) {
|
|
||||||
this._finishSearch();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hosts have no "/" in them.
|
|
||||||
let lastSlashIndex = this._currentSearchString.lastIndexOf("/");
|
|
||||||
|
|
||||||
// Search only URLs if there's a slash in the search string...
|
|
||||||
if (lastSlashIndex != -1) {
|
|
||||||
// ...but not if it's exactly at the end of the search string.
|
|
||||||
if (lastSlashIndex < this._currentSearchString.length - 1)
|
|
||||||
this._queryURL();
|
|
||||||
else
|
|
||||||
this._finishSearch();
|
this._finishSearch();
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Do a synchronous search on the table of hosts.
|
|
||||||
let query = this._hostQuery;
|
|
||||||
query.params.search_string = this._currentSearchString.toLowerCase();
|
|
||||||
// This is just to measure the delay to reach the UI, not the query time.
|
|
||||||
TelemetryStopwatch.start(DOMAIN_QUERY_TELEMETRY);
|
|
||||||
let ac = this;
|
|
||||||
let wrapper = new AutoCompleteStatementCallbackWrapper(this, {
|
|
||||||
handleResult: function (aResultSet) {
|
|
||||||
let row = aResultSet.getNextRow();
|
|
||||||
let trimmedHost = row.getResultByIndex(0);
|
|
||||||
let untrimmedHost = row.getResultByIndex(1);
|
|
||||||
// If the untrimmed value doesn't preserve the user's input just
|
|
||||||
// ignore it and complete to the found host.
|
|
||||||
if (untrimmedHost &&
|
|
||||||
!untrimmedHost.toLowerCase().contains(ac._originalSearchString.toLowerCase())) {
|
|
||||||
untrimmedHost = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ac._result.appendMatch(ac._strippedPrefix + trimmedHost, "", "", "", untrimmedHost);
|
|
||||||
|
|
||||||
// handleCompletion() will cause the result listener to be called, and
|
|
||||||
// will display the result in the UI.
|
|
||||||
},
|
|
||||||
|
|
||||||
handleError: function (aError) {
|
|
||||||
Components.utils.reportError(
|
|
||||||
"URL Inline Complete: An async statement encountered an " +
|
|
||||||
"error: " + aError.result + ", '" + aError.message + "'");
|
|
||||||
},
|
|
||||||
|
|
||||||
handleCompletion: function (aReason) {
|
|
||||||
TelemetryStopwatch.finish(DOMAIN_QUERY_TELEMETRY);
|
|
||||||
ac._finishSearch();
|
|
||||||
}
|
}
|
||||||
}, this._db);
|
|
||||||
this._pendingQuery = wrapper.executeAsync([query]);
|
// Don't try to autofill if the search term includes any whitespace.
|
||||||
|
// This may confuse completeDefaultIndex cause the AUTOCOMPLETE_MATCH
|
||||||
|
// tokenizer ends up trimming the search string and returning a value
|
||||||
|
// that doesn't match it, or is even shorter.
|
||||||
|
if (/\s/.test(this._currentSearchString)) {
|
||||||
|
this._finishSearch();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hosts have no "/" in them.
|
||||||
|
let lastSlashIndex = this._currentSearchString.lastIndexOf("/");
|
||||||
|
|
||||||
|
// Search only URLs if there's a slash in the search string...
|
||||||
|
if (lastSlashIndex != -1) {
|
||||||
|
// ...but not if it's exactly at the end of the search string.
|
||||||
|
if (lastSlashIndex < this._currentSearchString.length - 1)
|
||||||
|
this._queryURL();
|
||||||
|
else
|
||||||
|
this._finishSearch();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do a synchronous search on the table of hosts.
|
||||||
|
let query = this._hostQuery;
|
||||||
|
query.params.search_string = this._currentSearchString.toLowerCase();
|
||||||
|
// This is just to measure the delay to reach the UI, not the query time.
|
||||||
|
TelemetryStopwatch.start(DOMAIN_QUERY_TELEMETRY);
|
||||||
|
let wrapper = new AutoCompleteStatementCallbackWrapper(this, {
|
||||||
|
handleResult: aResultSet => {
|
||||||
|
if (this._pendingSearch != pendingSearch)
|
||||||
|
return;
|
||||||
|
let row = aResultSet.getNextRow();
|
||||||
|
let trimmedHost = row.getResultByIndex(0);
|
||||||
|
let untrimmedHost = row.getResultByIndex(1);
|
||||||
|
// If the untrimmed value doesn't preserve the user's input just
|
||||||
|
// ignore it and complete to the found host.
|
||||||
|
if (untrimmedHost &&
|
||||||
|
!untrimmedHost.toLowerCase().contains(this._originalSearchString.toLowerCase())) {
|
||||||
|
untrimmedHost = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._result.appendMatch(this._strippedPrefix + trimmedHost, "", "", "", untrimmedHost);
|
||||||
|
|
||||||
|
// handleCompletion() will cause the result listener to be called, and
|
||||||
|
// will display the result in the UI.
|
||||||
|
},
|
||||||
|
|
||||||
|
handleError: aError => {
|
||||||
|
Components.utils.reportError(
|
||||||
|
"URL Inline Complete: An async statement encountered an " +
|
||||||
|
"error: " + aError.result + ", '" + aError.message + "'");
|
||||||
|
},
|
||||||
|
|
||||||
|
handleCompletion: aReason => {
|
||||||
|
if (this._pendingSearch != pendingSearch)
|
||||||
|
return;
|
||||||
|
TelemetryStopwatch.finish(DOMAIN_QUERY_TELEMETRY);
|
||||||
|
this._finishSearch();
|
||||||
|
}
|
||||||
|
}, this._db);
|
||||||
|
this._pendingQuery = wrapper.executeAsync([query]);
|
||||||
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1546,9 +1550,8 @@ urlInlineComplete.prototype = {
|
||||||
params.searchString = this._currentSearchString;
|
params.searchString = this._currentSearchString;
|
||||||
|
|
||||||
// Execute the query.
|
// Execute the query.
|
||||||
let ac = this;
|
|
||||||
let wrapper = new AutoCompleteStatementCallbackWrapper(this, {
|
let wrapper = new AutoCompleteStatementCallbackWrapper(this, {
|
||||||
handleResult: function(aResultSet) {
|
handleResult: aResultSet => {
|
||||||
let row = aResultSet.getNextRow();
|
let row = aResultSet.getNextRow();
|
||||||
let value = row.getResultByIndex(0);
|
let value = row.getResultByIndex(0);
|
||||||
let url = fixupSearchText(value);
|
let url = fixupSearchText(value);
|
||||||
|
@ -1556,10 +1559,10 @@ urlInlineComplete.prototype = {
|
||||||
let prefix = value.slice(0, value.length - stripPrefix(value).length);
|
let prefix = value.slice(0, value.length - stripPrefix(value).length);
|
||||||
|
|
||||||
// We must complete the URL up to the next separator (which is /, ? or #).
|
// We must complete the URL up to the next separator (which is /, ? or #).
|
||||||
let separatorIndex = url.slice(ac._currentSearchString.length)
|
let separatorIndex = url.slice(this._currentSearchString.length)
|
||||||
.search(/[\/\?\#]/);
|
.search(/[\/\?\#]/);
|
||||||
if (separatorIndex != -1) {
|
if (separatorIndex != -1) {
|
||||||
separatorIndex += ac._currentSearchString.length;
|
separatorIndex += this._currentSearchString.length;
|
||||||
if (url[separatorIndex] == "/") {
|
if (url[separatorIndex] == "/") {
|
||||||
separatorIndex++; // Include the "/" separator
|
separatorIndex++; // Include the "/" separator
|
||||||
}
|
}
|
||||||
|
@ -1571,24 +1574,24 @@ urlInlineComplete.prototype = {
|
||||||
// ignore it and complete to the found url.
|
// ignore it and complete to the found url.
|
||||||
let untrimmedURL = prefix + url;
|
let untrimmedURL = prefix + url;
|
||||||
if (untrimmedURL &&
|
if (untrimmedURL &&
|
||||||
!untrimmedURL.toLowerCase().contains(ac._originalSearchString.toLowerCase())) {
|
!untrimmedURL.toLowerCase().contains(this._originalSearchString.toLowerCase())) {
|
||||||
untrimmedURL = null;
|
untrimmedURL = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ac._result.appendMatch(ac._strippedPrefix + url, "", "", "", untrimmedURL);
|
this._result.appendMatch(this._strippedPrefix + url, "", "", "", untrimmedURL);
|
||||||
|
|
||||||
// handleCompletion() will cause the result listener to be called, and
|
// handleCompletion() will cause the result listener to be called, and
|
||||||
// will display the result in the UI.
|
// will display the result in the UI.
|
||||||
},
|
},
|
||||||
|
|
||||||
handleError: function(aError) {
|
handleError: aError => {
|
||||||
Components.utils.reportError(
|
Components.utils.reportError(
|
||||||
"URL Inline Complete: An async statement encountered an " +
|
"URL Inline Complete: An async statement encountered an " +
|
||||||
"error: " + aError.result + ", '" + aError.message + "'");
|
"error: " + aError.result + ", '" + aError.message + "'");
|
||||||
},
|
},
|
||||||
|
|
||||||
handleCompletion: function(aReason) {
|
handleCompletion: aReason => {
|
||||||
ac._finishSearch();
|
this._finishSearch();
|
||||||
}
|
}
|
||||||
}, this._db);
|
}, this._db);
|
||||||
this._pendingQuery = wrapper.executeAsync([query]);
|
this._pendingQuery = wrapper.executeAsync([query]);
|
||||||
|
@ -1600,6 +1603,7 @@ urlInlineComplete.prototype = {
|
||||||
delete this._currentSearchString;
|
delete this._currentSearchString;
|
||||||
delete this._result;
|
delete this._result;
|
||||||
delete this._listener;
|
delete this._listener;
|
||||||
|
delete this._pendingSearch;
|
||||||
|
|
||||||
if (this._pendingQuery) {
|
if (this._pendingQuery) {
|
||||||
this._pendingQuery.cancel();
|
this._pendingQuery.cancel();
|
||||||
|
|
|
@ -38,18 +38,20 @@ let kURIs = [
|
||||||
let kTitles = [
|
let kTitles = [
|
||||||
"Generic page title",
|
"Generic page title",
|
||||||
"Keyword title",
|
"Keyword title",
|
||||||
|
"abc",
|
||||||
|
"xyz"
|
||||||
];
|
];
|
||||||
|
|
||||||
// Add the keyword bookmark
|
// Add the keyword bookmark
|
||||||
addPageBook(0, 0, 1, [], keyKey);
|
addPageBook(0, 0, 1, [], keyKey);
|
||||||
// Add in the "fake pages" for keyword searches
|
// Add in the "fake pages" for keyword searches
|
||||||
gPages[1] = [1,0];
|
gPages[1] = [1,2];
|
||||||
gPages[2] = [2,0];
|
gPages[2] = [2,2];
|
||||||
gPages[3] = [3,0];
|
gPages[3] = [3,2];
|
||||||
gPages[4] = [4,0];
|
gPages[4] = [4,2];
|
||||||
// Add a page into history
|
// Add a page into history
|
||||||
addPageBook(5, 0);
|
addPageBook(5, 2);
|
||||||
gPages[6] = [6,0];
|
gPages[6] = [6,2];
|
||||||
|
|
||||||
// Provide for each test: description; search terms; array of gPages indices of
|
// Provide for each test: description; search terms; array of gPages indices of
|
||||||
// pages that should match; optional function to be run before the test
|
// pages that should match; optional function to be run before the test
|
||||||
|
|
|
@ -122,26 +122,33 @@ function ensure_results(aSearchString, aExpectedValue) {
|
||||||
do_check_eq(numSearchesStarted, 1);
|
do_check_eq(numSearchesStarted, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
input.onSearchComplete = function() {
|
|
||||||
// We should be running only one query.
|
|
||||||
do_check_eq(numSearchesStarted, 1);
|
|
||||||
|
|
||||||
// Check the autoFilled result.
|
let promise = new Promise(resolve => {
|
||||||
do_check_eq(input.textValue, autoFilledValue);
|
input.onSearchComplete = function() {
|
||||||
|
// We should be running only one query.
|
||||||
|
do_check_eq(numSearchesStarted, 1);
|
||||||
|
|
||||||
if (completedValue) {
|
// Check the autoFilled result.
|
||||||
// Now force completion and check correct casing of the result.
|
do_check_eq(input.textValue, autoFilledValue);
|
||||||
// This ensures the controller is able to do its magic case-preserving
|
|
||||||
// stuff and correct replacement of the user's casing with result's one.
|
|
||||||
controller.handleEnter(false);
|
|
||||||
do_check_eq(input.textValue, completedValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
waitForCleanup(run_next_test);
|
if (completedValue) {
|
||||||
};
|
// Now force completion and check correct casing of the result.
|
||||||
|
// This ensures the controller is able to do its magic case-preserving
|
||||||
|
// stuff and correct replacement of the user's casing with result's one.
|
||||||
|
controller.handleEnter(false);
|
||||||
|
do_check_eq(input.textValue, completedValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup.
|
||||||
|
remove_all_bookmarks();
|
||||||
|
PlacesTestUtils.clearHistory().then(resolve);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
do_print("Searching for: '" + aSearchString + "'");
|
do_print("Searching for: '" + aSearchString + "'");
|
||||||
controller.startSearch(aSearchString);
|
controller.startSearch(aSearchString);
|
||||||
|
|
||||||
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
|
@ -153,22 +160,22 @@ function run_test() {
|
||||||
|
|
||||||
gAutoCompleteTests.forEach(function (testData) {
|
gAutoCompleteTests.forEach(function (testData) {
|
||||||
let [description, searchString, expectedValue, setupFunc] = testData;
|
let [description, searchString, expectedValue, setupFunc] = testData;
|
||||||
add_test(function () {
|
add_task(function* () {
|
||||||
do_print(description);
|
do_print(description);
|
||||||
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", true);
|
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", true);
|
||||||
Services.prefs.setBoolPref("browser.urlbar.autoFill", true);
|
Services.prefs.setBoolPref("browser.urlbar.autoFill", true);
|
||||||
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
|
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
|
||||||
|
|
||||||
if (setupFunc) {
|
if (setupFunc) {
|
||||||
setupFunc();
|
yield setupFunc();
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point frecency could still be updating due to latest pages
|
// At this point frecency could still be updating due to latest pages
|
||||||
// updates.
|
// updates.
|
||||||
// This is not a problem in real life, but autocomplete tests should
|
// This is not a problem in real life, but autocomplete tests should
|
||||||
// return reliable resultsets, thus we have to wait.
|
// return reliable resultsets, thus we have to wait.
|
||||||
PlacesTestUtils.promiseAsyncUpdates()
|
yield PlacesTestUtils.promiseAsyncUpdates();
|
||||||
.then(() => ensure_results(searchString, expectedValue));
|
yield ensure_results(searchString, expectedValue);
|
||||||
})
|
})
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
@ -180,21 +187,13 @@ function add_autocomplete_test(aTestData) {
|
||||||
gAutoCompleteTests.push(aTestData);
|
gAutoCompleteTests.push(aTestData);
|
||||||
}
|
}
|
||||||
|
|
||||||
function waitForCleanup(aCallback) {
|
function* addBookmark(aBookmarkObj) {
|
||||||
remove_all_bookmarks();
|
|
||||||
PlacesTestUtils.clearHistory().then(aCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
function addBookmark(aBookmarkObj) {
|
|
||||||
do_check_true(!!aBookmarkObj.url);
|
do_check_true(!!aBookmarkObj.url);
|
||||||
let parentId = aBookmarkObj.parentId ? aBookmarkObj.parentId
|
yield PlacesUtils.bookmarks
|
||||||
: PlacesUtils.unfiledBookmarksFolderId;
|
.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
let itemId = PlacesUtils.bookmarks
|
url: aBookmarkObj.url });
|
||||||
.insertBookmark(parentId,
|
|
||||||
NetUtil.newURI(aBookmarkObj.url),
|
|
||||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
|
||||||
"A bookmark");
|
|
||||||
if (aBookmarkObj.keyword) {
|
if (aBookmarkObj.keyword) {
|
||||||
PlacesUtils.bookmarks.setKeywordForBookmark(itemId, aBookmarkObj.keyword);
|
yield PlacesUtils.keywords.insert({ keyword: aBookmarkObj.keyword,
|
||||||
|
url: aBookmarkObj.url });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,9 @@ add_autocomplete_test([
|
||||||
"Check disabling autocomplete disables autofill",
|
"Check disabling autocomplete disables autofill",
|
||||||
"vis",
|
"vis",
|
||||||
"vis",
|
"vis",
|
||||||
function ()
|
function* () {
|
||||||
{
|
|
||||||
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false);
|
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false);
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://visit.mozilla.org"),
|
uri: NetUtil.newURI("http://visit.mozilla.org"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -22,10 +21,9 @@ add_autocomplete_test([
|
||||||
"Check disabling autofill disables autofill",
|
"Check disabling autofill disables autofill",
|
||||||
"vis",
|
"vis",
|
||||||
"vis",
|
"vis",
|
||||||
function ()
|
function* () {
|
||||||
{
|
|
||||||
Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
|
Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://visit.mozilla.org"),
|
uri: NetUtil.newURI("http://visit.mozilla.org"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -36,12 +34,11 @@ add_autocomplete_test([
|
||||||
"Add urls, check for correct order",
|
"Add urls, check for correct order",
|
||||||
"vis",
|
"vis",
|
||||||
"visit2.mozilla.org/",
|
"visit2.mozilla.org/",
|
||||||
function ()
|
function* () {
|
||||||
{
|
|
||||||
let places = [{ uri: NetUtil.newURI("http://visit1.mozilla.org") },
|
let places = [{ uri: NetUtil.newURI("http://visit1.mozilla.org") },
|
||||||
{ uri: NetUtil.newURI("http://visit2.mozilla.org"),
|
{ uri: NetUtil.newURI("http://visit2.mozilla.org"),
|
||||||
transition: TRANSITION_TYPED }];
|
transition: TRANSITION_TYPED }];
|
||||||
PlacesTestUtils.addVisits(places);
|
yield PlacesTestUtils.addVisits(places);
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -49,9 +46,8 @@ add_autocomplete_test([
|
||||||
"Add urls, make sure www and http are ignored",
|
"Add urls, make sure www and http are ignored",
|
||||||
"visit1",
|
"visit1",
|
||||||
"visit1.mozilla.org/",
|
"visit1.mozilla.org/",
|
||||||
function ()
|
function* () {
|
||||||
{
|
yield PlacesTestUtils.addVisits(NetUtil.newURI("http://www.visit1.mozilla.org"));
|
||||||
PlacesTestUtils.addVisits(NetUtil.newURI("http://www.visit1.mozilla.org"));
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -59,9 +55,8 @@ add_autocomplete_test([
|
||||||
"Autocompleting after an existing host completes to the url",
|
"Autocompleting after an existing host completes to the url",
|
||||||
"visit3.mozilla.org/",
|
"visit3.mozilla.org/",
|
||||||
"visit3.mozilla.org/",
|
"visit3.mozilla.org/",
|
||||||
function ()
|
function* () {
|
||||||
{
|
yield PlacesTestUtils.addVisits(NetUtil.newURI("http://www.visit3.mozilla.org"));
|
||||||
PlacesTestUtils.addVisits(NetUtil.newURI("http://www.visit3.mozilla.org"));
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -69,9 +64,8 @@ add_autocomplete_test([
|
||||||
"Searching for www.me should yield www.me.mozilla.org/",
|
"Searching for www.me should yield www.me.mozilla.org/",
|
||||||
"www.me",
|
"www.me",
|
||||||
"www.me.mozilla.org/",
|
"www.me.mozilla.org/",
|
||||||
function ()
|
function* () {
|
||||||
{
|
yield PlacesTestUtils.addVisits(NetUtil.newURI("http://www.me.mozilla.org"));
|
||||||
PlacesTestUtils.addVisits(NetUtil.newURI("http://www.me.mozilla.org"));
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -79,10 +73,9 @@ add_autocomplete_test([
|
||||||
"With a bookmark and history, the query result should be the bookmark",
|
"With a bookmark and history, the query result should be the bookmark",
|
||||||
"bookmark",
|
"bookmark",
|
||||||
"bookmark1.mozilla.org/",
|
"bookmark1.mozilla.org/",
|
||||||
function ()
|
function* () {
|
||||||
{
|
yield addBookmark({ url: "http://bookmark1.mozilla.org/", });
|
||||||
addBookmark({ url: "http://bookmark1.mozilla.org/", });
|
yield PlacesTestUtils.addVisits(NetUtil.newURI("http://bookmark1.mozilla.org/foo"));
|
||||||
PlacesTestUtils.addVisits(NetUtil.newURI("http://bookmark1.mozilla.org/foo"));
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -90,12 +83,10 @@ add_autocomplete_test([
|
||||||
"Check to make sure we get the proper results with full paths",
|
"Check to make sure we get the proper results with full paths",
|
||||||
"smokey",
|
"smokey",
|
||||||
"smokey.mozilla.org/",
|
"smokey.mozilla.org/",
|
||||||
function ()
|
function* () {
|
||||||
{
|
|
||||||
|
|
||||||
let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
|
let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
|
||||||
{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
|
{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
|
||||||
PlacesTestUtils.addVisits(places);
|
yield PlacesTestUtils.addVisits(places);
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -103,12 +94,10 @@ add_autocomplete_test([
|
||||||
"Check to make sure we autocomplete to the following '/'",
|
"Check to make sure we autocomplete to the following '/'",
|
||||||
"smokey.mozilla.org/fo",
|
"smokey.mozilla.org/fo",
|
||||||
"smokey.mozilla.org/foo/",
|
"smokey.mozilla.org/foo/",
|
||||||
function ()
|
function* () {
|
||||||
{
|
|
||||||
|
|
||||||
let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
|
let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
|
||||||
{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
|
{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
|
||||||
PlacesTestUtils.addVisits(places);
|
yield PlacesTestUtils.addVisits(places);
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -116,9 +105,8 @@ add_autocomplete_test([
|
||||||
"Check to make sure we autocomplete after ?",
|
"Check to make sure we autocomplete after ?",
|
||||||
"smokey.mozilla.org/foo?",
|
"smokey.mozilla.org/foo?",
|
||||||
"smokey.mozilla.org/foo?bacon=delicious",
|
"smokey.mozilla.org/foo?bacon=delicious",
|
||||||
function ()
|
function* () {
|
||||||
{
|
yield PlacesTestUtils.addVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious"));
|
||||||
PlacesTestUtils.addVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious"));
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -126,8 +114,7 @@ add_autocomplete_test([
|
||||||
"Check to make sure we autocomplete after #",
|
"Check to make sure we autocomplete after #",
|
||||||
"smokey.mozilla.org/foo?bacon=delicious#bar",
|
"smokey.mozilla.org/foo?bacon=delicious#bar",
|
||||||
"smokey.mozilla.org/foo?bacon=delicious#bar",
|
"smokey.mozilla.org/foo?bacon=delicious#bar",
|
||||||
function ()
|
function* () {
|
||||||
{
|
yield PlacesTestUtils.addVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious#bar"));
|
||||||
PlacesTestUtils.addVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious#bar"));
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -6,8 +6,8 @@ add_autocomplete_test([
|
||||||
"Searching for cased entry 1",
|
"Searching for cased entry 1",
|
||||||
"MOZ",
|
"MOZ",
|
||||||
{ autoFilled: "MOZilla.org/", completed: "mozilla.org/" },
|
{ autoFilled: "MOZilla.org/", completed: "mozilla.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/test/") });
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ add_autocomplete_test([
|
||||||
"Searching for cased entry 2",
|
"Searching for cased entry 2",
|
||||||
"mozilla.org/T",
|
"mozilla.org/T",
|
||||||
{ autoFilled: "mozilla.org/T", completed: "mozilla.org/T" },
|
{ autoFilled: "mozilla.org/T", completed: "mozilla.org/T" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/test/") });
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ add_autocomplete_test([
|
||||||
"Searching for cased entry 3",
|
"Searching for cased entry 3",
|
||||||
"mozilla.org/T",
|
"mozilla.org/T",
|
||||||
{ autoFilled: "mozilla.org/Test/", completed: "http://mozilla.org/Test/" },
|
{ autoFilled: "mozilla.org/Test/", completed: "http://mozilla.org/Test/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ add_autocomplete_test([
|
||||||
"Searching for cased entry 4",
|
"Searching for cased entry 4",
|
||||||
"mOzilla.org/t",
|
"mOzilla.org/t",
|
||||||
{ autoFilled: "mOzilla.org/t", completed: "mOzilla.org/t" },
|
{ autoFilled: "mOzilla.org/t", completed: "mOzilla.org/t" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ add_autocomplete_test([
|
||||||
"Searching for cased entry 5",
|
"Searching for cased entry 5",
|
||||||
"mOzilla.org/T",
|
"mOzilla.org/T",
|
||||||
{ autoFilled: "mOzilla.org/Test/", completed: "http://mozilla.org/Test/" },
|
{ autoFilled: "mOzilla.org/Test/", completed: "http://mozilla.org/Test/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed cased entry",
|
"Searching for untrimmed cased entry",
|
||||||
"http://mOz",
|
"http://mOz",
|
||||||
{ autoFilled: "http://mOzilla.org/", completed: "http://mozilla.org/" },
|
{ autoFilled: "http://mOzilla.org/", completed: "http://mozilla.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed cased entry with www",
|
"Searching for untrimmed cased entry with www",
|
||||||
"http://www.mOz",
|
"http://www.mOz",
|
||||||
{ autoFilled: "http://www.mOzilla.org/", completed: "http://www.mozilla.org/" },
|
{ autoFilled: "http://www.mOzilla.org/", completed: "http://www.mozilla.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/") });
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed cased entry with path",
|
"Searching for untrimmed cased entry with path",
|
||||||
"http://mOzilla.org/t",
|
"http://mOzilla.org/t",
|
||||||
{ autoFilled: "http://mOzilla.org/t", completed: "http://mOzilla.org/t" },
|
{ autoFilled: "http://mOzilla.org/t", completed: "http://mOzilla.org/t" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -78,8 +78,8 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed cased entry with path 2",
|
"Searching for untrimmed cased entry with path 2",
|
||||||
"http://mOzilla.org/T",
|
"http://mOzilla.org/T",
|
||||||
{ autoFilled: "http://mOzilla.org/Test/", completed: "http://mozilla.org/Test/" },
|
{ autoFilled: "http://mOzilla.org/Test/", completed: "http://mozilla.org/Test/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -87,8 +87,8 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed cased entry with www and path",
|
"Searching for untrimmed cased entry with www and path",
|
||||||
"http://www.mOzilla.org/t",
|
"http://www.mOzilla.org/t",
|
||||||
{ autoFilled: "http://www.mOzilla.org/t", completed: "http://www.mOzilla.org/t" },
|
{ autoFilled: "http://www.mOzilla.org/t", completed: "http://www.mOzilla.org/t" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/") });
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed cased entry with www and path 2",
|
"Searching for untrimmed cased entry with www and path 2",
|
||||||
"http://www.mOzilla.org/T",
|
"http://www.mOzilla.org/T",
|
||||||
{ autoFilled: "http://www.mOzilla.org/Test/", completed: "http://www.mozilla.org/Test/" },
|
{ autoFilled: "http://www.mOzilla.org/Test/", completed: "http://www.mozilla.org/Test/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/") });
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -9,8 +9,8 @@ add_autocomplete_test([
|
||||||
"Do not autofill whitespaced entry 1",
|
"Do not autofill whitespaced entry 1",
|
||||||
"mozilla.org ",
|
"mozilla.org ",
|
||||||
"mozilla.org ",
|
"mozilla.org ",
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://mozilla.org/link/"),
|
uri: NetUtil.newURI("http://mozilla.org/link/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -21,8 +21,8 @@ add_autocomplete_test([
|
||||||
"Do not autofill whitespaced entry 2",
|
"Do not autofill whitespaced entry 2",
|
||||||
"mozilla.org/ ",
|
"mozilla.org/ ",
|
||||||
"mozilla.org/ ",
|
"mozilla.org/ ",
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://mozilla.org/link/"),
|
uri: NetUtil.newURI("http://mozilla.org/link/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -33,8 +33,8 @@ add_autocomplete_test([
|
||||||
"Do not autofill whitespaced entry 3",
|
"Do not autofill whitespaced entry 3",
|
||||||
"mozilla.org/link ",
|
"mozilla.org/link ",
|
||||||
"mozilla.org/link ",
|
"mozilla.org/link ",
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://mozilla.org/link/"),
|
uri: NetUtil.newURI("http://mozilla.org/link/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -45,8 +45,8 @@ add_autocomplete_test([
|
||||||
"Do not autofill whitespaced entry 4",
|
"Do not autofill whitespaced entry 4",
|
||||||
"mozilla.org/link/ ",
|
"mozilla.org/link/ ",
|
||||||
"mozilla.org/link/ ",
|
"mozilla.org/link/ ",
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://mozilla.org/link/"),
|
uri: NetUtil.newURI("http://mozilla.org/link/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -58,8 +58,8 @@ add_autocomplete_test([
|
||||||
"Do not autofill whitespaced entry 5",
|
"Do not autofill whitespaced entry 5",
|
||||||
"moz illa ",
|
"moz illa ",
|
||||||
"moz illa ",
|
"moz illa ",
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://mozilla.org/link/"),
|
uri: NetUtil.newURI("http://mozilla.org/link/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -70,8 +70,8 @@ add_autocomplete_test([
|
||||||
"Do not autofill whitespaced entry 6",
|
"Do not autofill whitespaced entry 6",
|
||||||
" mozilla",
|
" mozilla",
|
||||||
" mozilla",
|
" mozilla",
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://mozilla.org/link/"),
|
uri: NetUtil.newURI("http://mozilla.org/link/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,8 +6,8 @@ add_autocomplete_test([
|
||||||
"Searching for non-keyworded entry should autoFill it",
|
"Searching for non-keyworded entry should autoFill it",
|
||||||
"moz",
|
"moz",
|
||||||
"mozilla.org/",
|
"mozilla.org/",
|
||||||
function () {
|
function* () {
|
||||||
addBookmark({ url: "http://mozilla.org/test/" });
|
yield addBookmark({ url: "http://mozilla.org/test/" });
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ add_autocomplete_test([
|
||||||
"Searching for keyworded entry should not autoFill it",
|
"Searching for keyworded entry should not autoFill it",
|
||||||
"moz",
|
"moz",
|
||||||
"moz",
|
"moz",
|
||||||
function () {
|
function* () {
|
||||||
addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
|
yield addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ add_autocomplete_test([
|
||||||
"Searching for more than keyworded entry should autoFill it",
|
"Searching for more than keyworded entry should autoFill it",
|
||||||
"mozi",
|
"mozi",
|
||||||
"mozilla.org/",
|
"mozilla.org/",
|
||||||
function () {
|
function* () {
|
||||||
addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
|
yield addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ add_autocomplete_test([
|
||||||
"Searching for less than keyworded entry should autoFill it",
|
"Searching for less than keyworded entry should autoFill it",
|
||||||
"mo",
|
"mo",
|
||||||
"mozilla.org/",
|
"mozilla.org/",
|
||||||
function () {
|
function* () {
|
||||||
addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
|
yield addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ add_autocomplete_test([
|
||||||
"Searching for keyworded entry is case-insensitive",
|
"Searching for keyworded entry is case-insensitive",
|
||||||
"MoZ",
|
"MoZ",
|
||||||
"MoZ",
|
"MoZ",
|
||||||
function () {
|
function* () {
|
||||||
addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
|
yield addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -6,8 +6,8 @@ add_autocomplete_test([
|
||||||
"Searching for host match without slash should match host",
|
"Searching for host match without slash should match host",
|
||||||
"file",
|
"file",
|
||||||
"file.org/",
|
"file.org/",
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://file.org/test/"),
|
uri: NetUtil.newURI("http://file.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
}, {
|
}, {
|
||||||
|
@ -21,8 +21,8 @@ add_autocomplete_test([
|
||||||
"Searching match with slash at the end should do nothing",
|
"Searching match with slash at the end should do nothing",
|
||||||
"file.org/",
|
"file.org/",
|
||||||
"file.org/",
|
"file.org/",
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://file.org/test/"),
|
uri: NetUtil.newURI("http://file.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
}, {
|
}, {
|
||||||
|
@ -36,8 +36,8 @@ add_autocomplete_test([
|
||||||
"Searching match with slash in the middle should match url",
|
"Searching match with slash in the middle should match url",
|
||||||
"file.org/t",
|
"file.org/t",
|
||||||
"file.org/test/",
|
"file.org/test/",
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://file.org/test/"),
|
uri: NetUtil.newURI("http://file.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
}, {
|
}, {
|
||||||
|
@ -51,8 +51,8 @@ add_autocomplete_test([
|
||||||
"Searching for non-host match without slash should not match url",
|
"Searching for non-host match without slash should not match url",
|
||||||
"file",
|
"file",
|
||||||
"file",
|
"file",
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("file:///c:/test.html"),
|
uri: NetUtil.newURI("file:///c:/test.html"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,8 +6,8 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed https://www entry",
|
"Searching for untrimmed https://www entry",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "mozilla.org/", completed: "https://www.mozilla.org/" },
|
{ autoFilled: "mozilla.org/", completed: "https://www.mozilla.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("https://www.mozilla.org/test/"),
|
uri: NetUtil.newURI("https://www.mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -18,8 +18,8 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed https://www entry with path",
|
"Searching for untrimmed https://www entry with path",
|
||||||
"mozilla.org/t",
|
"mozilla.org/t",
|
||||||
{ autoFilled: "mozilla.org/test/", completed: "https://www.mozilla.org/test/" },
|
{ autoFilled: "mozilla.org/test/", completed: "https://www.mozilla.org/test/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("https://www.mozilla.org/test/"),
|
uri: NetUtil.newURI("https://www.mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -30,8 +30,8 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed https:// entry",
|
"Searching for untrimmed https:// entry",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "mozilla.org/", completed: "https://mozilla.org/" },
|
{ autoFilled: "mozilla.org/", completed: "https://mozilla.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("https://mozilla.org/test/"),
|
uri: NetUtil.newURI("https://mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -42,8 +42,8 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed https:// entry with path",
|
"Searching for untrimmed https:// entry with path",
|
||||||
"mozilla.org/t",
|
"mozilla.org/t",
|
||||||
{ autoFilled: "mozilla.org/test/", completed: "https://mozilla.org/test/" },
|
{ autoFilled: "mozilla.org/test/", completed: "https://mozilla.org/test/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("https://mozilla.org/test/"),
|
uri: NetUtil.newURI("https://mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -54,8 +54,8 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed http://www entry",
|
"Searching for untrimmed http://www entry",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "mozilla.org/", completed: "www.mozilla.org/" },
|
{ autoFilled: "mozilla.org/", completed: "www.mozilla.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://www.mozilla.org/test/"),
|
uri: NetUtil.newURI("http://www.mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -66,8 +66,8 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed http://www entry with path",
|
"Searching for untrimmed http://www entry with path",
|
||||||
"mozilla.org/t",
|
"mozilla.org/t",
|
||||||
{ autoFilled: "mozilla.org/test/", completed: "http://www.mozilla.org/test/" },
|
{ autoFilled: "mozilla.org/test/", completed: "http://www.mozilla.org/test/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://www.mozilla.org/test/"),
|
uri: NetUtil.newURI("http://www.mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -78,8 +78,8 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed ftp:// entry",
|
"Searching for untrimmed ftp:// entry",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "mozilla.org/", completed: "ftp://mozilla.org/" },
|
{ autoFilled: "mozilla.org/", completed: "ftp://mozilla.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("ftp://mozilla.org/test/"),
|
uri: NetUtil.newURI("ftp://mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -90,8 +90,8 @@ add_autocomplete_test([
|
||||||
"Searching for untrimmed ftp:// entry with path",
|
"Searching for untrimmed ftp:// entry with path",
|
||||||
"mozilla.org/t",
|
"mozilla.org/t",
|
||||||
{ autoFilled: "mozilla.org/test/", completed: "ftp://mozilla.org/test/" },
|
{ autoFilled: "mozilla.org/test/", completed: "ftp://mozilla.org/test/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("ftp://mozilla.org/test/"),
|
uri: NetUtil.newURI("ftp://mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -102,27 +102,24 @@ add_autocomplete_test([
|
||||||
"Ensuring correct priority 1",
|
"Ensuring correct priority 1",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "mozilla.org/", completed: "mozilla.org/" },
|
{ autoFilled: "mozilla.org/", completed: "mozilla.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits([
|
||||||
uri: NetUtil.newURI("https://www.mozilla.org/test/"),
|
{ uri: NetUtil.newURI("https://www.mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
},
|
||||||
PlacesTestUtils.addVisits({
|
{ uri: NetUtil.newURI("https://mozilla.org/test/"),
|
||||||
uri: NetUtil.newURI("https://mozilla.org/test/"),
|
transition: TRANSITION_TYPED
|
||||||
transition: TRANSITION_TYPED
|
},
|
||||||
});
|
{ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
|
||||||
PlacesTestUtils.addVisits({
|
transition: TRANSITION_TYPED
|
||||||
uri: NetUtil.newURI("ftp://mozilla.org/test/"),
|
},
|
||||||
transition: TRANSITION_TYPED
|
{ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
|
||||||
});
|
transition: TRANSITION_TYPED
|
||||||
PlacesTestUtils.addVisits({
|
},
|
||||||
uri: NetUtil.newURI("http://www.mozilla.org/test/"),
|
{ uri: NetUtil.newURI("http://mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
}
|
||||||
PlacesTestUtils.addVisits({
|
]);
|
||||||
uri: NetUtil.newURI("http://mozilla.org/test/"),
|
|
||||||
transition: TRANSITION_TYPED
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -130,23 +127,21 @@ add_autocomplete_test([
|
||||||
"Ensuring correct priority 2",
|
"Ensuring correct priority 2",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "mozilla.org/", completed: "mozilla.org/" },
|
{ autoFilled: "mozilla.org/", completed: "mozilla.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits([
|
||||||
uri: NetUtil.newURI("https://mozilla.org/test/"),
|
{ uri: NetUtil.newURI("https://mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
},
|
||||||
PlacesTestUtils.addVisits({
|
{ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
|
||||||
uri: NetUtil.newURI("ftp://mozilla.org/test/"),
|
transition: TRANSITION_TYPED
|
||||||
transition: TRANSITION_TYPED
|
},
|
||||||
});
|
{ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
|
||||||
PlacesTestUtils.addVisits({
|
transition: TRANSITION_TYPED
|
||||||
uri: NetUtil.newURI("http://www.mozilla.org/test/"),
|
},
|
||||||
transition: TRANSITION_TYPED
|
{ uri: NetUtil.newURI("http://mozilla.org/test/"),
|
||||||
});
|
transition: TRANSITION_TYPED
|
||||||
PlacesTestUtils.addVisits({
|
}
|
||||||
uri: NetUtil.newURI("http://mozilla.org/test/"),
|
]);
|
||||||
transition: TRANSITION_TYPED
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -154,19 +149,18 @@ add_autocomplete_test([
|
||||||
"Ensuring correct priority 3",
|
"Ensuring correct priority 3",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "mozilla.org/", completed: "mozilla.org/" },
|
{ autoFilled: "mozilla.org/", completed: "mozilla.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits([
|
||||||
uri: NetUtil.newURI("ftp://mozilla.org/test/"),
|
{ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
},
|
||||||
PlacesTestUtils.addVisits({
|
{ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
|
||||||
uri: NetUtil.newURI("http://www.mozilla.org/test/"),
|
transition: TRANSITION_TYPED
|
||||||
transition: TRANSITION_TYPED
|
},
|
||||||
});
|
{ uri: NetUtil.newURI("http://mozilla.org/test/"),
|
||||||
PlacesTestUtils.addVisits({
|
transition: TRANSITION_TYPED
|
||||||
uri: NetUtil.newURI("http://mozilla.org/test/"),
|
}
|
||||||
transition: TRANSITION_TYPED
|
]);
|
||||||
});
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -174,15 +168,15 @@ add_autocomplete_test([
|
||||||
"Ensuring correct priority 4",
|
"Ensuring correct priority 4",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "mozilla.org/", completed: "mozilla.org/" },
|
{ autoFilled: "mozilla.org/", completed: "mozilla.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits([
|
||||||
uri: NetUtil.newURI("http://www.mozilla.org/test/"),
|
{ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
},
|
||||||
PlacesTestUtils.addVisits({
|
{ uri: NetUtil.newURI("http://mozilla.org/test/"),
|
||||||
uri: NetUtil.newURI("http://mozilla.org/test/"),
|
transition: TRANSITION_TYPED
|
||||||
transition: TRANSITION_TYPED
|
}
|
||||||
});
|
]);
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -190,15 +184,15 @@ add_autocomplete_test([
|
||||||
"Ensuring correct priority 5",
|
"Ensuring correct priority 5",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "mozilla.org/", completed: "ftp://mozilla.org/" },
|
{ autoFilled: "mozilla.org/", completed: "ftp://mozilla.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits([
|
||||||
uri: NetUtil.newURI("ftp://mozilla.org/test/"),
|
{ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
},
|
||||||
PlacesTestUtils.addVisits({
|
{ uri: NetUtil.newURI("ftp://www.mozilla.org/test/"),
|
||||||
uri: NetUtil.newURI("ftp://www.mozilla.org/test/"),
|
transition: TRANSITION_TYPED
|
||||||
transition: TRANSITION_TYPED
|
}
|
||||||
});
|
]);
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -206,15 +200,15 @@ add_autocomplete_test([
|
||||||
"Ensuring correct priority 6",
|
"Ensuring correct priority 6",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "mozilla.org/", completed: "www.mozilla.org/" },
|
{ autoFilled: "mozilla.org/", completed: "www.mozilla.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits([
|
||||||
uri: NetUtil.newURI("http://www.mozilla.org/test1/"),
|
{ uri: NetUtil.newURI("http://www.mozilla.org/test1/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
},
|
||||||
PlacesTestUtils.addVisits({
|
{ uri: NetUtil.newURI("http://www.mozilla.org/test2/"),
|
||||||
uri: NetUtil.newURI("http://www.mozilla.org/test2/"),
|
transition: TRANSITION_TYPED
|
||||||
transition: TRANSITION_TYPED
|
}
|
||||||
});
|
]);
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -222,21 +216,20 @@ add_autocomplete_test([
|
||||||
"Ensuring longer domain can't match",
|
"Ensuring longer domain can't match",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "mozilla.co/", completed: "mozilla.co/" },
|
{ autoFilled: "mozilla.co/", completed: "mozilla.co/" },
|
||||||
function () {
|
function* () {
|
||||||
// The .co should be preferred, but should not get the https from the .com.
|
// The .co should be preferred, but should not get the https from the .com.
|
||||||
// The .co domain must be added later to activate the trigger bug.
|
// The .co domain must be added later to activate the trigger bug.
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits([
|
||||||
uri: NetUtil.newURI("https://mozilla.com/"),
|
{ uri: NetUtil.newURI("https://mozilla.com/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
},
|
||||||
PlacesTestUtils.addVisits({
|
{ uri: NetUtil.newURI("http://mozilla.co/"),
|
||||||
uri: NetUtil.newURI("http://mozilla.co/"),
|
transition: TRANSITION_TYPED
|
||||||
transition: TRANSITION_TYPED
|
},
|
||||||
});
|
{ uri: NetUtil.newURI("http://mozilla.co/"),
|
||||||
PlacesTestUtils.addVisits({
|
transition: TRANSITION_TYPED
|
||||||
uri: NetUtil.newURI("http://mozilla.co/"),
|
}
|
||||||
transition: TRANSITION_TYPED
|
]);
|
||||||
});
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -244,8 +237,8 @@ add_autocomplete_test([
|
||||||
"Searching for URL with characters that are normally escaped",
|
"Searching for URL with characters that are normally escaped",
|
||||||
"https://www.mozilla.org/啊-test",
|
"https://www.mozilla.org/啊-test",
|
||||||
{ autoFilled: "https://www.mozilla.org/啊-test", completed: "https://www.mozilla.org/啊-test" },
|
{ autoFilled: "https://www.mozilla.org/啊-test", completed: "https://www.mozilla.org/啊-test" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("https://www.mozilla.org/啊-test"),
|
uri: NetUtil.newURI("https://www.mozilla.org/啊-test"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -256,8 +249,8 @@ add_autocomplete_test([
|
||||||
"Don't return unsecure URL when searching for secure ones",
|
"Don't return unsecure URL when searching for secure ones",
|
||||||
"https://test.moz.org/t",
|
"https://test.moz.org/t",
|
||||||
{ autoFilled: "https://test.moz.org/test/", completed: "https://test.moz.org/test/" },
|
{ autoFilled: "https://test.moz.org/test/", completed: "https://test.moz.org/test/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://test.moz.org/test/"),
|
uri: NetUtil.newURI("http://test.moz.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -268,8 +261,8 @@ add_autocomplete_test([
|
||||||
"Don't return unsecure domain when searching for secure ones",
|
"Don't return unsecure domain when searching for secure ones",
|
||||||
"https://test.moz",
|
"https://test.moz",
|
||||||
{ autoFilled: "https://test.moz.org/", completed: "https://test.moz.org/" },
|
{ autoFilled: "https://test.moz.org/", completed: "https://test.moz.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://test.moz.org/test/"),
|
uri: NetUtil.newURI("http://test.moz.org/test/"),
|
||||||
transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
});
|
});
|
||||||
|
@ -280,8 +273,8 @@ add_autocomplete_test([
|
||||||
"Untyped is not accounted for www",
|
"Untyped is not accounted for www",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "moz.org/", completed: "moz.org/" },
|
{ autoFilled: "moz.org/", completed: "moz.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://www.moz.org/test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://www.moz.org/test/") });
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -289,8 +282,8 @@ add_autocomplete_test([
|
||||||
"Untyped is not accounted for ftp",
|
"Untyped is not accounted for ftp",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "moz.org/", completed: "moz.org/" },
|
{ autoFilled: "moz.org/", completed: "moz.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("ftp://moz.org/test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("ftp://moz.org/test/") });
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -298,8 +291,8 @@ add_autocomplete_test([
|
||||||
"Untyped is not accounted for https",
|
"Untyped is not accounted for https",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "moz.org/", completed: "moz.org/" },
|
{ autoFilled: "moz.org/", completed: "moz.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("https://moz.org/test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("https://moz.org/test/") });
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -307,7 +300,7 @@ add_autocomplete_test([
|
||||||
"Untyped is not accounted for https://www",
|
"Untyped is not accounted for https://www",
|
||||||
"mo",
|
"mo",
|
||||||
{ autoFilled: "moz.org/", completed: "moz.org/" },
|
{ autoFilled: "moz.org/", completed: "moz.org/" },
|
||||||
function () {
|
function* () {
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("https://www.moz.org/test/") });
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("https://www.moz.org/test/") });
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -9,9 +9,9 @@ add_autocomplete_test([
|
||||||
"Searching for domain should autoFill it",
|
"Searching for domain should autoFill it",
|
||||||
"moz",
|
"moz",
|
||||||
"mozilla.org/",
|
"mozilla.org/",
|
||||||
function () {
|
function* () {
|
||||||
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
|
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
|
||||||
PlacesTestUtils.addVisits(NetUtil.newURI("http://mozilla.org/link/"));
|
yield PlacesTestUtils.addVisits(NetUtil.newURI("http://mozilla.org/link/"));
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ add_autocomplete_test([
|
||||||
"Searching for url should autoFill it",
|
"Searching for url should autoFill it",
|
||||||
"mozilla.org/li",
|
"mozilla.org/li",
|
||||||
"mozilla.org/link/",
|
"mozilla.org/link/",
|
||||||
function () {
|
function* () {
|
||||||
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
|
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
|
||||||
PlacesTestUtils.addVisits(NetUtil.newURI("http://mozilla.org/link/"));
|
yield PlacesTestUtils.addVisits(NetUtil.newURI("http://mozilla.org/link/"));
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -31,9 +31,9 @@ add_autocomplete_test([
|
||||||
"Searching for non-typed domain should not autoFill it",
|
"Searching for non-typed domain should not autoFill it",
|
||||||
"moz",
|
"moz",
|
||||||
"moz",
|
"moz",
|
||||||
function () {
|
function* () {
|
||||||
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
|
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
|
||||||
PlacesTestUtils.addVisits(NetUtil.newURI("http://mozilla.org/link/"));
|
yield PlacesTestUtils.addVisits(NetUtil.newURI("http://mozilla.org/link/"));
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -41,10 +41,10 @@ add_autocomplete_test([
|
||||||
"Searching for typed domain should autoFill it",
|
"Searching for typed domain should autoFill it",
|
||||||
"moz",
|
"moz",
|
||||||
"mozilla.org/",
|
"mozilla.org/",
|
||||||
function () {
|
function* () {
|
||||||
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
|
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/typed/"),
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/typed/"),
|
||||||
transition: TRANSITION_TYPED });
|
transition: TRANSITION_TYPED });
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -52,9 +52,9 @@ add_autocomplete_test([
|
||||||
"Searching for non-typed url should not autoFill it",
|
"Searching for non-typed url should not autoFill it",
|
||||||
"mozilla.org/li",
|
"mozilla.org/li",
|
||||||
"mozilla.org/li",
|
"mozilla.org/li",
|
||||||
function () {
|
function* () {
|
||||||
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
|
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
|
||||||
PlacesTestUtils.addVisits(NetUtil.newURI("http://mozilla.org/link/"));
|
yield PlacesTestUtils.addVisits(NetUtil.newURI("http://mozilla.org/link/"));
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -62,9 +62,9 @@ add_autocomplete_test([
|
||||||
"Searching for typed url should autoFill it",
|
"Searching for typed url should autoFill it",
|
||||||
"mozilla.org/li",
|
"mozilla.org/li",
|
||||||
"mozilla.org/link/",
|
"mozilla.org/link/",
|
||||||
function () {
|
function* () {
|
||||||
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
|
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
|
||||||
PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
|
yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
|
||||||
transition: TRANSITION_TYPED });
|
transition: TRANSITION_TYPED });
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -8,9 +8,9 @@ add_autocomplete_test([
|
||||||
"Searching for zero frecency domain should not autoFill it",
|
"Searching for zero frecency domain should not autoFill it",
|
||||||
"moz",
|
"moz",
|
||||||
"moz",
|
"moz",
|
||||||
function () {
|
function* () {
|
||||||
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
|
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://mozilla.org/framed_link/"),
|
uri: NetUtil.newURI("http://mozilla.org/framed_link/"),
|
||||||
transition: TRANSITION_FRAMED_LINK
|
transition: TRANSITION_FRAMED_LINK
|
||||||
});
|
});
|
||||||
|
@ -21,9 +21,9 @@ add_autocomplete_test([
|
||||||
"Searching for zero frecency url should not autoFill it",
|
"Searching for zero frecency url should not autoFill it",
|
||||||
"mozilla.org/f",
|
"mozilla.org/f",
|
||||||
"mozilla.org/f",
|
"mozilla.org/f",
|
||||||
function () {
|
function* () {
|
||||||
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
|
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
|
||||||
PlacesTestUtils.addVisits({
|
yield PlacesTestUtils.addVisits({
|
||||||
uri: NetUtil.newURI("http://mozilla.org/framed_link/"),
|
uri: NetUtil.newURI("http://mozilla.org/framed_link/"),
|
||||||
transition: TRANSITION_FRAMED_LINK
|
transition: TRANSITION_FRAMED_LINK
|
||||||
});
|
});
|
||||||
|
|
|
@ -226,7 +226,8 @@ let addBookmark = Task.async(function* (aBookmarkObj) {
|
||||||
let itemId = yield PlacesUtils.promiseItemId(bm.guid);
|
let itemId = yield PlacesUtils.promiseItemId(bm.guid);
|
||||||
|
|
||||||
if (aBookmarkObj.keyword) {
|
if (aBookmarkObj.keyword) {
|
||||||
PlacesUtils.bookmarks.setKeywordForBookmark(itemId, aBookmarkObj.keyword);
|
yield PlacesUtils.keywords.insert({ keyword: aBookmarkObj.keyword,
|
||||||
|
url: aBookmarkObj.uri.spec });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aBookmarkObj.tags) {
|
if (aBookmarkObj.tags) {
|
||||||
|
|
|
@ -24,43 +24,43 @@ add_task(function* test_keyword_searc() {
|
||||||
do_print("Plain keyword query");
|
do_print("Plain keyword query");
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key term",
|
search: "key term",
|
||||||
matches: [ { uri: NetUtil.newURI("http://abc/?search=term"), title: "Generic page title", style: ["keyword"] } ]
|
matches: [ { uri: NetUtil.newURI("http://abc/?search=term"), title: "abc", style: ["keyword"] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
do_print("Multi-word keyword query");
|
do_print("Multi-word keyword query");
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key multi word",
|
search: "key multi word",
|
||||||
matches: [ { uri: NetUtil.newURI("http://abc/?search=multi+word"), title: "Generic page title", style: ["keyword"] } ]
|
matches: [ { uri: NetUtil.newURI("http://abc/?search=multi+word"), title: "abc", style: ["keyword"] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
do_print("Keyword query with +");
|
do_print("Keyword query with +");
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key blocking+",
|
search: "key blocking+",
|
||||||
matches: [ { uri: NetUtil.newURI("http://abc/?search=blocking%2B"), title: "Generic page title", style: ["keyword"] } ]
|
matches: [ { uri: NetUtil.newURI("http://abc/?search=blocking%2B"), title: "abc", style: ["keyword"] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
do_print("Unescaped term in query");
|
do_print("Unescaped term in query");
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key ユニコード",
|
search: "key ユニコード",
|
||||||
matches: [ { uri: NetUtil.newURI("http://abc/?search=ユニコード"), title: "Generic page title", style: ["keyword"] } ]
|
matches: [ { uri: NetUtil.newURI("http://abc/?search=ユニコード"), title: "abc", style: ["keyword"] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
do_print("Keyword that happens to match a page");
|
do_print("Keyword that happens to match a page");
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key ThisPageIsInHistory",
|
search: "key ThisPageIsInHistory",
|
||||||
matches: [ { uri: NetUtil.newURI("http://abc/?search=ThisPageIsInHistory"), title: "Generic page title", style: ["keyword"] } ]
|
matches: [ { uri: NetUtil.newURI("http://abc/?search=ThisPageIsInHistory"), title: "abc", style: ["keyword"] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
do_print("Keyword without query (without space)");
|
do_print("Keyword without query (without space)");
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key",
|
search: "key",
|
||||||
matches: [ { uri: NetUtil.newURI("http://abc/?search="), title: "Generic page title", style: ["keyword"] } ]
|
matches: [ { uri: NetUtil.newURI("http://abc/?search="), title: "abc", style: ["keyword"] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
do_print("Keyword without query (with space)");
|
do_print("Keyword without query (with space)");
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key ",
|
search: "key ",
|
||||||
matches: [ { uri: NetUtil.newURI("http://abc/?search="), title: "Generic page title", style: ["keyword"] } ]
|
matches: [ { uri: NetUtil.newURI("http://abc/?search="), title: "abc", style: ["keyword"] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
yield cleanup();
|
yield cleanup();
|
||||||
|
|
|
@ -25,49 +25,49 @@ add_task(function* test_keyword_search() {
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key term",
|
search: "key term",
|
||||||
searchParam: "enable-actions",
|
searchParam: "enable-actions",
|
||||||
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=term", input: "key term"}), title: "Generic page title", style: [ "action", "keyword" ] } ]
|
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=term", input: "key term"}), title: "abc", style: [ "action", "keyword" ] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
do_print("Multi-word keyword query");
|
do_print("Multi-word keyword query");
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key multi word",
|
search: "key multi word",
|
||||||
searchParam: "enable-actions",
|
searchParam: "enable-actions",
|
||||||
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=multi+word", input: "key multi word"}), title: "Generic page title", style: [ "action", "keyword" ] } ]
|
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=multi+word", input: "key multi word"}), title: "abc", style: [ "action", "keyword" ] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
do_print("Keyword query with +");
|
do_print("Keyword query with +");
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key blocking+",
|
search: "key blocking+",
|
||||||
searchParam: "enable-actions",
|
searchParam: "enable-actions",
|
||||||
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=blocking%2B", input: "key blocking+"}), title: "Generic page title", style: [ "action", "keyword" ] } ]
|
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=blocking%2B", input: "key blocking+"}), title: "abc", style: [ "action", "keyword" ] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
do_print("Unescaped term in query");
|
do_print("Unescaped term in query");
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key ユニコード",
|
search: "key ユニコード",
|
||||||
searchParam: "enable-actions",
|
searchParam: "enable-actions",
|
||||||
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=ユニコード", input: "key ユニコード"}), title: "Generic page title", style: [ "action", "keyword" ] } ]
|
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=ユニコード", input: "key ユニコード"}), title: "abc", style: [ "action", "keyword" ] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
do_print("Keyword that happens to match a page");
|
do_print("Keyword that happens to match a page");
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key ThisPageIsInHistory",
|
search: "key ThisPageIsInHistory",
|
||||||
searchParam: "enable-actions",
|
searchParam: "enable-actions",
|
||||||
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=ThisPageIsInHistory", input: "key ThisPageIsInHistory"}), title: "Generic page title", style: [ "action", "keyword" ] } ]
|
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=ThisPageIsInHistory", input: "key ThisPageIsInHistory"}), title: "abc", style: [ "action", "keyword" ] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
do_print("Keyword without query (without space)");
|
do_print("Keyword without query (without space)");
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key",
|
search: "key",
|
||||||
searchParam: "enable-actions",
|
searchParam: "enable-actions",
|
||||||
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=", input: "key"}), title: "Generic page title", style: [ "action", "keyword" ] } ]
|
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=", input: "key"}), title: "abc", style: [ "action", "keyword" ] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
do_print("Keyword without query (with space)");
|
do_print("Keyword without query (with space)");
|
||||||
yield check_autocomplete({
|
yield check_autocomplete({
|
||||||
search: "key ",
|
search: "key ",
|
||||||
searchParam: "enable-actions",
|
searchParam: "enable-actions",
|
||||||
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=", input: "key "}), title: "Generic page title", style: [ "action", "keyword" ] } ]
|
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=", input: "key "}), title: "abc", style: [ "action", "keyword" ] } ]
|
||||||
});
|
});
|
||||||
|
|
||||||
yield cleanup();
|
yield cleanup();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче