mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-22 12:04:38 +00:00
Bug 641531 - Close Places containers after use (mechanical changes)
rs=me
This commit is contained in:
parent
a9acca6336
commit
604caf65ce
@ -237,6 +237,7 @@ function test() {
|
||||
false, "cannot move a child of a read-only folder");
|
||||
is(PlacesControllerDragHelper.canMoveNode(childFolder),
|
||||
false, "cannot move a child node of a read-only folder node");
|
||||
readOnlyFolder.containerOpen = false;
|
||||
}
|
||||
});
|
||||
|
||||
@ -246,5 +247,6 @@ function test() {
|
||||
aTest.validate();
|
||||
});
|
||||
|
||||
rootNode.containerOpen = false;
|
||||
PlacesUtils.bookmarks.removeItem(rootId);
|
||||
}
|
||||
|
@ -78,6 +78,8 @@ function test() {
|
||||
var rawNode = PlacesUtils.unwrapNodes(serializedNode, PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER).shift();
|
||||
// confirm serialization
|
||||
ok(rawNode.type, "confirm json node");
|
||||
folderANode.containerOpen = false;
|
||||
|
||||
var transaction = PlacesUIUtils.makeTransaction(rawNode,
|
||||
PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER,
|
||||
testRootId,
|
||||
|
@ -67,7 +67,9 @@ function test() {
|
||||
if (!result.root.childCount) {
|
||||
return null;
|
||||
}
|
||||
return result.root.getChild(0);
|
||||
var node = result.root.getChild(0);
|
||||
result.root.containerOpen = false;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
|
@ -89,6 +89,7 @@ function run_test() {
|
||||
|
||||
do_check_eq(rootNode.childCount, 1);
|
||||
do_check_eq(rootNode.getChild(0).itemId, b1);
|
||||
rootNode.containerOpen = false;
|
||||
|
||||
// partial matches are okay
|
||||
query.searchTerms = "wal";
|
||||
@ -96,6 +97,7 @@ function run_test() {
|
||||
var rootNode = result.root;
|
||||
rootNode.containerOpen = true;
|
||||
do_check_eq(rootNode.childCount, 1);
|
||||
rootNode.containerOpen = false;
|
||||
|
||||
// case insensitive search term
|
||||
query.searchTerms = "WALRUS";
|
||||
@ -104,6 +106,7 @@ function run_test() {
|
||||
rootNode.containerOpen = true;
|
||||
do_check_eq(rootNode.childCount, 1);
|
||||
do_check_eq(rootNode.getChild(0).itemId, b1);
|
||||
rootNode.containerOpen = false;
|
||||
|
||||
// case insensitive tag
|
||||
query.searchTerms = "baboon";
|
||||
@ -112,4 +115,5 @@ function run_test() {
|
||||
rootNode.containerOpen = true;
|
||||
do_check_eq(rootNode.childCount, 1);
|
||||
do_check_eq(rootNode.getChild(0).itemId, b1);
|
||||
rootNode.containerOpen = false;
|
||||
}
|
||||
|
@ -136,10 +136,14 @@ function run_test() {
|
||||
do_check_eq(queryNode.childCount, 1);
|
||||
var child = queryNode.getChild(0);
|
||||
do_check_true(bookmarkURI.equals(uri(child.uri)));
|
||||
queryNode.containerOpen = false;
|
||||
|
||||
var queryNode2 = root.getChild(root.childCount-1);
|
||||
do_check_eq(queryNode2.type, queryNode2.RESULT_TYPE_QUERY);
|
||||
queryNode2.QueryInterface(Ci.nsINavHistoryContainerResultNode);
|
||||
queryNode2.containerOpen = true;
|
||||
do_check_eq(queryNode2.childCount, 0);
|
||||
queryNode.containerOpen = false;
|
||||
|
||||
root.containerOpen = false;
|
||||
}
|
||||
|
@ -110,6 +110,7 @@ function run_test() {
|
||||
node.QueryInterface(Ci.nsINavHistoryContainerResultNode);
|
||||
do_check_eq(node.containerOpen, false);
|
||||
}
|
||||
rootNode.containerOpen = false;
|
||||
}
|
||||
catch(ex) {
|
||||
do_throw("expandQueries=0 query error: " + ex);
|
||||
@ -162,6 +163,7 @@ function run_test() {
|
||||
bmsvc.DEFAULT_INDEX, searchTerm + "blah");
|
||||
do_check_eq(node.childCount, 1);
|
||||
}
|
||||
rootNode.containerOpen = false;
|
||||
}
|
||||
catch(ex) {
|
||||
do_throw("expandQueries=1 bookmarks query: " + ex);
|
||||
@ -222,6 +224,7 @@ function run_test() {
|
||||
// test live-update of query results - delete a history visit that matches the query
|
||||
bhist.removePage(uri("http://foo.com"));
|
||||
do_check_eq(node.childCount, 1);
|
||||
node.containerOpen = false;
|
||||
}
|
||||
|
||||
// test live-update of moved queries
|
||||
@ -243,6 +246,9 @@ function run_test() {
|
||||
var tmpFolderNode = root.getChild(1);
|
||||
do_throw("query was not removed");
|
||||
} catch(ex) {}
|
||||
|
||||
tmpFolderNode.containerOpen = false;
|
||||
rootNode.containerOpen = false;
|
||||
}
|
||||
catch(ex) {
|
||||
do_throw("expandQueries=1 bookmarks query: " + ex);
|
||||
|
@ -121,6 +121,7 @@ function runTest1( folderId ) {
|
||||
var node = rootNode.getChild( 0 );
|
||||
ok( node.uri == firstURL,
|
||||
"first livemark item is invalid value "+node.uri);
|
||||
rootNode.containerOpen = false;
|
||||
|
||||
/* second folder has no item */
|
||||
options = histsvc.getNewQueryOptions();
|
||||
@ -131,6 +132,7 @@ function runTest1( folderId ) {
|
||||
rootNode.containerOpen = true;
|
||||
cc = rootNode.childCount;
|
||||
ok( cc == 0, "second livemark is not empty" );
|
||||
rootNode.containerOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,6 +154,7 @@ function runTest2( folderId ) {
|
||||
var node = rootNode.getChild( 0 );
|
||||
ok( node.uri == secondURL,
|
||||
"second livemark item is invalid value "+node.uri);
|
||||
rootNode.containerOpen = false;
|
||||
|
||||
/* Check passed 2sec.
|
||||
We should check for 3s but are relaxing request to accomplish possible
|
||||
|
@ -389,7 +389,8 @@ function compareArrayToResult(aArray, aRoot) {
|
||||
function isInResult(aQueryData, aRoot) {
|
||||
var rv = false;
|
||||
var uri;
|
||||
if (!aRoot.containerOpen)
|
||||
var wasOpen = aRoot.containerOpen;
|
||||
if (!wasOpen)
|
||||
aRoot.containerOpen = true;
|
||||
|
||||
// If we have an array, pluck out the first item. If an object, pluc out the
|
||||
@ -406,6 +407,8 @@ function isInResult(aQueryData, aRoot) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!wasOpen)
|
||||
aRoot.containerOpen = false;
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -416,7 +419,8 @@ function isInResult(aQueryData, aRoot) {
|
||||
*/
|
||||
function displayResultSet(aRoot) {
|
||||
|
||||
if (!aRoot.containerOpen)
|
||||
var wasOpen = aRoot.containerOpen;
|
||||
if (!wasOpen)
|
||||
aRoot.containerOpen = true;
|
||||
|
||||
if (!aRoot.hasChildren) {
|
||||
@ -429,4 +433,6 @@ function displayResultSet(aRoot) {
|
||||
LOG("Result Set URI: " + aRoot.getChild(i).uri + " Title: " +
|
||||
aRoot.getChild(i).title + " Visit Time: " + aRoot.getChild(i).time);
|
||||
}
|
||||
if (!wasOpen)
|
||||
aRoot.containerOpen = false;
|
||||
}
|
||||
|
@ -65,6 +65,8 @@ function run_test() {
|
||||
// Results
|
||||
var result = PlacesUtils.history.executeQuery(query, options);
|
||||
var root = result.root;
|
||||
root.containerOpen = true;
|
||||
|
||||
displayResultSet(root);
|
||||
// The readonly folder should not be in our result set.
|
||||
do_check_eq(1, root.childCount);
|
||||
|
@ -139,4 +139,6 @@ function createTestData() {
|
||||
title: "mo,z" }];
|
||||
populateDB(change4);
|
||||
do_check_false(isInResult(change4, root));
|
||||
|
||||
root.containerOpen = false;
|
||||
}
|
||||
|
@ -151,4 +151,6 @@ function run_test() {
|
||||
title: "mo,z"}];
|
||||
populateDB(change4);
|
||||
do_check_false(isInResult(change4, root));
|
||||
|
||||
root.containerOpen = false;
|
||||
}
|
||||
|
@ -148,4 +148,6 @@
|
||||
title: "mo,z"}];
|
||||
populateDB(change4);
|
||||
do_check_false(isInResult(change4, root));
|
||||
|
||||
root.containerOpen = false;
|
||||
}
|
||||
|
@ -102,6 +102,10 @@ function run_test() {
|
||||
do_check_eq(sf2Node.childCount, 1);
|
||||
do_check_eq(sf2Node.getChild(0).itemId, b3);
|
||||
|
||||
sf2Node.containerOpen = false;
|
||||
sf1Node.containerOpen = false;
|
||||
root.containerOpen = false;
|
||||
|
||||
// bookmark query that should result in a flat list
|
||||
// because we specified max results
|
||||
var options = histsvc.getNewQueryOptions();
|
||||
@ -116,6 +120,7 @@ function run_test() {
|
||||
do_check_eq(root.getChild(0).itemId, b1);
|
||||
do_check_eq(root.getChild(1).itemId, b2);
|
||||
do_check_eq(root.getChild(2).itemId, b3);
|
||||
root.containerOpen = false;
|
||||
|
||||
// XXX TODO
|
||||
// test that if we have: more than one query,
|
||||
|
@ -57,7 +57,9 @@ function search_has_result(aTerms)
|
||||
var result = hs.executeQuery(query, options);
|
||||
var root = result.root;
|
||||
root.containerOpen = true;
|
||||
return (root.childCount == 1);
|
||||
var cc = root.childCount;
|
||||
root.containerOpen = false;
|
||||
return (cc == 1);
|
||||
}
|
||||
|
||||
function run_test()
|
||||
|
@ -76,7 +76,9 @@ function uri_in_db(aURI) {
|
||||
var result = histsvc.executeQuery(query, options);
|
||||
var root = result.root;
|
||||
root.containerOpen = true;
|
||||
return (root.childCount == 1);
|
||||
var cc = root.childCount;
|
||||
root.containerOpen = false;
|
||||
return (cc == 1);
|
||||
}
|
||||
|
||||
const TOTAL_SITES = 20;
|
||||
|
@ -119,6 +119,7 @@ function run_test() {
|
||||
do_check_eq(theTag.childCount, 1);
|
||||
var node = theTag.getChild(0);
|
||||
do_check_eq(node.title, "new title 1");
|
||||
theTag.containerOpen = false;
|
||||
root.containerOpen = false;
|
||||
|
||||
// Change bookmark 2 title.
|
||||
|
@ -63,4 +63,6 @@ function run_test() {
|
||||
PlacesUtils.bookmarks.removeItem(queryId);
|
||||
|
||||
do_check_eq(root.childCount, oldCount-1);
|
||||
|
||||
root.containerOpen = false;
|
||||
}
|
||||
|
@ -65,4 +65,6 @@ function run_test() {
|
||||
|
||||
// confirm the node was updated
|
||||
do_check_eq(queryNode.title, "foo");
|
||||
|
||||
root.containerOpen = false;
|
||||
}
|
||||
|
@ -80,4 +80,5 @@ function run_test() {
|
||||
do_check_eq(queryNode.title, "test query");
|
||||
queryNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);
|
||||
do_check_eq(queryNode.hasChildren, true);
|
||||
root.containerOpen = false;
|
||||
}
|
||||
|
@ -87,7 +87,9 @@ function uri_in_db(aURI) {
|
||||
var result = histsvc.executeQuery(query, options);
|
||||
var root = result.root;
|
||||
root.containerOpen = true;
|
||||
return (root.childCount == 1);
|
||||
var cc = root.childCount;
|
||||
root.containerOpen = false;
|
||||
return (cc == 1);
|
||||
}
|
||||
|
||||
// main
|
||||
|
@ -89,6 +89,9 @@ function run_test() {
|
||||
bmsvc.insertBookmark(exposedFolder, uri("http://uri2.tld"), bmsvc.DEFAULT_INDEX, "");
|
||||
do_check_eq(folder.childCount, 2);
|
||||
|
||||
folder.containerOpen = false;
|
||||
rootNode.containerOpen = false;
|
||||
|
||||
// Bug 457681
|
||||
// Make the dynamic container read-only and check that it appear in the result
|
||||
bmsvc.setFolderReadonly(remoteContainer, true);
|
||||
|
@ -95,6 +95,7 @@ function run_test() {
|
||||
do_check_eq(node.itemId, livemarkItem);
|
||||
node = rootNode.getChild(1);
|
||||
do_check_eq(node.itemId, nonLivemarkItem);
|
||||
rootNode.containerOpen = false;
|
||||
|
||||
// exclude livemark items, search for "item", should get one result
|
||||
options = histsvc.getNewQueryOptions();
|
||||
@ -109,4 +110,5 @@ function run_test() {
|
||||
do_check_eq(cc, 1);
|
||||
var node = rootNode.getChild(0);
|
||||
do_check_eq(node.itemId, nonLivemarkItem);
|
||||
rootNode.containerOpen = false;
|
||||
}
|
||||
|
@ -82,7 +82,9 @@ function uri_in_db(aURI) {
|
||||
var result = histsvc.executeQuery(query, options);
|
||||
var root = result.root;
|
||||
root.containerOpen = true;
|
||||
return (root.childCount == 1);
|
||||
var cc = root.childCount;
|
||||
root.containerOpen = false;
|
||||
return (cc == 1);
|
||||
}
|
||||
|
||||
// main
|
||||
@ -130,18 +132,22 @@ function run_test() {
|
||||
result = histsvc.executeQuery(query, options);
|
||||
result.root.containerOpen = true;
|
||||
do_check_eq(result.root.childCount, 2);
|
||||
result.root.containerOpen = false;
|
||||
query.minVisits = 1;
|
||||
result = histsvc.executeQuery(query, options);
|
||||
result.root.containerOpen = true;
|
||||
do_check_eq(result.root.childCount, 2);
|
||||
result.root.containerOpen = false;
|
||||
query.minVisits = 2;
|
||||
result = histsvc.executeQuery(query, options);
|
||||
result.root.containerOpen = true;
|
||||
do_check_eq(result.root.childCount, 1);
|
||||
query.minVisits = 3;
|
||||
result.root.containerOpen = false;
|
||||
result = histsvc.executeQuery(query, options);
|
||||
result.root.containerOpen = true;
|
||||
do_check_eq(result.root.childCount, 0);
|
||||
result.root.containerOpen = false;
|
||||
|
||||
// test maxVisits
|
||||
query.minVisits = -1;
|
||||
@ -149,22 +155,27 @@ function run_test() {
|
||||
result = histsvc.executeQuery(query, options);
|
||||
result.root.containerOpen = true;
|
||||
do_check_eq(result.root.childCount, 2);
|
||||
result.root.containerOpen = false;
|
||||
query.maxVisits = 0;
|
||||
result = histsvc.executeQuery(query, options);
|
||||
result.root.containerOpen = true;
|
||||
do_check_eq(result.root.childCount, 0);
|
||||
result.root.containerOpen = false;
|
||||
query.maxVisits = 1;
|
||||
result = histsvc.executeQuery(query, options);
|
||||
result.root.containerOpen = true;
|
||||
do_check_eq(result.root.childCount, 1);
|
||||
result.root.containerOpen = false;
|
||||
query.maxVisits = 2;
|
||||
result = histsvc.executeQuery(query, options);
|
||||
result.root.containerOpen = true;
|
||||
do_check_eq(result.root.childCount, 2);
|
||||
result.root.containerOpen = false;
|
||||
query.maxVisits = 3;
|
||||
result = histsvc.executeQuery(query, options);
|
||||
result.root.containerOpen = true;
|
||||
do_check_eq(result.root.childCount, 2);
|
||||
result.root.containerOpen = false;
|
||||
|
||||
// test annotation-based queries
|
||||
var annos = Cc["@mozilla.org/browser/annotation-service;1"].
|
||||
@ -176,6 +187,7 @@ function run_test() {
|
||||
result.root.containerOpen = true;
|
||||
do_check_eq(result.root.childCount, 1);
|
||||
do_check_eq(result.root.getChild(0).uri, "http://mozilla.com/");
|
||||
result.root.containerOpen = false;
|
||||
|
||||
// test annotationIsNot
|
||||
query.annotationIsNot = true;
|
||||
@ -183,6 +195,7 @@ function run_test() {
|
||||
result.root.containerOpen = true;
|
||||
do_check_eq(result.root.childCount, 1);
|
||||
do_check_eq(result.root.getChild(0).uri, "http://google.com/");
|
||||
result.root.containerOpen = false;
|
||||
|
||||
// By default history is enabled.
|
||||
do_check_true(!histsvc.historyDisabled);
|
||||
@ -218,6 +231,7 @@ function run_test() {
|
||||
var root = result.root;
|
||||
root.containerOpen = true;
|
||||
do_check_true(root.childCount > 0);
|
||||
root.containerOpen = false;
|
||||
|
||||
// bug 400544 - testing that a referrer that is not in the DB gets added
|
||||
var referrerURI = uri("http://yahoo.com");
|
||||
|
@ -56,7 +56,9 @@ function uri_in_db(aURI) {
|
||||
var result = hs.executeQuery(query, options);
|
||||
var root = result.root;
|
||||
root.containerOpen = true;
|
||||
return (root.childCount == 1);
|
||||
var cc = root.childCount;
|
||||
root.containerOpen = false;
|
||||
return (cc == 1);
|
||||
}
|
||||
|
||||
// main
|
||||
|
@ -99,6 +99,7 @@ function run_test() {
|
||||
do_check_eq(root.getChild(0).uri, "http://site.tld/1");
|
||||
do_check_eq(root.getChild(1).uri, "http://site.tld/4");
|
||||
do_check_eq(root.getChild(2).uri, "http://site.tld/6");
|
||||
root.containerOpen = false;
|
||||
|
||||
query.searchTerms = "bar";
|
||||
result = histsvc.executeQuery(query, options);
|
||||
@ -109,6 +110,7 @@ function run_test() {
|
||||
do_check_eq(root.getChild(1).uri, "http://site.tld/4");
|
||||
do_check_eq(root.getChild(2).uri, "http://site.tld/5");
|
||||
do_check_eq(root.getChild(3).uri, "http://site.tld/6");
|
||||
root.containerOpen = false;
|
||||
|
||||
query.searchTerms = "cheese";
|
||||
result = histsvc.executeQuery(query, options);
|
||||
@ -118,6 +120,7 @@ function run_test() {
|
||||
do_check_eq(root.getChild(0).uri, "http://site.tld/3");
|
||||
do_check_eq(root.getChild(1).uri, "http://site.tld/5");
|
||||
do_check_eq(root.getChild(2).uri, "http://site.tld/6");
|
||||
root.containerOpen = false;
|
||||
|
||||
query.searchTerms = "foo bar";
|
||||
result = histsvc.executeQuery(query, options);
|
||||
@ -126,6 +129,7 @@ function run_test() {
|
||||
do_check_eq(root.childCount, 2);
|
||||
do_check_eq(root.getChild(0).uri, "http://site.tld/4");
|
||||
do_check_eq(root.getChild(1).uri, "http://site.tld/6");
|
||||
root.containerOpen = false;
|
||||
|
||||
query.searchTerms = "bar foo";
|
||||
result = histsvc.executeQuery(query, options);
|
||||
@ -134,6 +138,7 @@ function run_test() {
|
||||
do_check_eq(root.childCount, 2);
|
||||
do_check_eq(root.getChild(0).uri, "http://site.tld/4");
|
||||
do_check_eq(root.getChild(1).uri, "http://site.tld/6");
|
||||
root.containerOpen = false;
|
||||
|
||||
query.searchTerms = "bar cheese";
|
||||
result = histsvc.executeQuery(query, options);
|
||||
@ -142,6 +147,7 @@ function run_test() {
|
||||
do_check_eq(root.childCount, 2);
|
||||
do_check_eq(root.getChild(0).uri, "http://site.tld/5");
|
||||
do_check_eq(root.getChild(1).uri, "http://site.tld/6");
|
||||
root.containerOpen = false;
|
||||
|
||||
query.searchTerms = "cheese bar";
|
||||
result = histsvc.executeQuery(query, options);
|
||||
@ -150,6 +156,7 @@ function run_test() {
|
||||
do_check_eq(root.childCount, 2);
|
||||
do_check_eq(root.getChild(0).uri, "http://site.tld/5");
|
||||
do_check_eq(root.getChild(1).uri, "http://site.tld/6");
|
||||
root.containerOpen = false;
|
||||
|
||||
query.searchTerms = "foo bar cheese";
|
||||
result = histsvc.executeQuery(query, options);
|
||||
@ -157,6 +164,7 @@ function run_test() {
|
||||
root.containerOpen = true;
|
||||
do_check_eq(root.childCount, 1);
|
||||
do_check_eq(root.getChild(0).uri, "http://site.tld/6");
|
||||
root.containerOpen = false;
|
||||
|
||||
query.searchTerms = "cheese foo bar";
|
||||
result = histsvc.executeQuery(query, options);
|
||||
@ -164,6 +172,7 @@ function run_test() {
|
||||
root.containerOpen = true;
|
||||
do_check_eq(root.childCount, 1);
|
||||
do_check_eq(root.getChild(0).uri, "http://site.tld/6");
|
||||
root.containerOpen = false;
|
||||
|
||||
query.searchTerms = "cheese bar foo";
|
||||
result = histsvc.executeQuery(query, options);
|
||||
@ -171,4 +180,5 @@ function run_test() {
|
||||
root.containerOpen = true;
|
||||
do_check_eq(root.childCount, 1);
|
||||
do_check_eq(root.getChild(0).uri, "http://site.tld/6");
|
||||
root.containerOpen = false;
|
||||
}
|
||||
|
@ -93,4 +93,5 @@ function run_test() {
|
||||
// so they are reversed
|
||||
do_check_eq(root.getChild(0).title, "bar title");
|
||||
do_check_eq(root.getChild(1).title, "foo title");
|
||||
root.containerOpen = false;
|
||||
}
|
||||
|
@ -159,6 +159,7 @@ function run_test() {
|
||||
result.sortingMode = NHQO.SORT_BY_FRECENCY_ASCENDING;
|
||||
checkOrder(id1, id3, id2);
|
||||
|
||||
root.containerOpen = false;
|
||||
do_test_finished();
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user