Bug 186588 - [WPE] Trying to access the remote inspector hits an assertion in the UIProcess
Summary: [WPE] Trying to access the remote inspector hits an assertion in the UIProcess
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WPE WebKit (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adrian Perez
URL:
Keywords:
Depends on:
Blocks: 186594
  Show dependency treegraph
 
Reported: 2018-06-13 01:51 PDT by Adrian Perez
Modified: 2018-06-13 23:39 PDT (History)
13 users (show)

See Also:


Attachments
Patch (9.19 KB, patch)
2018-06-13 16:24 PDT, Adrian Perez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Perez 2018-06-13 01:51:03 PDT
Setting “WEBKIT_INSPECTOR_SERVER=127.0.0.1:8787” in the environment before
running e.g. Cog, and then trying to open “inspector://127.0.0.1:8787”
in Epiphany results in the following assertion being hit:

  (cog:2873): GLib-CRITICAL **: 10:13:52.759: g_bytes_get_data: assertion 'bytes != NULL' failed

The UIProcess will segfault immediately after printing the above. This
happens both in “trunk” and the current stable version (2.20.0).
Comment 1 Adrian Perez 2018-06-13 01:53:58 PDT
After some investigation I have been able to determine that this
issue is caused by resources inside “libWPEWebInspectorResources.so”
having incorrect base paths:

  % gresource list $PREFIX/lib/wpe-webkit-0.1/libWPEWebInspectorResources.so|grep Commands
  /org/webkitgtk/inspector/UserInterface/Images/DOMComment.svg
  /org/webkitgtk/inspector/UserInterface/Protocol/InspectorBackendCommands.js

(Note that the “/org/webkitgtk” prefix is being used, when it should
have been “/org/wpe” in this case.)
Comment 2 Michael Catanzaro 2018-06-13 06:05:12 PDT
(If you're bored, libWPEWebInspectorResources.so should almost certainly be turned into a GResource bundle, like it is for WebKitGTK+, instead of a separate shared object.)
Comment 3 Zan Dobersek 2018-06-13 06:13:15 PDT
(In reply to Michael Catanzaro from comment #2)
> (If you're bored, libWPEWebInspectorResources.so should almost certainly be
> turned into a GResource bundle, like it is for WebKitGTK+, instead of a
> separate shared object.)

It hasn't been yet since it would bloat up the libWPEWebKit.so binary, while as a separate .so object it can at least be copied over to the target device when in need of debugging.
Comment 4 Michael Catanzaro 2018-06-13 06:16:24 PDT
(You can still load a separate resource file at runtime using g_resource_load()!)
Comment 5 Zan Dobersek 2018-06-13 06:30:46 PDT
(In reply to Michael Catanzaro from comment #4)
> (You can still load a separate resource file at runtime using
> g_resource_load()!)

TIL. That could work I guess.
Comment 6 Adrian Perez 2018-06-13 16:24:00 PDT
Created attachment 342706 [details]
Patch


First I thought of adding --gtk/--wpe switches to the Python script
which generates the XML manifest passed to glib-compile-resources,
but then it dawned on me that it is not really needed to differentiate
between resources at /org/webkitgtk/inspector and /org/wpe/inspector:
they are the same, and it cannot ever happen anyway that both resource
sets are loaded into the same process... So why not just using the
same /org/webkit/inspector prefix for both ports? This way it will
be less likely that breakage is introduced again in the future.
Comment 7 Michael Catanzaro 2018-06-13 17:09:46 PDT
Comment on attachment 342706 [details]
Patch

Makes sense to me, but let's see what Carlos Garcia thinks tomorrow.
Comment 8 WebKit Commit Bot 2018-06-13 23:39:21 PDT
Comment on attachment 342706 [details]
Patch

Clearing flags on attachment: 342706

Committed r232832: <https://trac.webkit.org/changeset/232832>
Comment 9 WebKit Commit Bot 2018-06-13 23:39:23 PDT
All reviewed patches have been landed.  Closing bug.