Bug 760940 - Bookmarks and history menus behave incorrectly due to non-node weak map keys. r=mak
This commit is contained in:
@@ -68,7 +68,7 @@ PlacesViewBase.prototype = {
|
|||||||
if (val) {
|
if (val) {
|
||||||
this._resultNode = val.root;
|
this._resultNode = val.root;
|
||||||
this._rootElt._placesNode = this._resultNode;
|
this._rootElt._placesNode = this._resultNode;
|
||||||
this._domNodes = new WeakMap();
|
this._domNodes = new Map();
|
||||||
this._domNodes.set(this._resultNode, this._rootElt);
|
this._domNodes.set(this._resultNode, this._rootElt);
|
||||||
|
|
||||||
// This calls _rebuild through invalidateContainer.
|
// This calls _rebuild through invalidateContainer.
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ function PlacesController(aView) {
|
|||||||
return Services.dirsvc.get("ProfD", Ci.nsIFile).leafName;
|
return Services.dirsvc.get("ProfD", Ci.nsIFile).leafName;
|
||||||
});
|
});
|
||||||
|
|
||||||
this._cachedLivemarkInfoObjects = new WeakMap();
|
this._cachedLivemarkInfoObjects = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
PlacesController.prototype = {
|
PlacesController.prototype = {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ PlacesTreeView.prototype = {
|
|||||||
// Bug 761494:
|
// Bug 761494:
|
||||||
// ----------
|
// ----------
|
||||||
// Some addons use methods from nsINavHistoryResultObserver and
|
// Some addons use methods from nsINavHistoryResultObserver and
|
||||||
// nsINavHistoryResultTreeViewer, without QIing to these intefaces first.
|
// nsINavHistoryResultTreeViewer, without QIing to these interfaces first.
|
||||||
// That's not a problem when the view is retrieved through the
|
// That's not a problem when the view is retrieved through the
|
||||||
// <tree>.view getter (which returns the wrappedJSObject of this object),
|
// <tree>.view getter (which returns the wrappedJSObject of this object),
|
||||||
// it raises an issue when the view retrieved through the treeBoxObject.view
|
// it raises an issue when the view retrieved through the treeBoxObject.view
|
||||||
@@ -153,12 +153,21 @@ PlacesTreeView.prototype = {
|
|||||||
_getRowForNode:
|
_getRowForNode:
|
||||||
function PTV__getRowForNode(aNode, aForceBuild, aParentRow, aNodeIndex) {
|
function PTV__getRowForNode(aNode, aForceBuild, aParentRow, aNodeIndex) {
|
||||||
if (aNode == this._rootNode)
|
if (aNode == this._rootNode)
|
||||||
throw "The root node is never visible";
|
throw new Error("The root node is never visible");
|
||||||
|
|
||||||
let ancestors = PlacesUtils.nodeAncestors(aNode);
|
// A node is removed form the view either if it has no parent or if its
|
||||||
for (let ancestor in ancestors) {
|
// root-ancestor is not the root node (in which case that's the node
|
||||||
|
// for which nodeRemoved was called).
|
||||||
|
let ancestors = [x for each (x in PlacesUtils.nodeAncestors(aNode))];
|
||||||
|
if (ancestors.length == 0 ||
|
||||||
|
ancestors[ancestors.length - 1] != this._rootNode) {
|
||||||
|
throw new Error("Removed node passed to _getRowForNode");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure that the entire chain is open, otherwise that node is invisible.
|
||||||
|
for (let ancestor of ancestors) {
|
||||||
if (!ancestor.containerOpen)
|
if (!ancestor.containerOpen)
|
||||||
throw "Invisible node passed to _getRowForNode";
|
throw new Error("Invisible node passed to _getRowForNode");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Non-plain containers are initially built with their contents.
|
// Non-plain containers are initially built with their contents.
|
||||||
@@ -1097,7 +1106,7 @@ PlacesTreeView.prototype = {
|
|||||||
if (val) {
|
if (val) {
|
||||||
this._result = val;
|
this._result = val;
|
||||||
this._rootNode = this._result.root;
|
this._rootNode = this._result.root;
|
||||||
this._cellProperties = new WeakMap();
|
this._cellProperties = new Map();
|
||||||
this._cuttingNodes = new Set();
|
this._cuttingNodes = new Set();
|
||||||
}
|
}
|
||||||
else if (this._result) {
|
else if (this._result) {
|
||||||
|
|||||||
@@ -663,8 +663,8 @@ function Livemark(aLivemarkInfo)
|
|||||||
this._status = Ci.mozILivemark.STATUS_READY;
|
this._status = Ci.mozILivemark.STATUS_READY;
|
||||||
|
|
||||||
// Hash of resultObservers, hashed by container.
|
// Hash of resultObservers, hashed by container.
|
||||||
this._resultObservers = new WeakMap();
|
this._resultObservers = new Map();
|
||||||
// This keeps a list of the containers used as keys in the weakmap, since
|
// This keeps a list of the containers used as keys in the map, since
|
||||||
// it's not iterable. In future may use an iterable Map.
|
// it's not iterable. In future may use an iterable Map.
|
||||||
this._resultObserversList = [];
|
this._resultObserversList = [];
|
||||||
|
|
||||||
@@ -674,7 +674,7 @@ function Livemark(aLivemarkInfo)
|
|||||||
|
|
||||||
// Keeps a separate array of nodes for each requesting container, hashed by
|
// Keeps a separate array of nodes for each requesting container, hashed by
|
||||||
// the container itself.
|
// the container itself.
|
||||||
this._nodes = new WeakMap();
|
this._nodes = new Map();
|
||||||
|
|
||||||
this._guid = "";
|
this._guid = "";
|
||||||
this._lastModified = 0;
|
this._lastModified = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user