Bug 221771 - [GTK][WPE] Signal "window-object-cleared" not emitted unless frame js context is get before
Summary: [GTK][WPE] Signal "window-object-cleared" not emitted unless frame js context...
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2021-02-11 12:33 PST by Adrian Perez
Modified: 2021-06-07 01:22 PDT (History)
7 users (show)

See Also:

Example web process extension source (2.00 KB, text/x-csrc)
2021-02-11 12:33 PST, Adrian Perez
no flags Details
Patch (12.56 KB, patch)
2021-06-04 07:03 PDT, Carlos Garcia Campos
mcatanzaro: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Perez 2021-02-11 12:33:27 PST
Created attachment 420028 [details]
Example web process extension source

Using a custom WebKitScriptWorld in a web process extension never triggers
the “window-object-cleared” signal. This can be verified with a simple web
process extension like the attached one (“ext.c”).

To reproduce the issue:

 1. Build the example extension:

      $CC -shared -o libext.so ext.c \
          $(pkg-config --libs --cflags wpe-web-extension-1.0)

 2. The run Cog passing the path to the directory containing the built
    “libext.so” file:
      cog -P fdo --web-extensions-dir="$(pwd)" ddg.gg

The expected (correct) output should include the following two lines:

   ** Message: 19:17:26.517: --> on_window_object_cleared
   ** Message: 19:17:26.517: <-- on_window_object_cleared

Building the extension with “-DHACK_FOR_CUSTOM_SCRIPT_WORLD” will use a
workaround that GNOME Web is currently using, see:


Current trunk and stable versions of WebKit (2.30.x, both GTK and WPE ports)
do *not* need the workaround when using the default WebKitScriptWorld.
Comment 1 Carlos Garcia Campos 2021-06-04 06:57:02 PDT
This is happening for default script world too.
Comment 2 Carlos Garcia Campos 2021-06-04 07:03:20 PDT
Created attachment 430573 [details]
Comment 3 EWS Watchlist 2021-06-04 07:04:10 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 4 Carlos Garcia Campos 2021-06-07 01:21:13 PDT
Committed r278548 (238546@main): <https://commits.webkit.org/238546@main>
Comment 5 Radar WebKit Bug Importer 2021-06-07 01:22:17 PDT