WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
221655
WKWebView needs a synchronous API for JavaScript/DOM access
https://bugs.webkit.org/show_bug.cgi?id=221655
Summary
WKWebView needs a synchronous API for JavaScript/DOM access
Jonathan Deutsch
Reported
2021-02-09 23:21:21 PST
Practically speaking, applications that are tightly integrated with a web view have to go through clunky control flow contortions to deal with the callback structure of WKWebView's -evaluateJavaScript:/-callAsyncJavaScript: methods to access the DOM. The only reasonable solution for handling this is to shove more and more of the application logic into JavaScript, at which point there is less of a reason to develop a native Mac app anymore. For the time being, I have developed my own synchronous solution that reproduces the WebView Legacy DOM API. This uses run loop shenanigans and has significant drawbacks. At the very least, WKWebView could at least not use the main run loop for its communication channel and not have locks where the child process will not respond properly if it cannot talk to to the main app. This would at least allow for using a dispatch_semaphore_wait() that gets signaled in the callback. WKWebView could easily provide a better API, and it could probably be more performant too. I am surprised WebView was deprecated without providing this.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2021-02-16 23:22:27 PST
<
rdar://problem/74423269
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug