Bug 1303831 - have _buildGUIDMap yield to the event loop and have it abort on shutdown. r?tcsc,rnewman
MozReview-Commit-ID: Ff8mq9eHBsQ
--- a/services/sync/modules/engines/bookmarks.js
+++ b/services/sync/modules/engines/bookmarks.js
@@ -284,28 +284,30 @@ BookmarksEngine.prototype = {
url = `<failed: ${ex.toString()}>`;
}
}
return url;
},
_guidMapFailed: false,
_buildGUIDMap: function _buildGUIDMap() {
+ let store = this._store;
let guidMap = {};
let tree = Async.promiseSpinningly(PlacesUtils.promiseBookmarksTree("", {
includeItemIds: true
}));
function* walkBookmarksTree(tree, parent=null) {
if (tree) {
// Skip root node
if (parent) {
yield [tree, parent];
}
if (tree.children) {
for (let child of tree.children) {
+ store._sleep(0); // avoid jank while looping.
yield* walkBookmarksTree(child, tree);
}
}
}
}
function* walkBookmarksRoots(tree, rootIDs) {
for (let id of rootIDs) {