Bug 1303831 - have _buildGUIDMap yield to the event loop and have it abort on shutdown. r=rnewman,tcsc
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 15 Nov 2016 17:01:22 +1100
changeset 439686 0ecd90195aa2137e9e3fbc363d5e9f6820242937
parent 439685 0e6e3d0eec494dee468cc26befdedf4da02b8d7e
child 439687 13a9d632e987199ac804ebfcba5678be29179d51
push id36064
push userrthijssen@mozilla.com
push dateWed, 16 Nov 2016 13:38:27 +0000
reviewersrnewman, tcsc
bugs1303831
milestone53.0a1
Bug 1303831 - have _buildGUIDMap yield to the event loop and have it abort on shutdown. r=rnewman,tcsc MozReview-Commit-ID: Ff8mq9eHBsQ
services/sync/modules/engines/bookmarks.js
--- a/services/sync/modules/engines/bookmarks.js
+++ b/services/sync/modules/engines/bookmarks.js
@@ -295,28 +295,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) {