Add FrameNavigationControl.SetWantErrorMessageStackTrace

Gives the browser the ability to tell the renderer that it wants stack
traces on error-level console messages. Useful if we are sending error
reports about those messages back to Google.

Empirically, both console.error messages and unhandled exceptions get
stack traces; unhandled promise rejections do not.

Bug: chromium:1121816

Change-Id: I63768696dbd120522d7b5fb1e7133d8c233b213c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2556008
Reviewed-by: dstockwell <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Arthur Sonzogni <[email protected]>
Commit-Queue: Ian Barkley-Yeung <[email protected]>
Cr-Commit-Position: refs/heads/master@{#834561}
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
index e959809..d75eee23 100644
--- a/content/common/frame.mojom
+++ b/content/common/frame.mojom
@@ -202,6 +202,11 @@
       bool wants_result,
       int32 world_id) => (mojo_base.mojom.Value result);
 
+  // Indicates that the frame host (browser) wants the |untrusted_stack_trace|
+  // parameter of DidAddMessageToConsole() filled in for Error messages if at
+  // all possible.
+  SetWantErrorMessageStackTrace();
+
   // Requests that a provisional RenderFrame swap itself into the frame tree,
   // replacing the RenderFrameProxy that it is associated with. This is used
   // with remote-to-local frame navigations when the RenderFrameProxy
@@ -517,8 +522,9 @@
   // error reporting service. |source_id| is usually a URL.
   // |untrusted_stack_trace| should only be printed or sent to other services;
   // it's untrusted and should not be parsed to get a structured stack trace.
-  // The stack trace is only present if the message is from an exception and
-  // only if Frame.SetWantExceptionStackTrace has been called for this frame.
+  // The stack trace is only present if
+  // FrameNavigationControl.SetWantErrorMessageStackTrace has been called for
+  // this frame and the log_level is kError.
   DidAddMessageToConsole(
       blink.mojom.ConsoleMessageLevel log_level,
       mojo_base.mojom.BigString16 msg,