Bug 172390
| Summary: | [iOS]: RunLoop::main().dispatch() needs to take into account USE_WEB_THREAD | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Joseph Pecoraro <joepeck> |
| Component: | WebCore Misc. | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | aestes, andersca, beidson, cdumez, ddkilzer, ggaren |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=277299 | ||
Joseph Pecoraro
[iOS]: RunLoop::main().dispatch() needs to take into account WEB_THREAD
There are cases of RunLoop::main().dispatch() in WebCore that may not be safe if USE_WEB_THREAD
bindings/js/SerializedScriptValue.cpp
3166: RunLoop::main().dispatch([this, conditionPtr = &condition, valuePtr = &value] {
Modules/applepay/ApplePaySession.cpp
640: RunLoop::main().dispatch([promise, canMakePayments]() mutable {
workers/WorkerMessagingProxy.cpp
168: RunLoop::main().dispatch([this, protectedThis = makeRef(*this), message = message.isolatedCopy()] {
If possible callOnMainThread could be used or WebThreadRun. See Modules/websockets/WebSocket.cpp's approach.
Note: WorkerMessagingProxy case, callOnMainThread couldn't be used and was specifically avoided.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Andy Estes
(In reply to Joseph Pecoraro from comment #0)
> Modules/applepay/ApplePaySession.cpp
> 640: RunLoop::main().dispatch([promise, canMakePayments]()
> mutable {
>
In practice this is safe because Apple Pay is disabled at runtime in WebKit1 clients, so this code won't execute on a WebThread.
I think callOnMainThread() could be used here without a problem, though.
Anders Carlsson
RunLoop::main().dispatch() shouldn't be web thread aware since it's used in the UI process. If anything, callOnMainThread should be used in WebCore.
Chris Dumez
The call to RunLoop::main().dispatch() in SerializedScriptValue.cpp for IndexedDB does look unsafe and should probably be replaced with callOnMainThread().