Bug 1464461 - make dispatchMessagesAdd use batching; r=nchevobbe draft
authoryulia <ystartsev@mozilla.com>
Thu, 28 Jun 2018 12:00:55 +0200
changeset 813606 2a2462d109efb79cb0aa62cde46af350cb46406c
parent 813605 2271df1b8d4d6ddcad6c2f77338ba9332e8402f2
child 813607 8330fb4ea04b3cdf166bcd2032a6d4e37db92f74
push id114934
push userbmo:ystartsev@mozilla.com
push dateTue, 03 Jul 2018 13:34:11 +0000
reviewersnchevobbe
bugs1464461
milestone63.0a1
Bug 1464461 - make dispatchMessagesAdd use batching; r=nchevobbe MozReview-Commit-ID: 7sCFIfC2ovi
devtools/client/webconsole/webconsole-output-wrapper.js
--- a/devtools/client/webconsole/webconsole-output-wrapper.js
+++ b/devtools/client/webconsole/webconsole-output-wrapper.js
@@ -256,22 +256,22 @@ WebConsoleOutputWrapper.prototype = {
             }
           }
         }.bind(this));
       });
     } else {
       promise = Promise.resolve();
     }
 
-    this.batchedMessagesAdd(packet);
+    this.batchedMessageAdd(packet);
     return promise;
   },
 
   dispatchMessagesAdd: function(messages) {
-    store.dispatch(actions.messagesAdd(messages));
+    this.batchedMessagesAdd(messages);
   },
 
   dispatchMessagesClear: function() {
     // We might still have pending message additions and updates when the clear action is
     // triggered, so we need to flush them to make sure we don't have unexpected behavior
     // in the ConsoleOutput.
     this.queuedMessageAdds = [];
     this.queuedMessageUpdates = [];
@@ -368,21 +368,26 @@ WebConsoleOutputWrapper.prototype = {
     this.setTimeoutIfNeeded();
   },
 
   batchedRequestUpdates: function(message) {
     this.queuedRequestUpdates.push(message);
     this.setTimeoutIfNeeded();
   },
 
-  batchedMessagesAdd: function(message) {
+  batchedMessageAdd: function(message) {
     this.queuedMessageAdds.push(message);
     this.setTimeoutIfNeeded();
   },
 
+  batchedMessagesAdd: function(messages) {
+    this.queuedMessageAdds = this.queuedMessageAdds.concat(messages);
+    this.setTimeoutIfNeeded();
+  },
+
   dispatchClearHistory: function() {
     store.dispatch(actions.clearHistory());
   },
 
   /**
    * Returns a Promise that resolves once any async dispatch is finally dispatched.
    */
   waitAsyncDispatches: function() {