зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 5a673b05aea0 (bug 1713827) for bc failures on browser_contentSearchUI_default.js. CLOSED TREE
This commit is contained in:
Родитель
84b8cec8b2
Коммит
6b427ca596
|
@ -28,7 +28,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
Region: "resource://gre/modules/Region.jsm",
|
||||
UrlbarPrefs: "resource:///modules/UrlbarPrefs.jsm",
|
||||
});
|
||||
|
||||
// We only show the private search banner once per browser session.
|
||||
|
@ -63,14 +62,13 @@ class AboutPrivateBrowsingParent extends JSWindowActorParent {
|
|||
}
|
||||
case "SearchHandoff": {
|
||||
let urlBar = win.gURLBar;
|
||||
let searchEngine = Services.search.defaultPrivateEngine;
|
||||
let isFirstChange = true;
|
||||
|
||||
if (!aMessage.data || !aMessage.data.text) {
|
||||
urlBar.setHiddenFocus();
|
||||
} else {
|
||||
// Pass the provided text to the awesomebar
|
||||
urlBar.handoff(aMessage.data.text, searchEngine);
|
||||
urlBar.search(aMessage.data.text);
|
||||
isFirstChange = false;
|
||||
}
|
||||
|
||||
|
@ -81,7 +79,7 @@ class AboutPrivateBrowsingParent extends JSWindowActorParent {
|
|||
if (isFirstChange) {
|
||||
isFirstChange = false;
|
||||
urlBar.removeHiddenFocus(true);
|
||||
urlBar.handoff("", searchEngine);
|
||||
urlBar.search("");
|
||||
this.sendAsyncMessage("DisableSearch");
|
||||
urlBar.removeEventListener("compositionstart", checkFirstChange);
|
||||
urlBar.removeEventListener("paste", checkFirstChange);
|
||||
|
@ -125,10 +123,7 @@ class AboutPrivateBrowsingParent extends JSWindowActorParent {
|
|||
"browser.urlbar.placeholderName.private",
|
||||
""
|
||||
);
|
||||
let shouldHandOffToSearchMode = UrlbarPrefs.get(
|
||||
"shouldHandOffToSearchMode"
|
||||
);
|
||||
return [engineName, shouldHandOffToSearchMode];
|
||||
return engineName;
|
||||
}
|
||||
case "ShouldShowSearchBanner": {
|
||||
// If this is a pre-loaded private browsing new tab, then we don't want
|
||||
|
|
|
@ -18,7 +18,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
||||
SearchSuggestionController:
|
||||
"resource://gre/modules/SearchSuggestionController.jsm",
|
||||
UrlbarPrefs: "resource:///modules/UrlbarPrefs.jsm",
|
||||
});
|
||||
|
||||
const MAX_LOCAL_SUGGESTIONS = 3;
|
||||
|
@ -111,7 +110,6 @@ let ContentSearch = {
|
|||
Services.obs.addObserver(this, "browser-search-service");
|
||||
Services.obs.addObserver(this, "shutdown-leaks-before-check");
|
||||
Services.prefs.addObserver("browser.search.hiddenOneOffs", this);
|
||||
UrlbarPrefs.addObserver(this);
|
||||
|
||||
this.initialized = true;
|
||||
}
|
||||
|
@ -183,22 +181,6 @@ let ContentSearch = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Observes changes in prefs tracked by UrlbarPrefs.
|
||||
* @param {string} pref
|
||||
* The name of the pref, relative to `browser.urlbar.` if the pref is
|
||||
* in that branch.
|
||||
*/
|
||||
onPrefChanged(pref) {
|
||||
if (UrlbarPrefs.shouldHandOffToSearchModePrefs.includes(pref)) {
|
||||
this._eventQueue.push({
|
||||
type: "Observe",
|
||||
data: "shouldHandOffToSearchMode",
|
||||
});
|
||||
this._processEventQueue();
|
||||
}
|
||||
},
|
||||
|
||||
removeFormHistoryEntry(browser, entry) {
|
||||
let browserData = this._suggestionDataForBrowser(browser);
|
||||
if (browserData && browserData.previousFormHistoryResult) {
|
||||
|
@ -448,14 +430,6 @@ let ContentSearch = {
|
|||
});
|
||||
},
|
||||
|
||||
_onMessageGetHandoffSearchModePrefs({ actor }) {
|
||||
this._reply(
|
||||
actor,
|
||||
"HandoffSearchModePrefs",
|
||||
UrlbarPrefs.get("shouldHandOffToSearchMode")
|
||||
);
|
||||
},
|
||||
|
||||
_onMessageGetStrings({ actor }) {
|
||||
this._reply(actor, "Strings", this.searchSuggestionUIStrings);
|
||||
},
|
||||
|
@ -511,26 +485,15 @@ let ContentSearch = {
|
|||
},
|
||||
|
||||
async _onObserve(eventItem) {
|
||||
let engine;
|
||||
switch (eventItem.data) {
|
||||
case "engine-default":
|
||||
engine = await this._currentEngineObj(false);
|
||||
this._broadcast("CurrentEngine", engine);
|
||||
break;
|
||||
case "engine-default-private":
|
||||
engine = await this._currentEngineObj(true);
|
||||
this._broadcast("CurrentPrivateEngine", engine);
|
||||
break;
|
||||
case "shouldHandOffToSearchMode":
|
||||
this._broadcast(
|
||||
"HandoffSearchModePrefs",
|
||||
UrlbarPrefs.get("shouldHandOffToSearchMode")
|
||||
);
|
||||
break;
|
||||
default:
|
||||
let state = await this.currentStateObj();
|
||||
this._broadcast("CurrentState", state);
|
||||
break;
|
||||
if (eventItem.data === "engine-default") {
|
||||
let engine = await this._currentEngineObj(false);
|
||||
this._broadcast("CurrentEngine", engine);
|
||||
} else if (eventItem.data === "engine-default-private") {
|
||||
let engine = await this._currentEngineObj(true);
|
||||
this._broadcast("CurrentPrivateEngine", engine);
|
||||
} else {
|
||||
let state = await this.currentStateObj();
|
||||
this._broadcast("CurrentState", state);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -27,11 +27,6 @@ ChromeUtils.defineModuleGetter(
|
|||
"PlacesUtils",
|
||||
"resource://gre/modules/PlacesUtils.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm"
|
||||
);
|
||||
|
||||
const LINK_BLOCKED_EVENT = "newtab-linkBlocked";
|
||||
const PLACES_LINKS_CHANGED_DELAY_TIME = 1000; // time in ms to delay timer for places links changed events
|
||||
|
@ -390,23 +385,14 @@ class PlacesFeed {
|
|||
});
|
||||
}
|
||||
|
||||
_getDefaultSearchEngine(isPrivateWindow) {
|
||||
return Services.search[
|
||||
isPrivateWindow ? "defaultPrivateEngine" : "defaultEngine"
|
||||
];
|
||||
}
|
||||
|
||||
handoffSearchToAwesomebar({ _target, data, meta }) {
|
||||
const searchEngine = this._getDefaultSearchEngine(
|
||||
PrivateBrowsingUtils.isBrowserPrivate(_target.browser)
|
||||
);
|
||||
const urlBar = _target.browser.ownerGlobal.gURLBar;
|
||||
let isFirstChange = true;
|
||||
|
||||
if (!data || !data.text) {
|
||||
urlBar.setHiddenFocus();
|
||||
} else {
|
||||
urlBar.handoff(data.text, searchEngine);
|
||||
urlBar.search(data.text);
|
||||
isFirstChange = false;
|
||||
}
|
||||
|
||||
|
@ -417,7 +403,7 @@ class PlacesFeed {
|
|||
if (isFirstChange) {
|
||||
isFirstChange = false;
|
||||
urlBar.removeHiddenFocus(true);
|
||||
urlBar.handoff("", searchEngine);
|
||||
urlBar.search("");
|
||||
this.store.dispatch(
|
||||
ac.OnlyToOneContent({ type: at.DISABLE_SEARCH }, meta.fromTarget)
|
||||
);
|
||||
|
|
|
@ -653,7 +653,7 @@ describe("PlacesFeed", () => {
|
|||
beforeEach(() => {
|
||||
fakeUrlBar = {
|
||||
focus: sinon.spy(),
|
||||
handoff: sinon.spy(),
|
||||
search: sinon.spy(),
|
||||
setHiddenFocus: sinon.spy(),
|
||||
removeHiddenFocus: sinon.spy(),
|
||||
addEventListener: (ev, cb) => {
|
||||
|
@ -670,12 +670,12 @@ describe("PlacesFeed", () => {
|
|||
meta: { fromTarget: {} },
|
||||
});
|
||||
assert.calledOnce(fakeUrlBar.setHiddenFocus);
|
||||
assert.notCalled(fakeUrlBar.handoff);
|
||||
assert.notCalled(fakeUrlBar.search);
|
||||
assert.notCalled(feed.store.dispatch);
|
||||
|
||||
// Now type a character.
|
||||
listeners.keydown({ key: "f" });
|
||||
assert.calledOnce(fakeUrlBar.handoff);
|
||||
assert.calledOnce(fakeUrlBar.search);
|
||||
assert.calledOnce(fakeUrlBar.removeHiddenFocus);
|
||||
assert.calledOnce(feed.store.dispatch);
|
||||
assert.calledWith(feed.store.dispatch, {
|
||||
|
@ -694,12 +694,8 @@ describe("PlacesFeed", () => {
|
|||
data: { text: "foo" },
|
||||
meta: { fromTarget: {} },
|
||||
});
|
||||
assert.calledOnce(fakeUrlBar.handoff);
|
||||
assert.calledWith(
|
||||
fakeUrlBar.handoff,
|
||||
"foo",
|
||||
global.Services.search.defaultEngine
|
||||
);
|
||||
assert.calledOnce(fakeUrlBar.search);
|
||||
assert.calledWith(fakeUrlBar.search, "foo");
|
||||
assert.notCalled(fakeUrlBar.focus);
|
||||
assert.notCalled(fakeUrlBar.setHiddenFocus);
|
||||
|
||||
|
@ -723,12 +719,8 @@ describe("PlacesFeed", () => {
|
|||
data: { text: "foo" },
|
||||
meta: { fromTarget: {} },
|
||||
});
|
||||
assert.calledOnce(fakeUrlBar.handoff);
|
||||
assert.calledWith(
|
||||
fakeUrlBar.handoff,
|
||||
"foo",
|
||||
global.Services.search.defaultPrivateEngine
|
||||
);
|
||||
assert.calledOnce(fakeUrlBar.search);
|
||||
assert.calledWith(fakeUrlBar.search, "foo");
|
||||
assert.notCalled(fakeUrlBar.focus);
|
||||
assert.notCalled(fakeUrlBar.setHiddenFocus);
|
||||
|
||||
|
@ -752,12 +744,8 @@ describe("PlacesFeed", () => {
|
|||
data: { text: "foo" },
|
||||
meta: { fromTarget: {} },
|
||||
});
|
||||
assert.calledOnce(fakeUrlBar.handoff);
|
||||
assert.calledWithExactly(
|
||||
fakeUrlBar.handoff,
|
||||
"foo",
|
||||
global.Services.search.defaultEngine
|
||||
);
|
||||
assert.calledOnce(fakeUrlBar.search);
|
||||
assert.calledWithExactly(fakeUrlBar.search, "foo");
|
||||
assert.notCalled(fakeUrlBar.focus);
|
||||
|
||||
// Now call ESC keydown.
|
||||
|
|
|
@ -240,38 +240,30 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
|
||||
// Setup the search hand-off box.
|
||||
let btn = document.getElementById("search-handoff-button");
|
||||
RPMSendQuery("ShouldShowSearch", {}).then(
|
||||
([engineName, shouldHandOffToSearchMode]) => {
|
||||
let input = document.querySelector(".fake-textbox");
|
||||
if (shouldHandOffToSearchMode) {
|
||||
document.l10n.setAttributes(btn, "about-private-browsing-search-btn");
|
||||
document.l10n.setAttributes(
|
||||
input,
|
||||
"about-private-browsing-search-placeholder"
|
||||
);
|
||||
} else if (engineName) {
|
||||
document.l10n.setAttributes(btn, "about-private-browsing-handoff", {
|
||||
RPMSendQuery("ShouldShowSearch", {}).then(engineName => {
|
||||
let input = document.querySelector(".fake-textbox");
|
||||
if (engineName) {
|
||||
document.l10n.setAttributes(btn, "about-private-browsing-handoff", {
|
||||
engine: engineName,
|
||||
});
|
||||
document.l10n.setAttributes(
|
||||
input,
|
||||
"about-private-browsing-handoff-text",
|
||||
{
|
||||
engine: engineName,
|
||||
});
|
||||
document.l10n.setAttributes(
|
||||
input,
|
||||
"about-private-browsing-handoff-text",
|
||||
{
|
||||
engine: engineName,
|
||||
}
|
||||
);
|
||||
} else {
|
||||
document.l10n.setAttributes(
|
||||
btn,
|
||||
"about-private-browsing-handoff-no-engine"
|
||||
);
|
||||
document.l10n.setAttributes(
|
||||
input,
|
||||
"about-private-browsing-handoff-text-no-engine"
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
document.l10n.setAttributes(
|
||||
btn,
|
||||
"about-private-browsing-handoff-no-engine"
|
||||
);
|
||||
document.l10n.setAttributes(
|
||||
input,
|
||||
"about-private-browsing-handoff-text-no-engine"
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
let editable = document.getElementById("fake-editable");
|
||||
let DISABLE_SEARCH_TOPIC = "DisableSearch";
|
||||
|
|
|
@ -37,12 +37,7 @@ let expectedIconURL;
|
|||
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["browser.search.separatePrivateDefault", true],
|
||||
// Enable suggestions in this test. Otherwise, the behaviour of the
|
||||
// content search box changes.
|
||||
["browser.search.suggest.enabled", true],
|
||||
],
|
||||
set: [["browser.search.separatePrivateDefault", true]],
|
||||
});
|
||||
|
||||
const originalPrivateDefault = await Services.search.getDefaultPrivate();
|
||||
|
@ -198,61 +193,3 @@ add_task(async function test_search_handoff_on_paste() {
|
|||
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
||||
/**
|
||||
* Tests that handoff enters search mode when suggestions are disabled.
|
||||
*/
|
||||
add_task(async function test_search_handoff_search_mode() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.urlbar.suggest.searches", false]],
|
||||
});
|
||||
|
||||
let { win, tab } = await openAboutPrivateBrowsing();
|
||||
|
||||
await SpecialPowers.spawn(tab, [], async function() {
|
||||
let btn = content.document.getElementById("search-handoff-button");
|
||||
btn.click();
|
||||
ok(btn.classList.contains("focused"), "in-content search has focus styles");
|
||||
});
|
||||
ok(urlBarHasHiddenFocus(win), "Urlbar has hidden focus");
|
||||
|
||||
// Expect two searches, one to enter search mode and then another in search
|
||||
// mode.
|
||||
let searchPromise = UrlbarTestUtils.promiseSearchComplete(win);
|
||||
|
||||
await new Promise(r => EventUtils.synthesizeKey("f", {}, win, r));
|
||||
await SpecialPowers.spawn(tab, [], async function() {
|
||||
ok(
|
||||
content.document
|
||||
.getElementById("search-handoff-button")
|
||||
.classList.contains("disabled"),
|
||||
"in-content search is disabled"
|
||||
);
|
||||
});
|
||||
await searchPromise;
|
||||
ok(urlBarHasNormalFocus(win), "Urlbar has normal focus");
|
||||
await UrlbarTestUtils.assertSearchMode(win, {
|
||||
engineName: "DuckDuckGo",
|
||||
source: UrlbarUtils.RESULT_SOURCE.SEARCH,
|
||||
entry: "handoff",
|
||||
});
|
||||
is(win.gURLBar.value, "f", "url bar has search text");
|
||||
|
||||
// Close the popup.
|
||||
await UrlbarTestUtils.exitSearchMode(win);
|
||||
await UrlbarTestUtils.promisePopupClose(win);
|
||||
|
||||
// Hitting ESC should reshow the in-content search
|
||||
await new Promise(r => EventUtils.synthesizeKey("KEY_Escape", {}, win, r));
|
||||
await SpecialPowers.spawn(tab, [], async function() {
|
||||
ok(
|
||||
!content.document
|
||||
.getElementById("search-handoff-button")
|
||||
.classList.contains("disabled"),
|
||||
"in-content search is not disabled"
|
||||
);
|
||||
});
|
||||
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -10,7 +10,6 @@ function ContentSearchHandoffUIController() {
|
|||
|
||||
window.addEventListener("ContentSearchService", this);
|
||||
this._sendMsg("GetEngine");
|
||||
this._sendMsg("GetHandoffSearchModePrefs");
|
||||
}
|
||||
|
||||
ContentSearchHandoffUIController.prototype = {
|
||||
|
@ -42,11 +41,6 @@ ContentSearchHandoffUIController.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_onMsgHandoffSearchModePrefs(pref) {
|
||||
this._shouldHandOffToSearchMode = pref;
|
||||
this._updatel10nIds();
|
||||
},
|
||||
|
||||
_updateEngine(engine) {
|
||||
this._defaultEngine = engine;
|
||||
if (this._engineIcon) {
|
||||
|
@ -67,30 +61,10 @@ ContentSearchHandoffUIController.prototype = {
|
|||
"--newtab-search-icon",
|
||||
"url(" + this._engineIcon + ")"
|
||||
);
|
||||
this._updatel10nIds();
|
||||
},
|
||||
|
||||
_updatel10nIds() {
|
||||
let engine = this._defaultEngine;
|
||||
let fakeButton = document.querySelector(".search-handoff-button");
|
||||
let fakeInput = document.querySelector(".fake-textbox");
|
||||
if (!fakeButton || !fakeInput) {
|
||||
return;
|
||||
}
|
||||
if (!engine || this._shouldHandOffToSearchMode) {
|
||||
document.l10n.setAttributes(
|
||||
fakeButton,
|
||||
this._isPrivateWindow
|
||||
? "about-private-browsing-search-btn"
|
||||
: "newtab-search-box-input"
|
||||
);
|
||||
document.l10n.setAttributes(
|
||||
fakeInput,
|
||||
this._isPrivateWindow
|
||||
? "about-private-browsing-search-placeholder"
|
||||
: "newtab-search-box-text"
|
||||
);
|
||||
} else if (!engine.isAppProvided) {
|
||||
if (!engine.isAppProvided) {
|
||||
document.l10n.setAttributes(
|
||||
fakeButton,
|
||||
this._isPrivateWindow
|
||||
|
|
|
@ -22,12 +22,6 @@ add_task(async function setup() {
|
|||
|
||||
addedEngine = await Services.search.getEngineByName(TEST_ENGINE_NAME);
|
||||
|
||||
// Enable suggestions in this test. Otherwise, the string in the content
|
||||
// search box changes.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.urlbar.suggest.searches", true]],
|
||||
});
|
||||
|
||||
registerCleanupFunction(async () => {
|
||||
await Services.search.setDefault(defaultEngine);
|
||||
});
|
||||
|
@ -102,16 +96,6 @@ async function runNewTabTest(isHandoff) {
|
|||
await ensurePlaceholder(tab, "newtab-search-box-handoff-input-no-engine");
|
||||
}
|
||||
|
||||
// Disable suggestions in the Urlbar. This should update the placeholder
|
||||
// string since handoff will now enter search mode.
|
||||
if (isHandoff) {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.urlbar.suggest.searches", false]],
|
||||
});
|
||||
await ensurePlaceholder(tab, "newtab-search-box-input");
|
||||
await SpecialPowers.popPrefEnv();
|
||||
}
|
||||
|
||||
await Services.search.setDefault(defaultEngine);
|
||||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
@ -156,15 +140,6 @@ add_task(async function test_content_search_attributes_in_private_window() {
|
|||
await ensureIcon(tab, "chrome://global/skin/icons/search-glass.svg");
|
||||
await ensurePlaceholder(tab, "about-private-browsing-handoff-no-engine");
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.urlbar.suggest.searches", false]],
|
||||
});
|
||||
await ensurePlaceholder(tab, "about-private-browsing-search-btn");
|
||||
await SpecialPowers.popPrefEnv(
|
||||
tab,
|
||||
"about-private-browsing-search-placeholder"
|
||||
);
|
||||
|
||||
await Services.search.setDefault(defaultEngine);
|
||||
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
|
|
|
@ -660,28 +660,6 @@ class UrlbarInput {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by inputs that resemble search boxes, but actually hand input off
|
||||
* to the Urlbar. We use these fake inputs on the new tab page and
|
||||
* about:privatebrowsing.
|
||||
*
|
||||
* @param {string} searchString
|
||||
* @param {nsISearchEngine} [searchEngine]
|
||||
* Optional. If included and the right prefs are set, we will enter search
|
||||
* mode when handing `searchString` from the fake input to the Urlbar.
|
||||
*
|
||||
*/
|
||||
handoff(searchString, searchEngine) {
|
||||
if (UrlbarPrefs.get("shouldHandOffToSearchMode") && searchEngine) {
|
||||
this.search(searchString, {
|
||||
searchEngine,
|
||||
searchModeEntry: "handoff",
|
||||
});
|
||||
} else {
|
||||
this.search(searchString);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an element of the view is picked.
|
||||
*
|
||||
|
|
|
@ -402,13 +402,6 @@ class Preferences {
|
|||
}
|
||||
this._observerWeakRefs = [];
|
||||
this.addObserver(this);
|
||||
// These prefs control the value of the shouldHandOffToSearchMode pref. They
|
||||
// are exposed as a class variable so UrlbarPrefs observers can watch for
|
||||
// changes in these prefs.
|
||||
this.shouldHandOffToSearchModePrefs = [
|
||||
"keyword.enabled",
|
||||
"suggest.searches",
|
||||
];
|
||||
NimbusFeatures.urlbar.onUpdate(() => this._onNimbusUpdate());
|
||||
}
|
||||
|
||||
|
@ -551,10 +544,6 @@ class Preferences {
|
|||
if (pref.startsWith("suggest.")) {
|
||||
this._map.delete("defaultBehavior");
|
||||
}
|
||||
|
||||
if (this.shouldHandOffToSearchModePrefs.includes(pref)) {
|
||||
this._map.delete("shouldHandOffToSearchMode");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -619,10 +608,6 @@ class Preferences {
|
|||
return makeResultBuckets({
|
||||
showSearchSuggestionsFirst: this.get("showSearchSuggestionsFirst"),
|
||||
});
|
||||
case "shouldHandOffToSearchMode":
|
||||
return this.shouldHandOffToSearchModePrefs.some(
|
||||
prefName => !this.get(prefName)
|
||||
);
|
||||
}
|
||||
return this._readPref(pref);
|
||||
}
|
||||
|
|
|
@ -197,7 +197,6 @@ var UrlbarUtils = {
|
|||
// telemetry documentation and Scalars.yaml.
|
||||
SEARCH_MODE_ENTRY: new Set([
|
||||
"bookmarkmenu",
|
||||
"handoff",
|
||||
"keywordoffer",
|
||||
"oneoff",
|
||||
"other",
|
||||
|
|
|
@ -135,9 +135,8 @@ urlbar.searchmode.*
|
|||
menu.
|
||||
- ``handoff``
|
||||
Used when the user uses the search box on the new tab page and is handed off
|
||||
to the address bar. NOTE: This entry point was disabled from Firefox 88 to
|
||||
91. Starting with 91, it will appear but in low volume. Users must have
|
||||
searching in the Urlbar disabled to enter search mode via handoff.
|
||||
to the address bar. NOTE: This entry point was deprecated in Firefox 88.
|
||||
Handoff no longer enters search mode.
|
||||
- ``keywordoffer``
|
||||
Used when the user selects a keyword offer result.
|
||||
- ``oneoff``
|
||||
|
|
|
@ -38,13 +38,8 @@ class AwaitPromiseProvider extends UrlbarTestUtils.TestProvider {
|
|||
}
|
||||
|
||||
add_task(async function setup() {
|
||||
await SearchTestUtils.installSearchExtension();
|
||||
let engine = Services.search.getEngineByName("Example");
|
||||
let oldDefaultEngine = Services.search.defaultEngine;
|
||||
Services.search.defaultEngine = engine;
|
||||
registerCleanupFunction(function() {
|
||||
SpecialPowers.clipboardCopyString("");
|
||||
Services.search.defaultEngine = oldDefaultEngine;
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -392,44 +392,6 @@ add_task(async function test_tabmenu() {
|
|||
assertSearchModeScalars("tabmenu", "tabs");
|
||||
});
|
||||
|
||||
// Enters search mode by performing a search handoff on about:privatebrowsing.
|
||||
// Note that handoff-to-search-mode only occurs when suggestions are disabled
|
||||
// in the Urlbar.
|
||||
// NOTE: We don't test handoff on about:home. Running mochitests on about:home
|
||||
// is quite difficult. This subtest verifies that `handoff` is a valid scalar
|
||||
// suffix and that a call to UrlbarInput.handoff(value, searchEngine) records
|
||||
// values in the urlbar.searchmode.handoff scalar. PlacesFeed.test.js verfies that
|
||||
// about:home handoff makes that exact call.
|
||||
add_task(async function test_handoff_pbm() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.urlbar.suggest.searches", false]],
|
||||
});
|
||||
let win = await BrowserTestUtils.openNewBrowserWindow({
|
||||
private: true,
|
||||
waitForTabURL: "about:privatebrowsing",
|
||||
});
|
||||
let tab = win.gBrowser.selectedBrowser;
|
||||
|
||||
await SpecialPowers.spawn(tab, [], async function() {
|
||||
let btn = content.document.getElementById("search-handoff-button");
|
||||
btn.click();
|
||||
});
|
||||
|
||||
let searchPromise = UrlbarTestUtils.promiseSearchComplete(win);
|
||||
await new Promise(r => EventUtils.synthesizeKey("f", {}, win, r));
|
||||
await searchPromise;
|
||||
await UrlbarTestUtils.assertSearchMode(win, {
|
||||
engineName,
|
||||
entry: "handoff",
|
||||
});
|
||||
assertSearchModeScalars("handoff", "other");
|
||||
|
||||
await UrlbarTestUtils.exitSearchMode(win);
|
||||
await UrlbarTestUtils.promisePopupClose(win);
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
// Enters search mode by tapping a search shortcut on the Touch Bar.
|
||||
add_task(async function test_touchbar() {
|
||||
if (AppConstants.platform != "macosx") {
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
|
||||
privatebrowsingpage-open-private-window-label = Open a Private Window
|
||||
.accesskey = P
|
||||
about-private-browsing-search-placeholder = Search the web
|
||||
about-private-browsing-info-title = You’re in a Private Window
|
||||
about-private-browsing-info-myths = Common myths about private browsing
|
||||
about-private-browsing-search-btn =
|
||||
.title = Search the web
|
||||
# Variables
|
||||
# $engine (String): the name of the user's default search engine
|
||||
about-private-browsing-handoff =
|
||||
|
|
|
@ -40,7 +40,6 @@ newtab-search-box-search-the-web-input =
|
|||
.title = Search the Web
|
||||
.aria-label = Search the Web
|
||||
|
||||
newtab-search-box-text = Search the web
|
||||
newtab-search-box-input =
|
||||
.placeholder = Search the web
|
||||
.aria-label = Search the web
|
||||
|
|
Загрузка…
Ссылка в новой задаче