Bug 1357486: Part 0d - Propagate clonable console message args to the parent process. r?aswan draft
authorKris Maglione <maglione.k@gmail.com>
Fri, 07 Jul 2017 14:34:37 -0700
changeset 605564 00dc5151a4b0f8dc6015cdb5cd392e2b968f7cf4
parent 605563 7431a0ecced243a96ffb4cf1cc04adf6fbc17a4e
child 605565 a9cc5633536e159aa178ac8105a72cb97bbe58b7
push id67457
push usermaglione.k@gmail.com
push dateSat, 08 Jul 2017 01:21:07 +0000
reviewersaswan
bugs1357486
milestone56.0a1
Bug 1357486: Part 0d - Propagate clonable console message args to the parent process. r?aswan MozReview-Commit-ID: Bkecqr7hRvx
toolkit/components/processsingleton/ContentProcessSingleton.js
--- a/toolkit/components/processsingleton/ContentProcessSingleton.js
+++ b/toolkit/components/processsingleton/ContentProcessSingleton.js
@@ -74,17 +74,21 @@ ContentProcessSingleton.prototype = {
       // When the sum of argument sizes reaches MSG_MGR_CONSOLE_MAX_SIZE,
       // replace all arguments with "<truncated>".
       let totalArgLength = 0;
 
       // Walk through the arguments, checking the type and size.
       for (let arg of consoleMsg.arguments) {
         if ((typeof arg == "object" || typeof arg == "function") &&
             arg !== null) {
-          arg = unavailString;
+          try {
+            arg = Cu.cloneInto(arg, {});
+          } catch (e) {
+            arg = unavailString;
+          }
           totalArgLength += unavailStringLength;
         } else if (typeof arg == "string") {
           totalArgLength += arg.length * 2; // 2-bytes per char
         } else {
           totalArgLength += MSG_MGR_CONSOLE_VAR_SIZE;
         }
 
         if (totalArgLength <= MSG_MGR_CONSOLE_MAX_SIZE) {