Bug 1101817 - Part 1: Remove usages of WeakMap.prototype.clear from Gecko. r=yzen,mak,yoric,gijs,jlongster

This commit is contained in:
Till Schneidereit 2016-01-04 13:06:50 +01:00
parent 43adf056d6
commit bace318903
10 changed files with 16 additions and 15 deletions

View File

@ -77,7 +77,7 @@ this.EventManager.prototype = {
Logger.debug('EventManager.stop');
AccessibilityEventObserver.removeListener(this);
try {
this._preDialogPosition.clear();
this._preDialogPosition = new WeakMap();
this.webProgress.removeProgressListener(this);
this.removeEventListener('wheel', this, true);
this.removeEventListener('scroll', this, true);
@ -618,7 +618,7 @@ const AccessibilityEventObserver = {
}
Services.obs.removeObserver(this, 'accessible-event');
// Clean up all registered event managers.
this.eventManagers.clear();
this.eventManagers = new WeakMap();
this.listenerCount = 0;
this.started = false;
},

View File

@ -65,7 +65,6 @@ var FullZoom = {
}
// This should be nulled after initialization.
this._initialLocations.clear();
this._initialLocations = null;
},

View File

@ -1693,7 +1693,7 @@ CustomizeMode.prototype = {
let draggedWrapper = document.getElementById("wrapper-" + draggedItemId);
let originArea = this._getCustomizableParent(draggedWrapper);
if (this._dragSizeMap) {
this._dragSizeMap.clear();
this._dragSizeMap = new WeakMap();
}
// Do nothing if the target area or origin area are not customizable.
if (!targetArea || !originArea) {

View File

@ -410,7 +410,7 @@ var DragPositionManager = {
},
stop: function() {
gManagers.clear();
gManagers = new WeakMap();
},
getManagerForArea: function(aArea) {

View File

@ -230,7 +230,7 @@ FrameTreeInternal.prototype = {
if (stateFlags & Ci.nsIWebProgressListener.STATE_START) {
// Clear the list of frames until we can recollect it.
this._frames.clear();
this._frames = new WeakMap();
// Notify observers that the frame tree has been reset.
this.notifyObservers("onFrameTreeReset");

View File

@ -1575,7 +1575,7 @@ var SessionStoreInternal = {
}
this._clearRestoringWindows();
this._saveableClosedWindowData.clear();
this._saveableClosedWindowData = new WeakSet();
},
/**
@ -4330,7 +4330,7 @@ var DirtyWindows = {
},
clear: function (window) {
this._data.clear();
this._data = new WeakMap();
}
};

View File

@ -93,6 +93,9 @@ this.UITour = {
urlbarCapture: new WeakMap(),
appMenuOpenForAnnotation: new Set(),
availableTargetsCache: new WeakMap(),
clearAvailableTargetsCache() {
this.availableTargetsCache = new WeakMap();
},
_annotationPanelMutationObservers: new WeakMap(),
@ -285,7 +288,7 @@ this.UITour = {
"onAreaReset",
];
CustomizableUI.addListener(listenerMethods.reduce((listener, method) => {
listener[method] = () => this.availableTargetsCache.clear();
listener[method] = () => this.clearAvailableTargetsCache();
return listener;
}, {}));
},
@ -1582,7 +1585,7 @@ this.UITour = {
popup.addEventListener("popuphidden", this.onPanelHidden);
popup.setAttribute("noautohide", true);
this.availableTargetsCache.clear();
this.clearAvailableTargetsCache();
if (popup.state == "open") {
if (aOpenCallback) {
@ -1611,7 +1614,7 @@ this.UITour = {
panel.setAttribute("noautohide", true);
if (panel.state != "open") {
this.recreatePopup(panel);
this.availableTargetsCache.clear();
this.clearAvailableTargetsCache();
}
// An event object is expected but we don't want to toggle the panel with a click if the panel
@ -1731,7 +1734,7 @@ this.UITour = {
onPanelHidden: function(aEvent) {
aEvent.target.removeAttribute("noautohide");
UITour.recreatePopup(aEvent.target);
UITour.availableTargetsCache.clear();
UITour.clearAvailableTargetsCache();
},
recreatePopup: function(aPanel) {

View File

@ -114,7 +114,7 @@ var SourceUtils = {
clearCache: function() {
this._labelsCache.clear();
this._groupsCache.clear();
this._minifiedCache.clear();
this._minifiedCache = new WeakMap();
},
/**

View File

@ -1509,7 +1509,6 @@ EventTooltip.prototype = {
editor.destroy();
}
this._tooltip.eventEditors.clear();
this._tooltip.eventEditors = null;
}

View File

@ -155,7 +155,7 @@ VariablesView.prototype = {
}
this._store.length = 0;
this._itemsByElement.clear();
this._itemsByElement = new WeakMap();
this._prevHierarchy = this._currHierarchy;
this._currHierarchy = new Map(); // Don't clear, this is just simple swapping.