mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 944887 - Australis' destroyWidget functionality should also remove the node if it's in the palette, r=jaws
This commit is contained in:
parent
513a8e1cc7
commit
8a705801f0
@ -636,7 +636,7 @@ let CustomizableUIInternal = {
|
||||
}
|
||||
|
||||
LOG("No node for " + aWidgetId + " found.");
|
||||
return [];
|
||||
return [null, null];
|
||||
},
|
||||
|
||||
registerMenuPanel: function(aPanel) {
|
||||
@ -1877,27 +1877,23 @@ let CustomizableUIInternal = {
|
||||
// This will not remove the widget from gPlacements - we want to keep the
|
||||
// setting so the widget gets put back in it's old position if/when it
|
||||
// returns.
|
||||
|
||||
let area = widget.currentArea;
|
||||
let buildAreaNodes = area && gBuildAreas.get(area);
|
||||
if (buildAreaNodes) {
|
||||
for (let buildNode of buildAreaNodes) {
|
||||
let widgetNode = buildNode.ownerDocument.getElementById(aWidgetId);
|
||||
let windowCache = gSingleWrapperCache.get(buildNode.ownerDocument.defaultView);
|
||||
if (windowCache) {
|
||||
windowCache.delete(aWidgetId);
|
||||
}
|
||||
if (widgetNode) {
|
||||
widgetNode.parentNode.removeChild(widgetNode);
|
||||
}
|
||||
if (widget.type == "view") {
|
||||
let viewNode = buildNode.ownerDocument.getElementById(widget.viewId);
|
||||
if (viewNode) {
|
||||
for (let eventName of kSubviewEvents) {
|
||||
let handler = "on" + eventName;
|
||||
if (typeof widget[handler] == "function") {
|
||||
viewNode.removeEventListener(eventName, widget[handler], false);
|
||||
}
|
||||
for (let [window, ] of gBuildWindows) {
|
||||
let windowCache = gSingleWrapperCache.get(window);
|
||||
if (windowCache) {
|
||||
windowCache.delete(aWidgetId);
|
||||
}
|
||||
let widgetNode = window.document.getElementById(aWidgetId) ||
|
||||
window.gNavToolbox.palette.querySelector(idToSelector(aWidgetId));
|
||||
if (widgetNode) {
|
||||
widgetNode.remove();
|
||||
}
|
||||
if (widget.type == "view") {
|
||||
let viewNode = window.document.getElementById(widget.viewId);
|
||||
if (viewNode) {
|
||||
for (let eventName of kSubviewEvents) {
|
||||
let handler = "on" + eventName;
|
||||
if (typeof widget[handler] == "function") {
|
||||
viewNode.removeEventListener(eventName, widget[handler], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,4 +43,5 @@ skip-if = os == "mac"
|
||||
[browser_941083_invalidate_wrapper_cache_createWidget.js]
|
||||
[browser_942581_unregisterArea_keeps_placements.js]
|
||||
[browser_943683_migration_test.js]
|
||||
[browser_944887_destroyWidget_should_destroy_in_palette.js]
|
||||
[browser_panel_toggle.js]
|
||||
|
@ -0,0 +1,25 @@
|
||||
/* 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 kWidgetId = "test-destroy-in-palette";
|
||||
|
||||
let gTests = [
|
||||
{
|
||||
desc: "Check destroyWidget destroys the node if it's in the palette",
|
||||
run: function() {
|
||||
CustomizableUI.createWidget({id: kWidgetId, label: "Test destroying widgets in palette."});
|
||||
yield startCustomizing();
|
||||
yield endCustomizing();
|
||||
ok(gNavToolbox.palette.querySelector("#" + kWidgetId), "Widget still exists in palette.");
|
||||
CustomizableUI.destroyWidget(kWidgetId);
|
||||
ok(!gNavToolbox.palette.querySelector("#" + kWidgetId), "Widget no longer exists in palette.");
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
runTests(gTests);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user