WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
172390
[iOS]: RunLoop::main().dispatch() needs to take into account USE_WEB_THREAD
https://bugs.webkit.org/show_bug.cgi?id=172390
Summary
[iOS]: RunLoop::main().dispatch() needs to take into account USE_WEB_THREAD
Joseph Pecoraro
Reported
2017-05-19 15:06:39 PDT
[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
Comment 1
2017-05-19 17:22:25 PDT
(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
Comment 2
2017-05-19 18:01:58 PDT
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
Comment 3
2017-05-19 18:19:57 PDT
The call to RunLoop::main().dispatch() in SerializedScriptValue.cpp for IndexedDB does look unsafe and should probably be replaced with callOnMainThread().
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