зеркало из https://github.com/mozilla/gecko-dev.git
Bug 941321 - try-finally all of Australis' begin/endBatchUpdate calls, r=mconley
--HG-- extra : rebase_source : 06102ada89853f201baacbca37dc9ced1243acca
This commit is contained in:
Родитель
225944ff63
Коммит
6a64c70da7
|
@ -220,9 +220,12 @@ const PanelUI = {
|
|||
CustomizableUI.registerMenuPanel(this.contents);
|
||||
} else {
|
||||
this.beginBatchUpdate();
|
||||
try {
|
||||
CustomizableUI.registerMenuPanel(this.contents);
|
||||
} finally {
|
||||
this.endBatchUpdate();
|
||||
}
|
||||
}
|
||||
this.panel.hidden = false;
|
||||
}.bind(this)).then(null, Cu.reportError);
|
||||
|
||||
|
|
|
@ -193,6 +193,7 @@
|
|||
// Get a list of items only in the new list
|
||||
let newIds = [id for (id of newVal) if (oldIds.indexOf(id) == -1)];
|
||||
CustomizableUI.beginBatchUpdate();
|
||||
try {
|
||||
for (let newId of newIds) {
|
||||
oldIds = CustomizableUI.getWidgetIdsInArea(this.id);
|
||||
let nextId = newId;
|
||||
|
@ -215,7 +216,9 @@
|
|||
for (let removedId of removedIds) {
|
||||
CustomizableUI.removeWidgetFromArea(removedId);
|
||||
}
|
||||
} finally {
|
||||
CustomizableUI.endBatchUpdate();
|
||||
}
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
|
|
|
@ -279,6 +279,7 @@ let CustomizableUIInternal = {
|
|||
|
||||
// Move all the widgets out
|
||||
this.beginBatchUpdate();
|
||||
try {
|
||||
let placements = gPlacements.get(aName);
|
||||
placements.forEach(this.removeWidgetFromArea, this);
|
||||
|
||||
|
@ -287,7 +288,9 @@ let CustomizableUIInternal = {
|
|||
gPlacements.delete(aName);
|
||||
gFuturePlacements.delete(aName);
|
||||
gBuildAreas.delete(aName);
|
||||
} finally {
|
||||
this.endBatchUpdate(true);
|
||||
}
|
||||
},
|
||||
|
||||
registerToolbarNode: function(aToolbar, aExistingChildren) {
|
||||
|
@ -303,6 +306,7 @@ let CustomizableUIInternal = {
|
|||
}
|
||||
|
||||
this.beginBatchUpdate();
|
||||
try {
|
||||
let placements = gPlacements.get(area);
|
||||
if (!placements && areaProperties.has("legacy")) {
|
||||
let legacyState = aToolbar.getAttribute("currentset");
|
||||
|
@ -340,7 +344,9 @@ let CustomizableUIInternal = {
|
|||
this.buildArea(area, placements, aToolbar);
|
||||
}
|
||||
aToolbar.setAttribute("currentset", placements.join(","));
|
||||
} finally {
|
||||
this.endBatchUpdate();
|
||||
}
|
||||
},
|
||||
|
||||
buildArea: function(aArea, aPlacements, aAreaNode) {
|
||||
|
@ -354,14 +360,15 @@ let CustomizableUIInternal = {
|
|||
+ " to have a customizationTarget attribute.");
|
||||
}
|
||||
|
||||
this.beginBatchUpdate();
|
||||
|
||||
// Restore nav-bar visibility since it may have been hidden
|
||||
// through a migration path (bug 938980) or an add-on.
|
||||
if (aArea == CustomizableUI.AREA_NAVBAR) {
|
||||
aAreaNode.collapsed = false;
|
||||
}
|
||||
|
||||
this.beginBatchUpdate();
|
||||
|
||||
try {
|
||||
let currentNode = container.firstChild;
|
||||
let placementsToRemove = new Set();
|
||||
for (let id of aPlacements) {
|
||||
|
@ -456,8 +463,9 @@ let CustomizableUIInternal = {
|
|||
if (gResetting) {
|
||||
this.notifyListeners("onAreaReset", aArea);
|
||||
}
|
||||
|
||||
} finally {
|
||||
this.endBatchUpdate();
|
||||
}
|
||||
},
|
||||
|
||||
addPanelCloseListeners: function(aPanel) {
|
||||
|
@ -1382,6 +1390,7 @@ let CustomizableUIInternal = {
|
|||
}
|
||||
|
||||
this.beginBatchUpdate();
|
||||
try {
|
||||
gRestoring = true;
|
||||
|
||||
let restored = false;
|
||||
|
@ -1426,7 +1435,9 @@ let CustomizableUIInternal = {
|
|||
LOG("Placements for " + aArea + ":\n\t" + gPlacements.get(aArea).join("\n\t"));
|
||||
|
||||
gRestoring = false;
|
||||
} finally {
|
||||
this.endBatchUpdate();
|
||||
}
|
||||
},
|
||||
|
||||
saveState: function() {
|
||||
|
@ -1581,6 +1592,7 @@ let CustomizableUIInternal = {
|
|||
// seen before, then add it to its default area so it can be used.
|
||||
if (autoAdd && !widget.currentArea && !gSeenWidgets.has(widget.id)) {
|
||||
this.beginBatchUpdate();
|
||||
try {
|
||||
gSeenWidgets.add(widget.id);
|
||||
|
||||
if (widget.defaultArea) {
|
||||
|
@ -1590,10 +1602,11 @@ let CustomizableUIInternal = {
|
|||
this.addWidgetToArea(widget.id, widget.defaultArea);
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
this.endBatchUpdate(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.notifyListeners("onWidgetAfterCreation", widget.id, widget.currentArea);
|
||||
return widget.id;
|
||||
|
|
|
@ -93,6 +93,9 @@ CustomizeMode.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
let window = this.window;
|
||||
let document = this.document;
|
||||
|
||||
Task.spawn(function() {
|
||||
// We shouldn't start customize mode until after browser-delayed-startup has finished:
|
||||
if (!this.window.gBrowserInit.delayedStartupFinished) {
|
||||
|
@ -115,9 +118,6 @@ CustomizeMode.prototype = {
|
|||
this.dispatchToolboxEvent("beforecustomization");
|
||||
CustomizableUI.notifyStartCustomizing(this.window);
|
||||
|
||||
let window = this.window;
|
||||
let document = this.document;
|
||||
|
||||
// Add a keypress listener to the document so that we can quickly exit
|
||||
// customization mode when pressing ESC.
|
||||
document.addEventListener("keypress", this);
|
||||
|
@ -159,7 +159,6 @@ CustomizeMode.prototype = {
|
|||
}
|
||||
|
||||
this._showPanelCustomizationPlaceholders();
|
||||
CustomizableUI.addListener(this);
|
||||
|
||||
yield this._wrapToolbarItems();
|
||||
yield this.populatePalette();
|
||||
|
@ -184,11 +183,16 @@ CustomizeMode.prototype = {
|
|||
for (let toolbar of customizableToolbars)
|
||||
toolbar.setAttribute("customizing", true);
|
||||
|
||||
CustomizableUI.addListener(this);
|
||||
window.PanelUI.endBatchUpdate();
|
||||
this._customizing = true;
|
||||
this._transitioning = false;
|
||||
this.dispatchToolboxEvent("customizationready");
|
||||
}.bind(this)).then(null, ERROR);
|
||||
}.bind(this)).then(null, function(e) {
|
||||
ERROR(e);
|
||||
// We should ensure this has been called, and calling it again doesn't hurt:
|
||||
window.PanelUI.endBatchUpdate();
|
||||
});
|
||||
},
|
||||
|
||||
exit: function() {
|
||||
|
@ -298,7 +302,11 @@ CustomizeMode.prototype = {
|
|||
this._transitioning = false;
|
||||
this.dispatchToolboxEvent("aftercustomization");
|
||||
CustomizableUI.notifyEndCustomizing(this.window);
|
||||
}.bind(this)).then(null, ERROR);
|
||||
}.bind(this)).then(null, function(e) {
|
||||
ERROR(e);
|
||||
// We should ensure this has been called, and calling it again doesn't hurt:
|
||||
window.PanelUI.endBatchUpdate();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче