[Webkit-unassigned] [Bug 253810] New: Webkit API object/struct names hidden after change to 2022 API

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 13 00:25:56 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=253810

            Bug ID: 253810
           Summary: Webkit API object/struct names hidden after change to
                    2022 API
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WPE WebKit
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ryan at testtoast.com
                CC: bugs-noreply at webkitgtk.org

I have a number of client applications using WPE WebKit and a Wayland renderer with Swift 5.7 on Linux, and have just built 2.39.91 and found that the new GLib API has changed the visibility of a number of struct which is preventing their import by name in Swift.

For example, the below code to bring up a Web Extension works with 2.39.5 (which is neat), but fails to compile with 2.39.91:


fileprivate var pageCreatedCallback: @convention(c) (OpaquePointer, OpaquePointer, OpaquePointer) -> Void = { (extension, page, data) in
    print("Page created")
}

@_cdecl("webkit_web_process_extension_initialize_with_user_data")
func initialize (extension: UnsafeMutablePointer<WebKitWebProcessExtension>, data: OpaquePointer?) {
    g_signal_connect_data(`extension`, "page-created", unsafeBitCast(pageCreatedCallback, to: GCallback.self), nil, nil, GConnectFlags(rawValue: 0))
}

The error is:

error: cannot find type 'WebKitWebProcessExtension' in scope
func initialize (extension: UnsafePointer<WebKitWebProcessExtension>, data: OpaquePointer?) {
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~

If I change the declaration to OpaquePointer, then the example compiles, but I lose type information. This is replicated across the entire API, and appears to be the result of using WEBKIT_DECLARE_FINAL_TYPE for the 2022 API rather than the previous typedef method: 

typedef struct _WebKitWebExtension        WebKitWebExtension;

This may be something that can be worked around, but I note the new macro is a customisation of G_DECLARE_FINAL_TYPE, is there any way this can be improved so the symbols are available to Swift?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230313/b89e775c/attachment-0001.htm>


More information about the webkit-unassigned mailing list