Bug 1408845 - Release longString actors;r=bgrins.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Mon, 16 Oct 2017 09:55:50 +0200
changeset 386532 5d8477f1e9ea34238d75223f9cefb99b384139c6
parent 386531 8db059812121c6f7f6ce50075378b55b53254256
child 386533 3baaa616310062e7f024a016fcf817a4c4dd451c
push id53448
push usernchevobbe@mozilla.com
push dateTue, 17 Oct 2017 06:42:06 +0000
treeherderautoland@5d8477f1e9ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1408845
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1408845 - Release longString actors;r=bgrins. MozReview-Commit-ID: H3Z1pp5vgUm
devtools/client/webconsole/new-console-output/reducers/messages.js
devtools/client/webconsole/new-console-output/test/store/release-actors.test.js
--- a/devtools/client/webconsole/new-console-output/reducers/messages.js
+++ b/devtools/client/webconsole/new-console-output/reducers/messages.js
@@ -475,27 +475,33 @@ function limitTopLevelMessageCount(state
 /**
  * Get an array of all the actors logged in a specific message.
  *
  * @param {Message} message: The message to get actors from.
  * @param {Record} state: The redux state.
  * @return {Array} An array containing all the actors logged in a message.
  */
 function getAllActorsInMessage(message, state) {
-  // Messages without argument cannot be associated with backend actors.
-  if (!message || !Array.isArray(message.parameters) || message.parameters.length === 0) {
-    return [];
+  const {
+    parameters,
+    messageText,
+  } = message;
+
+  let actors = [];
+  if (Array.isArray(parameters)) {
+    message.parameters.forEach(parameter => {
+      if (parameter.actor) {
+        actors.push(parameter.actor);
+      }
+    });
   }
 
-  const actors = [...message.parameters.reduce((res, parameter) => {
-    if (parameter.actor) {
-      res.push(parameter.actor);
-    }
-    return res;
-  }, [])];
+  if (messageText && messageText.actor) {
+    actors.push(messageText.actor);
+  }
 
   return actors;
 }
 
 /**
  * Returns total count of top level messages (those which are not
  * within a group).
  */
--- a/devtools/client/webconsole/new-console-output/test/store/release-actors.test.js
+++ b/devtools/client/webconsole/new-console-output/test/store/release-actors.test.js
@@ -86,18 +86,24 @@ describe("Release actor enhancer:", () =
       const secondMessageActor = packet.message.arguments[0].actor;
       dispatch(actions.messageAdd(packet));
 
       // Add an evaluation result message (see Bug 1408321).
       const evaluationResultPacket = stubPackets.get("new Date(0)");
       dispatch(actions.messageAdd(evaluationResultPacket));
       const thirdMessageActor = evaluationResultPacket.result.actor;
 
+      // Add a message with a long string messageText property.
+      const longStringPacket = stubPackets.get("TypeError longString message");
+      dispatch(actions.messageAdd(longStringPacket));
+      const fourthMessageActor = longStringPacket.pageError.errorMessage.actor;
+
       // Kick-off the actor release.
       dispatch(actions.messagesClear());
 
-      expect(releasedActors.length).toBe(3);
+      expect(releasedActors.length).toBe(4);
       expect(releasedActors).toInclude(firstMessageActor);
       expect(releasedActors).toInclude(secondMessageActor);
       expect(releasedActors).toInclude(thirdMessageActor);
+      expect(releasedActors).toInclude(fourthMessageActor);
     });
   });
 });