Bug 1373563 - More specific mozscreenshots cropping for PermissionPrompts and ControlCenter. r=johannh

Also remove the default selectors for LightweightThemes since we capture the union of all regions and we can leave it up to the other used configuration to know which region is relevant. The whole navigator-toolbox isn't always relavant for LightweightThemes changes since they also affect panels and other widgets.

Differential Revision: https://phabricator.services.mozilla.com/D8815

--HG--
extra : rebase_source : 124ffb5493903fdbbe85d0181b10649d611ddc76
extra : amend_source : c151c8a48a8fb25b3aafc217c293835ab443fa54
This commit is contained in:
Matthew Noorenberghe 2018-10-18 15:31:45 -07:00
Родитель d875812fa7
Коммит 4622f078c4
3 изменённых файлов: 39 добавлений и 42 удалений

Просмотреть файл

@ -34,7 +34,7 @@ var ControlCenter = {
configurations: { configurations: {
about: { about: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
await loadPage("about:rights"); await loadPage("about:rights");
await openIdentityPopup(); await openIdentityPopup();
@ -42,7 +42,8 @@ var ControlCenter = {
}, },
localFile: { localFile: {
selectors: ["#identity-popup"], // This selector is different so we can exclude the changing file: path
selectors: ["#identity-popup-security"],
async applyConfig() { async applyConfig() {
let channel = NetUtil.newChannel({ let channel = NetUtil.newChannel({
uri: "resource://mozscreenshots/lib/mozscreenshots.html", uri: "resource://mozscreenshots/lib/mozscreenshots.html",
@ -55,14 +56,10 @@ var ControlCenter = {
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
await openIdentityPopup(); await openIdentityPopup();
}, },
async verifyConfig() {
return { todo: "Bug 1373563: intermittent controlCenter_localFile on Taskcluster" };
},
}, },
http: { http: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
await loadPage(HTTP_PAGE); await loadPage(HTTP_PAGE);
await openIdentityPopup(); await openIdentityPopup();
@ -70,7 +67,7 @@ var ControlCenter = {
}, },
httpSubView: { httpSubView: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
await loadPage(HTTP_PAGE); await loadPage(HTTP_PAGE);
await openIdentityPopup(true); await openIdentityPopup(true);
@ -78,7 +75,7 @@ var ControlCenter = {
}, },
https: { https: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
await loadPage(HTTPS_PAGE); await loadPage(HTTPS_PAGE);
await openIdentityPopup(); await openIdentityPopup();
@ -86,7 +83,7 @@ var ControlCenter = {
}, },
httpsSubView: { httpsSubView: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
await loadPage(HTTPS_PAGE); await loadPage(HTTPS_PAGE);
await openIdentityPopup(true); await openIdentityPopup(true);
@ -94,7 +91,7 @@ var ControlCenter = {
}, },
singlePermission: { singlePermission: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
let uri = Services.io.newURI(PERMISSIONS_PAGE); let uri = Services.io.newURI(PERMISSIONS_PAGE);
SitePermissions.set(uri, "camera", SitePermissions.ALLOW); SitePermissions.set(uri, "camera", SitePermissions.ALLOW);
@ -105,7 +102,7 @@ var ControlCenter = {
}, },
allPermissions: { allPermissions: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
// TODO: (Bug 1330601) Rewrite this to consider temporary (TAB) permission states. // TODO: (Bug 1330601) Rewrite this to consider temporary (TAB) permission states.
// There are 2 possible non-default permission states, so we alternate between them. // There are 2 possible non-default permission states, so we alternate between them.
@ -121,7 +118,7 @@ var ControlCenter = {
}, },
mixed: { mixed: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
await loadPage(MIXED_CONTENT_URL); await loadPage(MIXED_CONTENT_URL);
await openIdentityPopup(); await openIdentityPopup();
@ -129,7 +126,7 @@ var ControlCenter = {
}, },
mixedSubView: { mixedSubView: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
await loadPage(MIXED_CONTENT_URL); await loadPage(MIXED_CONTENT_URL);
await openIdentityPopup(true); await openIdentityPopup(true);
@ -137,7 +134,7 @@ var ControlCenter = {
}, },
mixedPassive: { mixedPassive: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
await loadPage(MIXED_PASSIVE_CONTENT_URL); await loadPage(MIXED_PASSIVE_CONTENT_URL);
await openIdentityPopup(); await openIdentityPopup();
@ -145,7 +142,7 @@ var ControlCenter = {
}, },
mixedPassiveSubView: { mixedPassiveSubView: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
await loadPage(MIXED_PASSIVE_CONTENT_URL); await loadPage(MIXED_PASSIVE_CONTENT_URL);
await openIdentityPopup(true); await openIdentityPopup(true);
@ -153,7 +150,7 @@ var ControlCenter = {
}, },
mixedActive: { mixedActive: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
await loadPage(MIXED_ACTIVE_CONTENT_URL); await loadPage(MIXED_ACTIVE_CONTENT_URL);
await openIdentityPopup(); await openIdentityPopup();
@ -161,7 +158,7 @@ var ControlCenter = {
}, },
mixedActiveSubView: { mixedActiveSubView: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
await loadPage(MIXED_ACTIVE_CONTENT_URL); await loadPage(MIXED_ACTIVE_CONTENT_URL);
await openIdentityPopup(true); await openIdentityPopup(true);
@ -169,7 +166,7 @@ var ControlCenter = {
}, },
mixedActiveUnblocked: { mixedActiveUnblocked: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser"); let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
let gBrowser = browserWindow.gBrowser; let gBrowser = browserWindow.gBrowser;
@ -181,7 +178,7 @@ var ControlCenter = {
}, },
mixedActiveUnblockedSubView: { mixedActiveUnblockedSubView: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser"); let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
let gBrowser = browserWindow.gBrowser; let gBrowser = browserWindow.gBrowser;
@ -193,7 +190,7 @@ var ControlCenter = {
}, },
httpPassword: { httpPassword: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
await loadPage(HTTP_PASSWORD_PAGE); await loadPage(HTTP_PASSWORD_PAGE);
await openIdentityPopup(); await openIdentityPopup();
@ -201,7 +198,7 @@ var ControlCenter = {
}, },
httpPasswordSubView: { httpPasswordSubView: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
await loadPage(HTTP_PASSWORD_PAGE); await loadPage(HTTP_PASSWORD_PAGE);
await openIdentityPopup(true); await openIdentityPopup(true);
@ -209,7 +206,7 @@ var ControlCenter = {
}, },
trackingProtectionNoElements: { trackingProtectionNoElements: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true); Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true);
@ -219,7 +216,7 @@ var ControlCenter = {
}, },
trackingProtectionEnabled: { trackingProtectionEnabled: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true); Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true);
await UrlClassifierTestUtils.addTestTrackers(); await UrlClassifierTestUtils.addTestTrackers();
@ -230,7 +227,7 @@ var ControlCenter = {
}, },
trackingProtectionDisabled: { trackingProtectionDisabled: {
selectors: ["#identity-popup"], selectors: ["#navigator-toolbox", "#identity-popup"],
async applyConfig() { async applyConfig() {
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser"); let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
let gBrowser = browserWindow.gBrowser; let gBrowser = browserWindow.gBrowser;

Просмотреть файл

@ -25,14 +25,14 @@ var LightweightThemes = {
configurations: { configurations: {
noLWT: { noLWT: {
selectors: ["#navigator-toolbox"], selectors: [],
async applyConfig() { async applyConfig() {
LightweightThemeManager.currentTheme = null; LightweightThemeManager.currentTheme = null;
}, },
}, },
darkLWT: { darkLWT: {
selectors: ["#navigator-toolbox"], selectors: [],
applyConfig() { applyConfig() {
LightweightThemeManager.setLocalTheme({ LightweightThemeManager.setLocalTheme({
id: "black", id: "black",
@ -45,14 +45,14 @@ var LightweightThemes = {
// Wait for LWT listener // Wait for LWT listener
return new Promise(resolve => { return new Promise(resolve => {
setTimeout(() => { setTimeout(() => {
resolve("darkLWT"); resolve();
}, 500); }, 500);
}); });
}, },
}, },
lightLWT: { lightLWT: {
selectors: ["#navigator-toolbox"], selectors: [],
applyConfig() { applyConfig() {
LightweightThemeManager.setLocalTheme({ LightweightThemeManager.setLocalTheme({
id: "white", id: "white",
@ -64,21 +64,21 @@ var LightweightThemes = {
// Wait for LWT listener // Wait for LWT listener
return new Promise(resolve => { return new Promise(resolve => {
setTimeout(() => { setTimeout(() => {
resolve("lightLWT"); resolve();
}, 500); }, 500);
}); });
}, },
}, },
compactLight: { compactLight: {
selectors: ["#navigator-toolbox"], selectors: [],
applyConfig() { applyConfig() {
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme("firefox-compact-light@mozilla.org"); LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme("firefox-compact-light@mozilla.org");
}, },
}, },
compactDark: { compactDark: {
selectors: ["#navigator-toolbox"], selectors: [],
applyConfig() { applyConfig() {
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme("firefox-compact-dark@mozilla.org"); LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme("firefox-compact-dark@mozilla.org");
}, },

Просмотреть файл

@ -23,7 +23,7 @@ var PermissionPrompts = {
configurations: { configurations: {
shareDevices: { shareDevices: {
selectors: ["#notification-popup"], selectors: ["#notification-popup", "#identity-box"],
async applyConfig() { async applyConfig() {
await closeLastTab(); await closeLastTab();
await clickOn("#webRTC-shareDevices"); await clickOn("#webRTC-shareDevices");
@ -31,7 +31,7 @@ var PermissionPrompts = {
}, },
shareMicrophone: { shareMicrophone: {
selectors: ["#notification-popup"], selectors: ["#notification-popup", "#identity-box"],
async applyConfig() { async applyConfig() {
await closeLastTab(); await closeLastTab();
await clickOn("#webRTC-shareMicrophone"); await clickOn("#webRTC-shareMicrophone");
@ -39,7 +39,7 @@ var PermissionPrompts = {
}, },
shareVideoAndMicrophone: { shareVideoAndMicrophone: {
selectors: ["#notification-popup"], selectors: ["#notification-popup", "#identity-box"],
async applyConfig() { async applyConfig() {
await closeLastTab(); await closeLastTab();
await clickOn("#webRTC-shareDevices2"); await clickOn("#webRTC-shareDevices2");
@ -47,7 +47,7 @@ var PermissionPrompts = {
}, },
shareScreen: { shareScreen: {
selectors: ["#notification-popup"], selectors: ["#notification-popup", "#identity-box"],
async applyConfig() { async applyConfig() {
await closeLastTab(); await closeLastTab();
await clickOn("#webRTC-shareScreen"); await clickOn("#webRTC-shareScreen");
@ -55,7 +55,7 @@ var PermissionPrompts = {
}, },
geo: { geo: {
selectors: ["#notification-popup"], selectors: ["#notification-popup", "#identity-box"],
async applyConfig() { async applyConfig() {
await closeLastTab(); await closeLastTab();
await clickOn("#geo"); await clickOn("#geo");
@ -63,7 +63,7 @@ var PermissionPrompts = {
}, },
persistentStorage: { persistentStorage: {
selectors: ["#notification-popup"], selectors: ["#notification-popup", "#identity-box"],
async applyConfig() { async applyConfig() {
await closeLastTab(); await closeLastTab();
await clickOn("#persistent-storage"); await clickOn("#persistent-storage");
@ -71,7 +71,7 @@ var PermissionPrompts = {
}, },
loginCapture: { loginCapture: {
selectors: ["#notification-popup"], selectors: ["#notification-popup", "#identity-box"],
async applyConfig() { async applyConfig() {
await closeLastTab(); await closeLastTab();
await clickOn("#login-capture"); await clickOn("#login-capture");
@ -79,7 +79,7 @@ var PermissionPrompts = {
}, },
notifications: { notifications: {
selectors: ["#notification-popup"], selectors: ["#notification-popup", "#identity-box"],
async applyConfig() { async applyConfig() {
await closeLastTab(); await closeLastTab();
await clickOn("#web-notifications"); await clickOn("#web-notifications");
@ -87,7 +87,7 @@ var PermissionPrompts = {
}, },
addons: { addons: {
selectors: ["#notification-popup"], selectors: ["#notification-popup", "#identity-box"],
async applyConfig() { async applyConfig() {
Services.prefs.setBoolPref("xpinstall.whitelist.required", true); Services.prefs.setBoolPref("xpinstall.whitelist.required", true);
@ -97,7 +97,7 @@ var PermissionPrompts = {
}, },
addonsNoWhitelist: { addonsNoWhitelist: {
selectors: ["#notification-popup"], selectors: ["#notification-popup", "#identity-box"],
async applyConfig() { async applyConfig() {
Services.prefs.setBoolPref("xpinstall.whitelist.required", false); Services.prefs.setBoolPref("xpinstall.whitelist.required", false);