Bug 1303831 - have _buildGUIDMap yield to the event loop and have it abort on shutdown. r?tcsc,rnewman draft
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 15 Nov 2016 17:01:22 +1100
changeset 439389 01e03d6475db447a61f3e6a2503de9913625a660
parent 439388 5698c80f0eab6a38ab574080276516e6229e350e
child 537162 257771f552924fd7ea5d4f484e36dcce61380e16
push id35999
push userbmo:markh@mozilla.com
push dateWed, 16 Nov 2016 01:21:11 +0000
reviewerstcsc, rnewman
bugs1303831
milestone53.0a1
Bug 1303831 - have _buildGUIDMap yield to the event loop and have it abort on shutdown. r?tcsc,rnewman MozReview-Commit-ID: Ff8mq9eHBsQ
services/sync/modules/engines/bookmarks.js
--- 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) {