Backed out 2 changesets (bug 1926145, bug 1924850) for causing bc failures @ browser_menubar_profiles CLOSED TREE
Backed out changeset ce1ce2a8cacd (bug 1924850) Backed out changeset 387976dca835 (bug 1926145)
This commit is contained in:
@@ -105,7 +105,6 @@ const extraBrowserTestPaths = [
|
|||||||
"browser/base/content/test/popupNotifications/",
|
"browser/base/content/test/popupNotifications/",
|
||||||
"browser/base/content/test/popups/",
|
"browser/base/content/test/popups/",
|
||||||
"browser/base/content/test/privateBrowsing/",
|
"browser/base/content/test/privateBrowsing/",
|
||||||
"browser/base/content/test/profiles/",
|
|
||||||
"browser/base/content/test/protectionsUI/",
|
"browser/base/content/test/protectionsUI/",
|
||||||
"browser/base/content/test/referrer/",
|
"browser/base/content/test/referrer/",
|
||||||
"browser/base/content/test/sanitize/",
|
"browser/base/content/test/sanitize/",
|
||||||
|
|||||||
@@ -29,15 +29,12 @@
|
|||||||
</vbox>
|
</vbox>
|
||||||
</toolbarbutton>
|
</toolbarbutton>
|
||||||
</toolbaritem>
|
</toolbaritem>
|
||||||
<toolbarbutton id="appMenu-empty-profiles-button"
|
#ifdef MOZ_SELECTABLE_PROFILES
|
||||||
class="subviewbutton subviewbutton-nav"
|
|
||||||
closemenu="none"
|
|
||||||
data-l10n-id="appmenu-profiles"
|
|
||||||
hidden="true"/>
|
|
||||||
<toolbarbutton id="appMenu-profiles-button"
|
<toolbarbutton id="appMenu-profiles-button"
|
||||||
class="subviewbutton subviewbutton-nav subviewbutton-iconic"
|
class="subviewbutton subviewbutton-nav subviewbutton-iconic"
|
||||||
closemenu="none"
|
closemenu="none"
|
||||||
hidden="true"/>
|
hidden="true"/>
|
||||||
|
#endif
|
||||||
<toolbarseparator id="appMenu-fxa-separator" class="proton-zap"/>
|
<toolbarseparator id="appMenu-fxa-separator" class="proton-zap"/>
|
||||||
<toolbarbutton id="appMenu-new-tab-button2"
|
<toolbarbutton id="appMenu-new-tab-button2"
|
||||||
class="subviewbutton"
|
class="subviewbutton"
|
||||||
|
|||||||
@@ -949,11 +949,9 @@ var gBrowserInit = {
|
|||||||
gGfxUtils.init();
|
gGfxUtils.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (AppConstants.MOZ_SELECTABLE_PROFILES) {
|
|
||||||
scheduleIdleTask(async () => {
|
scheduleIdleTask(async () => {
|
||||||
await gProfiles.init();
|
await gProfiles.init();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
// This should always go last, since the idle tasks (except for the ones with
|
// This should always go last, since the idle tasks (except for the ones with
|
||||||
// timeouts) should execute in order. Note that this observer notification is
|
// timeouts) should execute in order. Note that this observer notification is
|
||||||
|
|||||||
@@ -328,13 +328,6 @@
|
|||||||
</menupopup>
|
</menupopup>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
#ifdef MOZ_SELECTABLE_PROFILES
|
|
||||||
<menu id="profiles-menu" data-l10n-id="menu-profiles" hidden="true">
|
|
||||||
<menupopup id="menu_ProfilesPopup">
|
|
||||||
</menupopup>
|
|
||||||
</menu>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
<menu id="tools-menu" data-l10n-id="menu-tools">
|
<menu id="tools-menu" data-l10n-id="menu-tools">
|
||||||
<menupopup id="menu_ToolsPopup">
|
<menupopup id="menu_ToolsPopup">
|
||||||
<menuitem id="menu_openDownloads"
|
<menuitem id="menu_openDownloads"
|
||||||
|
|||||||
@@ -196,9 +196,6 @@ document.addEventListener(
|
|||||||
case "menu_HelpPopup":
|
case "menu_HelpPopup":
|
||||||
buildHelpMenu();
|
buildHelpMenu();
|
||||||
break;
|
break;
|
||||||
case "menu_ProfilesPopup":
|
|
||||||
gProfiles.onPopupShowing(event);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,20 +7,10 @@
|
|||||||
|
|
||||||
var gProfiles = {
|
var gProfiles = {
|
||||||
async init() {
|
async init() {
|
||||||
this.createNewProfile = this.createNewProfile.bind(this);
|
this.handleEvent.bind(this);
|
||||||
this.handleCommand = this.handleCommand.bind(this);
|
this.launchProfile.bind(this);
|
||||||
this.launchProfile = this.launchProfile.bind(this);
|
this.toggleProfileButtonVisibility.bind(this);
|
||||||
this.manageProfiles = this.manageProfiles.bind(this);
|
this.updateView.bind(this);
|
||||||
this.onAppMenuViewHiding = this.onAppMenuViewHiding.bind(this);
|
|
||||||
this.onAppMenuViewShowing = this.onAppMenuViewShowing.bind(this);
|
|
||||||
this.onPopupShowing = this.onPopupShowing.bind(this);
|
|
||||||
this.toggleProfileMenus = this.toggleProfileMenus.bind(this);
|
|
||||||
this.updateView = this.updateView.bind(this);
|
|
||||||
|
|
||||||
this.profiles = [];
|
|
||||||
if (SelectableProfileService.initialized) {
|
|
||||||
this.profiles = await SelectableProfileService.getAllProfiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.bundle = Services.strings.createBundle(
|
this.bundle = Services.strings.createBundle(
|
||||||
"chrome://browser/locale/browser.properties"
|
"chrome://browser/locale/browser.properties"
|
||||||
@@ -31,66 +21,35 @@ var gProfiles = {
|
|||||||
"PROFILES_ENABLED",
|
"PROFILES_ENABLED",
|
||||||
"browser.profiles.enabled",
|
"browser.profiles.enabled",
|
||||||
false,
|
false,
|
||||||
this.toggleProfileMenus,
|
this.toggleProfileButtonVisibility.bind(this),
|
||||||
() => SelectableProfileService?.isEnabled
|
() => SelectableProfileService?.isEnabled
|
||||||
);
|
);
|
||||||
|
|
||||||
this.toggleProfileMenus();
|
if (!this.PROFILES_ENABLED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.toggleProfileButtonVisibility();
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleProfileMenus() {
|
async toggleProfileButtonVisibility() {
|
||||||
let profilesMenu = document.getElementById("profiles-menu");
|
let profilesButton = PanelMultiView.getViewNode(
|
||||||
profilesMenu.hidden = !this.PROFILES_ENABLED;
|
|
||||||
|
|
||||||
this.emptyProfilesButton = PanelMultiView.getViewNode(
|
|
||||||
document,
|
|
||||||
"appMenu-empty-profiles-button"
|
|
||||||
);
|
|
||||||
this.profilesButton = PanelMultiView.getViewNode(
|
|
||||||
document,
|
document,
|
||||||
"appMenu-profiles-button"
|
"appMenu-profiles-button"
|
||||||
);
|
);
|
||||||
this.subview = PanelMultiView.getViewNode(document, "PanelUI-profiles");
|
let subview = PanelMultiView.getViewNode(document, "PanelUI-profiles");
|
||||||
|
|
||||||
this.toggleAppMenuButton();
|
profilesButton.hidden = !this.PROFILES_ENABLED;
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggles listeners for the profiles app menu button in response to changes
|
|
||||||
* in the profiles feature pref.
|
|
||||||
*/
|
|
||||||
toggleAppMenuButton() {
|
|
||||||
if (!this.PROFILES_ENABLED) {
|
if (!this.PROFILES_ENABLED) {
|
||||||
PanelUI.mainView.removeEventListener(
|
document.l10n.setAttributes(profilesButton, "appmenu-profiles");
|
||||||
"ViewShowing",
|
profilesButton.classList.remove("subviewbutton-iconic");
|
||||||
this.onAppMenuViewShowing
|
profilesButton.removeEventListener("command", this);
|
||||||
);
|
subview.removeEventListener("command", this);
|
||||||
PanelUI.mainView.removeEventListener(
|
|
||||||
"ViewHiding",
|
|
||||||
this.onAppMenuViewHiding
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
PanelUI.mainView.addEventListener(
|
|
||||||
"ViewShowing",
|
|
||||||
this.onAppMenuViewShowing
|
|
||||||
);
|
|
||||||
PanelUI.mainView.addEventListener("ViewHiding", this.onAppMenuViewHiding);
|
|
||||||
}
|
|
||||||
this.onAppMenuViewShowing();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Renders and shows the correct profiles app menu button in response to the
|
|
||||||
* main app menu ViewShowing event.
|
|
||||||
*/
|
|
||||||
async onAppMenuViewShowing() {
|
|
||||||
if (!this.PROFILES_ENABLED) {
|
|
||||||
this.profilesButton.hidden = true;
|
|
||||||
this.emptyProfilesButton.hidden = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.profilesButton.addEventListener("command", this.handleCommand);
|
profilesButton.addEventListener("command", this);
|
||||||
this.subview.addEventListener("command", this.handleCommand);
|
subview.addEventListener("command", this);
|
||||||
|
|
||||||
// If the feature is preffed on, but we haven't created profiles yet, the
|
// If the feature is preffed on, but we haven't created profiles yet, the
|
||||||
// service will not be initialized.
|
// service will not be initialized.
|
||||||
@@ -98,129 +57,33 @@ var gProfiles = {
|
|||||||
? await SelectableProfileService.getAllProfiles()
|
? await SelectableProfileService.getAllProfiles()
|
||||||
: [];
|
: [];
|
||||||
if (profiles.length < 2) {
|
if (profiles.length < 2) {
|
||||||
this.profilesButton.hidden = true;
|
profilesButton.classList.remove("subviewbutton-iconic");
|
||||||
this.emptyProfilesButton.hidden = false;
|
document.l10n.setAttributes(profilesButton, "appmenu-profiles");
|
||||||
this.emptyProfilesButton.addEventListener("command", this.handleCommand);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.emptyProfilesButton.hidden = true;
|
|
||||||
this.profilesButton.hidden = false;
|
|
||||||
this.profilesButton.addEventListener("command", this.handleCommand);
|
|
||||||
let { themeBg, themeFg } = SelectableProfileService.currentProfile.theme;
|
let { themeBg, themeFg } = SelectableProfileService.currentProfile.theme;
|
||||||
this.profilesButton.style.setProperty(
|
profilesButton.style.cssText = `--themeBg: ${themeBg}; --themeFg: ${themeFg};`;
|
||||||
"--appmenu-profiles-theme-bg",
|
|
||||||
themeBg
|
profilesButton.classList.add("subviewbutton-iconic");
|
||||||
);
|
profilesButton.setAttribute(
|
||||||
this.profilesButton.style.setProperty(
|
|
||||||
"--appmenu-profiles-theme-fg",
|
|
||||||
themeFg
|
|
||||||
);
|
|
||||||
this.profilesButton.setAttribute(
|
|
||||||
"label",
|
"label",
|
||||||
SelectableProfileService.currentProfile.name
|
SelectableProfileService.currentProfile.name
|
||||||
);
|
);
|
||||||
let avatar = SelectableProfileService.currentProfile.avatar;
|
let avatar = SelectableProfileService.currentProfile.avatar;
|
||||||
this.profilesButton.setAttribute(
|
profilesButton.setAttribute(
|
||||||
"image",
|
"image",
|
||||||
`chrome://browser/content/profiles/assets/16_${avatar}.svg`
|
`chrome://browser/content/profiles/assets/16_${avatar}.svg`
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
updateView(panel) {
|
||||||
* Removes event listeners from the profiles app menu button in response to
|
this.populateSubView();
|
||||||
* the main app menu ViewHiding event.
|
|
||||||
*/
|
|
||||||
onAppMenuViewHiding() {
|
|
||||||
this.profilesButton.removeEventListener("command", this.handleCommand);
|
|
||||||
this.emptyProfilesButton.removeEventListener("command", this.handleCommand);
|
|
||||||
this.subview.removeEventListener("command", this.handleCommand);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws the menubar panel contents.
|
|
||||||
*/
|
|
||||||
onPopupShowing() {
|
|
||||||
// TODO (bug 1926630) We cannot async fetch the current list of profiles
|
|
||||||
// because menubar popups do not support async popupshowing callbacks
|
|
||||||
// (the resulting menu is not rendered correctly on macos).
|
|
||||||
//
|
|
||||||
// Our temporary workaround is to use a stale cached copy of the profiles
|
|
||||||
// list to render synchronously, and update our profiles list async. If the
|
|
||||||
// profiles datastore has been updated since the popup was last shown, the
|
|
||||||
// contents of the menu will be stale on the first render, then up-to-date
|
|
||||||
// after that.
|
|
||||||
//
|
|
||||||
// Bug 1926630 will ensure correct menu contents by updating
|
|
||||||
// `this.profiles` in response to a notification from the
|
|
||||||
// SelectableProfileService, and we can remove this call then.
|
|
||||||
SelectableProfileService.getAllProfiles().then(profiles => {
|
|
||||||
this.profiles = profiles;
|
|
||||||
});
|
|
||||||
|
|
||||||
let menuPopup = document.getElementById("menu_ProfilesPopup");
|
|
||||||
|
|
||||||
while (menuPopup.hasChildNodes()) {
|
|
||||||
menuPopup.firstChild.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
let profiles = this.profiles;
|
|
||||||
let currentProfile = SelectableProfileService.currentProfile;
|
|
||||||
|
|
||||||
for (let profile of profiles) {
|
|
||||||
let menuitem = document.createXULElement("menuitem");
|
|
||||||
let { themeBg, themeFg } = profile.theme;
|
|
||||||
menuitem.setAttribute("profileid", profile.id);
|
|
||||||
menuitem.setAttribute("command", "Profiles:LaunchProfile");
|
|
||||||
menuitem.setAttribute("label", profile.name);
|
|
||||||
menuitem.style.setProperty("--menu-profiles-theme-bg", themeBg);
|
|
||||||
menuitem.style.setProperty("--menu-profiles-theme-fg", themeFg);
|
|
||||||
menuitem.style.listStyleImage = `url(chrome://browser/content/profiles/assets/48_${profile.avatar}.svg)`;
|
|
||||||
menuitem.classList.add("menuitem-iconic", "menuitem-iconic-profile");
|
|
||||||
|
|
||||||
if (profile.id === currentProfile.id) {
|
|
||||||
menuitem.classList.add("current");
|
|
||||||
menuitem.setAttribute("type", "checkbox");
|
|
||||||
menuitem.setAttribute("checked", "true");
|
|
||||||
}
|
|
||||||
|
|
||||||
menuPopup.appendChild(menuitem);
|
|
||||||
}
|
|
||||||
|
|
||||||
let newProfile = document.createXULElement("menuitem");
|
|
||||||
newProfile.id = "menu_newProfile";
|
|
||||||
newProfile.setAttribute("command", "Profiles:CreateProfile");
|
|
||||||
newProfile.setAttribute("data-l10n-id", "menu-profiles-new-profile");
|
|
||||||
menuPopup.appendChild(newProfile);
|
|
||||||
|
|
||||||
let separator = document.createXULElement("menuseparator");
|
|
||||||
separator.id = "profilesSeparator";
|
|
||||||
menuPopup.appendChild(separator);
|
|
||||||
|
|
||||||
let manageProfiles = document.createXULElement("menuitem");
|
|
||||||
manageProfiles.id = "menu_manageProfiles";
|
|
||||||
manageProfiles.setAttribute("command", "Profiles:ManageProfiles");
|
|
||||||
manageProfiles.setAttribute(
|
|
||||||
"data-l10n-id",
|
|
||||||
"menu-profiles-manage-profiles"
|
|
||||||
);
|
|
||||||
menuPopup.appendChild(manageProfiles);
|
|
||||||
},
|
|
||||||
|
|
||||||
manageProfiles() {
|
|
||||||
return SelectableProfileService.maybeSetupDataStore().then(() => {
|
|
||||||
openTrustedLinkIn("about:profilemanager", "tab");
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
createNewProfile() {
|
|
||||||
SelectableProfileService.createNewProfile();
|
|
||||||
},
|
|
||||||
|
|
||||||
async updateView(panel) {
|
|
||||||
await this.populateSubView();
|
|
||||||
PanelUI.showSubView("PanelUI-profiles", panel);
|
PanelUI.showSubView("PanelUI-profiles", panel);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Note: Not async because the browser-sets.js handler is not async.
|
||||||
|
// This will be an issue when we add menubar menuitems.
|
||||||
launchProfile(aEvent) {
|
launchProfile(aEvent) {
|
||||||
SelectableProfileService.getProfile(
|
SelectableProfileService.getProfile(
|
||||||
aEvent.target.getAttribute("profileid")
|
aEvent.target.getAttribute("profileid")
|
||||||
@@ -229,56 +92,32 @@ var gProfiles = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
handleCommand(aEvent) {
|
async handleEvent(aEvent) {
|
||||||
switch (aEvent.target.id) {
|
let id = aEvent.target.id;
|
||||||
/* Appmenu events */
|
switch (aEvent.type) {
|
||||||
case "appMenu-profiles-button":
|
case "command": {
|
||||||
// deliberate fallthrough
|
if (id == "appMenu-profiles-button") {
|
||||||
case "appMenu-empty-profiles-button": {
|
|
||||||
this.updateView(aEvent.target);
|
this.updateView(aEvent.target);
|
||||||
break;
|
} else if (id == "profiles-appmenu-back-button") {
|
||||||
}
|
|
||||||
case "profiles-appmenu-back-button": {
|
|
||||||
aEvent.target.closest("panelview").panelMultiView.goBack();
|
aEvent.target.closest("panelview").panelMultiView.goBack();
|
||||||
aEvent.target.blur();
|
aEvent.target.blur();
|
||||||
break;
|
} else if (id == "profiles-edit-this-profile-button") {
|
||||||
}
|
|
||||||
case "profiles-edit-this-profile-button": {
|
|
||||||
openTrustedLinkIn("about:editprofile", "tab");
|
openTrustedLinkIn("about:editprofile", "tab");
|
||||||
break;
|
} else if (id == "profiles-manage-profiles-button") {
|
||||||
}
|
// TODO: (Bug 1924827) Open in a dialog, not a tab.
|
||||||
case "profiles-manage-profiles-button": {
|
openTrustedLinkIn("about:profilemanager", "tab");
|
||||||
this.manageProfiles();
|
} else if (id == "profiles-create-profile-button") {
|
||||||
break;
|
SelectableProfileService.createNewProfile();
|
||||||
}
|
} else if (aEvent.target.classList.contains("profile-item")) {
|
||||||
case "profiles-create-profile-button": {
|
// moved to a helper to expose to the menubar commands
|
||||||
this.createNewProfile();
|
this.launchProfile(aEvent);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Menubar events - separated out to simplify telemetry */
|
|
||||||
case "Profiles:CreateProfile": {
|
|
||||||
this.createNewProfile();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "Profiles:ManageProfiles": {
|
|
||||||
this.manageProfiles();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "Profiles:LaunchProfile": {
|
|
||||||
this.launchProfile(aEvent.sourceEvent);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Appmenu */
|
|
||||||
if (aEvent.target.classList.contains("profile-item")) {
|
|
||||||
this.launchProfile(aEvent);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws the subpanel contents for the app menu.
|
|
||||||
*/
|
|
||||||
async populateSubView() {
|
async populateSubView() {
|
||||||
let profiles = [];
|
let profiles = [];
|
||||||
let currentProfile = null;
|
let currentProfile = null;
|
||||||
@@ -317,15 +156,14 @@ var gProfiles = {
|
|||||||
profilesHeader.removeAttribute("style");
|
profilesHeader.removeAttribute("style");
|
||||||
editButton.hidden = true;
|
editButton.hidden = true;
|
||||||
} else {
|
} else {
|
||||||
profilesHeader.style.backgroundColor = "var(--appmenu-profiles-theme-bg)";
|
profilesHeader.style.backgroundColor = "var(--themeBg)";
|
||||||
editButton.hidden = false;
|
editButton.hidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentProfile && profiles.length > 1) {
|
if (currentProfile && profiles.length > 1) {
|
||||||
let subview = PanelMultiView.getViewNode(document, "PanelUI-profiles");
|
let subview = PanelMultiView.getViewNode(document, "PanelUI-profiles");
|
||||||
let { themeBg, themeFg } = currentProfile.theme;
|
let { themeBg, themeFg } = currentProfile.theme;
|
||||||
subview.style.setProperty("--appmenu-profiles-theme-bg", themeBg);
|
subview.style.cssText = `--themeBg: ${themeBg}; --themeFg: ${themeFg};`;
|
||||||
subview.style.setProperty("--appmenu-profiles-theme-fg", themeFg);
|
|
||||||
|
|
||||||
let headerText = PanelMultiView.getViewNode(
|
let headerText = PanelMultiView.getViewNode(
|
||||||
document,
|
document,
|
||||||
@@ -337,14 +175,7 @@ var gProfiles = {
|
|||||||
document,
|
document,
|
||||||
"profile-icon-image"
|
"profile-icon-image"
|
||||||
);
|
);
|
||||||
currentProfileCard.style.setProperty(
|
currentProfileCard.style.cssText = `--themeFg: ${themeFg}; --themeBg: ${themeBg};`;
|
||||||
"--appmenu-profiles-theme-bg",
|
|
||||||
themeBg
|
|
||||||
);
|
|
||||||
currentProfileCard.style.setProperty(
|
|
||||||
"--appmenu-profiles-theme-fg",
|
|
||||||
themeFg
|
|
||||||
);
|
|
||||||
|
|
||||||
let avatar = currentProfile.avatar;
|
let avatar = currentProfile.avatar;
|
||||||
profileIconEl.style.listStyleImage = `url("chrome://browser/content/profiles/assets/80_${avatar}.svg")`;
|
profileIconEl.style.listStyleImage = `url("chrome://browser/content/profiles/assets/80_${avatar}.svg")`;
|
||||||
@@ -367,8 +198,7 @@ var gProfiles = {
|
|||||||
button.setAttribute("label", profile.name);
|
button.setAttribute("label", profile.name);
|
||||||
button.className = "subviewbutton subviewbutton-iconic profile-item";
|
button.className = "subviewbutton subviewbutton-iconic profile-item";
|
||||||
let { themeFg, themeBg } = profile.theme;
|
let { themeFg, themeBg } = profile.theme;
|
||||||
button.style.setProperty("--appmenu-profiles-theme-bg", themeBg);
|
button.style.cssText = `--themeBg: ${themeBg}; --themeFg: ${themeFg};`;
|
||||||
button.style.setProperty("--appmenu-profiles-theme-fg", themeFg);
|
|
||||||
button.setAttribute(
|
button.setAttribute(
|
||||||
"image",
|
"image",
|
||||||
`chrome://browser/content/profiles/assets/16_${profile.avatar}.svg`
|
`chrome://browser/content/profiles/assets/16_${profile.avatar}.svg`
|
||||||
|
|||||||
@@ -76,9 +76,6 @@
|
|||||||
<command id="Browser:ReloadSkipCache" disabled="true">
|
<command id="Browser:ReloadSkipCache" disabled="true">
|
||||||
<observes element="Browser:Reload" attribute="disabled"/>
|
<observes element="Browser:Reload" attribute="disabled"/>
|
||||||
</command>
|
</command>
|
||||||
<command id="Profiles:CreateProfile" />
|
|
||||||
<command id="Profiles:ManageProfiles" />
|
|
||||||
<command id="Profiles:LaunchProfile" />
|
|
||||||
<command id="Browser:NextTab" />
|
<command id="Browser:NextTab" />
|
||||||
<command id="Browser:PrevTab" />
|
<command id="Browser:PrevTab" />
|
||||||
<command id="Browser:ShowAllTabs" />
|
<command id="Browser:ShowAllTabs" />
|
||||||
|
|||||||
@@ -205,12 +205,6 @@ document.addEventListener(
|
|||||||
case "Browser:OpenAboutContainers":
|
case "Browser:OpenAboutContainers":
|
||||||
openPreferences("paneContainers");
|
openPreferences("paneContainers");
|
||||||
break;
|
break;
|
||||||
// deliberate fallthrough
|
|
||||||
case "Profiles:CreateProfile":
|
|
||||||
case "Profiles:ManageProfiles":
|
|
||||||
case "Profiles:LaunchProfile":
|
|
||||||
gProfiles.handleCommand(event);
|
|
||||||
break;
|
|
||||||
case "Tools:Search":
|
case "Tools:Search":
|
||||||
BrowserSearch.webSearch();
|
BrowserSearch.webSearch();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
[DEFAULT]
|
|
||||||
prefs = [
|
|
||||||
"browser.profiles.enabled=true",
|
|
||||||
]
|
|
||||||
support-files = [
|
|
||||||
"head.js"
|
|
||||||
]
|
|
||||||
|
|
||||||
["browser_menubar_profiles.js"]
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
/* Any copyright is dedicated to the Public Domain.
|
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
function resetPrefs() {
|
|
||||||
Services.prefs.clearUserPref("browser.profiles.enabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO (bug 1928538): figure out what condition to wait for instead of setting
|
|
||||||
// an arbitrary timeout.
|
|
||||||
async function waitForUIUpdate() {
|
|
||||||
/* eslint-disable mozilla/no-arbitrary-setTimeout */
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 50));
|
|
||||||
}
|
|
||||||
|
|
||||||
add_task(async function test_pref_toggles_menu() {
|
|
||||||
registerCleanupFunction(resetPrefs);
|
|
||||||
let menu = document.getElementById("profiles-menu");
|
|
||||||
|
|
||||||
Services.prefs.setBoolPref("browser.profiles.enabled", false);
|
|
||||||
await waitForUIUpdate();
|
|
||||||
Assert.equal(menu.hidden, true, "menu should be hidden when preffed off");
|
|
||||||
|
|
||||||
Services.prefs.setBoolPref("browser.profiles.enabled", true);
|
|
||||||
await waitForUIUpdate();
|
|
||||||
Assert.equal(menu.hidden, false, "menu should be visible when preffed on");
|
|
||||||
});
|
|
||||||
|
|
||||||
add_task(async function test_menu_contents_no_profiles() {
|
|
||||||
registerCleanupFunction(resetPrefs);
|
|
||||||
Services.prefs.setBoolPref("browser.profiles.enabled", true);
|
|
||||||
let popup = document.getElementById("menu_ProfilesPopup");
|
|
||||||
|
|
||||||
// Uninit the service to simulate a user with no profiles.
|
|
||||||
SelectableProfileService.uninit();
|
|
||||||
await waitForUIUpdate();
|
|
||||||
|
|
||||||
// Simulate opening the menu, as seen in browser_file_close_tabs.js.
|
|
||||||
let updated = new Promise(resolve => {
|
|
||||||
popup.addEventListener("popupshown", resolve, { once: true });
|
|
||||||
});
|
|
||||||
popup.dispatchEvent(new MouseEvent("popupshowing", { bubbles: true }));
|
|
||||||
popup.dispatchEvent(new MouseEvent("popupshown", { bubbles: true }));
|
|
||||||
await updated;
|
|
||||||
|
|
||||||
let newProfileMenuItem = popup.querySelector("#menu_newProfile");
|
|
||||||
ok(!!newProfileMenuItem, "should be a 'new profile' menu item");
|
|
||||||
let manageProfilesMenuItem = popup.querySelector("#menu_manageProfiles");
|
|
||||||
ok(!!manageProfilesMenuItem, "should be a 'manage profiles' menu item");
|
|
||||||
let profileMenuItems = popup.querySelectorAll("menuitem[profileid]");
|
|
||||||
Assert.equal(
|
|
||||||
profileMenuItems.length,
|
|
||||||
0,
|
|
||||||
"should not be any profile items in the menu"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
@@ -45,7 +45,6 @@ BROWSER_CHROME_MANIFESTS += [
|
|||||||
"content/test/popupNotifications/browser.toml",
|
"content/test/popupNotifications/browser.toml",
|
||||||
"content/test/popups/browser.toml",
|
"content/test/popups/browser.toml",
|
||||||
"content/test/privateBrowsing/browser.toml",
|
"content/test/privateBrowsing/browser.toml",
|
||||||
"content/test/profiles/browser.toml",
|
|
||||||
"content/test/protectionsUI/browser.toml",
|
"content/test/protectionsUI/browser.toml",
|
||||||
"content/test/referrer/browser.toml",
|
"content/test/referrer/browser.toml",
|
||||||
"content/test/sanitize/browser.toml",
|
"content/test/sanitize/browser.toml",
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ prefs = [
|
|||||||
"browser.profiles.enabled=true",
|
"browser.profiles.enabled=true",
|
||||||
]
|
]
|
||||||
|
|
||||||
["browser_appmenu_menuitem_updates.js"]
|
|
||||||
head = "../unit/head.js head.js"
|
|
||||||
|
|
||||||
["browser_create_profile_page_test.js"]
|
["browser_create_profile_page_test.js"]
|
||||||
|
|
||||||
["browser_edit_profile_test.js"]
|
["browser_edit_profile_test.js"]
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
/* Any copyright is dedicated to the Public Domain.
|
|
||||||
https://creativecommons.org/publicdomain/zero/1.0/ */
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
async function promiseAppMenuOpened() {
|
|
||||||
let promiseViewShown = BrowserTestUtils.waitForEvent(
|
|
||||||
PanelUI.panel,
|
|
||||||
"ViewShown"
|
|
||||||
);
|
|
||||||
PanelUI.show();
|
|
||||||
return promiseViewShown;
|
|
||||||
}
|
|
||||||
|
|
||||||
add_task(async function test_appmenu_updates_on_edit() {
|
|
||||||
// TODO: Seems odd that we need to do this manually.
|
|
||||||
await gProfiles.init();
|
|
||||||
|
|
||||||
// Mock the executable process so we don't launch a new process when we
|
|
||||||
// create new profiles.
|
|
||||||
SelectableProfileService._getExecutableProcess =
|
|
||||||
SelectableProfileService.getExecutableProcess;
|
|
||||||
registerCleanupFunction(() => {
|
|
||||||
SelectableProfileService.getExecutableProcess =
|
|
||||||
SelectableProfileService._getExecutableProcess;
|
|
||||||
});
|
|
||||||
SelectableProfileService.getExecutableProcess = () => {
|
|
||||||
return { runw: () => {} };
|
|
||||||
};
|
|
||||||
|
|
||||||
// We need to create a second profile for the name to be shown in the app
|
|
||||||
// menu.
|
|
||||||
await SelectableProfileService.createNewProfile();
|
|
||||||
|
|
||||||
const INITIAL_NAME = "Initial name";
|
|
||||||
const UPDATED_NAME = "Updated";
|
|
||||||
|
|
||||||
SelectableProfileService.currentProfile.name = INITIAL_NAME;
|
|
||||||
await promiseAppMenuOpened();
|
|
||||||
let view = PanelMultiView.getViewNode(document, "appMenu-profiles-button");
|
|
||||||
Assert.equal(view.label, INITIAL_NAME, "expected the initial name");
|
|
||||||
|
|
||||||
SelectableProfileService.currentProfile.name = UPDATED_NAME;
|
|
||||||
PanelUI.hide();
|
|
||||||
await promiseAppMenuOpened();
|
|
||||||
Assert.equal(view.label, UPDATED_NAME, "expected the name to be updated");
|
|
||||||
PanelUI.hide();
|
|
||||||
});
|
|
||||||
@@ -248,15 +248,6 @@ menu-bookmarks-other =
|
|||||||
menu-bookmarks-mobile =
|
menu-bookmarks-mobile =
|
||||||
.label = Mobile Bookmarks
|
.label = Mobile Bookmarks
|
||||||
|
|
||||||
## Profiles Menu
|
|
||||||
|
|
||||||
menu-profiles =
|
|
||||||
.label = Profiles
|
|
||||||
menu-profiles-manage-profiles =
|
|
||||||
.label = Manage profiles
|
|
||||||
menu-profiles-new-profile =
|
|
||||||
.label = New profile
|
|
||||||
|
|
||||||
## Tools Menu
|
## Tools Menu
|
||||||
|
|
||||||
menu-tools =
|
menu-tools =
|
||||||
|
|||||||
@@ -330,14 +330,6 @@ body {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Profiles menu */
|
|
||||||
|
|
||||||
.menuitem-iconic-profile {
|
|
||||||
-moz-context-properties: fill, stroke;
|
|
||||||
fill: var(--menu-profiles-theme-bg);
|
|
||||||
stroke: var(--menu-profiles-theme-fg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Navigation toolbar */
|
/* Navigation toolbar */
|
||||||
|
|
||||||
#nav-bar {
|
#nav-bar {
|
||||||
|
|||||||
@@ -1188,13 +1188,12 @@ panelview .toolbarbutton-1,
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the --appmenu-profiles-theme-bg and --appmenu-profiles-theme-fg
|
/* Set the --themeBg and --themeFg variables inline on the toolbarbutton */
|
||||||
* variables inline on the toolbarbutton */
|
|
||||||
#appMenu-profiles-button.subviewbutton-iconic > .toolbarbutton-icon,
|
#appMenu-profiles-button.subviewbutton-iconic > .toolbarbutton-icon,
|
||||||
.subviewbutton-iconic.profile-item > .toolbarbutton-icon {
|
.subviewbutton-iconic.profile-item > .toolbarbutton-icon {
|
||||||
-moz-context-properties: fill, stroke;
|
-moz-context-properties: fill, stroke;
|
||||||
fill: var(--appmenu-profiles-theme-bg);
|
fill: var(--themeBg);
|
||||||
stroke: var(--appmenu-profiles-theme-fg);
|
stroke: var(--themeFg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adjust the Zoom toolbaritem padding to have its height the same as other toolbarbuttons,
|
/* Adjust the Zoom toolbaritem padding to have its height the same as other toolbarbuttons,
|
||||||
@@ -2222,8 +2221,8 @@ radiogroup:focus-visible > .subviewradio[focused="true"] {
|
|||||||
width: 75px;
|
width: 75px;
|
||||||
height: 75px;
|
height: 75px;
|
||||||
-moz-context-properties: fill, stroke;
|
-moz-context-properties: fill, stroke;
|
||||||
fill: var(--appmenu-profiles-theme-bg);
|
fill: var(--themeBg);
|
||||||
stroke: var(--appmenu-profiles-theme-fg);
|
stroke: var(--themeFg);
|
||||||
border: 4px solid var(--panel-background);
|
border: 4px solid var(--panel-background);
|
||||||
border-radius: 40px;
|
border-radius: 40px;
|
||||||
}
|
}
|
||||||
@@ -2235,7 +2234,7 @@ radiogroup:focus-visible > .subviewradio[focused="true"] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#half-height-profile {
|
#half-height-profile {
|
||||||
background: var(--appmenu-profiles-theme-bg);
|
background: var(--themeBg);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 50%;
|
height: 50%;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user