зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1893676 - enable tab previews by default in Nightly builds. r=mconley,tabbrowser-reviewers,dao,settings-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D208766
This commit is contained in:
Родитель
a572c0d70b
Коммит
cbbd7efae0
|
@ -935,8 +935,12 @@ pref("browser.tabs.tooltipsShowPidAndActiveness", true);
|
|||
pref("browser.tabs.tooltipsShowPidAndActiveness", false);
|
||||
#endif
|
||||
|
||||
pref("browser.tabs.cardPreview.enabled", false);
|
||||
pref("browser.tabs.cardPreview.showThumbnails", true);
|
||||
#ifdef NIGHTLY_BUILD
|
||||
pref("browser.tabs.hoverPreview.enabled", true);
|
||||
#else
|
||||
pref("browser.tabs.hoverPreview.enabled", false);
|
||||
#endif
|
||||
pref("browser.tabs.hoverPreview.showThumbnails", true);
|
||||
|
||||
pref("browser.tabs.firefox-view.logLevel", "Warn");
|
||||
|
||||
|
|
|
@ -50,8 +50,7 @@ add_task(async function mute_web_audio() {
|
|||
|
||||
info("- mute browser -");
|
||||
ok(!tab.linkedBrowser.audioMuted, "Audio should not be muted by default");
|
||||
let tabContent = tab.querySelector(".tab-content");
|
||||
await hoverIcon(tabContent);
|
||||
await hoverIcon(tab.overlayIcon);
|
||||
await clickIcon(tab.overlayIcon);
|
||||
ok(tab.linkedBrowser.audioMuted, "Audio should be muted now");
|
||||
|
||||
|
@ -63,7 +62,7 @@ add_task(async function mute_web_audio() {
|
|||
|
||||
info("- unmute browser -");
|
||||
ok(tab.linkedBrowser.audioMuted, "Audio should be muted now");
|
||||
await hoverIcon(tabContent);
|
||||
await hoverIcon(tab.overlayIcon);
|
||||
await clickIcon(tab.overlayIcon);
|
||||
ok(!tab.linkedBrowser.audioMuted, "Audio should be unmuted now");
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
#endif
|
||||
|
||||
<checkbox id="tabPreviewShowThumbnails" data-l10n-id="settings-tabs-show-image-in-preview"
|
||||
preference="browser.tabs.cardPreview.showThumbnails" hidden="true"/>
|
||||
preference="browser.tabs.hoverPreview.showThumbnails" hidden="true"/>
|
||||
|
||||
<vbox id="browserContainersbox" hidden="true">
|
||||
<hbox id="browserContainersExtensionContent"
|
||||
|
|
|
@ -87,8 +87,8 @@ Preferences.addAll([
|
|||
{ id: "browser.warnOnQuitShortcut", type: "bool" },
|
||||
{ id: "browser.tabs.warnOnOpen", type: "bool" },
|
||||
{ id: "browser.ctrlTab.sortByRecentlyUsed", type: "bool" },
|
||||
{ id: "browser.tabs.cardPreview.enabled", type: "bool" },
|
||||
{ id: "browser.tabs.cardPreview.showThumbnails", type: "bool" },
|
||||
{ id: "browser.tabs.hoverPreview.enabled", type: "bool" },
|
||||
{ id: "browser.tabs.hoverPreview.showThumbnails", type: "bool" },
|
||||
|
||||
// CFR
|
||||
{
|
||||
|
@ -358,7 +358,7 @@ var gMainPane = {
|
|||
|
||||
let thumbsCheckbox = document.getElementById("tabPreviewShowThumbnails");
|
||||
let cardPreviewEnabledPref = Preferences.get(
|
||||
"browser.tabs.cardPreview.enabled"
|
||||
"browser.tabs.hoverPreview.enabled"
|
||||
);
|
||||
let maybeShowThumbsCheckbox = () =>
|
||||
(thumbsCheckbox.hidden = !cardPreviewEnabledPref.value);
|
||||
|
|
|
@ -38,7 +38,7 @@ export default class TabHoverPreviewPanel {
|
|||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
"_prefDisplayThumbnail",
|
||||
"browser.tabs.cardPreview.showThumbnails",
|
||||
"browser.tabs.hoverPreview.showThumbnails",
|
||||
false
|
||||
);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
|
@ -111,7 +111,6 @@ export default class TabHoverPreviewPanel {
|
|||
this._panel.openPopup(this._tab, POPUP_OPTIONS);
|
||||
}, this._prefPreviewDelay);
|
||||
this._win.addEventListener("TabSelect", this);
|
||||
this._win.addEventListener("blur", this);
|
||||
this._panel.addEventListener("popupshowing", this);
|
||||
}
|
||||
|
||||
|
@ -151,9 +150,6 @@ export default class TabHoverPreviewPanel {
|
|||
this._thumbnailElement = null;
|
||||
}
|
||||
break;
|
||||
case "blur":
|
||||
this.deactivate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,7 +239,7 @@ export default class TabHoverPreviewPanel {
|
|||
}
|
||||
|
||||
get _displayURI() {
|
||||
if (!this._tab) {
|
||||
if (!this._tab || !this._tab.linkedBrowser) {
|
||||
return "";
|
||||
}
|
||||
return this.getPrettyURI(this._tab.linkedBrowser.currentURI.spec);
|
||||
|
@ -260,6 +256,6 @@ export default class TabHoverPreviewPanel {
|
|||
}
|
||||
|
||||
get _displayActiveness() {
|
||||
return this._tab.linkedBrowser.docShellIsActive ? "[A]" : "";
|
||||
return this._tab?.linkedBrowser?.docShellIsActive ? "[A]" : "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
"_showTabCardPreview",
|
||||
"browser.tabs.cardPreview.enabled",
|
||||
"browser.tabs.hoverPreview.enabled",
|
||||
true
|
||||
);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// This is loaded into all browser windows. Wrap in a block to prevent
|
||||
// leaking to window scope.
|
||||
{
|
||||
const TAB_PREVIEW_PREF = "browser.tabs.cardPreview.enabled";
|
||||
const TAB_PREVIEW_PREF = "browser.tabs.hoverPreview.enabled";
|
||||
|
||||
class MozTabbrowserTabs extends MozElements.TabsBase {
|
||||
constructor() {
|
||||
|
|
|
@ -76,13 +76,14 @@ async function show_tab(tab) {
|
|||
return tabShown;
|
||||
}
|
||||
|
||||
async function test_tooltip(icon, expectedTooltip, isActiveTab, tab) {
|
||||
async function test_tooltip(icon, expectedTooltip, isActiveTab) {
|
||||
let tooltip = document.getElementById("tabbrowser-tab-tooltip");
|
||||
|
||||
let tabContent = tab.querySelector(".tab-content");
|
||||
await hover_icon(tabContent, tooltip);
|
||||
|
||||
await hover_icon(icon, tooltip);
|
||||
while (document.hasPendingL10nMutations) {
|
||||
// wait for correct menu text
|
||||
await BrowserTestUtils.waitForEvent(document, "L10nMutationsFinished");
|
||||
}
|
||||
if (isActiveTab) {
|
||||
// The active tab should have the keybinding shortcut in the tooltip.
|
||||
// We check this by ensuring that the strings are not equal but the expected
|
||||
|
@ -101,7 +102,7 @@ async function test_tooltip(icon, expectedTooltip, isActiveTab, tab) {
|
|||
is(
|
||||
tooltip.getAttribute("label"),
|
||||
expectedTooltip,
|
||||
"Tooltips should not be equal"
|
||||
"Tooltips should be equal"
|
||||
);
|
||||
}
|
||||
leave_icon(icon);
|
||||
|
@ -114,12 +115,20 @@ function get_tab_state(tab) {
|
|||
async function test_muting_using_menu(tab, expectMuted) {
|
||||
// Show the popup menu
|
||||
let contextMenu = document.getElementById("tabContextMenu");
|
||||
let l10nFinishedPromise = BrowserTestUtils.waitForEvent(
|
||||
document,
|
||||
"L10nMutationsFinished"
|
||||
);
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(
|
||||
contextMenu,
|
||||
"popupshown"
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(tab, { type: "contextmenu", button: 2 });
|
||||
await popupShownPromise;
|
||||
if (document.hasPendingL10nMutations) {
|
||||
// wait for correct menu text
|
||||
await l10nFinishedPromise;
|
||||
}
|
||||
|
||||
// Check the menu
|
||||
let expectedLabel = expectMuted ? "Unmute Tab" : "Mute Tab";
|
||||
|
|
|
@ -3,6 +3,22 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
async function waitForAllTabsMenu(window = window) {
|
||||
// Borrowed from browser_menu_touch.js,
|
||||
// Ensure menu has been added to the document and that it's open
|
||||
await BrowserTestUtils.waitForCondition(
|
||||
() => window.document.getElementById("customizationui-widget-panel") != null
|
||||
);
|
||||
let menu = window.document.getElementById("customizationui-widget-panel");
|
||||
|
||||
if (menu.state != "open") {
|
||||
await BrowserTestUtils.waitForEvent(menu, "popupshown");
|
||||
is(menu.state, "open", `All tabs menu is open`);
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check we can open the tab manager using the keyboard.
|
||||
* Note that navigation to buttons in the toolbar is covered
|
||||
|
@ -18,19 +34,19 @@ add_task(async function test_open_tabmanager_keyboard() {
|
|||
// Borrowed from forceFocus() in the keyboard directory head.js
|
||||
elem.setAttribute("tabindex", "-1");
|
||||
elem.focus();
|
||||
elem.removeAttribute("tabindex");
|
||||
|
||||
let focused = BrowserTestUtils.waitForEvent(newWindow, "focus", true);
|
||||
EventUtils.synthesizeKey(" ", {}, newWindow);
|
||||
let event = await focused;
|
||||
let allTabsMenu = await waitForAllTabsMenu(newWindow);
|
||||
|
||||
elem.removeAttribute("tabindex");
|
||||
|
||||
ok(
|
||||
event.originalTarget.closest("#allTabsMenu-allTabsView"),
|
||||
"Focus inside all tabs menu after toolbar button pressed"
|
||||
);
|
||||
let hidden = BrowserTestUtils.waitForEvent(
|
||||
event.target.closest("panel"),
|
||||
"popuphidden"
|
||||
);
|
||||
let hidden = BrowserTestUtils.waitForEvent(allTabsMenu, "popuphidden");
|
||||
EventUtils.synthesizeKey("KEY_Escape", { shiftKey: false }, newWindow);
|
||||
await hidden;
|
||||
await BrowserTestUtils.closeWindow(newWindow);
|
||||
|
|
|
@ -38,8 +38,8 @@ async function closePreviews(win = window) {
|
|||
add_setup(async function () {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["browser.tabs.cardPreview.enabled", true],
|
||||
["browser.tabs.cardPreview.showThumbnails", false],
|
||||
["browser.tabs.hoverPreview.enabled", true],
|
||||
["browser.tabs.hoverPreview.showThumbnails", false],
|
||||
["browser.tabs.tooltipsShowPidAndActiveness", false],
|
||||
["ui.tooltip.delay_ms", 0],
|
||||
],
|
||||
|
@ -99,7 +99,7 @@ add_task(async function hoverTests() {
|
|||
resolved = true;
|
||||
});
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
let timeoutPromise = new Promise(resolve => setTimeout(resolve, 100));
|
||||
let timeoutPromise = new Promise(resolve => setTimeout(resolve, 500));
|
||||
await Promise.race([openPreviewPromise, timeoutPromise]);
|
||||
Assert.ok(!resolved, "preview does not open from background window");
|
||||
Assert.ok(
|
||||
|
@ -213,12 +213,12 @@ add_task(async function pidAndActivenessTests() {
|
|||
|
||||
/**
|
||||
* Verify that non-selected tabs display a thumbnail in their preview
|
||||
* when browser.tabs.cardPreview.showThumbnails is set to true,
|
||||
* when browser.tabs.hoverPreview.showThumbnails is set to true,
|
||||
* while the currently selected tab never displays a thumbnail in its preview.
|
||||
*/
|
||||
add_task(async function thumbnailTests() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.tabs.cardPreview.showThumbnails", true]],
|
||||
set: [["browser.tabs.hoverPreview.showThumbnails", true]],
|
||||
});
|
||||
const tabUrl1 = "about:blank";
|
||||
const tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl1);
|
||||
|
|
|
@ -31,6 +31,12 @@ function closeTooltip(node, tooltip) {
|
|||
return tooltipHiddenPromise;
|
||||
}
|
||||
|
||||
add_setup(async function () {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.tabs.hoverPreview.enabled", false]],
|
||||
});
|
||||
});
|
||||
|
||||
// This test verifies that the tab tooltip appears at the correct location, aligned
|
||||
// with the bottom of the tab, and that the tooltip appears near the close button.
|
||||
add_task(async function () {
|
||||
|
|
|
@ -2768,7 +2768,7 @@ tabPreview:
|
|||
type: boolean
|
||||
setPref:
|
||||
branch: default
|
||||
pref: browser.tabs.cardPreview.enabled
|
||||
pref: browser.tabs.hoverPreview.enabled
|
||||
description: >-
|
||||
When true, users will see the new card preview when hovering a tab, instead of the standard tooltip
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче