Bug 1464461 - make dispatchMessagesAdd use batching; r=nchevobbe draft
authoryulia <ystartsev@mozilla.com>
Thu, 28 Jun 2018 12:00:55 +0200
changeset 811793 c3132c5df313d2e9b233b309f68e7825e8c71c93
parent 811792 1b5e862e324a4f7f17d606061d3c649e7ec2008f
child 811794 ac1c0286d427d4569c2e7c68546dfb3e1b446c32
push id114430
push userbmo:ystartsev@mozilla.com
push dateThu, 28 Jun 2018 10:56:40 +0000
reviewersnchevobbe
bugs1464461
milestone62.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
@@ -245,22 +245,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 = [];
@@ -357,21 +357,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() {