WebPlatformForEmbedded / WPEWebKit

WPE WebKit port (downstream)
211 stars 135 forks source link

[wpe-2.38] console logs are not showing up in remote web inspector on x86_64 builds #1219

Closed Scony closed 5 months ago

Scony commented 10 months ago

When WPE WebKit is built on x86_64 (e.g. Ubuntu 20 LTS) and run with remote web inspector (RWI) enabled, the logs printed from RWI or from the HTML app itself using console.log() are not displayed in RWI. I've tracked the flows of such console logs through WPEWebKit and it turned out the logs are actually delivered to the RWI frontend but there's an JS exception during processing of stactrace:

Main.js:3242 TypeError: payload.callFrames.map is not a function
    at StackTrace.fromPayload (StackTrace.js:46:49)
    at new ConsoleMessage (ConsoleMessage.js:52:42)
    at ConsoleManager.messageWasAdded (ConsoleManager.js:97:23)
    at ConsoleObserver.messageAdded (ConsoleObserver.js:38:27)
    at InspectorBackendTargetConnection._dispatchEvent (Connection.js:210:21)
    at InspectorBackendTargetConnection.dispatch (Connection.js:79:18)
    at TargetManager.dispatchMessageFromTarget (TargetManager.js:167:31)
    at TargetObserver.dispatchMessageFromTarget (TargetObserver.js:47:26)
    at InspectorBackendBackendConnection._dispatchEvent (Connection.js:210:21)
    at InspectorBackendBackendConnection.dispatch (Connection.js:79:18)

which happens due to the fact that payload.callFrames is an object while it's expected to be array. Interestingly the expected array can be found within that object under the payload.callFrames.callFrames field.

I haven't investigated that further, but on ARM builds it works fine.

pgorszkowski-igalia commented 8 months ago

I built WPE WebKit (latest wpe-2.38) on x86_64 (Ubuntu 20.04 and JH_BUILD). The logs from application or the ones called from RWI (console.log()) are printed without any problems. I have never got the error which you provided.

Scony commented 8 months ago

Well, in that case it looks like it may be some issue related to caching from older version of WebKit or some other nuance. Let's stop any activities on that then and let me investigate a little bit more on my side. Please note I'll be working on it with low priority.

Scony commented 5 months ago

It turned out I was using /usr/local/lib/wpe-webkit-1.0/libWPEWebInspectorResources.so from different build by accident and hence this issue was occurring.

With correct shared object everything works as expected.