Backed out changeset fe2ffeac3ec2 (bug 1783521) for marionette failure on test_restore_manually.py . CLOSED TREE

This commit is contained in:
Narcis Beleuzu 2023-12-20 21:20:39 +02:00
parent d7e2843de2
commit 11a7de2215
15 changed files with 0 additions and 498 deletions

View file

@ -907,10 +907,6 @@ pref("browser.tabs.tooltipsShowPidAndActiveness", true);
pref("browser.tabs.tooltipsShowPidAndActiveness", false);
#endif
pref("browser.tabs.cardPreview.enabled", false);
pref("browser.tabs.cardPreview.delayMs", 1000);
pref("browser.tabs.cardPreview.showThumbnails", true);
pref("browser.tabs.firefox-view", true);
pref("browser.tabs.firefox-view-next", true);
pref("browser.tabs.firefox-view-newIcon", true);

View file

@ -142,7 +142,6 @@
window.addEventListener("DOMContentLoaded",
gBrowserInit.onDOMContentLoaded.bind(gBrowserInit), { once: true });
</script>
<script type="module" src="chrome://browser/content/tabpreview/tabpreview.mjs"></script>
</head>
<html:body xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
# All sets except for popupsets (commands, keys, and stringbundles)

View file

@ -412,8 +412,6 @@
<hbox id="ctrlTab-showAll-container" pack="center"/>
</panel>
<html:tab-preview id="tabbrowser-tab-preview" hidden="true" />
<html:template id="pageActionPanelTemplate">
<panel id="pageActionPanel"
class="cui-widget-panel panel-no-padding"

View file

