Bug 1303831 - have _buildGUIDMap yield to the event loop and have it abort on shutdown. r=rnewman,tcsc a=gchang
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 15 Nov 2016 17:01:22 +1100
changeset 352455 b557b0081e7cb997d9a199afdf42d8a6863cd810
parent 352454 f52c628bce82e3e20cb6d9a6b27ba5372bf8849c
child 352456 aa167117bd4dc833888b84f3397c620de7b4a15a
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman, tcsc, gchang
bugs1303831
milestone52.0a2
Bug 1303831 - have _buildGUIDMap yield to the event loop and have it abort on shutdown. r=rnewman,tcsc a=gchang 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) {