RESOLVED FIXED 159855
Exceptions logged to the JS console should use toString()
https://bugs.webkit.org/show_bug.cgi?id=159855
Summary Exceptions logged to the JS console should use toString()
Brady Eidson
Reported 2016-07-16 12:43:42 PDT
Change how exceptions are logged in the JS console to not look redundant and silly. This is needed with work on https://bugs.webkit.org/show_bug.cgi?id=159822, which is making exception messages more rich. An example of how this work effects console.log can be found here - https://bugs.webkit.org/show_bug.cgi?id=159847#c2 CONSOLE MESSAGE: line 14: An invalid value was passed to an operation or assigned to an attribute.: An invalid value was passed to an operation or assigned to an attribute. The code responsible is in JSDOMBinding.cpp: void reportException(ExecState* exec, Exception* exception, CachedScript* cachedScript, ExceptionDetails* exceptionDetails) ... errorMessage = exceptionBase->message() + ": " + exceptionBase->description(); For Exceptions that have adopted the "description as message" mode, the message and the description are the same. This can all get cleaned up once the task represented by 159822 is complete, but for now we should do something a little different for the new exceptions vs the old ones.
Attachments
Patch (6.69 KB, patch)
2016-07-17 10:14 PDT, Brady Eidson
no flags
Patch (7.25 KB, patch)
2016-07-17 10:22 PDT, Brady Eidson
darin: review+
Brady Eidson
Comment 1 2016-07-16 12:50:05 PDT
Retitled: Exceptions logged to the JS console should use toString()
Brady Eidson
Comment 2 2016-07-17 08:41:42 PDT
*** Bug 159845 has been marked as a duplicate of this bug. ***
Brady Eidson
Comment 3 2016-07-17 08:41:46 PDT
*** Bug 159846 has been marked as a duplicate of this bug. ***
Darin Adler
Comment 4 2016-07-17 09:29:42 PDT
When we change this to use toString, I think we possibly want to use a variant of toString that does not run arbitrary code.
Brady Eidson
Comment 5 2016-07-17 10:14:55 PDT
Brady Eidson
Comment 6 2016-07-17 10:15:43 PDT
(In reply to comment #4) > When we change this to use toString, I think we possibly want to use a > variant of toString that does not run arbitrary code. Okay.
Brady Eidson
Comment 7 2016-07-17 10:19:16 PDT
(In reply to comment #6) > (In reply to comment #4) > > When we change this to use toString, I think we possibly want to use a > > variant of toString that does not run arbitrary code. > > Okay. Seems useful to not initialize a "toString" message when the ExceptionBase is made, as it's not always needed. So toString() will still run code, but cache the result.
Brady Eidson
Comment 8 2016-07-17 10:22:05 PDT
Darin Adler
Comment 9 2016-07-17 10:57:13 PDT
Comment on attachment 283867 [details] Patch This is fine. When I said not run "arbitrary code", I meant specifically that it should not run arbitrary JavaScript code, not C++ code.
Brady Eidson
Comment 10 2016-07-17 12:12:29 PDT
(In reply to comment #9) > Comment on attachment 283867 [details] > Patch > > This is fine. When I said not run "arbitrary code", I meant specifically > that it should not run arbitrary JavaScript code, not C++ code. Ah! Yah, we're definitely fine there.
Brady Eidson
Comment 11 2016-07-17 12:14:08 PDT
Note You need to log in before you can comment on or make changes to this bug.