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.
Retitled: Exceptions logged to the JS console should use toString()
*** Bug 159845 has been marked as a duplicate of this bug. ***
*** Bug 159846 has been marked as a duplicate of this bug. ***
When we change this to use toString, I think we possibly want to use a variant of toString that does not run arbitrary code.
Created attachment 283866 [details] Patch
(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.
(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.
Created attachment 283867 [details] Patch
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.
(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.
https://trac.webkit.org/changeset/203334