@ -550,8 +550,6 @@
tabToWarm = gBrowser._findTabToBlurTo(this);
}
gBrowser.warmupTab(tabToWarm);
this.dispatchEvent(new CustomEvent("TabHoverStart", { bubbles: true }));
}
_mouseleave() {
@ -563,7 +561,6 @@
this.linkedBrowser.unselectedTabHover(false);
this.cancelUnselectedTabHoverTimer();
}
this.dispatchEvent(new CustomEvent("TabHoverEnd", { bubbles: true }));
}
setSecondaryTabTooltipLabel(l10nID, l10nArgs) {

View file

@ -9,8 +9,6 @@
// 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";
class MozTabbrowserTabs extends MozElements.TabsBase {
constructor() {
super();
@ -22,8 +20,6 @@
this.addEventListener("TabShow", this);
this.addEventListener("TabPinned", this);
this.addEventListener("TabUnpinned", this);
this.addEventListener("TabHoverStart", this);
this.addEventListener("TabHoverEnd", this);
this.addEventListener("transitionend", this);
this.addEventListener("dblclick", this);
this.addEventListener("click", this);
@ -122,24 +118,6 @@
if (gMultiProcessBrowser) {
this.tabbox.tabpanels.setAttribute("async", "true");
}
this.configureTooltip = () => {
// fall back to original tooltip behavior if pref is not set
this.tooltip = this._showCardPreviews ? null : "tabbrowser-tab-tooltip";
// activate new tooltip behavior if pref is set
document
.getElementById("tabbrowser-tab-preview")
.toggleAttribute("hidden", !this._showCardPreviews);
};
XPCOMUtils.defineLazyPreferenceGetter(
this,
"_showCardPreviews",
TAB_PREVIEW_PREF,
false,
() => this.configureTooltip()
);
this.configureTooltip();
}
on_TabSelect(event) {
@ -1813,22 +1791,6 @@
handleEvent(aEvent) {
switch (aEvent.type) {
case "TabHoverStart":
if (this._showCardPreviews) {
const previewContainer = document.getElementById(
"tabbrowser-tab-preview"
);
previewContainer.tab = aEvent.target;
}
break;
case "TabHoverEnd":
if (this._showCardPreviews) {
const previewContainer = document.getElementById(
"tabbrowser-tab-preview"
);
previewContainer.tab = null;
}
break;
case "mouseout":
// If the "related target" (the node to which the pointer went) is not
// a child of the current document, the mouse just left the window.

View file

@ -315,8 +315,6 @@ skip-if = ["true"] # Bug 1616418 Bug 1549985
["browser_tab_play.js"]
["browser_tab_preview.js"]
["browser_tab_tooltips.js"]
["browser_tabswitch_contextmenu.js"]

View file

@ -1,126 +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/. */
"use strict";
async function openPreview(tab) {
const previewShown = BrowserTestUtils.waitForEvent(
document.getElementById("tabbrowser-tab-preview"),
"previewshown",
false,
e => {
return e.detail.tab === tab;
}
);
EventUtils.synthesizeMouseAtCenter(tab, { type: "mouseover" });
return previewShown;
}
async function closePreviews() {
const tabs = document.getElementById("tabbrowser-tabs");
const previewHidden = BrowserTestUtils.waitForEvent(
document.getElementById("tabbrowser-tab-preview"),
"previewhidden"
);
EventUtils.synthesizeMouse(tabs, 0, tabs.outerHeight + 1, {
type: "mouseout",
});
return previewHidden;
}
add_setup(async function () {
await SpecialPowers.pushPrefEnv({
set: [
["browser.tabs.cardPreview.enabled", true],
["browser.tabs.cardPreview.showThumbnails", false],
["browser.tabs.cardPreview.delayMs", 0],
],
});
});
/**
* Verify the following:
*
* 1. Tab preview card appears when the mouse hovers over a tab
* 2. Tab preview card shows the correct preview for the tab being hovered
* 3. Tab preview card is dismissed when the mouse leaves the tab bar
*/
add_task(async () => {
const tabUrl1 =
"data:text/html,<html><head><title>First New Tab</title></head><body>Hello</body></html>";
const tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl1);
const tabUrl2 =
"data:text/html,<html><head><title>Second New Tab</title></head><body>Hello</body></html>";
const tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl2);
const previewContainer = document.getElementById("tabbrowser-tab-preview");
await openPreview(tab1);
Assert.ok(
["open", "showing"].includes(previewContainer.panel.state),
"tab1 preview shown"
);
Assert.equal(
previewContainer.renderRoot.querySelector(".tab-preview-title").innerText,
"First New Tab",
"Preview of tab1 shows correct title"
);
await openPreview(tab2);
Assert.ok(
["open", "showing"].includes(previewContainer.panel.state),
"tab2 preview shown"
);
Assert.equal(
previewContainer.renderRoot.querySelector(".tab-preview-title").innerText,
"Second New Tab",
"Preview of tab2 shows correct title"
);
await closePreviews();
Assert.ok(
["closed", "hiding"].includes(previewContainer.panel.state),
"preview container is now hidden"
);
BrowserTestUtils.removeTab(tab1);
BrowserTestUtils.removeTab(tab2);
});
/**
* Verify that non-selected tabs display a thumbnail in their preview
* when browser.tabs.cardPreview.showThumbnails is set to true,
* while the currently selected tab never displays a thumbnail in its preview.
*/
add_task(async () => {
await SpecialPowers.pushPrefEnv({
set: [["browser.tabs.cardPreview.showThumbnails", true]],
});
const tabUrl1 = "about:blank";
const tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl1);
const tabUrl2 = "about:blank";
const tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl2);
const previewContainer = document.getElementById("tabbrowser-tab-preview");
const thumbnailUpdated = BrowserTestUtils.waitForEvent(
previewContainer,
"previewThumbnailUpdated"
);
await openPreview(tab1);
await thumbnailUpdated;
Assert.ok(
previewContainer.renderRoot.querySelectorAll("img,canvas").length,
"Tab1 preview contains thumbnail"
);
await openPreview(tab2);
Assert.equal(
previewContainer.renderRoot.querySelectorAll("img,canvas").length,
0,
"Tab2 (selected) does not contain thumbnail"
);
BrowserTestUtils.removeTab(tab1);
BrowserTestUtils.removeTab(tab2);
await SpecialPowers.popPrefEnv();
});

View file

@ -61,7 +61,6 @@ DIRS += [
"shell",
"shopping",
"syncedtabs",
"tabpreview",
"tabunloader",
"textrecognition",
"translations",

View file

@ -110,9 +110,6 @@
preference="browser.taskbar.previews.enable"/>
#endif
<checkbox id="tabPreviewShowThumbnails" data-l10n-id="settings-tabs-show-image-in-preview"
preference="browser.tabs.cardPreview.showThumbnails" hidden="true"/>
<vbox id="browserContainersbox" hidden="true">
<hbox id="browserContainersExtensionContent"
align="center" class="extension-controlled info-box-container">

View file

@ -86,8 +86,6 @@ 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" },
// CFR
{
@ -356,15 +354,6 @@ var gMainPane = {
} catch (ex) {}
}
let thumbsCheckbox = document.getElementById("tabPreviewShowThumbnails");
let cardPreviewEnabledPref = Preferences.get(
"browser.tabs.cardPreview.enabled"
);
let maybeShowThumbsCheckbox = () =>
(thumbsCheckbox.hidden = !cardPreviewEnabledPref.value);
cardPreviewEnabledPref.on("change", maybeShowThumbsCheckbox);
maybeShowThumbsCheckbox();
// The "opening multiple tabs might slow down Firefox" warning provides
// an option for not showing this warning again. When the user disables it,
// we provide checkboxes to re-enable the warning.

View file

@ -1,7 +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/.
browser.jar:
content/browser/tabpreview/tabpreview.mjs (tabpreview.mjs)
content/browser/tabpreview/tabpreview.css (tabpreview.css)

View file

@ -1,10 +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/.
JAR_MANIFESTS += ["jar.mn"]
with Files("**"):
BUG_COMPONENT = ("Firefox", "Tabbed Browser")
SPHINX_TREES["docs"] = "docs"

View file

@ -1,63 +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/. */
.tab-preview-container {
background-color: #ffffff;
color: #15141a;
border-radius: 9px;
display: inline-block;
width: 280px;
overflow: hidden;
line-height: 1.5;
}
.tab-preview-title {
max-height: 3em;
overflow: hidden;
font-weight: 600;
}
.tab-preview-uri {
color: #4a4b49;
max-height: 1.5em;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.tab-preview-text-container {
padding: 8px;
}
.tab-preview-thumbnail-container img,
.tab-preview-thumbnail-container canvas {
display: block;
width: 100%;
}
@media (prefers-color-scheme: dark) {
.tab-preview-container {
background-color: #42414d;
color: #fbfbfe;
}
.tab-preview-uri {
color: #cfcfd8;
}
}
@media (prefers-contrast) {
.tab-preview-container {
background-color: Canvas;
color: CanvasText;
}
.tab-preview-uri {
color: CanvasText;
}
}
@media (max-width: 640px) {
.tab-preview-thumbnail-container {
display: none;
}
}

View file

@ -1,223 +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/. */
import { html } from "chrome://global/content/vendor/lit.all.mjs";
import { MozLitElement } from "chrome://global/content/lit-utils.mjs";
var { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const TAB_PREVIEW_USE_THUMBNAILS_PREF =
"browser.tabs.cardPreview.showThumbnails";
const TAB_PREVIEW_DELAY_PREF = "browser.tabs.cardPreview.delayMs";
/**
* Detailed preview card that displays when hovering a tab
*
* @property {MozTabbrowserTab} tab - the tab to preview
* @fires TabPreview#previewhidden
* @fires TabPreview#previewshown
* @fires TabPreview#previewThumbnailUpdated
*/
export default class TabPreview extends MozLitElement {
static properties = {
tab: { type: Object },
_previewIsActive: { type: Boolean, state: true },
_previewDelayTimeout: { type: Number, state: true },
_displayTitle: { type: String, state: true },
_displayURI: { type: String, state: true },
_displayImg: { type: Object, state: true },
};
constructor() {
super();
XPCOMUtils.defineLazyPreferenceGetter(
this,
"_prefPreviewDelay",
TAB_PREVIEW_DELAY_PREF
);
XPCOMUtils.defineLazyPreferenceGetter(
this,
"_prefDisplayThumbnail",
TAB_PREVIEW_USE_THUMBNAILS_PREF
);
}
// create the panel here
createRenderRoot() {
if (!document.createXULElement) {
console.error(
"Unable to create panel: document.createXULElement is not available"
);
return super.createRenderRoot();
}
this.attachShadow({ mode: "open" });
this.panel = document.createXULElement("panel");
this.panel.setAttribute("id", "tabPreviewPanel");
this.panel.setAttribute("noautofocus", true);
this.panel.setAttribute("norolluponanchor", true);
this.panel.setAttribute("consumeoutsideclicks", "never");
this.shadowRoot.append(this.panel);
return this.panel;
}
get previewCanShow() {
return this._previewIsActive && this.tab;
}
get thumbnailCanShow() {
return (
this.previewCanShow &&
this._prefDisplayThumbnail &&
!this.tab.selected &&
this._displayImg
);
}
getPrettyURI(uri) {
try {
const url = new URL(uri);
return `${url.hostname}${url.pathname}`.replace(/\/+$/, "");
} catch {
return this.pageURI;
}
}
handleEvent(e) {
if (e.type == "TabSelect") {
this.requestUpdate();
}
}
connectedCallback() {
super.connectedCallback();
window.addEventListener("TabSelect", this);
}
disconnectedCallback() {
window.removeEventListener("TabSelect", this);
}
// compute values derived from tab element
willUpdate(changedProperties) {
if (!changedProperties.has("tab")) {
return;
}
if (!this.tab) {
this._displayTitle = "";
this._displayURI = "";
this._displayImg = null;
return;
}
this._displayTitle = this.tab.textLabel.textContent;
this._displayURI = this.getPrettyURI(
this.tab.linkedBrowser.currentURI.spec
);
this._displayImg = null;
let { tab } = this;
window.tabPreviews.get(this.tab).then(el => {
if (this.tab == tab) {
this._displayImg = el;
}
});
}
updated(changedProperties) {
if (changedProperties.has("tab")) {
// handle preview delay
if (!this.tab) {
clearTimeout(this._previewDelayTimeout);
this._previewIsActive = false;
} else {
let lastTabVal = changedProperties.get("tab");
if (!lastTabVal) {
// tab was set from an empty state,
// so wait for the delay duration before showing
this._previewDelayTimeout = setTimeout(() => {
this._previewIsActive = true;
}, this._prefPreviewDelay);
}
}
}
if (changedProperties.has("_previewIsActive")) {
if (!this._previewIsActive) {
this.panel.hidePopup();
this.updateComplete.then(() => {
/**
* @event TabPreview#previewhidden
* @type {CustomEvent}
*/
this.dispatchEvent(new CustomEvent("previewhidden"));
});
}
}
if (
(changedProperties.has("tab") ||
changedProperties.has("_previewIsActive")) &&
this.previewCanShow
) {
this.updateComplete.then(() => {
if (this.panel.state == "open" || this.panel.state == "showing") {
this.panel.moveToAnchor(this.tab, "bottomleft topleft", 0, -2);
} else {
this.panel.openPopup(this.tab, {
position: "bottomleft topleft",
y: -2,
isContextMenu: false,
});
}
this.dispatchEvent(
/**
* @event TabPreview#previewshown
* @type {CustomEvent}
* @property {object} detail
* @property {MozTabbrowserTab} detail.tab - the tab being previewed
*/
new CustomEvent("previewshown", {
detail: { tab: this.tab },
})
);
});
}
if (changedProperties.has("_displayImg")) {
this.updateComplete.then(() => {
/**
* fires when the thumbnail for a preview is loaded
* and added to the document.
*
* @event TabPreview#previewThumbnailUpdated
* @type {CustomEvent}
*/
this.dispatchEvent(new CustomEvent("previewThumbnailUpdated"));
});
}
}
render() {
return html`
<link
rel="stylesheet"
type="text/css"
href="chrome://browser/content/tabpreview/tabpreview.css"
/>
<div class="tab-preview-container">
<div class="tab-preview-text-container">
<div class="tab-preview-title">${this._displayTitle}</div>
<div class="tab-preview-uri">${this._displayURI}</div>
</div>
${this.thumbnailCanShow
? html`
<div class="tab-preview-thumbnail-container">
${this._displayImg}
</div>
`
: ""}
</div>
`;
}
}
customElements.define("tab-preview", TabPreview);

View file

@ -253,10 +253,6 @@ containers-remove-alert-msg =
containers-remove-ok-button = Remove this Container
containers-remove-cancel-button = Dont remove this Container
settings-tabs-show-image-in-preview =
.label = Show an image preview when you hover on a tab
.accessKey = h
## General Section - Language & Appearance
language-and-appearance-header = Language and Appearance