Previously, the logging of messages to the system console was done in PageConsoleClient::addMessage(), which was called by Document::addConsoleMessage(). The latter was called in a TaskQueue callback. This had the unfortunate side effect of adding a delay from the time a macro such as ALWAYS_LOG() is called and the text being printed to the console. This is particularly a problem when logging 3rd party libraries that don't use the WebKit logging API to log to stderr, such as GStreamer, since it causes messages logged by WebKit to not be synchronized with messages logged by 3rd party libraries or logging systems. As a consequence the usefulness of WebKit logs is noticeably reduced. This patch fixes the issue by moving the code logging to the system console to the synchronous part of Document::didLogMessage(), while still handling the rest in the m_logMessageTaskQueue callback.
Created attachment 421214 [details] Patch
Created attachment 421294 [details] Patch
Committed r273329: <https://commits.webkit.org/r273329> All reviewed patches have been landed. Closing bug and clearing flags on attachment 421294 [details].
<rdar://problem/74654614>
This change broke logging most errors like CSP and promise rejections to the system console. Those do not go through Document::didLogMessage(), they call Document::addConsoleMessage() directly.
Re-opened since this is blocked by bug 227060.
Re-opened since this is blocked by bug 227080.
Can reproduce. Will investigate.