mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1733428 - Toggle screenshots UI if screenshots toolbar button is pressed. r=sfoster
Differential Revision: https://phabricator.services.mozilla.com/D127893
This commit is contained in:
parent
48a4be6ee9
commit
4dfb677424
@ -35,23 +35,10 @@ this.main = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
function setIconActive(active) {
|
||||
let windowIDPromise = browser.windows.getLastFocused().then(windowInfo => {
|
||||
return windowInfo.id;
|
||||
});
|
||||
windowIDPromise.then(id => {
|
||||
return browser.experiments.screenshots.setIcon(active, id);
|
||||
});
|
||||
}
|
||||
|
||||
function toggleSelector(tab) {
|
||||
return analytics
|
||||
.refreshTelemetryPref()
|
||||
.then(() => selectorLoader.toggle(tab.id))
|
||||
.then(active => {
|
||||
setIconActive(active);
|
||||
return active;
|
||||
})
|
||||
.catch(error => {
|
||||
if (
|
||||
error.message &&
|
||||
@ -255,10 +242,6 @@ this.main = (function() {
|
||||
});
|
||||
});
|
||||
|
||||
communication.register("closeSelector", sender => {
|
||||
setIconActive(false);
|
||||
});
|
||||
|
||||
communication.register("abortStartShot", () => {
|
||||
// Note, we only show the error but don't report it, as we know that we can't
|
||||
// take shots of these pages:
|
||||
|
@ -35,13 +35,6 @@ this.screenshots = class extends ExtensionAPI {
|
||||
isHistoryEnabled() {
|
||||
return Services.prefs.getBoolPref("places.history.enabled", true);
|
||||
},
|
||||
setIcon: (isActive, windowId) => {
|
||||
Services.obs.notifyObservers(
|
||||
Services.wm.getOuterWindowWithId(windowId),
|
||||
"toggle-screenshot-disable",
|
||||
isActive
|
||||
);
|
||||
},
|
||||
onScreenshotCommand: new EventManager({
|
||||
context,
|
||||
name: "experiments.screenshots.onScreenshotCommand",
|
||||
|
@ -16,22 +16,6 @@
|
||||
"description": "Returns the value of the 'places.history.enabled' preference",
|
||||
"parameters": [],
|
||||
"async": true
|
||||
},
|
||||
{
|
||||
"name": "setIcon",
|
||||
"type": "function",
|
||||
"description": "Disables or enables the screenshot toolbar button",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "isActive",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "windowId",
|
||||
"type": "integer"
|
||||
}
|
||||
],
|
||||
"async": false
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
|
@ -856,7 +856,6 @@ this.uicontrol = (function() {
|
||||
try {
|
||||
sendEvent("internal", "deactivate");
|
||||
setState("cancel");
|
||||
callBackground("closeSelector");
|
||||
selectorLoader.unloadModules();
|
||||
} catch (e) {
|
||||
log.error("Error in deactivate", e);
|
||||
|
@ -49,10 +49,10 @@ add_task(async function test_disabledMultiWindow() {
|
||||
"The screenshots button was added to the nav bar"
|
||||
);
|
||||
|
||||
Assert.equal(
|
||||
screenshotBtn.disabled,
|
||||
true,
|
||||
"Screenshots button is now disabled"
|
||||
info("Waiting for the preselect UI");
|
||||
await helper.waitForUIContent(
|
||||
helper.selector.preselectIframe,
|
||||
helper.selector.fullPageButton
|
||||
);
|
||||
|
||||
let newWin = await BrowserTestUtils.openNewBrowserWindow();
|
||||
|
Loading…
Reference in New Issue
Block a user