зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 0c8a5b5094b6 (bug 1628926) for Eslint failure on UrlbarView.jsm
CLOSED TREE
This commit is contained in:
Родитель
025f4b6335
Коммит
3f105ec0c5
|
@ -288,6 +288,8 @@ pref("browser.urlbar.maxCharsForSearchSuggestions", 20);
|
|||
pref("browser.urlbar.formatting.enabled", true);
|
||||
pref("browser.urlbar.trimURLs", true);
|
||||
|
||||
pref("browser.urlbar.oneOffSearches", true);
|
||||
|
||||
// If changed to true, copying the entire URL from the location bar will put the
|
||||
// human readable (percent-decoded) URL on the clipboard.
|
||||
pref("browser.urlbar.decodeURLsOnCopy", false);
|
||||
|
|
|
@ -8,6 +8,7 @@ const TEST_ENGINE_NAME = "Foo";
|
|||
const TEST_ENGINE_BASENAME = "testEngine.xml";
|
||||
const SEARCHBAR_BASE_ID = "searchbar-engine-one-off-item-";
|
||||
const URLBAR_BASE_ID = "urlbar-engine-one-off-item-";
|
||||
const ONEOFF_URLBAR_PREF = "browser.urlbar.oneOffSearches";
|
||||
|
||||
let originalEngine;
|
||||
let originalPrivateEngine;
|
||||
|
@ -113,6 +114,10 @@ async function testUrlBarChangeEngine(win, testPrivate, isPrivateWindow) {
|
|||
info(
|
||||
`Testing urlbar with testPrivate: ${testPrivate} isPrivateWindow: ${isPrivateWindow}`
|
||||
);
|
||||
Services.prefs.setBoolPref(ONEOFF_URLBAR_PREF, true);
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref(ONEOFF_URLBAR_PREF);
|
||||
});
|
||||
|
||||
// Ensure the engine is reset.
|
||||
await resetEngines();
|
||||
|
|
|
@ -89,6 +89,9 @@ const PREF_URLBAR_DEFAULTS = new Map([
|
|||
// The maximum number of results in the urlbar popup.
|
||||
["maxRichResults", 10],
|
||||
|
||||
// One-off search buttons enabled status.
|
||||
["oneOffSearches", false],
|
||||
|
||||
// Whether addresses and search results typed into the address bar
|
||||
// should be opened in new tabs by default.
|
||||
["openintab", false],
|
||||
|
|
|
@ -10,6 +10,7 @@ const { XPCOMUtils } = ChromeUtils.import(
|
|||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
UrlbarPrefs: "resource:///modules/UrlbarPrefs.jsm",
|
||||
UrlbarTokenizer: "resource:///modules/UrlbarTokenizer.jsm",
|
||||
UrlbarUtils: "resource:///modules/UrlbarUtils.jsm",
|
||||
});
|
||||
|
@ -1303,7 +1304,7 @@ class UrlbarView {
|
|||
}
|
||||
|
||||
_enableOrDisableOneOffSearches(enable = true) {
|
||||
if (enable) {
|
||||
if (enable && UrlbarPrefs.get("oneOffSearches")) {
|
||||
this.oneOffSearchButtons.telemetryOrigin = "urlbar";
|
||||
this.oneOffSearchButtons.style.display = "";
|
||||
this.oneOffSearchButtons.textbox = this.input.inputField;
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
* around the results list.
|
||||
*/
|
||||
|
||||
const ONEOFF_URLBAR_PREF = "browser.urlbar.oneOffSearches";
|
||||
|
||||
function repeat(limit, func) {
|
||||
for (let i = 0; i < limit; i++) {
|
||||
func(i);
|
||||
|
@ -55,12 +57,14 @@ function assertSelected_one_off(index) {
|
|||
|
||||
add_task(async function() {
|
||||
let maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
|
||||
Services.prefs.setBoolPref(ONEOFF_URLBAR_PREF, true);
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
"about:mozilla"
|
||||
);
|
||||
registerCleanupFunction(async function() {
|
||||
await PlacesUtils.history.clear();
|
||||
Services.prefs.clearUserPref(ONEOFF_URLBAR_PREF);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* Tests navigation between results using ctrl-n/p.
|
||||
*/
|
||||
|
||||
const ONEOFF_URLBAR_PREF = "browser.urlbar.oneOffSearches";
|
||||
|
||||
function repeat(limit, func) {
|
||||
for (let i = 0; i < limit; i++) {
|
||||
func(i);
|
||||
|
@ -31,12 +33,14 @@ function assertSelected(index) {
|
|||
|
||||
add_task(async function() {
|
||||
let maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
|
||||
Services.prefs.setBoolPref(ONEOFF_URLBAR_PREF, true);
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
"about:mozilla"
|
||||
);
|
||||
registerCleanupFunction(async function() {
|
||||
await PlacesUtils.history.clear();
|
||||
Services.prefs.clearUserPref(ONEOFF_URLBAR_PREF);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ XPCOMUtils.defineLazyGetter(this, "oneOffSearchButtons", () => {
|
|||
});
|
||||
|
||||
add_task(async function init() {
|
||||
Services.prefs.setBoolPref("browser.urlbar.oneOffSearches", true);
|
||||
gMaxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
|
||||
|
||||
// Add a search suggestion engine and move it to the front so that it appears
|
||||
|
|
|
@ -21,6 +21,7 @@ let newEngine;
|
|||
add_task(async function setup() {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["browser.urlbar.oneOffSearches", true],
|
||||
// Avoid hitting the network with search suggestions.
|
||||
["browser.urlbar.suggest.searches", false],
|
||||
["browser.tabs.loadInBackground", true],
|
||||
|
|
|
@ -19,7 +19,10 @@ const serverInfo = {
|
|||
add_task(async function init() {
|
||||
await PlacesUtils.history.clear();
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.urlbar.suggest.searches", true]],
|
||||
set: [
|
||||
["browser.urlbar.oneOffSearches", true],
|
||||
["browser.urlbar.suggest.searches", true],
|
||||
],
|
||||
});
|
||||
let engine = await SearchTestUtils.promiseNewSearchEngine(
|
||||
getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
let gMaxResults;
|
||||
|
||||
add_task(async function init() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.urlbar.oneOffSearches", true]],
|
||||
});
|
||||
gMaxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
|
||||
|
||||
registerCleanupFunction(async function() {
|
||||
|
|
|
@ -16,6 +16,7 @@ add_task(async function setup() {
|
|||
set: [
|
||||
["browser.search.separatePrivateDefault.ui.enabled", true],
|
||||
["browser.search.separatePrivateDefault", true],
|
||||
["browser.urlbar.oneOffSearches", true],
|
||||
["browser.urlbar.suggest.searches", true],
|
||||
],
|
||||
});
|
||||
|
|
|
@ -15,6 +15,7 @@ const SUGGEST_URLBAR_PREF = "browser.urlbar.suggest.searches";
|
|||
// The name of the search engine used to generate suggestions.
|
||||
const SUGGESTION_ENGINE_NAME =
|
||||
"browser_UsageTelemetry usageTelemetrySearchSuggestions.xml";
|
||||
const ONEOFF_URLBAR_PREF = "browser.urlbar.oneOffSearches";
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
SearchTelemetry: "resource:///modules/SearchTelemetry.jsm",
|
||||
|
@ -108,6 +109,9 @@ add_task(async function setup() {
|
|||
let suggestionsEnabled = Services.prefs.getBoolPref(SUGGEST_URLBAR_PREF);
|
||||
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, true);
|
||||
|
||||
// Enable the urlbar one-off buttons.
|
||||
Services.prefs.setBoolPref(ONEOFF_URLBAR_PREF, true);
|
||||
|
||||
// Enable local telemetry recording for the duration of the tests.
|
||||
let oldCanRecord = Services.telemetry.canRecordExtended;
|
||||
Services.telemetry.canRecordExtended = true;
|
||||
|
@ -136,6 +140,7 @@ add_task(async function setup() {
|
|||
await Services.search.setDefault(originalEngine);
|
||||
await Services.search.removeEngine(engine);
|
||||
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
|
||||
Services.prefs.clearUserPref(ONEOFF_URLBAR_PREF);
|
||||
await PlacesUtils.history.clear();
|
||||
Services.telemetry.setEventRecordingEnabled("navigation", false);
|
||||
});
|
||||
|
|
|
@ -16,6 +16,7 @@ const POPUP_URL_COLOR_BRIGHT = "#74c0ff";
|
|||
const POPUP_ACTION_COLOR_BRIGHT = "#30e60b";
|
||||
|
||||
const SEARCH_TERM = "urlbar-reflows-" + Date.now();
|
||||
const ONEOFF_URLBAR_PREF = "browser.urlbar.oneOffSearches";
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.jsm",
|
||||
|
@ -69,12 +70,14 @@ add_task(async function test_popup_url() {
|
|||
await extension.startup();
|
||||
|
||||
let maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
|
||||
Services.prefs.setBoolPref(ONEOFF_URLBAR_PREF, true);
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
"about:mozilla"
|
||||
);
|
||||
registerCleanupFunction(async function() {
|
||||
await PlacesUtils.history.clear();
|
||||
Services.prefs.clearUserPref(ONEOFF_URLBAR_PREF);
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче