Bug 854761 - Part 2: Remove previous bookmark calls from PlacesUtils - Sync. r=rnewman

This commit is contained in:
Raymond Lee 2013-06-04 00:21:41 +08:00
parent e89af5938a
commit 2bf4ba49f2

View File

@ -17,6 +17,8 @@ const CU = Components.utils;
CU.import("resource://tps/logger.jsm");
CU.import("resource://gre/modules/Services.jsm");
CU.import("resource://gre/modules/PlacesUtils.jsm");
Cu.import("resource://gre/modules/BookmarkJSONUtils.jsm");
Cu.import("resource://gre/modules/Task.jsm");
CU.import("resource://services-common/async.js");
var DumpBookmarks = function TPS_Bookmarks__DumpBookmarks() {
@ -33,9 +35,14 @@ var DumpBookmarks = function TPS_Bookmarks__DumpBookmarks() {
query.setFolders([PlacesUtils.placesRootId], 1);
let root = PlacesUtils.history.executeQuery(query, options).root;
root.containerOpen = true;
PlacesUtils.serializeNodeAsJSONToOutputStream(root, writer, true, false);
let value = JSON.parse(writer.value);
Logger.logInfo("dumping bookmarks\n\n" + JSON.stringify(value, null, ' ') + "\n\n");
let cb = Async.makeSpinningCallback();
Task.spawn(function() {
yield BookmarkJSONUtils.serializeNodeAsJSONToOutputStream(root, writer, true, false);
let value = JSON.parse(writer.value);
Logger.logInfo("dumping bookmarks\n\n" + JSON.stringify(value, null, ' ') + "\n\n");
cb();
});
cb.wait();
};
/**