--- a/accessible/tests/mochitest/tree/test_combobox.xul
+++ b/accessible/tests/mochitest/tree/test_combobox.xul
@@ -272,17 +272,17 @@
<menulist id="menulist2" editable="true">
<menupopup>
<menuitem label="item"/>
<menuitem label="item"/>
</menupopup>
</menulist>
<textbox id="autocomplete" type="autocomplete"
- autocompletesearch="history"
+ autocompletesearch="unifiedcomplete"
value="http://mochi.test:8888/redirect-a11y.html"/>
<textbox id="autocomplete2" type="autocomplete">
<menupopup>
<menuitem label="item1"/>
</menupopup>
</textbox>
</vbox>
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -543,19 +543,16 @@
@RESPATH@/components/nsURLFormatter.js
@RESPATH@/components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@
@RESPATH@/components/txEXSLTRegExFunctions.manifest
@RESPATH@/components/txEXSLTRegExFunctions.js
@RESPATH@/components/toolkitplaces.manifest
@RESPATH@/components/nsLivemarkService.js
@RESPATH@/components/nsTaggingService.js
@RESPATH@/components/nsPlacesDBFlush.js
-@RESPATH@/components/nsPlacesAutoComplete.manifest
-@RESPATH@/components/nsPlacesAutoComplete.js
-@RESPATH@/components/UnifiedComplete.manifest
@RESPATH@/components/UnifiedComplete.js
@RESPATH@/components/nsPlacesExpiration.js
@RESPATH@/components/PlacesCategoriesStarter.js
@RESPATH@/components/nsDefaultCLH.manifest
@RESPATH@/components/nsDefaultCLH.js
@RESPATH@/components/nsContentPrefService.manifest
@RESPATH@/components/nsContentPrefService.js
@RESPATH@/components/nsContentDispatchChooser.manifest
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -293,18 +293,16 @@ pref("browser.urlbar.doubleClickSelectsA
#else
pref("browser.urlbar.doubleClickSelectsAll", false);
#endif
// Control autoFill behavior
pref("browser.urlbar.autoFill", true);
pref("browser.urlbar.autoFill.typed", true);
-pref("browser.urlbar.unifiedcomplete", true);
-
// 0: Match anywhere (e.g., middle of words)
// 1: Match on word boundaries and then try matching anywhere
// 2: Match only on word boundaries (e.g., after / or .)
// 3: Match at the beginning of the url or title
pref("browser.urlbar.matchBehavior", 1);
pref("browser.urlbar.filter.javascript", true);
// the maximum number of results to show in autocomplete when doing richResults
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -717,17 +717,17 @@
label="&forwardCmd.label;"
command="Browser:ForwardOrForwardDuplicate"
onclick="checkForMiddleClick(this, event);"
tooltip="forward-button-tooltip"
context="backForwardMenu"/>
<textbox id="urlbar" flex="1"
placeholder="&urlbar.placeholder2;"
type="autocomplete"
- autocompletesearch="urlinline history"
+ autocompletesearch="unifiedcomplete"
autocompletesearchparam="enable-actions"
autocompletepopup="PopupAutoCompleteRichResult"
completeselectedindex="true"
shrinkdelay="250"
tabscrolling="true"
showcommentcolumn="true"
showimagecolumn="true"
enablehistory="true"
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -62,20 +62,16 @@
<field name="mURIFixup" readonly="true">
Components.classes["@mozilla.org/docshell/urifixup;1"]
.getService(Components.interfaces.nsIURIFixup);
</field>
<field name="mFaviconService" readonly="true">
Components.classes["@mozilla.org/browser/favicon-service;1"]
.getService(Components.interfaces.nsIFaviconService);
</field>
- <field name="_placesAutocomplete" readonly="true">
- Components.classes["@mozilla.org/autocomplete/search;1?name=history"]
- .getService(Components.interfaces.mozIPlacesAutoComplete);
- </field>
<field name="_unifiedComplete" readonly="true">
Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Components.interfaces.mozIPlacesAutoComplete);
</field>
<field name="PlacesUtils" readonly="true">
(Components.utils.import("resource://gre/modules/PlacesUtils.jsm", {})).PlacesUtils;
</field>
<field name="AppConstants" readonly="true">
@@ -791,29 +787,26 @@
// Don't clear the favicon if this onLocationChange was
// triggered by a pushState or a replaceState (bug 550565) or
// a hash change (bug 408415).
if (aWebProgress.isLoadingDocument && !isSameDocument) {
this.mBrowser.mIconURL = null;
}
- let autocomplete = this.mTabBrowser._placesAutocomplete;
let unifiedComplete = this.mTabBrowser._unifiedComplete;
if (this.mBrowser.registeredOpenURI) {
- autocomplete.unregisterOpenPage(this.mBrowser.registeredOpenURI);
unifiedComplete.unregisterOpenPage(this.mBrowser.registeredOpenURI);
delete this.mBrowser.registeredOpenURI;
}
// Tabs in private windows aren't registered as "Open" so
// that they don't appear as switch-to-tab candidates.
if (!isBlankPageURL(aLocation.spec) &&
(!PrivateBrowsingUtils.isWindowPrivate(window) ||
PrivateBrowsingUtils.permanentPrivateBrowsing)) {
- autocomplete.registerOpenPage(aLocation);
unifiedComplete.registerOpenPage(aLocation);
this.mBrowser.registeredOpenURI = aLocation;
}
}
if (!this.mBlank) {
this._callProgressListeners("onLocationChange",
[aWebProgress, aRequest, aLocation,
@@ -2389,17 +2382,16 @@
browser.webProgress.removeProgressListener(filter);
const listener = this._tabListeners.get(aTab);
filter.removeProgressListener(listener);
listener.destroy();
if (browser.registeredOpenURI && !aAdoptedByTab) {
- this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI);
this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI);
delete browser.registeredOpenURI;
}
// We are no longer the primary content area.
browser.setAttribute("type", "content-targetable");
// Remove this tab as the owner of any other tabs, since it's going away.
@@ -2728,17 +2720,16 @@
<method name="_swapRegisteredOpenURIs">
<parameter name="aOurBrowser"/>
<parameter name="aOtherBrowser"/>
<body>
<![CDATA[
// If the current URI is registered as open remove it from the list.
if (aOurBrowser.registeredOpenURI) {
- this._placesAutocomplete.unregisterOpenPage(aOurBrowser.registeredOpenURI);
this._unifiedComplete.unregisterOpenPage(aOurBrowser.registeredOpenURI);
delete aOurBrowser.registeredOpenURI;
}
// If the other/new URI is registered as open then copy it over.
if (aOtherBrowser.registeredOpenURI) {
aOurBrowser.registeredOpenURI = aOtherBrowser.registeredOpenURI;
delete aOtherBrowser.registeredOpenURI;
@@ -4497,17 +4488,16 @@
<destructor>
<![CDATA[
Services.obs.removeObserver(this, "live-resize-start", false);
Services.obs.removeObserver(this, "live-resize-end", false);
for (let tab of this.tabs) {
let browser = tab.linkedBrowser;
if (browser.registeredOpenURI) {
- this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI);
this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI);
delete browser.registeredOpenURI;
}
let filter = this._tabFilters.get(tab);
let listener = this._tabListeners.get(tab);
browser.webProgress.removeProgressListener(filter);
filter.removeProgressListener(listener);
--- a/browser/base/content/test/urlbar/browser.ini
+++ b/browser/base/content/test/urlbar/browser.ini
@@ -10,17 +10,16 @@ skip-if = (os == "linux" || os == "mac")
[browser_action_searchengine.js]
[browser_action_searchengine_alias.js]
[browser_autocomplete_a11y_label.js]
[browser_autocomplete_autoselect.js]
[browser_autocomplete_cursor.js]
[browser_autocomplete_edit_completed.js]
[browser_autocomplete_enter_race.js]
[browser_autocomplete_no_title.js]
-[browser_autocomplete_oldschool_wrap.js]
[browser_autocomplete_tag_star_visibility.js]
[browser_bug1104165-switchtab-decodeuri.js]
[browser_bug1003461-switchtab-override.js]
[browser_bug1024133-switchtab-override-keynav.js]
[browser_bug1025195_switchToTabHavingURI_aOpenParams.js]
[browser_bug1070778.js]
[browser_bug1225194-remotetab.js]
[browser_bug304198.js]
--- a/browser/base/content/test/urlbar/browser_action_keyword.js
+++ b/browser/base/content/test/urlbar/browser_action_keyword.js
@@ -7,23 +7,16 @@ function* promise_first_result(inputText
yield promiseAutocompleteResultPopup(inputText);
let firstResult = gURLBar.popup.richlistbox.firstChild;
return firstResult;
}
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);
- registerCleanupFunction(() => {
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
- });
-
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla");
let tabs = [tab];
registerCleanupFunction(function* () {
for (let tab of tabs)
gBrowser.removeTab(tab);
yield PlacesUtils.bookmarks.remove(bm);
});
--- a/browser/base/content/test/urlbar/browser_action_keyword_override.js
+++ b/browser/base/content/test/urlbar/browser_action_keyword_override.js
@@ -1,16 +1,9 @@
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);
- registerCleanupFunction(() => {
- 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);
--- a/browser/base/content/test/urlbar/browser_action_searchengine.js
+++ b/browser/base/content/test/urlbar/browser_action_searchengine.js
@@ -1,19 +1,9 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
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);
- registerCleanupFunction(() => {
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
- });
-
Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
"http://example.com/?q={searchTerms}");
let engine = Services.search.getEngineByName("MozSearch");
let originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
yield promiseTabLoaded(gBrowser.selectedTab);
--- a/browser/base/content/test/urlbar/browser_action_searchengine_alias.js
+++ b/browser/base/content/test/urlbar/browser_action_searchengine_alias.js
@@ -1,21 +1,9 @@
-/**
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- **/
-
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);
- 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";
Services.search.addEngineWithDetails("MozSearch", iconURI, "moz", "", "GET",
"http://example.com/?q={searchTerms}");
let engine = Services.search.getEngineByName("MozSearch");
let originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
--- a/browser/base/content/test/urlbar/browser_autocomplete_a11y_label.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_a11y_label.js
@@ -1,24 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const UNIFIEDCOMPLETE_PREF = "browser.urlbar.unifiedcomplete";
const SUGGEST_ALL_PREF = "browser.search.suggest.enabled";
const SUGGEST_URLBAR_PREF = "browser.urlbar.suggest.searches";
const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
-add_task(function* prepare() {
- // This test is only relevant if UnifiedComplete is enabled.
- Services.prefs.setBoolPref(UNIFIEDCOMPLETE_PREF, true);
- registerCleanupFunction(() => {
- Services.prefs.clearUserPref(UNIFIEDCOMPLETE_PREF);
- });
-});
-
add_task(function* switchToTab() {
let tab = gBrowser.addTab("about:about");
yield promiseTabLoaded(tab);
let actionURL = makeActionURI("switchtab", {url: "about:about"}).spec;
yield promiseAutocompleteResultPopup("% about");
ok(gURLBar.popup.richlistbox.children.length > 1, "Should get at least 2 results");
--- a/browser/base/content/test/urlbar/browser_autocomplete_autoselect.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_autoselect.js
@@ -4,23 +4,16 @@ function repeat(limit, func) {
}
}
function is_selected(index) {
is(gURLBar.popup.richlistbox.selectedIndex, index, `Item ${index + 1} should be selected`);
}
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);
- registerCleanupFunction(() => {
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
- });
-
let maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
registerCleanupFunction(function* () {
yield PlacesTestUtils.clearHistory();
});
let visits = [];
repeat(maxResults, i => {
--- a/browser/base/content/test/urlbar/browser_autocomplete_cursor.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_cursor.js
@@ -1,16 +1,9 @@
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);
- registerCleanupFunction(() => {
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
- });
-
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
yield promiseTabLoaded(tab);
yield promiseAutocompleteResultPopup("www.mozilla.org");
gURLBar.selectTextRange(4, 4);
is(gURLBar.popup.state, "open", "Popup should be open");
is(gURLBar.popup.richlistbox.selectedIndex, 0, "Should have selected something");
--- a/browser/base/content/test/urlbar/browser_autocomplete_edit_completed.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_edit_completed.js
@@ -1,28 +1,20 @@
add_task(function*() {
yield PlacesTestUtils.clearHistory();
yield PlacesTestUtils.addVisits([
{ uri: makeURI("http://example.com/foo") },
{ uri: makeURI("http://example.com/foo/bar") },
]);
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
- yield* do_test();
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", false);
- yield* do_test();
-});
+ registerCleanupFunction(function* () {
+ yield PlacesTestUtils.clearHistory();
+ });
-registerCleanupFunction(function* () {
- Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
- yield PlacesTestUtils.clearHistory();
-});
-
-function* do_test() {
gBrowser.selectedTab = gBrowser.addTab("about:blank");
gURLBar.focus();
yield promiseAutocompleteResultPopup("http://example.com");
let popup = gURLBar.popup;
let list = popup.richlistbox;
let initialIndex = list.selectedIndex;
@@ -45,9 +37,9 @@ function* do_test() {
info("Press return to load edited URL.");
EventUtils.synthesizeKey("VK_RETURN", {});
yield Promise.all([
promisePopupHidden(gURLBar.popup),
waitForDocLoadAndStopIt("http://" + editedValue)]);
gBrowser.removeTab(gBrowser.selectedTab);
-}
+});
--- a/browser/base/content/test/urlbar/browser_autocomplete_enter_race.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_enter_race.js
@@ -1,14 +1,10 @@
add_task(function*() {
- // This test is only relevant if UnifiedComplete is enabled.
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-
registerCleanupFunction(function* () {
- Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
yield PlacesUtils.bookmarks.remove(bm);
});
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" });
--- a/browser/base/content/test/urlbar/browser_autocomplete_no_title.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_no_title.js
@@ -1,19 +1,9 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
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);
- registerCleanupFunction(() => {
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
- });
-
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
yield promiseTabLoaded(tab);
let uri = NetUtil.newURI("http://bug1060642.example.com/beards/are/pretty/great");
yield PlacesTestUtils.addVisits([{uri: uri, title: ""}]);
yield promiseAutocompleteResultPopup("bug1060642");
ok(gURLBar.popup.richlistbox.children.length > 1, "Should get at least 2 results");
deleted file mode 100644
--- a/browser/base/content/test/urlbar/browser_autocomplete_oldschool_wrap.js
+++ /dev/null
@@ -1,74 +0,0 @@
-function repeat(limit, func) {
- for (let i = 0; i < limit; i++) {
- func(i);
- }
-}
-
-function is_selected(index) {
- is(gURLBar.popup.richlistbox.selectedIndex, index, `Item ${index + 1} should be selected`);
-}
-
-add_task(function*() {
- // This test is only relevant if UnifiedComplete is *disabled*.
- if (Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) {
- ok(true, "Don't run this test with UnifiedComplete enabled.")
- return;
- }
-
- yield PlacesTestUtils.clearHistory();
- let visits = [];
- repeat(10, i => {
- visits.push({
- uri: makeURI("http://example.com/autocomplete/?" + i),
- });
- });
- yield PlacesTestUtils.addVisits(visits);
-
- registerCleanupFunction(function* () {
- yield PlacesTestUtils.clearHistory();
- });
-
- let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
- yield promiseTabLoaded(tab);
- yield promiseAutocompleteResultPopup("example.com/autocomplete");
-
- let popup = gURLBar.popup;
- let results = popup.richlistbox.children.filter(is_visible);
-
- is(results.length, 10, "Should get 10 results");
- is_selected(-1);
-
- info("Key Down to select the next item");
- EventUtils.synthesizeKey("VK_DOWN", {});
- is_selected(0);
-
- info("Key Up to select the previous item");
- EventUtils.synthesizeKey("VK_UP", {});
- is_selected(-1);
-
- info("Key Down to select the next item");
- EventUtils.synthesizeKey("VK_DOWN", {});
- is_selected(0);
-
- info("Key Down 11 times should wrap around all the way around");
- repeat(11, () => EventUtils.synthesizeKey("VK_DOWN", {}));
- is_selected(0);
-
- info("Key Up 11 times should wrap around the other way");
- repeat(11, () => EventUtils.synthesizeKey("VK_UP", {}));
- is_selected(0);
-
- info("Page Up will go up the list, but not wrap");
- repeat(4, () => EventUtils.synthesizeKey("VK_DOWN", {}));
- is_selected(4);
- EventUtils.synthesizeKey("VK_PAGE_UP", {})
- is_selected(0);
-
- info("Page Up again will wrap around to the end of the list");
- EventUtils.synthesizeKey("VK_PAGE_UP", {})
- is_selected(-1);
-
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- yield promisePopupHidden(gURLBar.popup);
- gBrowser.removeTab(tab);
-});
--- a/browser/base/content/test/urlbar/browser_autocomplete_tag_star_visibility.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_tag_star_visibility.js
@@ -1,16 +1,11 @@
add_task(function*() {
- // This test is only relevant if UnifiedComplete is enabled.
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
-
registerCleanupFunction(() => {
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
- Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
- Services.prefs.clearUserPref("browser.urlbar.suggest.bookmark");
});
function* addTagItem(tagName) {
let uri = NetUtil.newURI(`http://example.com/this/is/tagged/${tagName}`);
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
uri,
PlacesUtils.bookmarks.DEFAULT_INDEX,
`test ${tagName}`);
--- a/browser/base/content/test/urlbar/browser_bug1003461-switchtab-override.js
+++ b/browser/base/content/test/urlbar/browser_bug1003461-switchtab-override.js
@@ -1,20 +1,13 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(function* test_switchtab_override() {
- // This test is only relevant if UnifiedComplete is enabled.
- let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
- registerCleanupFunction(() => {
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
- });
-
let testURL = "http://example.org/browser/browser/base/content/test/urlbar/dummy_page.html";
info("Opening first tab");
let tab = gBrowser.addTab(testURL);
let deferred = Promise.defer();
whenTabLoaded(tab, deferred.resolve);
yield deferred.promise;
--- a/browser/base/content/test/urlbar/browser_bug1070778.js
+++ b/browser/base/content/test/urlbar/browser_bug1070778.js
@@ -1,23 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function is_selected(index) {
is(gURLBar.popup.richlistbox.selectedIndex, index, `Item ${index + 1} should be selected`);
}
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);
- registerCleanupFunction(() => {
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
- });
-
let bookmarks = [];
bookmarks.push((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" });
--- a/browser/base/content/test/urlbar/browser_search_favicon.js
+++ b/browser/base/content/test/urlbar/browser_search_favicon.js
@@ -1,26 +1,20 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
var gOriginalEngine;
var gEngine;
-var gUnifiedCompletePref = "browser.urlbar.unifiedcomplete";
var gRestyleSearchesPref = "browser.urlbar.restyleSearches";
registerCleanupFunction(() => {
- Services.prefs.clearUserPref(gUnifiedCompletePref);
Services.prefs.clearUserPref(gRestyleSearchesPref);
Services.search.currentEngine = gOriginalEngine;
Services.search.removeEngine(gEngine);
return PlacesTestUtils.clearHistory();
});
add_task(function*() {
- Services.prefs.setBoolPref(gUnifiedCompletePref, true);
Services.prefs.setBoolPref(gRestyleSearchesPref, true);
});
add_task(function*() {
Services.search.addEngineWithDetails("SearchEngine", "", "", "",
"GET", "http://s.example.com/search");
gEngine = Services.search.getEngineByName("SearchEngine");
--- a/browser/base/content/test/urlbar/browser_tabMatchesInAwesomebar.js
+++ b/browser/base/content/test/urlbar/browser_tabMatchesInAwesomebar.js
@@ -15,17 +15,18 @@ var gController = Cc["@mozilla.org/autoc
getService(Ci.nsIAutoCompleteController);
var gTabWaitCount = 0;
var gTabCounter = 0;
var gTestSteps = [
function() {
info("Running step 1");
- for (let i = 0; i < 10; i++) {
+ let maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
+ for (let i = 0; i < maxResults - 1; i++) {
let tab = gBrowser.addTab();
loadTab(tab, TEST_URL_BASES[0] + (++gTabCounter));
}
},
function() {
info("Running step 2");
gBrowser.selectTabAtIndex(1);
gBrowser.removeCurrentTab();
@@ -186,31 +187,36 @@ function ensure_opentabs_match_db(aCallb
checkAutocompleteResults(tabs, aCallback);
}
function checkAutocompleteResults(aExpected, aCallback)
{
gController.input = {
timeout: 10,
textValue: "",
- searches: ["history"],
+ searches: ["unifiedcomplete"],
searchParam: "enable-actions",
popupOpen: false,
minResultsForPopup: 0,
invalidate: function() {},
disableAutoComplete: false,
completeDefaultIndex: false,
get popup() { return this; },
onSearchBegin: function() {},
onSearchComplete: function ()
{
info("Found " + gController.matchCount + " matches.");
// Check to see the expected uris and titles match up (in any order)
for (let i = 0; i < gController.matchCount; i++) {
- let uri = gController.getValueAt(i).replace(/^moz-action:[^,]+,/i, "");
+ if (gController.getStyleAt(i).includes("heuristic")) {
+ do_print("Skip heuristic match");
+ continue;
+ }
+ let action = gURLBar.popup.input._parseActionUrl(gController.getValueAt(i));
+ let uri = action.params.url;
info("Search for '" + uri + "' in open tabs.");
let expected = uri in aExpected;
ok(expected, uri + " was found in autocomplete, was " + (expected ? "" : "not ") + "expected");
// Remove the found entry from expected results.
delete aExpected[uri];
}
--- a/browser/base/content/test/urlbar/browser_urlbarAutoFillTrimURLs.js
+++ b/browser/base/content/test/urlbar/browser_urlbarAutoFillTrimURLs.js
@@ -49,20 +49,17 @@ function continue_test() {
aCallback();
});
}
test_autoFill("http://", "http://", function () {
test_autoFill("http://au", "http://autofilltrimurl.com/", function () {
test_autoFill("http://www.autofilltrimurl.com", "http://www.autofilltrimurl.com/", function () {
// Now ensure selecting from the popup correctly trims.
- if (Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete"))
- is(gURLBar.controller.matchCount, 2, "Found the expected number of matches");
- else
- is(gURLBar.controller.matchCount, 1, "Found the expected number of matches");
+ is(gURLBar.controller.matchCount, 2, "Found the expected number of matches");
EventUtils.synthesizeKey("VK_DOWN", {});
is(gURLBar.textValue, "www.autofilltrimurl.com/whatever", "trim was applied correctly");
gURLBar.closePopup();
PlacesTestUtils.clearHistory().then(finish);
});
});
});
}
--- a/browser/base/content/test/urlbar/browser_urlbarDelete.js
+++ b/browser/base/content/test/urlbar/browser_urlbarDelete.js
@@ -2,25 +2,16 @@ add_task(function*() {
let bm = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: "http://bug1105244.example.com/",
title: "test" });
registerCleanupFunction(function* () {
yield PlacesUtils.bookmarks.remove(bm);
});
- // We do this test with both unifiedcomplete disabled and enabled.
- let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
- registerCleanupFunction(() => {
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
- });
-
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", false);
- yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, testDelete);
-
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, testDelete);
});
function sendHome() {
// unclear why VK_HOME doesn't work on Mac, but it doesn't...
if (Services.appinfo.OS == "Darwin") {
EventUtils.synthesizeKey("VK_LEFT", { altKey: true });
--- a/browser/base/content/test/urlbar/browser_urlbarEnterAfterMouseOver.js
+++ b/browser/base/content/test/urlbar/browser_urlbarEnterAfterMouseOver.js
@@ -30,24 +30,16 @@ add_task(function*() {
let visits = [];
repeat(gMaxResults, i => {
visits.push({
uri: makeURI("http://example.com/autocomplete/?" + i),
});
});
yield PlacesTestUtils.addVisits(visits);
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
- yield* do_test();
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", false);
- yield* do_test();
- Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
-});
-
-function* do_test() {
gBrowser.selectedTab = gBrowser.addTab("about:blank");
yield promiseAutoComplete("http://example.com/autocomplete/");
let popup = gURLBar.popup;
let results = popup.richlistbox.children;
is(results.length, gMaxResults,
"Should get gMaxResults=" + gMaxResults + " results");
@@ -70,9 +62,9 @@ function* do_test() {
is_selected(3);
let autocompletePopupHidden = promisePopupHidden(gURLBar.popup);
let openedExpectedPage = waitForDocLoadAndStopIt(expectedURL);
EventUtils.synthesizeKey("VK_RETURN", {});
yield Promise.all([autocompletePopupHidden, openedExpectedPage]);
gBrowser.removeCurrentTab();
-}
+});
--- a/browser/base/content/test/urlbar/browser_urlbarSearchSuggestionsNotification.js
+++ b/browser/base/content/test/urlbar/browser_urlbarSearchSuggestionsNotification.js
@@ -1,22 +1,19 @@
const SUGGEST_ALL_PREF = "browser.search.suggest.enabled";
const SUGGEST_URLBAR_PREF = "browser.urlbar.suggest.searches";
const CHOICE_PREF = "browser.urlbar.userMadeSearchSuggestionsChoice";
const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
// Must run first.
add_task(function* prepare() {
- // The test makes only sense if unified complete is enabled.
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
let engine = yield promiseNewSearchEngine(TEST_ENGINE_BASENAME);
let oldCurrentEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
+ registerCleanupFunction(function* () {
Services.search.currentEngine = oldCurrentEngine;
Services.prefs.clearUserPref(SUGGEST_ALL_PREF);
Services.prefs.clearUserPref(SUGGEST_URLBAR_PREF);
// Disable the notification for future tests so it doesn't interfere with
// them. clearUserPref() won't work because by default the pref is false.
yield setUserMadeChoicePref(true);
--- a/browser/base/content/test/urlbar/browser_urlbar_autoFill_backspaced.js
+++ b/browser/base/content/test/urlbar/browser_urlbar_autoFill_backspaced.js
@@ -21,26 +21,24 @@ function* test_autocomplete(data) {
let result = gURLBar.popup.richlistbox.children[0];
let type = result.getAttribute("type");
let types = type.split(/\s+/);
ok(types.indexOf(action) >= 0, `The type attribute "${type}" includes the expected action "${action}"`);
gURLBar.popup.hidePopup();
yield promisePopupHidden(gURLBar.popup);
gURLBar.blur();
-};
+}
add_task(function* () {
registerCleanupFunction(function* () {
- Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
Services.prefs.clearUserPref("browser.urlbar.autoFill");
gURLBar.handleRevert();
yield PlacesTestUtils.clearHistory();
});
- Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
Services.prefs.setBoolPref("browser.urlbar.autoFill", true);
// Add a typed visit, so it will be autofilled.
yield PlacesTestUtils.addVisits({
uri: NetUtil.newURI("http://example.com/"),
transition: Ci.nsINavHistoryService.TRANSITION_TYPED
});
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -72,23 +72,16 @@ file, You can obtain one at http://mozil
this.inputField.controllers.insertControllerAt(0, this._copyCutController);
this.inputField.addEventListener("paste", this, false);
this.inputField.addEventListener("mousedown", this, false);
this.inputField.addEventListener("mousemove", this, false);
this.inputField.addEventListener("mouseout", this, false);
this.inputField.addEventListener("overflow", this, false);
this.inputField.addEventListener("underflow", this, false);
- try {
- if (this._prefs.getBoolPref("unifiedcomplete")) {
- this.setAttribute("autocompletesearch", "unifiedcomplete");
- this.mSearchNames = null;
- }
- } catch (ex) {}
-
const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var textBox = document.getAnonymousElementByAttribute(this,
"anonid", "textbox-input-box");
var cxmenu = document.getAnonymousElementByAttribute(textBox,
"anonid", "input-box-contextmenu");
var pasteAndGo;
cxmenu.addEventListener("popupshowing", function() {
if (!pasteAndGo)
@@ -727,25 +720,16 @@ file, You can obtain one at http://mozil
this.popup.searchSuggestionsNotificationWasDismissed(
this._prefs.getBoolPref("suggest.searches")
);
}
break;
case "trimURLs":
this._mayTrimURLs = this._prefs.getBoolPref(aData);
break;
- case "unifiedcomplete":
- let useUnifiedComplete = false;
- try {
- useUnifiedComplete = this._prefs.getBoolPref(aData);
- } catch (ex) {}
- this.setAttribute("autocompletesearch",
- useUnifiedComplete ? "unifiedcomplete"
- : "urlinline history");
- this.mSearchNames = null;
}
}
]]></body>
</method>
<method name="handleEvent">
<parameter name="aEvent"/>
<body><![CDATA[
@@ -862,29 +846,19 @@ file, You can obtain one at http://mozil
// URL is in the format moz-action:ACTION,PARAMS
// Where PARAMS is a JSON encoded object.
let [, type, params] = aUrl.match(MOZ_ACTION_REGEX);
let action = {
type: type,
};
- try {
- action.params = JSON.parse(params);
- for (let key in action.params) {
- action.params[key] = decodeURIComponent(action.params[key]);
- }
- } catch (e) {
- // If this failed, we assume that params is not a JSON object, and
- // is instead just a flat string. This will happen when
- // UnifiedComplete is disabled - in which case, the param is always
- // a URL.
- action.params = {
- url: params,
- };
+ action.params = JSON.parse(params);
+ for (let key in action.params) {
+ action.params[key] = decodeURIComponent(action.params[key]);
}
if ("url" in action.params) {
let uri;
try {
uri = makeURI(action.params.url);
action.params.displayUrl = losslessDecodeURI(uri);
} catch (e) {
@@ -922,32 +896,23 @@ file, You can obtain one at http://mozil
this.mController.handleText();
}
this.resetActionType();
]]></body>
</method>
<method name="handleEnter">
<body><![CDATA[
- // When UnifiedComplete is enabled, we need to ensure we're using
- // a selected autocomplete result. A result should automatically be
- // selected by default (UnifiedComplete guarantees at least one
- // result), however autocomplete is async and therefore we may not
+ // We need to ensure we're using a selected autocomplete result.
+ // A result should automatically be selected by default,
+ // however autocomplete is async and therefore we may not
// have a result set relating to the current input yet. If that
// happens, we need to mark that when the first result does get added,
// it needs to be handled as if enter was pressed with that first
// result selected.
- // With UnifiedComplete disabled we don't have this problem, as the
- // default is to use the value directly from the input field (without
- // relying on autocomplete).
-
- if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) {
- return this.mController.handleEnter(false);
- }
-
// If anything other than the default (first) result is selected, then
// it must have been manually selected by the human. We let this
// explicit choice be used, even if it may be related to a previous
// input.
// However, if the default result is automatically selected, we
// ensure that it corresponds to the current input.
if (this.popup.selectedIndex != 0 || this.gotResultForCurrentQuery) {
@@ -988,18 +953,17 @@ file, You can obtain one at http://mozil
<property name="shouldShowSearchSuggestionsNotification" readonly="true">
<getter><![CDATA[
return !this._userMadeSearchSuggestionsChoice &&
!this.inPrivateContext &&
// When _urlbarFocused is true, tabbrowser would close the
// popup if it's opened here, so don't show the notification.
!gBrowser.selectedBrowser._urlbarFocused &&
- Services.prefs.getBoolPref("browser.search.suggest.enabled") &&
- this._prefs.getBoolPref("unifiedcomplete");
+ Services.prefs.getBoolPref("browser.search.suggest.enabled");
]]></getter>
</property>
</implementation>
<handlers>
<handler event="keydown"><![CDATA[
if ((event.keyCode === KeyEvent.DOM_VK_ALT ||
@@ -1249,21 +1213,18 @@ file, You can obtain one at http://mozil
);
Services.prefs.setBoolPref(
"browser.urlbar.userMadeSearchSuggestionsChoice", true
);
// The input's pref observer will now hide the notification.
]]></body>
</method>
- <!-- Override this so that when UnifiedComplete is enabled, navigating
- between items results in an item always being selected. This is
- contrary to the old behaviour (UnifiedComplete disabled) where
- if you navigate beyond either end of the list, no item will be
- selected. -->
+ <!-- Override this so that navigating between items results in an item
+ always being selected. -->
<method name="getNextIndex">
<parameter name="reverse"/>
<parameter name="amount"/>
<parameter name="index"/>
<parameter name="maxRow"/>
<body><![CDATA[
if (maxRow < 0)
return -1;
@@ -1603,19 +1564,16 @@ file, You can obtain one at http://mozil
return parts.filter(str => str).join(" ");
]]>
</body>
</method>
<method name="onResultsAdded">
<body>
<![CDATA[
- if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete"))
- return;
-
// If nothing is selected yet, select the first result if it is a
// pre-selected "heuristic" result. (See UnifiedComplete.js.)
if (this.selectedIndex == -1 && this._isFirstResultHeuristic) {
// Don't handle this as a user-initiated action.
this._ignoreNextSelect = true;
// Don't fire DOMMenuItemActive so that screen readers still see
// the input as being focused.
--- a/browser/components/preferences/in-content/main.xul
+++ b/browser/components/preferences/in-content/main.xul
@@ -187,17 +187,17 @@
<html:td class="label-cell">
<label accesskey="&homepage.accesskey;"
control="browserHomePage">&homepage.label;</label>
</html:td>
<html:td class="content-cell">
<textbox id="browserHomePage"
class="padded uri-element content-cell-item"
type="autocomplete"
- autocompletesearch="history"
+ autocompletesearch="unifiedcomplete"
onsyncfrompreference="return gMainPane.syncFromHomePref();"
onsynctopreference="return gMainPane.syncToHomePref(this.value);"
placeholder="&abouthome.pageTitle;"
preference="browser.startup.homepage"/>
</html:td>
</html:tr>
<html:tr>
<html:td class="label-cell" />
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -44,29 +44,18 @@ var gPrivacyPane = {
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection-pbm";
link.setAttribute("href", url);
},
/**
* Initialize autocomplete to ensure prefs are in sync.
*/
_initAutocomplete: function () {
- let unifiedCompletePref = false;
- try {
- unifiedCompletePref =
- Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
- } catch (ex) {}
-
- if (unifiedCompletePref) {
- Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
- .getService(Components.interfaces.mozIPlacesAutoComplete);
- } else {
- Components.classes["@mozilla.org/autocomplete/search;1?name=history"]
- .getService(Components.interfaces.mozIPlacesAutoComplete);
- }
+ Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
+ .getService(Components.interfaces.mozIPlacesAutoComplete);
},
/**
* Sets up the UI for the number of days of history to keep, and updates the
* label of the "Clear Now..." button.
*/
init: function ()
{
--- a/browser/components/preferences/in-content/search.js
+++ b/browser/components/preferences/in-content/search.js
@@ -21,29 +21,18 @@ document.addEventListener("Initialized",
var gEngineView = null;
var gSearchPane = {
/**
* Initialize autocomplete to ensure prefs are in sync.
*/
_initAutocomplete: function () {
- let unifiedCompletePref = false;
- try {
- unifiedCompletePref =
- Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
- } catch (ex) {}
-
- if (unifiedCompletePref) {
- Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
- .getService(Components.interfaces.mozIPlacesAutoComplete);
- } else {
- Components.classes["@mozilla.org/autocomplete/search;1?name=history"]
- .getService(Components.interfaces.mozIPlacesAutoComplete);
- }
+ Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
+ .getService(Components.interfaces.mozIPlacesAutoComplete);
},
init: function ()
{
gEngineView = new EngineView(new EngineStore());
document.getElementById("engineList").view = gEngineView;
this.buildDefaultEngineDropDown();
@@ -65,24 +54,21 @@ var gSearchPane = {
document.getElementById("browser.search.suggest.enabled");
suggestsPref.addEventListener("change", () => {
this.updateSuggestsCheckbox();
});
this.updateSuggestsCheckbox();
},
updateSuggestsCheckbox() {
- let urlbarSuggests = document.getElementById("urlBarSuggestion");
- urlbarSuggests.hidden =
- !Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
-
let suggestsPref =
document.getElementById("browser.search.suggest.enabled");
let permanentPB =
Services.prefs.getBoolPref("browser.privatebrowsing.autostart");
+ let urlbarSuggests = document.getElementById("urlBarSuggestion");
urlbarSuggests.disabled = !suggestsPref.value || permanentPB;
let urlbarSuggestsPref =
document.getElementById("browser.urlbar.suggest.searches");
urlbarSuggests.checked = urlbarSuggestsPref.value;
if (urlbarSuggests.disabled) {
urlbarSuggests.checked = false;
}
--- a/browser/components/sessionstore/test/browser_599909.js
+++ b/browser/components/sessionstore/test/browser_599909.js
@@ -65,31 +65,36 @@ function test() {
// so that we could do the same sort of checking.
var gController = Cc["@mozilla.org/autocomplete/controller;1"].
getService(Ci.nsIAutoCompleteController);
function checkAutocompleteResults(aExpected, aCallback) {
gController.input = {
timeout: 10,
textValue: "",
- searches: ["history"],
+ searches: ["unifiedcomplete"],
searchParam: "enable-actions",
popupOpen: false,
minResultsForPopup: 0,
invalidate: function() {},
disableAutoComplete: false,
completeDefaultIndex: false,
get popup() { return this; },
onSearchBegin: function() {},
onSearchComplete: function ()
{
info("Found " + gController.matchCount + " matches.");
// Check to see the expected uris and titles match up (in any order)
for (let i = 0; i < gController.matchCount; i++) {
- let uri = gController.getValueAt(i).replace(/^moz-action:[^,]+,/i, "");
+ if (gController.getStyleAt(i).includes("heuristic")) {
+ do_print("Skip heuristic match");
+ continue;
+ }
+ let action = gURLBar.popup.input._parseActionUrl(gController.getValueAt(i));
+ let uri = action.params.url;
info("Search for '" + uri + "' in open tabs.");
ok(uri in aExpected, "Registered open page found in autocomplete.");
// Remove the found entry from expected results.
delete aExpected[uri];
}
// Make sure there is no reported open page that is not open.
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -431,19 +431,16 @@
@RESPATH@/components/nsURLFormatter.manifest
@RESPATH@/components/nsURLFormatter.js
@RESPATH@/browser/components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@
@RESPATH@/components/txEXSLTRegExFunctions.manifest
@RESPATH@/components/txEXSLTRegExFunctions.js
@RESPATH@/components/toolkitplaces.manifest
@RESPATH@/components/nsLivemarkService.js
@RESPATH@/components/nsTaggingService.js
-@RESPATH@/components/nsPlacesAutoComplete.manifest
-@RESPATH@/components/nsPlacesAutoComplete.js
-@RESPATH@/components/UnifiedComplete.manifest
@RESPATH@/components/UnifiedComplete.js
@RESPATH@/components/nsPlacesExpiration.js
@RESPATH@/components/PlacesCategoriesStarter.js
@RESPATH@/components/ColorAnalyzer.js
@RESPATH@/components/PageThumbsProtocol.js
@RESPATH@/components/nsDefaultCLH.manifest
@RESPATH@/components/nsDefaultCLH.js
@RESPATH@/components/nsContentPrefService.manifest
--- a/toolkit/components/build/nsToolkitCompsCID.h
+++ b/toolkit/components/build/nsToolkitCompsCID.h
@@ -34,19 +34,16 @@
"@mozilla.org/satchel/form-fill-controller;1"
#define NS_FORMHISTORYAUTOCOMPLETE_CONTRACTID \
"@mozilla.org/autocomplete/search;1?name=form-history"
#define NS_GLOBALHISTORY_DATASOURCE_CONTRACTID \
"@mozilla.org/rdf/datasource;1?name=history"
-#define NS_GLOBALHISTORY_AUTOCOMPLETE_CONTRACTID \
- "@mozilla.org/autocomplete/search;1?name=history"
-
#define NS_TYPEAHEADFIND_CONTRACTID \
"@mozilla.org/typeaheadfind;1"
#define NS_PARENTALCONTROLSSERVICE_CONTRACTID \
"@mozilla.org/parental-controls-service;1"
#define NS_URLCLASSIFIERPREFIXSET_CONTRACTID \
"@mozilla.org/url-classifier/prefixset;1"
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -903,19 +903,21 @@ Search.prototype = {
// We sleep a little between adding the heuristicFirstMatch and matching
// any other searches so we aren't kicking off potentially expensive
// searches on every keystroke.
yield this._sleep(Prefs.delay);
if (!this.pending)
return;
- yield this._matchSearchSuggestions();
- if (!this.pending)
- return;
+ if (this._enableActions) {
+ yield this._matchSearchSuggestions();
+ if (!this.pending)
+ return;
+ }
for (let [query, params] of queries) {
yield conn.executeCached(query, params, this._onResultRow.bind(this));
if (!this.pending)
return;
}
if (this._enableActions && this.hasBehavior("openpage")) {
@@ -1955,16 +1957,18 @@ UnifiedComplete.prototype = {
* Indicates if we should notify the AutoComplete listener about our
* results or not.
*/
finishSearch: function (notify=false) {
TelemetryStopwatch.cancel(TELEMETRY_1ST_RESULT, this);
TelemetryStopwatch.cancel(TELEMETRY_6_FIRST_RESULTS, this);
// Clear state now to avoid race conditions, see below.
let search = this._currentSearch;
+ if (!search)
+ return;
this._lastLowResultsSearchSuggestion = search._lastLowResultsSearchSuggestion;
delete this._currentSearch;
if (!notify)
return;
// There is a possible race condition here.
// When a search completes it calls finishSearch that notifies results
--- a/toolkit/components/places/moz.build
+++ b/toolkit/components/places/moz.build
@@ -74,23 +74,23 @@ if CONFIG['MOZ_PLACES']:
EXTRA_COMPONENTS += [
'ColorAnalyzer.js',
'nsLivemarkService.js',
'nsPlacesExpiration.js',
'nsTaggingService.js',
'PlacesCategoriesStarter.js',
'toolkitplaces.manifest',
+ 'UnifiedComplete.js',
]
- if CONFIG['MOZ_XUL']:
+
+ if CONFIG['MOZ_SUITE']:
EXTRA_COMPONENTS += [
'nsPlacesAutoComplete.js',
'nsPlacesAutoComplete.manifest',
- 'UnifiedComplete.js',
- 'UnifiedComplete.manifest',
]
FINAL_LIBRARY = 'xul'
include('/ipc/chromium/chromium-config.mozbuild')
with Files('**'):
BUG_COMPONENT = ('Toolkit', 'Places')
--- a/toolkit/components/places/nsPlacesAutoComplete.js
+++ b/toolkit/components/places/nsPlacesAutoComplete.js
@@ -73,23 +73,16 @@ const kQueryTypeFiltered = 1;
// 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
// "comment" back into the title and the tag.
const kTitleTagsSeparator = " \u2013 ";
const kBrowserUrlbarBranch = "browser.urlbar.";
// Toggle autocomplete.
const kBrowserUrlbarAutocompleteEnabledPref = "autocomplete.enabled";
-// Toggle autoFill.
-const kBrowserUrlbarAutofillPref = "autoFill";
-// Whether to search only typed entries.
-const kBrowserUrlbarAutofillTypedPref = "autoFill.typed";
-
-// The Telemetry histogram for urlInlineComplete query on domain
-const DOMAIN_QUERY_TELEMETRY = "PLACES_AUTOCOMPLETE_URLINLINE_DOMAIN_QUERY_TIME_MS";
////////////////////////////////////////////////////////////////////////////////
//// Globals
XPCOMUtils.defineLazyServiceGetter(this, "gTextURIService",
"@mozilla.org/intl/texttosuburi;1",
"nsITextToSubURI");
@@ -1367,412 +1360,10 @@ nsPlacesAutoComplete.prototype = {
Ci.nsIAutoCompleteSimpleResultListener,
Ci.mozIPlacesAutoComplete,
Ci.mozIStorageStatementCallback,
Ci.nsIObserver,
Ci.nsISupportsWeakReference,
])
};
-////////////////////////////////////////////////////////////////////////////////
-//// urlInlineComplete class
-//// component @mozilla.org/autocomplete/search;1?name=urlinline
-
-function urlInlineComplete()
-{
- this._loadPrefs(true);
- Services.obs.addObserver(this, kTopicShutdown, true);
-}
-
-urlInlineComplete.prototype = {
-
-/////////////////////////////////////////////////////////////////////////////////
-//// Database and query getters
-
- __db: null,
-
- get _db()
- {
- if (!this.__db && this._autofillEnabled) {
- this.__db = PlacesUtils.history.DBConnection.clone(true);
- }
- return this.__db;
- },
-
- __hostQuery: null,
-
- get _hostQuery()
- {
- if (!this.__hostQuery) {
- // Add a trailing slash at the end of the hostname, since we always
- // want to complete up to and including a URL separator.
- this.__hostQuery = this._db.createAsyncStatement(
- `/* do not warn (bug no): could index on (typed,frecency) but not worth it */
- SELECT host || '/', prefix || host || '/'
- FROM moz_hosts
- WHERE host BETWEEN :search_string AND :search_string || X'FFFF'
- AND frecency <> 0
- ${this._autofillTyped ? "AND typed = 1" : ""}
- ORDER BY frecency DESC
- LIMIT 1`
- );
- }
- return this.__hostQuery;
- },
-
- __urlQuery: null,
-
- get _urlQuery()
- {
- if (!this.__urlQuery) {
- this.__urlQuery = this._db.createAsyncStatement(
- `/* do not warn (bug no): can't use an index */
- SELECT h.url
- FROM moz_places h
- WHERE h.frecency <> 0
- ${this._autofillTyped ? "AND h.typed = 1 " : ""}
- AND AUTOCOMPLETE_MATCH(:searchString, h.url,
- h.title, '',
- h.visit_count, h.typed, 0, 0,
- :matchBehavior, :searchBehavior)
- ORDER BY h.frecency DESC, h.id DESC
- LIMIT 1`
- );
- }
- return this.__urlQuery;
- },
-
- //////////////////////////////////////////////////////////////////////////////
- //// nsIAutoCompleteSearch
-
- startSearch: function UIC_startSearch(aSearchString, aSearchParam,
- aPreviousResult, aListener)
- {
- // Stop the search in case the controller has not taken care of it.
- if (this._pendingQuery) {
- this.stopSearch();
- }
-
- let pendingSearch = this._pendingSearch = {};
-
- // We want to store the original string with no leading or trailing
- // whitespace for case sensitive searches.
- this._originalSearchString = aSearchString;
- this._currentSearchString =
- fixupSearchText(this._originalSearchString.toLowerCase());
- // The protocol and the host are lowercased by nsIURI, so it's fine to
- // lowercase the typed prefix to add it back to the results later.
- this._strippedPrefix = this._originalSearchString.slice(
- 0, this._originalSearchString.length - this._currentSearchString.length
- ).toLowerCase();
-
- this._result = Cc["@mozilla.org/autocomplete/simple-result;1"].
- createInstance(Ci.nsIAutoCompleteSimpleResult);
- this._result.setSearchString(aSearchString);
- this._result.setTypeAheadResult(true);
-
- this._listener = aListener;
-
- Task.spawn(function* () {
- // Don't autoFill if the search term is recognized as a keyword, otherwise
- // it will override default keywords behavior. Note that keywords are
- // hashed on first use, so while the first query may delay a little bit,
- // next ones will just hit the memory hash.
- let dontAutoFill = this._currentSearchString.length == 0 || !this._db ||
- (yield PlacesUtils.keywords.fetch(this._currentSearchString));
- if (this._pendingSearch != pendingSearch)
- return;
- if (dontAutoFill) {
- this._finishSearch();
- return;
- }
-
- // 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().includes(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));
- },
-
- /**
- * Execute an asynchronous search through places, and complete
- * up to the next URL separator.
- */
- _queryURL: function UIC__queryURL()
- {
- // The URIs in the database are fixed up, so we can match on a lowercased
- // host, but the path must be matched in a case sensitive way.
- let pathIndex =
- this._originalSearchString.indexOf("/", this._strippedPrefix.length);
- this._currentSearchString = fixupSearchText(
- this._originalSearchString.slice(0, pathIndex).toLowerCase() +
- this._originalSearchString.slice(pathIndex)
- );
-
- // Within the standard autocomplete query, we only search the beginning
- // of URLs for 1 result.
- let query = this._urlQuery;
- let params = query.params;
- params.matchBehavior = MATCH_BEGINNING_CASE_SENSITIVE;
- params.searchBehavior |= Ci.mozIPlacesAutoComplete.BEHAVIOR_HISTORY |
- Ci.mozIPlacesAutoComplete.BEHAVIOR_TYPED |
- Ci.mozIPlacesAutoComplete.BEHAVIOR_URL;
- params.searchString = this._currentSearchString;
-
- // Execute the query.
- let wrapper = new AutoCompleteStatementCallbackWrapper(this, {
- handleResult: aResultSet => {
- let row = aResultSet.getNextRow();
- let value = row.getResultByIndex(0);
- let url = fixupSearchText(value);
-
- let prefix = value.slice(0, value.length - stripPrefix(value).length);
-
- // We must complete the URL up to the next separator (which is /, ? or #).
- let separatorIndex = url.slice(this._currentSearchString.length)
- .search(/[\/\?\#]/);
- if (separatorIndex != -1) {
- separatorIndex += this._currentSearchString.length;
- if (url[separatorIndex] == "/") {
- separatorIndex++; // Include the "/" separator
- }
- url = url.slice(0, separatorIndex);
- }
-
- // Add the result.
- // If the untrimmed value doesn't preserve the user's input just
- // ignore it and complete to the found url.
- let untrimmedURL = prefix + url;
- if (untrimmedURL &&
- !untrimmedURL.toLowerCase().includes(this._originalSearchString.toLowerCase())) {
- untrimmedURL = null;
- }
-
- this._result.appendMatch(this._strippedPrefix + url, "", "", "", untrimmedURL);
-
- // 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 => {
- this._finishSearch();
- }
- }, this._db);
- this._pendingQuery = wrapper.executeAsync([query]);
- },
-
- stopSearch: function UIC_stopSearch()
- {
- delete this._originalSearchString;
- delete this._currentSearchString;
- delete this._result;
- delete this._listener;
- delete this._pendingSearch;
-
- if (this._pendingQuery) {
- this._pendingQuery.cancel();
- delete this._pendingQuery;
- }
- },
-
- /**
- * Loads the preferences that we care about.
- *
- * @param [optional] aRegisterObserver
- * Indicates if the preference observer should be added or not. The
- * default value is false.
- */
- _loadPrefs: function UIC_loadPrefs(aRegisterObserver)
- {
- let prefBranch = Services.prefs.getBranch(kBrowserUrlbarBranch);
- let autocomplete = safePrefGetter(prefBranch,
- kBrowserUrlbarAutocompleteEnabledPref,
- true);
- let autofill = safePrefGetter(prefBranch,
- kBrowserUrlbarAutofillPref,
- true);
- this._autofillEnabled = autocomplete && autofill;
- this._autofillTyped = safePrefGetter(prefBranch,
- kBrowserUrlbarAutofillTypedPref,
- true);
- if (aRegisterObserver) {
- Services.prefs.addObserver(kBrowserUrlbarBranch, this, true);
- }
- },
-
- //////////////////////////////////////////////////////////////////////////////
- //// nsIAutoCompleteSearchDescriptor
-
- get searchType() {
- return Ci.nsIAutoCompleteSearchDescriptor.SEARCH_TYPE_IMMEDIATE;
- },
-
- get clearingAutoFillSearchesAgain() {
- return false;
- },
-
- //////////////////////////////////////////////////////////////////////////////
- //// nsIObserver
-
- observe: function UIC_observe(aSubject, aTopic, aData)
- {
- if (aTopic == kTopicShutdown) {
- this._closeDatabase();
- }
- else if (aTopic == kPrefChanged &&
- (aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutofillPref ||
- aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutocompleteEnabledPref ||
- aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutofillTypedPref)) {
- let previousAutofillTyped = this._autofillTyped;
- this._loadPrefs();
- if (!this._autofillEnabled) {
- this.stopSearch();
- this._closeDatabase();
- }
- else if (this._autofillTyped != previousAutofillTyped) {
- // Invalidate the statements to update them for the new typed status.
- this._invalidateStatements();
- }
- }
- },
-
- /**
- * Finalizes and invalidates cached statements.
- */
- _invalidateStatements: function UIC_invalidateStatements()
- {
- // Finalize the statements that we have used.
- let stmts = [
- "__hostQuery",
- "__urlQuery",
- ];
- for (let i = 0; i < stmts.length; i++) {
- // We do not want to create any query we haven't already created, so
- // see if it is a getter first.
- if (this[stmts[i]]) {
- this[stmts[i]].finalize();
- this[stmts[i]] = null;
- }
- }
- },
-
- /**
- * Closes the database.
- */
- _closeDatabase: function UIC_closeDatabase()
- {
- this._invalidateStatements();
- if (this.__db) {
- this._db.asyncClose();
- this.__db = null;
- }
- },
-
- //////////////////////////////////////////////////////////////////////////////
- //// urlInlineComplete
-
- _finishSearch: function UIC_finishSearch()
- {
- // Notify the result object
- let result = this._result;
-
- if (result.matchCount) {
- result.setDefaultIndex(0);
- result.setSearchResult(Ci.nsIAutoCompleteResult["RESULT_SUCCESS"]);
- } else {
- result.setDefaultIndex(-1);
- result.setSearchResult(Ci.nsIAutoCompleteResult["RESULT_NOMATCH"]);
- }
-
- this._listener.onSearchResult(this, result);
- this.stopSearch();
- },
-
- isSearchComplete: function UIC_isSearchComplete()
- {
- return this._pendingQuery == null;
- },
-
- isPendingSearch: function UIC_isPendingSearch(aHandle)
- {
- return this._pendingQuery == aHandle;
- },
-
- //////////////////////////////////////////////////////////////////////////////
- //// nsISupports
-
- classID: Components.ID("c88fae2d-25cf-4338-a1f4-64a320ea7440"),
-
- _xpcom_factory: XPCOMUtils.generateSingletonFactory(urlInlineComplete),
-
- QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIAutoCompleteSearch,
- Ci.nsIAutoCompleteSearchDescriptor,
- Ci.nsIObserver,
- Ci.nsISupportsWeakReference,
- ])
-};
-
-var components = [nsPlacesAutoComplete, urlInlineComplete];
+var components = [nsPlacesAutoComplete];
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/toolkit/components/places/nsPlacesAutoComplete.manifest
+++ b/toolkit/components/places/nsPlacesAutoComplete.manifest
@@ -1,6 +1,3 @@
component {d0272978-beab-4adc-a3d4-04b76acfa4e7} nsPlacesAutoComplete.js
contract @mozilla.org/autocomplete/search;1?name=history {d0272978-beab-4adc-a3d4-04b76acfa4e7}
-component {c88fae2d-25cf-4338-a1f4-64a320ea7440} nsPlacesAutoComplete.js
-contract @mozilla.org/autocomplete/search;1?name=urlinline {c88fae2d-25cf-4338-a1f4-64a320ea7440}
-
--- a/toolkit/components/places/tests/autocomplete/test_enabled.js
+++ b/toolkit/components/places/tests/autocomplete/test_enabled.js
@@ -28,17 +28,17 @@ var gTests = [
"url", [0], () => setSearch(1)],
];
function setSearch(aSearch) {
prefs.setBoolPref("browser.urlbar.autocomplete.enabled", !!aSearch);
}
add_task(function* test_sync_enabled() {
- // Initialize unified complete.
+ // Initialize autocomplete component.
Cc["@mozilla.org/autocomplete/search;1?name=history"]
.getService(Ci.mozIPlacesAutoComplete);
let types = [ "history", "bookmark", "openpage" ];
// Test the service keeps browser.urlbar.autocomplete.enabled synchronized
// with browser.urlbar.suggest prefs.
for (let type of types) {
deleted file mode 100644
--- a/toolkit/components/places/tests/inline/.eslintrc
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "extends": [
- "../../../../../testing/xpcshell/xpcshell.eslintrc"
- ]
-}
deleted file mode 100644
--- a/toolkit/components/places/tests/inline/head_autocomplete.js
+++ /dev/null
@@ -1,201 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-var Ci = Components.interfaces;
-var Cc = Components.classes;
-var Cr = Components.results;
-var Cu = Components.utils;
-
-Cu.import("resource://gre/modules/Services.jsm");
-
-// Import common head.
-{
- let commonFile = do_get_file("../head_common.js", false);
- let uri = Services.io.newFileURI(commonFile);
- Services.scriptloader.loadSubScript(uri.spec, this);
-}
-
-// Put any other stuff relative to this test folder below.
-
-XPCOMUtils.defineLazyServiceGetter(this, "gHistory",
- "@mozilla.org/browser/history;1",
- "mozIAsyncHistory");
-
-/**
- * @param aSearches
- * Array of AutoCompleteSearch names.
- */
-function AutoCompleteInput(aSearches) {
- this.searches = aSearches;
-}
-AutoCompleteInput.prototype = {
- searches: null,
- minResultsForPopup: 0,
- timeout: 10,
- searchParam: "",
- textValue: "",
- disableAutoComplete: false,
-
- completeDefaultIndex: true,
- defaultIndex: 0,
-
- // Text selection range
- _selStart: 0,
- _selEnd: 0,
- get selectionStart() {
- return this._selStart;
- },
- get selectionEnd() {
- return this._selEnd;
- },
- selectTextRange: function(aStart, aEnd) {
- this._selStart = aStart;
- this._selEnd = aEnd;
- },
-
- onTextEntered: () => false,
- onTextReverted: () => false,
-
- get searchCount() {
- return this.searches.length;
- },
- getSearchAt: function(aIndex) {
- return this.searches[aIndex];
- },
-
- onSearchBegin: function () {},
- onSearchComplete: function () {},
-
- popupOpen: false,
-
- popup: {
- selectedIndex: -1,
- invalidate: function () {},
-
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompletePopup])
- },
-
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompleteInput])
-}
-
-/**
- * @param aSearchString
- * String to search.
- * @param aExpectedValue
- * Expected value returned by autoFill.
- * May be a string, or an object like
- * {
- * autoFilled: the value suggested by autofill,
- * completed: the value completed on user's confirmation
- * }
- * In the latter case this will also check that on user's confirmation
- * the result's casing is correctly applied.
- */
-function ensure_results(aSearchString, aExpectedValue) {
- let autoFilledValue, completedValue;
- if (typeof(aExpectedValue) == "string") {
- autoFilledValue = aExpectedValue;
- }
- else {
- autoFilledValue = aExpectedValue.autoFilled;
- completedValue = aExpectedValue.completed;
- }
-
- // Make an AutoCompleteInput that uses our searches and confirms results.
- let input = new AutoCompleteInput(["urlinline"]);
- input.textValue = aSearchString;
-
- // Caret must be at the end for autoFill to happen.
- let strLen = aSearchString.length;
- input.selectTextRange(strLen, strLen);
- do_check_eq(input.selectionStart, strLen);
- do_check_eq(input.selectionEnd, strLen);
-
- let controller = Cc["@mozilla.org/autocomplete/controller;1"].
- getService(Ci.nsIAutoCompleteController);
- controller.input = input;
-
- let numSearchesStarted = 0;
- input.onSearchBegin = function() {
- numSearchesStarted++;
- do_check_eq(numSearchesStarted, 1);
- };
-
-
- let promise = new Promise(resolve => {
- input.onSearchComplete = function() {
- // We should be running only one query.
- do_check_eq(numSearchesStarted, 1);
-
- // Check the autoFilled result.
- do_check_eq(input.textValue, autoFilledValue);
-
- 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.
- Promise.all([
- PlacesUtils.bookmarks.eraseEverything(),
- PlacesTestUtils.clearHistory()
- ]).then(resolve);
- };
- });
-
- do_print("Searching for: '" + aSearchString + "'");
- controller.startSearch(aSearchString);
-
- return promise;
-}
-
-function run_test() {
- do_register_cleanup(function () {
- Services.prefs.clearUserPref("browser.urlbar.autocomplete.enabled");
- Services.prefs.clearUserPref("browser.urlbar.autoFill");
- Services.prefs.clearUserPref("browser.urlbar.autoFill.typed");
- });
-
- gAutoCompleteTests.forEach(function (testData) {
- let [description, searchString, expectedValue, setupFunc] = testData;
- add_task(function* () {
- do_print(description);
- Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", true);
- Services.prefs.setBoolPref("browser.urlbar.autoFill", true);
- Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
-
- if (setupFunc) {
- yield setupFunc();
- }
-
- // At this point frecency could still be updating due to latest pages
- // updates.
- // This is not a problem in real life, but autocomplete tests should
- // return reliable resultsets, thus we have to wait.
- yield PlacesTestUtils.promiseAsyncUpdates();
- yield ensure_results(searchString, expectedValue);
- })
- }, this);
-
- run_next_test();
-}
-
-var gAutoCompleteTests = [];
-function add_autocomplete_test(aTestData) {
- gAutoCompleteTests.push(aTestData);
-}
-
-function* addBookmark(aBookmarkObj) {
- do_check_true(!!aBookmarkObj.url);
- yield PlacesUtils.bookmarks
- .insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
- url: aBookmarkObj.url });
- if (aBookmarkObj.keyword) {
- yield PlacesUtils.keywords.insert({ keyword: aBookmarkObj.keyword,
- url: aBookmarkObj.url });
- }
-}
deleted file mode 100644
--- a/toolkit/components/places/tests/inline/test_autocomplete_functional.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Functional tests for inline autocomplete
-
-add_autocomplete_test([
- "Check disabling autocomplete disables autofill",
- "vis",
- "vis",
- function* () {
- Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false);
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://visit.mozilla.org"),
- transition: TRANSITION_TYPED
- });
- }
-]);
-
-add_autocomplete_test([
- "Check disabling autofill disables autofill",
- "vis",
- "vis",
- function* () {
- Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://visit.mozilla.org"),
- transition: TRANSITION_TYPED
- });
- }
-]);
-
-add_autocomplete_test([
- "Add urls, check for correct order",
- "vis",
- "visit2.mozilla.org/",
- function* () {
- let places = [{ uri: NetUtil.newURI("http://visit1.mozilla.org") },
- { uri: NetUtil.newURI("http://visit2.mozilla.org"),
- transition: TRANSITION_TYPED }];
- yield PlacesTestUtils.addVisits(places);
- }
-]);
-
-add_autocomplete_test([
- "Add urls, make sure www and http are ignored",
- "visit1",
- "visit1.mozilla.org/",
- function* () {
- yield PlacesTestUtils.addVisits(NetUtil.newURI("http://www.visit1.mozilla.org"));
- }
-]);
-
-add_autocomplete_test([
- "Autocompleting after an existing host completes to the url",
- "visit3.mozilla.org/",
- "visit3.mozilla.org/",
- function* () {
- yield PlacesTestUtils.addVisits(NetUtil.newURI("http://www.visit3.mozilla.org"));
- }
-]);
-
-add_autocomplete_test([
- "Searching for www.me should yield www.me.mozilla.org/",
- "www.me",
- "www.me.mozilla.org/",
- function* () {
- yield PlacesTestUtils.addVisits(NetUtil.newURI("http://www.me.mozilla.org"));
- }
-]);
-
-add_autocomplete_test([
- "With a bookmark and history, the query result should be the bookmark",
- "bookmark",
- "bookmark1.mozilla.org/",
- function* () {
- yield addBookmark({ url: "http://bookmark1.mozilla.org/", });
- yield PlacesTestUtils.addVisits(NetUtil.newURI("http://bookmark1.mozilla.org/foo"));
- }
-]);
-
-add_autocomplete_test([
- "Check to make sure we get the proper results with full paths",
- "smokey",
- "smokey.mozilla.org/",
- function* () {
- 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") }];
- yield PlacesTestUtils.addVisits(places);
- }
-]);
-
-add_autocomplete_test([
- "Check to make sure we autocomplete to the following '/'",
- "smokey.mozilla.org/fo",
- "smokey.mozilla.org/foo/",
- function* () {
- 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") }];
- yield PlacesTestUtils.addVisits(places);
- }
-]);
-
-add_autocomplete_test([
- "Check to make sure we autocomplete after ?",
- "smokey.mozilla.org/foo?",
- "smokey.mozilla.org/foo?bacon=delicious",
- function* () {
- yield PlacesTestUtils.addVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious"));
- }
-]);
-
-add_autocomplete_test([
- "Check to make sure we autocomplete after #",
- "smokey.mozilla.org/foo?bacon=delicious#bar",
- "smokey.mozilla.org/foo?bacon=delicious#bar",
- function* () {
- yield PlacesTestUtils.addVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious#bar"));
- }
-]);
deleted file mode 100644
--- a/toolkit/components/places/tests/inline/test_casing.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-add_autocomplete_test([
- "Searching for cased entry 1",
- "MOZ",
- { autoFilled: "MOZilla.org/", completed: "mozilla.org/" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/test/") });
- }
-]);
-
-add_autocomplete_test([
- "Searching for cased entry 2",
- "mozilla.org/T",
- { autoFilled: "mozilla.org/T", completed: "mozilla.org/T" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/test/") });
- }
-]);
-
-add_autocomplete_test([
- "Searching for cased entry 3",
- "mozilla.org/T",
- { autoFilled: "mozilla.org/Test/", completed: "http://mozilla.org/Test/" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
- }
-]);
-
-add_autocomplete_test([
- "Searching for cased entry 4",
- "mOzilla.org/t",
- { autoFilled: "mOzilla.org/t", completed: "mOzilla.org/t" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
- },
-]);
-
-add_autocomplete_test([
- "Searching for cased entry 5",
- "mOzilla.org/T",
- { autoFilled: "mOzilla.org/Test/", completed: "http://mozilla.org/Test/" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
- },
-]);
-
-add_autocomplete_test([
- "Searching for untrimmed cased entry",
- "http://mOz",
- { autoFilled: "http://mOzilla.org/", completed: "http://mozilla.org/" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
- },
-]);
-
-add_autocomplete_test([
- "Searching for untrimmed cased entry with www",
- "http://www.mOz",
- { autoFilled: "http://www.mOzilla.org/", completed: "http://www.mozilla.org/" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/") });
- },
-]);
-
-add_autocomplete_test([
- "Searching for untrimmed cased entry with path",
- "http://mOzilla.org/t",
- { autoFilled: "http://mOzilla.org/t", completed: "http://mOzilla.org/t" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
- },
-]);
-
-add_autocomplete_test([
- "Searching for untrimmed cased entry with path 2",
- "http://mOzilla.org/T",
- { autoFilled: "http://mOzilla.org/Test/", completed: "http://mozilla.org/Test/" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/") });
- },
-]);
-
-add_autocomplete_test([
- "Searching for untrimmed cased entry with www and path",
- "http://www.mOzilla.org/t",
- { autoFilled: "http://www.mOzilla.org/t", completed: "http://www.mOzilla.org/t" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/") });
- },
-]);
-
-add_autocomplete_test([
- "Searching for untrimmed cased entry with www and path 2",
- "http://www.mOzilla.org/T",
- { autoFilled: "http://www.mOzilla.org/Test/", completed: "http://www.mozilla.org/Test/" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/") });
- },
-]);
deleted file mode 100644
--- a/toolkit/components/places/tests/inline/test_do_not_trim.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Inline should never return matches shorter than the search string, since
-// that largely confuses completeDefaultIndex
-
-add_autocomplete_test([
- "Do not autofill whitespaced entry 1",
- "mozilla.org ",
- "mozilla.org ",
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://mozilla.org/link/"),
- transition: TRANSITION_TYPED
- });
- }
-]);
-
-add_autocomplete_test([
- "Do not autofill whitespaced entry 2",
- "mozilla.org/ ",
- "mozilla.org/ ",
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://mozilla.org/link/"),
- transition: TRANSITION_TYPED
- });
- }
-]);
-
-add_autocomplete_test([
- "Do not autofill whitespaced entry 3",
- "mozilla.org/link ",
- "mozilla.org/link ",
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://mozilla.org/link/"),
- transition: TRANSITION_TYPED
- });
- }
-]);
-
-add_autocomplete_test([
- "Do not autofill whitespaced entry 4",
- "mozilla.org/link/ ",
- "mozilla.org/link/ ",
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://mozilla.org/link/"),
- transition: TRANSITION_TYPED
- });
- }
-]);
-
-
-add_autocomplete_test([
- "Do not autofill whitespaced entry 5",
- "moz illa ",
- "moz illa ",
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://mozilla.org/link/"),
- transition: TRANSITION_TYPED
- });
- }
-]);
-
-add_autocomplete_test([
- "Do not autofill whitespaced entry 6",
- " mozilla",
- " mozilla",
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://mozilla.org/link/"),
- transition: TRANSITION_TYPED
- });
- }
-]);
deleted file mode 100644
--- a/toolkit/components/places/tests/inline/test_keywords.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-add_autocomplete_test([
- "Searching for non-keyworded entry should autoFill it",
- "moz",
- "mozilla.org/",
- function* () {
- yield addBookmark({ url: "http://mozilla.org/test/" });
- }
-]);
-
-add_autocomplete_test([
- "Searching for keyworded entry should not autoFill it",
- "moz",
- "moz",
- function* () {
- yield addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
- }
-]);
-
-add_autocomplete_test([
- "Searching for more than keyworded entry should autoFill it",
- "mozi",
- "mozilla.org/",
- function* () {
- yield addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
- }
-]);
-
-add_autocomplete_test([
- "Searching for less than keyworded entry should autoFill it",
- "mo",
- "mozilla.org/",
- function* () {
- yield addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
- }
-]);
-
-add_autocomplete_test([
- "Searching for keyworded entry is case-insensitive",
- "MoZ",
- "MoZ",
- function* () {
- yield addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
- }
-]);
deleted file mode 100644
--- a/toolkit/components/places/tests/inline/test_queryurl.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-add_autocomplete_test([
- "Searching for host match without slash should match host",
- "file",
- "file.org/",
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://file.org/test/"),
- transition: TRANSITION_TYPED
- }, {
- uri: NetUtil.newURI("file:///c:/test.html"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Searching match with slash at the end should do nothing",
- "file.org/",
- "file.org/",
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://file.org/test/"),
- transition: TRANSITION_TYPED
- }, {
- uri: NetUtil.newURI("file:///c:/test.html"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Searching match with slash in the middle should match url",
- "file.org/t",
- "file.org/test/",
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://file.org/test/"),
- transition: TRANSITION_TYPED
- }, {
- uri: NetUtil.newURI("file:///c:/test.html"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Searching for non-host match without slash should not match url",
- "file",
- "file",
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("file:///c:/test.html"),
- transition: TRANSITION_TYPED
- });
- },
-]);
deleted file mode 100644
--- a/toolkit/components/places/tests/inline/test_trimming.js
+++ /dev/null
@@ -1,306 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-add_autocomplete_test([
- "Searching for untrimmed https://www entry",
- "mo",
- { autoFilled: "mozilla.org/", completed: "https://www.mozilla.org/" },
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("https://www.mozilla.org/test/"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Searching for untrimmed https://www entry with path",
- "mozilla.org/t",
- { autoFilled: "mozilla.org/test/", completed: "https://www.mozilla.org/test/" },
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("https://www.mozilla.org/test/"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Searching for untrimmed https:// entry",
- "mo",
- { autoFilled: "mozilla.org/", completed: "https://mozilla.org/" },
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("https://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Searching for untrimmed https:// entry with path",
- "mozilla.org/t",
- { autoFilled: "mozilla.org/test/", completed: "https://mozilla.org/test/" },
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("https://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Searching for untrimmed http://www entry",
- "mo",
- { autoFilled: "mozilla.org/", completed: "www.mozilla.org/" },
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://www.mozilla.org/test/"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Searching for untrimmed http://www entry with path",
- "mozilla.org/t",
- { autoFilled: "mozilla.org/test/", completed: "http://www.mozilla.org/test/" },
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://www.mozilla.org/test/"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Searching for untrimmed ftp:// entry",
- "mo",
- { autoFilled: "mozilla.org/", completed: "ftp://mozilla.org/" },
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("ftp://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Searching for untrimmed ftp:// entry with path",
- "mozilla.org/t",
- { autoFilled: "mozilla.org/test/", completed: "ftp://mozilla.org/test/" },
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("ftp://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Ensuring correct priority 1",
- "mo",
- { autoFilled: "mozilla.org/", completed: "mozilla.org/" },
- function* () {
- yield PlacesTestUtils.addVisits([
- { uri: NetUtil.newURI("https://www.mozilla.org/test/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("https://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("ftp://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("http://www.mozilla.org/test/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("http://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- }
- ]);
- },
-]);
-
-add_autocomplete_test([
- "Ensuring correct priority 2",
- "mo",
- { autoFilled: "mozilla.org/", completed: "mozilla.org/" },
- function* () {
- yield PlacesTestUtils.addVisits([
- { uri: NetUtil.newURI("https://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("ftp://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("http://www.mozilla.org/test/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("http://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- }
- ]);
- },
-]);
-
-add_autocomplete_test([
- "Ensuring correct priority 3",
- "mo",
- { autoFilled: "mozilla.org/", completed: "mozilla.org/" },
- function* () {
- yield PlacesTestUtils.addVisits([
- { uri: NetUtil.newURI("ftp://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("http://www.mozilla.org/test/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("http://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- }
- ]);
- },
-]);
-
-add_autocomplete_test([
- "Ensuring correct priority 4",
- "mo",
- { autoFilled: "mozilla.org/", completed: "mozilla.org/" },
- function* () {
- yield PlacesTestUtils.addVisits([
- { uri: NetUtil.newURI("http://www.mozilla.org/test/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("http://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- }
- ]);
- },
-]);
-
-add_autocomplete_test([
- "Ensuring correct priority 5",
- "mo",
- { autoFilled: "mozilla.org/", completed: "ftp://mozilla.org/" },
- function* () {
- yield PlacesTestUtils.addVisits([
- { uri: NetUtil.newURI("ftp://mozilla.org/test/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("ftp://www.mozilla.org/test/"),
- transition: TRANSITION_TYPED
- }
- ]);
- },
-]);
-
-add_autocomplete_test([
- "Ensuring correct priority 6",
- "mo",
- { autoFilled: "mozilla.org/", completed: "www.mozilla.org/" },
- function* () {
- yield PlacesTestUtils.addVisits([
- { uri: NetUtil.newURI("http://www.mozilla.org/test1/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("http://www.mozilla.org/test2/"),
- transition: TRANSITION_TYPED
- }
- ]);
- },
-]);
-
-add_autocomplete_test([
- "Ensuring longer domain can't match",
- "mo",
- { autoFilled: "mozilla.co/", completed: "mozilla.co/" },
- function* () {
- // 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.
- yield PlacesTestUtils.addVisits([
- { uri: NetUtil.newURI("https://mozilla.com/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("http://mozilla.co/"),
- transition: TRANSITION_TYPED
- },
- { uri: NetUtil.newURI("http://mozilla.co/"),
- transition: TRANSITION_TYPED
- }
- ]);
- },
-]);
-
-add_autocomplete_test([
- "Searching for URL with characters that are normally escaped",
- "https://www.mozilla.org/å•Š-test",
- { autoFilled: "https://www.mozilla.org/å•Š-test", completed: "https://www.mozilla.org/å•Š-test" },
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("https://www.mozilla.org/å•Š-test"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Don't return unsecure URL when searching for secure ones",
- "https://test.moz.org/t",
- { autoFilled: "https://test.moz.org/test/", completed: "https://test.moz.org/test/" },
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://test.moz.org/test/"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Don't return unsecure domain when searching for secure ones",
- "https://test.moz",
- { autoFilled: "https://test.moz.org/", completed: "https://test.moz.org/" },
- function* () {
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://test.moz.org/test/"),
- transition: TRANSITION_TYPED
- });
- },
-]);
-
-add_autocomplete_test([
- "Untyped is not accounted for www",
- "mo",
- { autoFilled: "moz.org/", completed: "moz.org/" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://www.moz.org/test/") });
- },
-]);
-
-add_autocomplete_test([
- "Untyped is not accounted for ftp",
- "mo",
- { autoFilled: "moz.org/", completed: "moz.org/" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("ftp://moz.org/test/") });
- },
-]);
-
-add_autocomplete_test([
- "Untyped is not accounted for https",
- "mo",
- { autoFilled: "moz.org/", completed: "moz.org/" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("https://moz.org/test/") });
- },
-]);
-
-add_autocomplete_test([
- "Untyped is not accounted for https://www",
- "mo",
- { autoFilled: "moz.org/", completed: "moz.org/" },
- function* () {
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("https://www.moz.org/test/") });
- },
-]);
deleted file mode 100644
--- a/toolkit/components/places/tests/inline/test_typed.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// First do searches with typed behavior forced to false, so later tests will
-// ensure autocomplete is able to dinamically switch behavior.
-
-add_autocomplete_test([
- "Searching for domain should autoFill it",
- "moz",
- "mozilla.org/",
- function* () {
- Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
- yield PlacesTestUtils.addVisits(NetUtil.newURI("http://mozilla.org/link/"));
- }
-]);
-
-add_autocomplete_test([
- "Searching for url should autoFill it",
- "mozilla.org/li",
- "mozilla.org/link/",
- function* () {
- Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
- yield PlacesTestUtils.addVisits(NetUtil.newURI("http://mozilla.org/link/"));
- }
-]);
-
-// Now do searches with typed behavior forced to true.
-
-add_autocomplete_test([
- "Searching for non-typed domain should not autoFill it",
- "moz",
- "moz",
- function* () {
- Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
- yield PlacesTestUtils.addVisits(NetUtil.newURI("http://mozilla.org/link/"));
- }
-]);
-
-add_autocomplete_test([
- "Searching for typed domain should autoFill it",
- "moz",
- "mozilla.org/",
- function* () {
- Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/typed/"),
- transition: TRANSITION_TYPED });
- }
-]);
-
-add_autocomplete_test([
- "Searching for non-typed url should not autoFill it",
- "mozilla.org/li",
- "mozilla.org/li",
- function* () {
- Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
- yield PlacesTestUtils.addVisits(NetUtil.newURI("http://mozilla.org/link/"));
- }
-]);
-
-add_autocomplete_test([
- "Searching for typed url should autoFill it",
- "mozilla.org/li",
- "mozilla.org/link/",
- function* () {
- Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
- yield PlacesTestUtils.addVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
- transition: TRANSITION_TYPED });
- }
-]);
deleted file mode 100644
--- a/toolkit/components/places/tests/inline/test_zero_frecency.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Ensure inline autocomplete doesn't return zero frecency pages.
-
-add_autocomplete_test([
- "Searching for zero frecency domain should not autoFill it",
- "moz",
- "moz",
- function* () {
- Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://mozilla.org/framed_link/"),
- transition: TRANSITION_FRAMED_LINK
- });
- }
-]);
-
-add_autocomplete_test([
- "Searching for zero frecency url should not autoFill it",
- "mozilla.org/f",
- "mozilla.org/f",
- function* () {
- Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
- yield PlacesTestUtils.addVisits({
- uri: NetUtil.newURI("http://mozilla.org/framed_link/"),
- transition: TRANSITION_FRAMED_LINK
- });
- }
-]);
deleted file mode 100644
--- a/toolkit/components/places/tests/inline/xpcshell.ini
+++ /dev/null
@@ -1,13 +0,0 @@
-[DEFAULT]
-head = head_autocomplete.js
-tail =
-skip-if = toolkit == 'android' || toolkit == 'gonk'
-
-[test_autocomplete_functional.js]
-[test_casing.js]
-[test_do_not_trim.js]
-[test_keywords.js]
-[test_queryurl.js]
-[test_trimming.js]
-[test_typed.js]
-[test_zero_frecency.js]
--- a/toolkit/components/places/tests/moz.build
+++ b/toolkit/components/places/tests/moz.build
@@ -6,29 +6,32 @@
TEST_DIRS += ['cpp']
TESTING_JS_MODULES += [
'PlacesTestUtils.jsm',
]
XPCSHELL_TESTS_MANIFESTS += [
- 'autocomplete/xpcshell.ini',
'bookmarks/xpcshell.ini',
'expiration/xpcshell.ini',
'favicons/xpcshell.ini',
'history/xpcshell.ini',
- 'inline/xpcshell.ini',
'migration/xpcshell.ini',
'network/xpcshell.ini',
'queries/xpcshell.ini',
'unifiedcomplete/xpcshell.ini',
'unit/xpcshell.ini',
]
+if CONFIG['MOZ_SUITE']:
+ XPCSHELL_TESTS_MANIFESTS += [
+ 'autocomplete/xpcshell.ini',
+ ]
+
BROWSER_CHROME_MANIFESTS += ['browser/browser.ini']
MOCHITEST_CHROME_MANIFESTS += [
'chrome/chrome.ini',
]
TEST_HARNESS_FILES.xpcshell.toolkit.components.places.tests += [
'head_common.js',
]
--- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -114,17 +114,17 @@ function _check_autocomplete_matches(mat
let { uri, title, tags, searchEngine, style } = match;
if (tags)
title += " \u2013 " + tags.sort().join(", ");
if (style)
style = style.sort();
else
style = ["favicon"];
- do_print("Checking against expected '" + uri.spec + "', '" + title + "'...");
+ do_print(`Checking against expected "${uri.spec}", "${title}"`);
// Got a match on both uri and title?
if (stripPrefix(uri.spec) != stripPrefix(result.value) || title != result.comment) {
return false;
}
let actualStyle = result.style.split(/\s+/).sort();
if (style)
Assert.equal(actualStyle.toString(), style.toString(), "Match should have expected style");
@@ -188,57 +188,59 @@ function* check_autocomplete(test) {
// is specified, we check that the first specified match is the first
// controller value (as this is the "special" always selected item), but the
// rest can match in any order.
// If 'enable-actions' is not specified, they can match in any order.
if (test.matches) {
// Do not modify the test original matches.
let matches = test.matches.slice();
- let firstIndexToCheck = 0;
- if (test.searchParam && test.searchParam == "enable-actions") {
- firstIndexToCheck = 1;
- do_print("Checking first match is first autocomplete entry")
- let result = {
- value: controller.getValueAt(0),
- comment: controller.getCommentAt(0),
- style: controller.getStyleAt(0),
- image: controller.getImageAt(0),
- }
- do_print(`First match is "${result.value}", " ${result.comment}"`);
- Assert.ok(_check_autocomplete_matches(matches[0], result), "first item is correct");
- do_print("Checking rest of the matches");
- }
-
- for (let i = firstIndexToCheck; i < controller.matchCount; i++) {
- let result = {
- value: controller.getValueAt(i),
- comment: controller.getCommentAt(i),
- style: controller.getStyleAt(i),
- image: controller.getImageAt(i),
- }
- do_print(`Looking for "${result.value}", "${result.comment}" in expected results...`);
- let lowerBound = test.checkSorting ? i : firstIndexToCheck;
- let upperBound = test.checkSorting ? i + 1 : matches.length;
- let found = false;
- for (let j = lowerBound; j < upperBound; ++j) {
- // Skip processed expected results
- if (matches[j] == undefined)
- continue;
- if (_check_autocomplete_matches(matches[j], result)) {
- do_print("Got a match at index " + j + "!");
- // Make it undefined so we don't process it again
- matches[j] = undefined;
- found = true;
- break;
+ if (matches.length) {
+ let firstIndexToCheck = 0;
+ if (test.searchParam && test.searchParam.includes("enable-actions")) {
+ firstIndexToCheck = 1;
+ do_print("Checking first match is first autocomplete entry")
+ let result = {
+ value: controller.getValueAt(0),
+ comment: controller.getCommentAt(0),
+ style: controller.getStyleAt(0),
+ image: controller.getImageAt(0),
}
+ do_print(`First match is "${result.value}", "${result.comment}"`);
+ Assert.ok(_check_autocomplete_matches(matches[0], result), "first item is correct");
+ do_print("Checking rest of the matches");
}
- if (!found)
- do_throw(`Didn't find the current result ("${result.value}", "${result.comment}") in matches`); //' (Emacs syntax highlighting fix)
+ for (let i = firstIndexToCheck; i < controller.matchCount; i++) {
+ let result = {
+ value: controller.getValueAt(i),
+ comment: controller.getCommentAt(i),
+ style: controller.getStyleAt(i),
+ image: controller.getImageAt(i),
+ }
+ do_print(`Looking for "${result.value}", "${result.comment}" in expected results...`);
+ let lowerBound = test.checkSorting ? i : firstIndexToCheck;
+ let upperBound = test.checkSorting ? i + 1 : matches.length;
+ let found = false;
+ for (let j = lowerBound; j < upperBound; ++j) {
+ // Skip processed expected results
+ if (matches[j] == undefined)
+ continue;
+ if (_check_autocomplete_matches(matches[j], result)) {
+ do_print("Got a match at index " + j + "!");
+ // Make it undefined so we don't process it again
+ matches[j] = undefined;
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ do_throw(`Didn't find the current result ("${result.value}", "${result.comment}") in matches`); //' (Emacs syntax highlighting fix)
+ }
}
Assert.equal(controller.matchCount, matches.length,
"Got as many results as expected");
// If we expect results, make sure we got matches.
do_check_eq(controller.searchStatus, matches.length ?
Ci.nsIAutoCompleteController.STATUS_COMPLETE_MATCH :
--- a/toolkit/components/places/tests/unifiedcomplete/test_searchSuggestions.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_searchSuggestions.js
@@ -47,50 +47,60 @@ add_task(function* setUp() {
Services.search.currentEngine = engine;
});
add_task(function* disabled_urlbarSuggestions() {
Services.prefs.setBoolPref(SUGGEST_PREF, false);
Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, true);
yield check_autocomplete({
search: "hello",
- matches: [],
+ searchParam: "enable-actions",
+ matches: [
+ makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
+ ],
});
yield cleanUpSuggestions();
});
add_task(function* disabled_allSuggestions() {
Services.prefs.setBoolPref(SUGGEST_PREF, true);
Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, false);
yield check_autocomplete({
search: "hello",
- matches: [],
+ searchParam: "enable-actions",
+ matches: [
+ makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
+ ],
});
yield cleanUpSuggestions();
});
add_task(function* disabled_privateWindow() {
Services.prefs.setBoolPref(SUGGEST_PREF, true);
Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, true);
yield check_autocomplete({
search: "hello",
- matches: [],
- searchParam: "private-window",
+ searchParam: "private-window enable-actions",
+ matches: [
+ makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
+ ],
});
yield cleanUpSuggestions();
});
add_task(function* singleWordQuery() {
Services.prefs.setBoolPref(SUGGEST_PREF, true);
Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, true);
yield check_autocomplete({
search: "hello",
- matches: [{
- uri: makeActionURI(("searchengine"), {
+ searchParam: "enable-actions",
+ matches: [
+ makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
+ { uri: makeActionURI(("searchengine"), {
engineName: ENGINE_NAME,
input: "hello foo",
searchQuery: "hello",
searchSuggestion: "hello foo",
}),
title: ENGINE_NAME,
style: ["action", "searchengine"],
icon: "",
@@ -111,18 +121,20 @@ add_task(function* singleWordQuery() {
});
add_task(function* multiWordQuery() {
Services.prefs.setBoolPref(SUGGEST_PREF, true);
Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, true);
yield check_autocomplete({
search: "hello world",
- matches: [{
- uri: makeActionURI(("searchengine"), {
+ searchParam: "enable-actions",
+ matches: [
+ makeSearchMatch("hello world", { engineName: ENGINE_NAME, heuristic: true }),
+ { uri: makeActionURI(("searchengine"), {
engineName: ENGINE_NAME,
input: "hello world foo",
searchQuery: "hello world",
searchSuggestion: "hello world foo",
}),
title: ENGINE_NAME,
style: ["action", "searchengine"],
icon: "",
@@ -148,18 +160,20 @@ add_task(function* suffixMatch() {
setSuggestionsFn(searchStr => {
let prefixes = ["baz", "quux"];
return prefixes.map(p => p + " " + searchStr);
});
yield check_autocomplete({
search: "hello",
- matches: [{
- uri: makeActionURI(("searchengine"), {
+ searchParam: "enable-actions",
+ matches: [
+ makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
+ { uri: makeActionURI(("searchengine"), {
engineName: ENGINE_NAME,
input: "baz hello",
searchQuery: "hello",
searchSuggestion: "baz hello",
}),
title: ENGINE_NAME,
style: ["action", "searchengine"],
icon: "",
@@ -183,18 +197,20 @@ add_task(function* queryIsNotASubstring(
Services.prefs.setBoolPref(SUGGEST_PREF, true);
setSuggestionsFn(searchStr => {
return ["aaa", "bbb"];
});
yield check_autocomplete({
search: "hello",
- matches: [{
- uri: makeActionURI(("searchengine"), {
+ searchParam: "enable-actions",
+ matches: [
+ makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
+ { uri: makeActionURI(("searchengine"), {
engineName: ENGINE_NAME,
input: "aaa",
searchQuery: "hello",
searchSuggestion: "aaa",
}),
title: ENGINE_NAME,
style: ["action", "searchengine"],
icon: "",
@@ -236,17 +252,19 @@ add_task(function* restrictToken() {
uri: NetUtil.newURI("http://example.com/hello-bookmark"),
title: "hello bookmark",
});
// Do an unrestricted search to make sure everything appears in it, including
// the visit and bookmark.
yield check_autocomplete({
search: "hello",
+ searchParam: "enable-actions",
matches: [
+ makeSearchMatch("hello", { engineName: ENGINE_NAME, heuristic: true }),
{
uri: NetUtil.newURI("http://example.com/hello-visit"),
title: "hello visit",
},
{
uri: NetUtil.newURI("http://example.com/hello-bookmark"),
title: "hello bookmark",
style: ["bookmark"],
@@ -274,17 +292,20 @@ add_task(function* restrictToken() {
icon: "",
},
],
});
// Now do a restricted search to make sure only suggestions appear.
yield check_autocomplete({
search: SUGGEST_RESTRICT_TOKEN + " hello",
+ searchParam: "enable-actions",
matches: [
+ // TODO (bug 1177895) This is wrong.
+ makeSearchMatch(SUGGEST_RESTRICT_TOKEN + " hello", { engineName: ENGINE_NAME, heuristic: true }),
{
uri: makeActionURI(("searchengine"), {
engineName: ENGINE_NAME,
input: "hello foo",
searchQuery: "hello",
searchSuggestion: "hello foo",
}),
title: ENGINE_NAME,
@@ -359,33 +380,33 @@ add_task(function* mixup_frecency() {
`frecency for ${href}: ${frecency}, should be higher than ${FRECENCY_DEFAULT}`);
}
// Do an unrestricted search to make sure everything appears in it, including
// the visit and bookmark.
yield check_autocomplete({
checkSorting: true,
search: "frecency",
+ searchParam: "enable-actions",
matches: [
+ makeSearchMatch("frecency", { engineName: ENGINE_NAME, heuristic: true }),
{ uri: NetUtil.newURI("http://example.com/hi3"),
title: "high frecency 3",
style: [ "bookmark" ] },
{ uri: NetUtil.newURI("http://example.com/hi2"),
title: "high frecency 2",
style: [ "bookmark" ] },
{ uri: NetUtil.newURI("http://example.com/hi1"),
title: "high frecency 1",
style: [ "bookmark" ] },
{ uri: NetUtil.newURI("http://example.com/hi0"),
title: "high frecency 0",
style: [ "bookmark" ] },
{ uri: NetUtil.newURI("http://example.com/lo4"),
title: "low frecency 4" },
- { uri: NetUtil.newURI("http://example.com/lo3"),
- title: "low frecency 3" },
{
uri: makeActionURI(("searchengine"), {
engineName: ENGINE_NAME,
input: "frecency foo",
searchQuery: "frecency",
searchSuggestion: "frecency foo",
}),
title: ENGINE_NAME,
@@ -398,16 +419,18 @@ add_task(function* mixup_frecency() {
input: "frecency bar",
searchQuery: "frecency",
searchSuggestion: "frecency bar",
}),
title: ENGINE_NAME,
style: ["action", "searchengine"],
icon: "",
},
+ { uri: NetUtil.newURI("http://example.com/lo3"),
+ title: "low frecency 3" },
{ uri: NetUtil.newURI("http://example.com/lo2"),
title: "low frecency 2" },
{ uri: NetUtil.newURI("http://example.com/lo1"),
title: "low frecency 1" },
{ uri: NetUtil.newURI("http://example.com/lo0"),
title: "low frecency 0" },
],
});
@@ -415,17 +438,19 @@ add_task(function* mixup_frecency() {
yield cleanUpSuggestions();
});
add_task(function* prohibit_suggestions() {
Services.prefs.setBoolPref(SUGGEST_PREF, true);
yield check_autocomplete({
search: "localhost",
+ searchParam: "enable-actions",
matches: [
+ makeSearchMatch("localhost", { engineName: ENGINE_NAME, heuristic: true }),
{
uri: makeActionURI(("searchengine"), {
engineName: ENGINE_NAME,
input: "localhost foo",
searchQuery: "localhost",
searchSuggestion: "localhost foo",
}),
title: ENGINE_NAME,
@@ -446,59 +471,82 @@ add_task(function* prohibit_suggestions(
],
});
Services.prefs.setBoolPref("browser.fixup.domainwhitelist.localhost", true);
do_register_cleanup(() => {
Services.prefs.clearUserPref("browser.fixup.domainwhitelist.localhost");
});
yield check_autocomplete({
search: "localhost",
- matches: [],
+ searchParam: "enable-actions",
+ matches: [
+ makeVisitMatch("localhost", "http://localhost/", { heuristic: true }),
+ ],
});
yield check_autocomplete({
search: "1.2.3.4",
- matches: [],
+ searchParam: "enable-actions",
+ matches: [
+ makeVisitMatch("1.2.3.4", "http://1.2.3.4/", { heuristic: true }),
+ ],
});
yield check_autocomplete({
search: "[2001::1]:30",
- matches: [],
+ searchParam: "enable-actions",
+ matches: [
+ makeVisitMatch("[2001::1]:30", "http://[2001::1]:30/", { heuristic: true }),
+ ],
});
yield check_autocomplete({
search: "user:pass@test",
- matches: [],
+ searchParam: "enable-actions",
+ matches: [
+ makeSearchMatch("user:pass@test", { engineName: ENGINE_NAME, heuristic: true }),
+ ],
});
yield check_autocomplete({
search: "test/test",
- matches: [],
+ searchParam: "enable-actions",
+ matches: [
+ makeSearchMatch("test/test", { engineName: ENGINE_NAME, heuristic: true }),
+ ],
});
yield check_autocomplete({
search: "data:text/plain,Content",
- matches: [],
+ searchParam: "enable-actions",
+ matches: [
+ makeVisitMatch("data:text/plain,Content", "data:text/plain,Content", { heuristic: true }),
+ ],
});
yield check_autocomplete({
search: "a",
- matches: [],
+ searchParam: "enable-actions",
+ matches: [
+ makeSearchMatch("a", { engineName: ENGINE_NAME, heuristic: true }),
+ ],
});
yield cleanUpSuggestions();
});
add_task(function* avoid_url_suggestions() {
Services.prefs.setBoolPref(SUGGEST_PREF, true);
setSuggestionsFn(searchStr => {
let suffixes = [".com", "/test", ":1]", "@test", ". com"];
return suffixes.map(s => searchStr + s);
});
yield check_autocomplete({
search: "test",
+ searchParam: "enable-actions",
matches: [
+ makeSearchMatch("test", { engineName: ENGINE_NAME, heuristic: true }),
{
uri: makeActionURI(("searchengine"), {
engineName: ENGINE_NAME,
input: "test. com",
searchQuery: "test",
searchSuggestion: "test. com",
}),
title: ENGINE_NAME,
--- a/toolkit/components/places/tests/unit/test_000_frecency.js
+++ b/toolkit/components/places/tests/unit/test_000_frecency.js
@@ -192,23 +192,21 @@ AutoCompleteInput.prototype = {
if (iid.equals(Ci.nsISupports) ||
iid.equals(Ci.nsIAutoCompleteInput))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
}
}
-function run_test()
-{
- run_next_test();
-}
-
add_task(function* test_frecency()
{
+ // Disable autoFill for this test.
+ Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
+ do_register_cleanup(() => Services.prefs.clearUserPref("browser.urlbar.autoFill"));
for (let bucket of bucketPrefs) {
yield task_initializeBucket(bucket);
}
// sort results by frecency
results.sort((a,b) => b[1] - a[1]);
// Make sure there's enough results returned
prefs.setIntPref("browser.urlbar.maxRichResults", results.length);
@@ -218,17 +216,17 @@ add_task(function* test_frecency()
yield PlacesTestUtils.promiseAsyncUpdates();
var controller = Components.classes["@mozilla.org/autocomplete/controller;1"].
getService(Components.interfaces.nsIAutoCompleteController);
// Make an AutoCompleteInput that uses our searches
// and confirms results on search complete
- var input = new AutoCompleteInput(["history"]);
+ var input = new AutoCompleteInput(["unifiedcomplete"]);
controller.input = input;
// always search in history + bookmarks, no matter what the default is
prefs.setIntPref("browser.urlbar.search.sources", 3);
prefs.setIntPref("browser.urlbar.default.behavior", 0);
var numSearchesStarted = 0;
--- a/toolkit/components/places/tests/unit/test_408221.js
+++ b/toolkit/components/places/tests/unit/test_408221.js
@@ -68,17 +68,17 @@ try {
function ensure_tag_results(uris, searchTerm)
{
var controller = Components.classes["@mozilla.org/autocomplete/controller;1"].
getService(Components.interfaces.nsIAutoCompleteController);
// Make an AutoCompleteInput that uses our searches
// and confirms results on search complete
- var input = new AutoCompleteInput(["history"]);
+ var input = new AutoCompleteInput(["unifiedcomplete"]);
controller.input = input;
// Search is asynchronous, so don't let the test finish immediately
do_test_pending();
var numSearchesStarted = 0;
input.onSearchBegin = function() {
@@ -90,17 +90,17 @@ function ensure_tag_results(uris, search
do_check_eq(numSearchesStarted, 1);
do_check_eq(controller.searchStatus,
Ci.nsIAutoCompleteController.STATUS_COMPLETE_MATCH);
do_check_eq(controller.matchCount, uris.length);
let vals = [];
for (var i=0; i<controller.matchCount; i++) {
// Keep the URL for later because order of tag results is undefined
vals.push(controller.getValueAt(i));
- do_check_eq(controller.getStyleAt(i), "tag");
+ do_check_eq(controller.getStyleAt(i), "bookmark-tag");
}
// Sort the results then check if we have the right items
vals.sort().forEach((val, i) => do_check_eq(val, uris[i].spec))
if (current_test < (tests.length - 1)) {
current_test++;
tests[current_test]();
}
--- a/toolkit/components/places/tests/unit/test_413784.js
+++ b/toolkit/components/places/tests/unit/test_413784.js
@@ -85,17 +85,17 @@ function run_test()
function continue_test()
{
var controller = Components.classes["@mozilla.org/autocomplete/controller;1"].
getService(Components.interfaces.nsIAutoCompleteController);
// Make an AutoCompleteInput that uses our searches
// and confirms results on search complete
- var input = new AutoCompleteInput(["history"]);
+ var input = new AutoCompleteInput(["unifiedcomplete"]);
controller.input = input;
var numSearchesStarted = 0;
input.onSearchBegin = function() {
numSearchesStarted++;
do_check_eq(numSearchesStarted, 1);
};
--- a/toolkit/components/places/tests/unit/test_adaptive.js
+++ b/toolkit/components/places/tests/unit/test_adaptive.js
@@ -70,17 +70,17 @@ AutoCompleteInput.prototype = {
*/
function ensure_results(expected, searchTerm)
{
let controller = Cc["@mozilla.org/autocomplete/controller;1"].
getService(Ci.nsIAutoCompleteController);
// Make an AutoCompleteInput that uses our searches
// and confirms results on search complete.
- let input = new AutoCompleteInput(["history"]);
+ let input = new AutoCompleteInput(["unifiedcomplete"]);
controller.input = input;
input.onSearchComplete = function() {
do_check_eq(controller.searchStatus,
Ci.nsIAutoCompleteController.STATUS_COMPLETE_MATCH);
do_check_eq(controller.matchCount, expected.length);
for (let i = 0; i < controller.matchCount; i++) {
@@ -374,23 +374,21 @@ var tests = [
* This deferred object contains a promise that is resolved when the
* ensure_results function has finished its execution.
*/
var deferEnsureResults;
/**
* Test adaptive autocomplete.
*/
-function run_test()
-{
- run_next_test();
-}
-
add_task(function* test_adaptive()
{
+ // Disable autoFill for this test.
+ Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
+ do_register_cleanup(() => Services.prefs.clearUserPref("browser.urlbar.autoFill"));
for (let [, test] in Iterator(tests)) {
// Cleanup.
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.tagsFolderId);
observer.runCount = -1;
let types = ["history", "bookmark", "openpage"];
for (let type of types) {
--- a/toolkit/components/places/tests/unit/test_adaptive_bug527311.js
+++ b/toolkit/components/places/tests/unit/test_adaptive_bug527311.js
@@ -76,17 +76,17 @@ AutoCompleteInput.prototype = {
throw Components.results.NS_ERROR_NO_INTERFACE;
}
}
function check_results() {
let controller = Cc["@mozilla.org/autocomplete/controller;1"].
getService(Ci.nsIAutoCompleteController);
- let input = new AutoCompleteInput(["history"]);
+ let input = new AutoCompleteInput(["unifiedcomplete"]);
controller.input = input;
input.onSearchComplete = function() {
do_check_eq(controller.searchStatus,
Ci.nsIAutoCompleteController.STATUS_COMPLETE_NO_MATCH);
do_check_eq(controller.matchCount, 0);
PlacesUtils.bookmarks.eraseEverything().then(() => {
--- a/toolkit/components/places/tests/unit/test_autocomplete_stopSearch_no_throw.js
+++ b/toolkit/components/places/tests/unit/test_autocomplete_stopSearch_no_throw.js
@@ -9,17 +9,17 @@
* AutoComplete implementation does not throw.
*/
////////////////////////////////////////////////////////////////////////////////
//// Globals and Constants
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
-var ac = Cc["@mozilla.org/autocomplete/search;1?name=history"].
+var ac = Cc["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"].
getService(Ci.nsIAutoCompleteSearch);
////////////////////////////////////////////////////////////////////////////////
//// Test Functions
function test_stopSearch()
{
try {
--- a/toolkit/components/places/tests/unit/test_frecency.js
+++ b/toolkit/components/places/tests/unit/test_frecency.js
@@ -79,17 +79,17 @@ function ensure_results(uris, searchTerm
function ensure_results_internal(uris, searchTerm)
{
var controller = Components.classes["@mozilla.org/autocomplete/controller;1"].
getService(Components.interfaces.nsIAutoCompleteController);
// Make an AutoCompleteInput that uses our searches
// and confirms results on search complete
- var input = new AutoCompleteInput(["history"]);
+ var input = new AutoCompleteInput(["unifiedcomplete"]);
controller.input = input;
var numSearchesStarted = 0;
input.onSearchBegin = function() {
numSearchesStarted++;
do_check_eq(numSearchesStarted, 1);
};
@@ -263,26 +263,21 @@ function*() {
];
/**
* This deferred object contains a promise that is resolved when the
* ensure_results_internal function has finished its execution.
*/
var deferEnsureResults;
-/**
- * Test adaptive autocomplete
- */
-function run_test()
-{
- run_next_test();
-}
-
add_task(function* test_frecency()
{
+ // Disable autoFill for this test.
+ Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
+ do_register_cleanup(() => Services.prefs.clearUserPref("browser.urlbar.autoFill"));
// always search in history + bookmarks, no matter what the default is
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
prefs.setBoolPref("browser.urlbar.suggest.history", true);
prefs.setBoolPref("browser.urlbar.suggest.bookmark", true);
prefs.setBoolPref("browser.urlbar.suggest.openpage", false);
for (let test of tests) {
--- a/toolkit/components/places/tests/unit/test_history_autocomplete_tags.js
+++ b/toolkit/components/places/tests/unit/test_history_autocomplete_tags.js
@@ -69,17 +69,17 @@ try {
function ensure_tag_results(uris, searchTerm)
{
print("Searching for '" + searchTerm + "'");
var controller = Components.classes["@mozilla.org/autocomplete/controller;1"].
getService(Components.interfaces.nsIAutoCompleteController);
// Make an AutoCompleteInput that uses our searches
// and confirms results on search complete
- var input = new AutoCompleteInput(["history"]);
+ var input = new AutoCompleteInput(["unifiedcomplete"]);
controller.input = input;
// Search is asynchronous, so don't let the test finish immediately
do_test_pending();
var numSearchesStarted = 0;
input.onSearchBegin = function() {
@@ -93,17 +93,17 @@ function ensure_tag_results(uris, search
uris.length ?
Ci.nsIAutoCompleteController.STATUS_COMPLETE_MATCH :
Ci.nsIAutoCompleteController.STATUS_COMPLETE_NO_MATCH);
do_check_eq(controller.matchCount, uris.length);
let vals = [];
for (var i=0; i<controller.matchCount; i++) {
// Keep the URL for later because order of tag results is undefined
vals.push(controller.getValueAt(i));
- do_check_eq(controller.getStyleAt(i), "tag");
+ do_check_eq(controller.getStyleAt(i), "bookmark-tag");
}
// Sort the results then check if we have the right items
vals.sort().forEach((val, i) => do_check_eq(val, uris[i].spec))
if (current_test < (tests.length - 1)) {
current_test++;
tests[current_test]();
}
--- a/toolkit/components/places/tests/unit/test_telemetry.js
+++ b/toolkit/components/places/tests/unit/test_telemetry.js
@@ -132,17 +132,17 @@ add_task(function* test_execute()
getSearchAt: function(aIndex) { return this.searches[aIndex]; },
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIAutoCompleteInput,
Ci.nsIAutoCompletePopup,
])
};
let controller = Cc["@mozilla.org/autocomplete/controller;1"].
getService(Ci.nsIAutoCompleteController);
- controller.input = new AutoCompleteInput(["history"]);
+ controller.input = new AutoCompleteInput(["unifiedcomplete"]);
controller.startSearch("moz");
*/
// Test idle probes.
PlacesUtils.history.QueryInterface(Ci.nsIObserver)
.observe(null, "idle-daily", null);
PlacesDBUtils.maintenanceOnIdle();
--- a/toolkit/components/places/toolkitplaces.manifest
+++ b/toolkit/components/places/toolkitplaces.manifest
@@ -17,8 +17,12 @@ category history-observers nsPlacesExpir
component {803938d5-e26d-4453-bf46-ad4b26e41114} PlacesCategoriesStarter.js
contract @mozilla.org/places/categoriesStarter;1 {803938d5-e26d-4453-bf46-ad4b26e41114}
category idle-daily PlacesCategoriesStarter @mozilla.org/places/categoriesStarter;1
category bookmark-observers PlacesCategoriesStarter @mozilla.org/places/categoriesStarter;1
# ColorAnalyzer.js
component {d056186c-28a0-494e-aacc-9e433772b143} ColorAnalyzer.js
contract @mozilla.org/places/colorAnalyzer;1 {d056186c-28a0-494e-aacc-9e433772b143}
+
+# UnifiedComplete.js
+component {f964a319-397a-4d21-8be6-5cdd1ee3e3ae} UnifiedComplete.js
+contract @mozilla.org/autocomplete/search;1?name=unifiedcomplete {f964a319-397a-4d21-8be6-5cdd1ee3e3ae}
--- a/toolkit/components/telemetry/TelemetryEnvironment.jsm
+++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm
@@ -115,17 +115,16 @@ const DEFAULT_ENVIRONMENT_PREFS = new Ma
["browser.newtabpage.enabled", {what: RECORD_PREF_VALUE}],
["browser.newtabpage.enhanced", {what: RECORD_PREF_VALUE}],
["browser.shell.checkDefaultBrowser", {what: RECORD_PREF_VALUE}],
["browser.search.suggest.enabled", {what: RECORD_PREF_VALUE}],
["browser.startup.homepage", {what: RECORD_PREF_STATE}],
["browser.startup.page", {what: RECORD_PREF_VALUE}],
["browser.tabs.animate", {what: RECORD_PREF_VALUE}],
["browser.urlbar.suggest.searches", {what: RECORD_PREF_VALUE}],
- ["browser.urlbar.unifiedcomplete", {what: RECORD_PREF_VALUE}],
["browser.urlbar.userMadeSearchSuggestionsChoice", {what: RECORD_PREF_VALUE}],
["devtools.chrome.enabled", {what: RECORD_PREF_VALUE}],
["devtools.debugger.enabled", {what: RECORD_PREF_VALUE}],
["devtools.debugger.remote-enabled", {what: RECORD_PREF_VALUE}],
["dom.ipc.plugins.asyncInit.enabled", {what: RECORD_PREF_VALUE}],
["dom.ipc.plugins.enabled", {what: RECORD_PREF_VALUE}],
["dom.ipc.processCount", {what: RECORD_PREF_VALUE, requiresRestart: true}],
["dom.max_script_run_time", {what: RECORD_PREF_VALUE}],
--- a/toolkit/components/telemetry/docs/environment.rst
+++ b/toolkit/components/telemetry/docs/environment.rst
@@ -305,18 +305,16 @@ This object contains user preferences.
Each key in the object is the name of a preference. A key's value depends on the policy with which the preference was collected. There are two such policies, "value" and "state". For preferences collected under the "value" policy, the value will be the preference's value. For preferences collected under the "state" policy, the value will be an opaque marker signifying only that the preference has a user value. The "state" policy is therefore used when user privacy is a concern.
The following is a partial list of collected preferences.
- ``browser.search.suggest.enabled``: The "master switch" for search suggestions everywhere in Firefox (search bar, urlbar, etc.). Defaults to true.
- ``browser.urlbar.suggest.searches``: True if search suggestions are enabled in the urlbar. Defaults to false.
-- ``browser.urlbar.unifiedcomplete``: True if the urlbar's UnifiedComplete back-end is enabled.
-
- ``browser.urlbar.userMadeSearchSuggestionsChoice``: True if the user has clicked Yes or No in the urlbar's opt-in notification. Defaults to false.
partner
-------
If the user is using a partner repack, this contains information identifying the repack being used, otherwise "partnerNames" will be an empty array and other entries will be null. The information may be missing when the profile just becomes available. In Firefox for desktop, the information along with other customizations defined in distribution.ini are processed later in the startup phase, and will be fully applied when "distribution-customization-complete" notification is sent.
Distributions are most reliably identified by the ``distributionId`` field. Partner information can be found in the `partner repacks <https://github.com/mozilla-partners>`_ (`the old one <http://hg.mozilla.org/build/partner-repacks/>`_ is deprecated): it contains one private repository per partner.
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -2172,19 +2172,18 @@ extends="chrome://global/content/binding
try {
action.params = JSON.parse(params);
for (let key in action.params) {
action.params[key] = decodeURIComponent(action.params[key]);
}
} catch (e) {
// If this failed, we assume that params is not a JSON object, and
- // is instead just a flat string. This will happen when
- // UnifiedComplete is disabled - in which case, the param is always
- // a URL.
+ // is instead just a flat string. This may happen for legacy
+ // search components.
action.params = {
url: params,
}
}
return action;
]]></body>
</method>