mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 17:16:12 +00:00
Backout bug 989609 (48e5925d8c81) for suspected leak in bc1 on CLOSED TREE.
This commit is contained in:
parent
6fc380cde2
commit
40a13dcd87
@ -1594,12 +1594,6 @@ let CustomizableUIInternal = {
|
|||||||
aPosition = placements.length;
|
aPosition = placements.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
let widget = gPalette.get(aWidgetId);
|
|
||||||
if (widget) {
|
|
||||||
widget.currentPosition = aPosition;
|
|
||||||
widget.currentArea = oldPlacement.area;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aPosition == oldPlacement.position) {
|
if (aPosition == oldPlacement.position) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1612,6 +1606,11 @@ let CustomizableUIInternal = {
|
|||||||
}
|
}
|
||||||
placements.splice(aPosition, 0, aWidgetId);
|
placements.splice(aPosition, 0, aWidgetId);
|
||||||
|
|
||||||
|
let widget = gPalette.get(aWidgetId);
|
||||||
|
if (widget) {
|
||||||
|
widget.currentPosition = aPosition;
|
||||||
|
}
|
||||||
|
|
||||||
gDirty = true;
|
gDirty = true;
|
||||||
gDirtyAreaCache.add(oldPlacement.area);
|
gDirtyAreaCache.add(oldPlacement.area);
|
||||||
|
|
||||||
@ -1657,25 +1656,19 @@ let CustomizableUIInternal = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
restoreStateForArea: function(aArea, aLegacyState) {
|
restoreStateForArea: function(aArea, aLegacyState) {
|
||||||
let placementsPreexisted = gPlacements.has(aArea);
|
if (gPlacements.has(aArea)) {
|
||||||
|
// Already restored.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.beginBatchUpdate();
|
this.beginBatchUpdate();
|
||||||
try {
|
try {
|
||||||
gRestoring = true;
|
gRestoring = true;
|
||||||
|
|
||||||
let restored = false;
|
let restored = false;
|
||||||
if (placementsPreexisted) {
|
gPlacements.set(aArea, []);
|
||||||
LOG("Restoring " + aArea + " from pre-existing placements");
|
|
||||||
for (let [position, id] in Iterator(gPlacements.get(aArea))) {
|
|
||||||
this.moveWidgetWithinArea(id, position);
|
|
||||||
}
|
|
||||||
gDirty = false;
|
|
||||||
restored = true;
|
|
||||||
} else {
|
|
||||||
gPlacements.set(aArea, []);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!restored && gSavedState && aArea in gSavedState.placements) {
|
if (gSavedState && aArea in gSavedState.placements) {
|
||||||
LOG("Restoring " + aArea + " from saved state");
|
LOG("Restoring " + aArea + " from saved state");
|
||||||
let placements = gSavedState.placements[aArea];
|
let placements = gSavedState.placements[aArea];
|
||||||
for (let id of placements)
|
for (let id of placements)
|
||||||
|
@ -95,7 +95,6 @@ skip-if = os == "linux"
|
|||||||
[browser_981418-widget-onbeforecreated-handler.js]
|
[browser_981418-widget-onbeforecreated-handler.js]
|
||||||
[browser_985815_propagate_setToolbarVisibility.js]
|
[browser_985815_propagate_setToolbarVisibility.js]
|
||||||
[browser_981305_separator_insertion.js]
|
[browser_981305_separator_insertion.js]
|
||||||
[browser_989609_bootstrapped_custom_toolbar.js]
|
|
||||||
[browser_987177_destroyWidget_xul.js]
|
[browser_987177_destroyWidget_xul.js]
|
||||||
[browser_987177_xul_wrapper_updating.js]
|
[browser_987177_xul_wrapper_updating.js]
|
||||||
[browser_987492_window_api.js]
|
[browser_987492_window_api.js]
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
/* 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/. */
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const kTestBarID = "testBar";
|
|
||||||
const kWidgetID = "characterencoding-button";
|
|
||||||
|
|
||||||
function createTestBar() {
|
|
||||||
let testBar = document.createElement("toolbar");
|
|
||||||
testBar.id = kTestBarID;
|
|
||||||
testBar.setAttribute("customizable", "true");
|
|
||||||
CustomizableUI.registerArea(kTestBarID,
|
|
||||||
{ type: CustomizableUI.TYPE_TOOLBAR, legacy: false }
|
|
||||||
);
|
|
||||||
gNavToolbox.appendChild(testBar);
|
|
||||||
return testBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function that does the following:
|
|
||||||
*
|
|
||||||
* 1) Creates a custom toolbar and registers it
|
|
||||||
* with CustomizableUI.
|
|
||||||
* 2) Adds the widget with ID aWidgetID to that new
|
|
||||||
* toolbar.
|
|
||||||
* 3) Enters customize mode and makes sure that the
|
|
||||||
* widget is still in the right toolbar.
|
|
||||||
* 4) Exits customize mode, then removes and deregisters
|
|
||||||
* the custom toolbar.
|
|
||||||
* 5) Checks that the widget has no placement.
|
|
||||||
* 6) Re-adds and re-registers a custom toolbar with the same
|
|
||||||
* ID as the first one.
|
|
||||||
* 7) Enters customize mode and checks that the widget is
|
|
||||||
* properly back in the toolbar.
|
|
||||||
* 8) Exits customize mode, removes and de-registers the
|
|
||||||
* toolbar, and resets the toolbars to default.
|
|
||||||
*/
|
|
||||||
function checkRestoredPresence(aWidgetID) {
|
|
||||||
return Task.spawn(function* () {
|
|
||||||
let testBar = createTestBar();
|
|
||||||
CustomizableUI.addWidgetToArea(aWidgetID, kTestBarID);
|
|
||||||
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
|
|
||||||
is(placement.area, kTestBarID,
|
|
||||||
"Expected " + aWidgetID + " to be in the test toolbar");
|
|
||||||
|
|
||||||
CustomizableUI.unregisterArea(testBar.id);
|
|
||||||
testBar.remove();
|
|
||||||
|
|
||||||
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
|
|
||||||
is(placement, null, "Expected " + aWidgetID + " to be in the palette");
|
|
||||||
|
|
||||||
testBar = createTestBar();
|
|
||||||
|
|
||||||
yield startCustomizing();
|
|
||||||
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
|
|
||||||
is(placement.area, kTestBarID,
|
|
||||||
"Expected " + aWidgetID + " to be in the test toolbar");
|
|
||||||
yield endCustomizing();
|
|
||||||
|
|
||||||
CustomizableUI.unregisterArea(testBar.id);
|
|
||||||
testBar.remove();
|
|
||||||
|
|
||||||
yield resetCustomization();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
add_task(function* () {
|
|
||||||
yield checkRestoredPresence("downloads-button")
|
|
||||||
});
|
|
||||||
|
|
||||||
add_task(function* () {
|
|
||||||
yield checkRestoredPresence("characterencoding-button")
|
|
||||||
});
|
|
Loading…
Reference in New Issue
Block a user