mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 641531 - Close Places containers after use (Sync changes)
r=philikon
This commit is contained in:
parent
74eda3623a
commit
8da8e3f7d5
@ -529,22 +529,27 @@ BookmarksStore.prototype = {
|
||||
}
|
||||
|
||||
tags.containerOpen = true;
|
||||
for (let i = 0; i < tags.childCount; i++) {
|
||||
let child = tags.getChild(i);
|
||||
if (child.title == tag) {
|
||||
// Found the tag, so fix up the query to use the right id.
|
||||
this._log.debug("Tag query folder: " + tag + " = " + child.itemId);
|
||||
|
||||
this._log.trace("Replacing folders in: " + uri);
|
||||
for each (let q in queriesRef.value)
|
||||
q.setFolders([child.itemId], 1);
|
||||
|
||||
record.bmkUri = Svc.History.queriesToQueryString(queriesRef.value,
|
||||
queryCountRef.value,
|
||||
optionsRef.value);
|
||||
return;
|
||||
try {
|
||||
for (let i = 0; i < tags.childCount; i++) {
|
||||
let child = tags.getChild(i);
|
||||
if (child.title == tag) {
|
||||
// Found the tag, so fix up the query to use the right id.
|
||||
this._log.debug("Tag query folder: " + tag + " = " + child.itemId);
|
||||
|
||||
this._log.trace("Replacing folders in: " + uri);
|
||||
for each (let q in queriesRef.value)
|
||||
q.setFolders([child.itemId], 1);
|
||||
|
||||
record.bmkUri = Svc.History.queriesToQueryString(queriesRef.value,
|
||||
queryCountRef.value,
|
||||
optionsRef.value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
tags.containerOpen = false;
|
||||
}
|
||||
},
|
||||
|
||||
applyIncoming: function BStore_applyIncoming(record) {
|
||||
@ -1245,12 +1250,16 @@ BookmarksStore.prototype = {
|
||||
!this._ls.isLivemark(node.itemId)) {
|
||||
node.QueryInterface(Ci.nsINavHistoryQueryResultNode);
|
||||
node.containerOpen = true;
|
||||
|
||||
// Remember all the children GUIDs and recursively get more
|
||||
for (let i = 0; i < node.childCount; i++) {
|
||||
let child = node.getChild(i);
|
||||
items[this.GUIDForId(child.itemId)] = true;
|
||||
this._getChildren(child, items);
|
||||
try {
|
||||
// Remember all the children GUIDs and recursively get more
|
||||
for (let i = 0; i < node.childCount; i++) {
|
||||
let child = node.getChild(i);
|
||||
items[this.GUIDForId(child.itemId)] = true;
|
||||
this._getChildren(child, items);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
node.containerOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,8 @@ function run_test() {
|
||||
if (child.title == "bar")
|
||||
tagID = child.itemId;
|
||||
}
|
||||
|
||||
tags.containerOpen = false;
|
||||
|
||||
_("Tag ID: " + tagID);
|
||||
do_check_eq(tagRecord.bmkUri, uri.replace("499", tagID));
|
||||
|
||||
|
@ -147,13 +147,16 @@ function test_copying_places() {
|
||||
do_check_true(!!b1GUID);
|
||||
|
||||
_("Make sure the destination folder is empty.");
|
||||
do_check_eq(PlacesUtils.getFolderContents(f2, false, true).root.childCount, 0);
|
||||
let root = PlacesUtils.getFolderContents(f2, false, true).root;
|
||||
do_check_eq(root.childCount, 0);
|
||||
root.containerOpen = false;
|
||||
|
||||
let f1Node = PlacesUtils.getFolderContents(f1, false, false);
|
||||
_("Node to copy: " + f1Node.root.itemId);
|
||||
let f1Node = PlacesUtils.getFolderContents(f1, false, false).root;
|
||||
_("Node to copy: " + f1Node.itemId);
|
||||
|
||||
let serialized = PlacesUtils.wrapNode(f1Node.root, PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER);
|
||||
let serialized = PlacesUtils.wrapNode(f1Node, PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER);
|
||||
_("Serialized to " + serialized);
|
||||
f1Node.containerOpen = false;
|
||||
|
||||
let raw = PlacesUtils.unwrapNodes(serialized, PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER).shift();
|
||||
let transaction = getFolderCopyTransaction(raw, f2, Svc.Bookmark.DEFAULT_INDEX, true);
|
||||
@ -162,11 +165,11 @@ function test_copying_places() {
|
||||
ptm.doTransaction(transaction);
|
||||
|
||||
_("Verify that items have been copied.");
|
||||
let f2Node = PlacesUtils.getFolderContents(f2, false, true);
|
||||
do_check_eq(f2Node.root.childCount, 1);
|
||||
let f2Node = PlacesUtils.getFolderContents(f2, false, true).root;
|
||||
do_check_eq(f2Node.childCount, 1);
|
||||
|
||||
_("Verify that the copied folder has different GUIDs.");
|
||||
let c0 = f2Node.root.getChild(0);
|
||||
let c0 = f2Node.getChild(0);
|
||||
do_check_eq(c0.title, "Folder One");
|
||||
do_check_neq(c0.itemId, f1);
|
||||
do_check_neq(store.GUIDForId(c0.itemId), f1GUID);
|
||||
@ -183,6 +186,8 @@ function test_copying_places() {
|
||||
do_check_neq(b0.itemId, b1);
|
||||
do_check_neq(store.GUIDForId(b0.itemId), b1GUID);
|
||||
|
||||
c0.containerOpen = false;
|
||||
f2Node.containerOpen = false;
|
||||
} finally {
|
||||
tracker.clearChangedIDs();
|
||||
Svc.Obs.notify("weave:engine:stop-tracking");
|
||||
|
@ -15,6 +15,7 @@ function queryPlaces(uri, options) {
|
||||
let results = [];
|
||||
for (let i = 0; i < res.root.childCount; i++)
|
||||
results.push(res.root.getChild(i));
|
||||
res.root.containerOpen = false;
|
||||
return results;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user