зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 216cda008304 (bug 1805774) for causing bc failures on browser_quickactions.js. CLOSED TREE
This commit is contained in:
Родитель
07f8e9babd
Коммит
3f2e95db79
|
@ -54,6 +54,13 @@ let openAddonsUrl = url => {
|
|||
};
|
||||
};
|
||||
|
||||
// There are various actions that will either fail or do not
|
||||
// make sense to use unless the user is viewing web content,
|
||||
// Screenshots for example cannot be taken on about: pages.
|
||||
// We may want to show these as disabled buttons, that may
|
||||
// aid discovery but may also confuse users.
|
||||
let currentPageIsWebContentFilter = () =>
|
||||
!currentBrowser()?.currentURI.spec.startsWith("about:");
|
||||
let currentBrowser = () =>
|
||||
lazy.BrowserWindowTracker.getTopWindow()?.gBrowser.selectedBrowser;
|
||||
let currentTab = () =>
|
||||
|
@ -176,9 +183,7 @@ const DEFAULT_ACTIONS = {
|
|||
l10nCommands: ["quickactions-cmd-screenshot", "quickactions-screenshot3"],
|
||||
label: "quickactions-screenshot3",
|
||||
icon: "chrome://browser/skin/screenshot.svg",
|
||||
isActive: () => {
|
||||
return !lazy.BrowserWindowTracker.getTopWindow().gScreenshots.shouldScreenshotsButtonBeDisabled();
|
||||
},
|
||||
isActive: currentPageIsWebContentFilter,
|
||||
onPick: () => {
|
||||
lazy.BrowserWindowTracker.getTopWindow()
|
||||
.document.getElementById("Browser:Screenshot")
|
||||
|
|
|
@ -214,13 +214,7 @@ add_task(async function test_disabled() {
|
|||
UrlbarProviderQuickActions.removeAction("disabledaction");
|
||||
});
|
||||
|
||||
/**
|
||||
* The first part of this test confirms that when the screenshots component is enabled
|
||||
* the screenshot quick action button will be enabled on about: pages.
|
||||
* The second part confirms that when the screenshots extension is enabled the
|
||||
* screenshot quick action button will be disbaled on about: pages.
|
||||
*/
|
||||
add_task(async function test_screenshot_enabled_or_disabled() {
|
||||
add_task(async function test_screenshot_disabled() {
|
||||
let onLoaded = BrowserTestUtils.browserLoaded(
|
||||
gBrowser.selectedBrowser,
|
||||
false,
|
||||
|
@ -241,30 +235,6 @@ add_task(async function test_screenshot_enabled_or_disabled() {
|
|||
let screenshotButton = window.document.querySelector(
|
||||
".urlbarView-row[dynamicType=quickactions] .urlbarView-quickaction-row"
|
||||
);
|
||||
Assert.ok(
|
||||
!screenshotButton.hasAttribute("disabled"),
|
||||
"Screenshot button is disabled on about pages"
|
||||
);
|
||||
|
||||
await UrlbarTestUtils.promisePopupClose(window);
|
||||
EventUtils.synthesizeKey("KEY_Escape");
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["screenshots.browser.component.enabled", false]],
|
||||
});
|
||||
|
||||
await UrlbarTestUtils.promiseAutocompleteResultPopup({
|
||||
window,
|
||||
value: "screenshot",
|
||||
});
|
||||
Assert.equal(
|
||||
UrlbarTestUtils.getResultCount(window),
|
||||
2,
|
||||
"The action is displayed"
|
||||
);
|
||||
screenshotButton = window.document.querySelector(
|
||||
".urlbarView-row[dynamicType=quickactions] .urlbarView-quickaction-row"
|
||||
);
|
||||
Assert.equal(
|
||||
screenshotButton.getAttribute("disabled"),
|
||||
"disabled",
|
||||
|
@ -273,8 +243,6 @@ add_task(async function test_screenshot_enabled_or_disabled() {
|
|||
|
||||
await UrlbarTestUtils.promisePopupClose(window);
|
||||
EventUtils.synthesizeKey("KEY_Escape");
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_task(async function match_in_phrase() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче