Bug 1373565 - Part 1: Port Bug 1354143 to C-C applications: JumpListBuilder::CommitListBuild is an async function now. r=jorgk
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Fri, 16 Jun 2017 03:05:00 +0200
changeset 28353 412abacb5ca5cdb65f08adfcae5846b275377d6b
parent 28352 ca379f40ef826555e7da4988f56205a117f30542
child 28354 e156549bd91a5036d58a7724dd386e041738cb46
push id1986
push userclokep@gmail.com
push dateWed, 02 Aug 2017 14:43:31 +0000
treeherdercomm-beta@b51c9adf2c9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs1373565, 1354143
Bug 1373565 - Part 1: Port Bug 1354143 to C-C applications: JumpListBuilder::CommitListBuild is an async function now. r=jorgk
im/modules/ibWinJumpList.jsm
mail/components/wintaskbar/windowsJumpLists.js
suite/modules/WindowsJumpLists.jsm
--- a/im/modules/ibWinJumpList.jsm
+++ b/im/modules/ibWinJumpList.jsm
@@ -93,22 +93,26 @@ var WinJumpList = {
 
     try {
       // Initialize the array.
       let items2 = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
       this.winJumpListBuilder.initListBuild(items2);
 
       this.winJumpListBuilder.addListToBuild(
         Ci.nsIJumpListBuilder.JUMPLIST_CATEGORY_TASKS, items);
-
-      // Send the list to Windows
-      this.winJumpListBuilder.commitListBuild();
     } catch (e) {
       Cu.reportError(e);
     }
+
+    // Send the list to Windows
+    this.winJumpListBuilder.commitListBuild(succeed => {
+      if (!succeed) {
+        Cu.reportError("commitListBuild failed");
+      }
+    });
   },
 
   reset: function WJL_reset() {
     // Remove the jump list.
     if (this.winJumpListBuilder)
       this.winJumpListBuilder.deleteActiveList();
   },
 
--- a/mail/components/wintaskbar/windowsJumpLists.js
+++ b/mail/components/wintaskbar/windowsJumpLists.js
@@ -144,19 +144,21 @@ var WinTaskbarJumpList = {
     // Since our list is static right now, we won't actually get back any
     // removed items.
     let removedItems = Cc["@mozilla.org/array;1"]
                          .createInstance(Ci.nsIMutableArray);
     return this._builder.initListBuild(removedItems);
   },
 
   _commitBuild: function WTBJL__commitBuild() {
-    if (!this._builder.commitListBuild()) {
-      this._builder.abortListBuild();
-    }
+    this._builder.commitListBuild(succeed => {
+      if (!succeed) {
+        this._builder.abortListBuild();
+      }
+    });
   },
 
   _buildTasks: function WTBJL__buildTasks() {
     if (this._tasks.length > 0) {
       let items = toXPCOMArray(this._tasks.map(task =>
                                  this._createHandlerAppItem(task)),
                                Ci.nsIMutableArray);
       this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_TASKS, items);
--- a/suite/modules/WindowsJumpLists.jsm
+++ b/suite/modules/WindowsJumpLists.jsm
@@ -304,19 +304,26 @@ var WinTaskbarJumpList =
       // Prior to building, delete removed items from history.
       this._clearHistory(removedItems);
       return true;
     }
     return false;
   },
 
   _commitBuild: function WTBJL__commitBuild() {
-    if (!this._hasPendingStatements() && !this._builder.commitListBuild()) {
-      this._builder.abortListBuild();
+
+    if (this._hasPendingStatements()) {
+      return;
     }
+
+    this._builder.commitListBuild(succeed => {
+      if (!succeed) {
+        this._builder.abortListBuild();
+      }
+    });
   },
 
   _buildTasks: function WTBJL__buildTasks() {
     var items = Cc["@mozilla.org/array;1"].
                 createInstance(Ci.nsIMutableArray);
     this._tasks.forEach(function (task) {
       if ((this._shuttingDown && !task.close) || (!this._shuttingDown && !task.open))
         return;