From Kai.Koehne at qt.io Wed Mar 6 15:18:37 2019 From: Kai.Koehne at qt.io (=?iso-8859-1?Q?Kai_K=F6hne?=) Date: Wed, 6 Mar 2019 14:18:37 +0000 Subject: [Qtwebengine] [Interest] Fixing up console.log() in QtWebEngine In-Reply-To: References: <299B1AC3-8C1C-4F31-8FEE-0FEFAB596376@blighty.com>, Message-ID: Alright, it's qtwebengine at qt-project.org ... ________________________________ From: Interest on behalf of Kai Köhne Sent: Wednesday, March 6, 2019 3:14 PM To: Steve Atkins; Qt Project; webengine at qt-project.org Subject: Re: [Interest] Fixing up console.log() in QtWebEngine Hi Steve, I agree with you that the current console.log behavior in Qt WebEngine is pretty basic. Anyhow, looking at the code the problem can be traced back to v8, Chromium's JavaScript engine: https://bugs.chromium.org/p/v8/issues/detail?id=5579 https://955-bad0a5abd2d1-tainted-dot-chromiumcodereview.appspot.com/2899113003/ So it looks like fixing this would either above change to be merged, or finding other ways to get the same information ... Regards Kai PS: webengine at qt-project.org is arguably the better mailing list for discussion implementation details like this, CC'ed ________________________________ From: Interest on behalf of Steve Atkins Sent: Monday, March 4, 2019 2:42:12 PM To: Qt Project Subject: [Interest] Fixing up console.log() in QtWebEngine In a normal web browser console.log() takes one or more values as parameters and renders them for the user in some appropriate way. If the first parameter is a string containing %s style escapes it'll do some printf style formatting of the remaining parameters. ( https://developers.google.com/web/tools/chrome-devtools/console/api#log ). [https://developers.google.com/web/images/social-webfu-16x9.png] Console API Reference | Tools for Web Developers | Google Developers developers.google.com Use the Console API to write information to the console, create JavaScript profiles, and start a debugging session. console.assert(expression, object) Inside a QtWebEngine page console.log() accepts any number of parameters of any type. But by the time we get to Qt it arrives as QWebEnginePage::javaScriptConsoleMessage(QWebEnginePage::JavaScriptConsoleMessageLevellevel, const QString &message, int lineNumber, const QString &sourceID) The first parameter of console.log() is converted to a string - e.g. "[Object object]" - and delivered as a QString. The remaining parameters are discarded. That's better than nothing, but still a little annoying if you're working on javascript logic running inside a Qt app. Does anyone know where inside the Qt-Chromium interface I should start looking if I wanted to improve things? Cheers, Steve _______________________________________________ Interest mailing list Interest at qt-project.org https://lists.qt-project.org/listinfo/interest -------------- next part -------------- An HTML attachment was scrubbed... URL: