зеркало из https://github.com/mozilla/gecko-dev.git
Bug 940946 - [Australis] items in the navbar without the removable attribute shouldn't be removable in customize mode either, r=jaws
This commit is contained in:
Родитель
9d76a4fd35
Коммит
2158099b53
|
@ -867,26 +867,29 @@ let CustomizableUIInternal = {
|
|||
if (node) {
|
||||
let parent = node.parentNode;
|
||||
while (parent && !(parent.customizationTarget ||
|
||||
parent.localName == "toolbarpaletteitem")) {
|
||||
parent == aWindow.gNavToolbox.palette)) {
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
|
||||
if (parent && ((parent.customizationTarget == node.parentNode &&
|
||||
if (parent) {
|
||||
let nodeInArea = node.parentNode.localName == "toolbarpaletteitem" ?
|
||||
node.parentNode : node;
|
||||
// Check if we're in a customization target, or in the palette:
|
||||
if ((parent.customizationTarget == nodeInArea.parentNode &&
|
||||
gBuildWindows.get(aWindow).has(parent.toolbox)) ||
|
||||
parent.localName == "toolbarpaletteitem")) {
|
||||
aWindow.gNavToolbox.palette == nodeInArea.parentNode) {
|
||||
// Normalize the removable attribute. For backwards compat, if
|
||||
// the widget is not defined in a toolbox palette then absence
|
||||
// the widget is not located in a toolbox palette then absence
|
||||
// of the "removable" attribute means it is not removable.
|
||||
if (!node.hasAttribute("removable")) {
|
||||
parent = parent.localName == "toolbarpaletteitem" ? parent.parentNode : parent;
|
||||
// If we first see this in customization mode, it may be in the
|
||||
// customization palette instead of the toolbox palette.
|
||||
node.setAttribute("removable", !parent.customizationTarget);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let toolboxes = gBuildWindows.get(aWindow);
|
||||
for (let toolbox of toolboxes) {
|
||||
|
@ -896,8 +899,8 @@ let CustomizableUIInternal = {
|
|||
let node = toolbox.palette.querySelector(idToSelector(aId));
|
||||
if (node) {
|
||||
// Normalize the removable attribute. For backwards compat, this
|
||||
// is optional if the widget is defined in the toolbox palette,
|
||||
// and defaults to *true*, unlike if it was defined elsewhere.
|
||||
// is optional if the widget is located in the toolbox palette,
|
||||
// and defaults to *true*, unlike if it was located elsewhere.
|
||||
if (!node.hasAttribute("removable")) {
|
||||
node.setAttribute("removable", true);
|
||||
}
|
||||
|
|
|
@ -36,5 +36,6 @@ skip-if = true
|
|||
skip-if = os == "mac"
|
||||
|
||||
[browser_938980_navbar_collapsed.js]
|
||||
[browser_940946_removable_from_navbar_customizemode.js]
|
||||
[browser_941083_invalidate_wrapper_cache_createWidget.js]
|
||||
[browser_panel_toggle.js]
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/* 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/. */
|
||||
|
||||
const kTestBtnId = "test-removable-navbar-customize-mode";
|
||||
|
||||
let gTests = [
|
||||
{
|
||||
desc: "Items without the removable attribute in the navbar should be considered non-removable",
|
||||
setup: function() {
|
||||
let btn = createDummyXULButton(kTestBtnId, "Test removable in navbar in customize mode");
|
||||
document.getElementById("nav-bar").customizationTarget.appendChild(btn);
|
||||
return startCustomizing();
|
||||
},
|
||||
run: function() {
|
||||
ok(!CustomizableUI.isWidgetRemovable(kTestBtnId), "Widget should not be considered removable");
|
||||
},
|
||||
teardown: function() {
|
||||
yield endCustomizing();
|
||||
document.getElementById(kTestBtnId).remove();
|
||||
}
|
||||
},
|
||||
];
|
||||
function asyncCleanup() {
|
||||
yield endCustomizing();
|
||||
yield resetCustomization();
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
runTests(gTests, asyncCleanup);
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче