Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dae43b16 authored by Yuya Aoki's avatar Yuya Aoki Committed by Takeshi Aimi
Browse files

Fix deadlock of WebViewCoreThread

There was a deadlock in destroy process.
Investigation showed that WebViewCoreThread is waiting some
callbacks but in this case WebViewCoreThread can not resume
itself not to call notify method.

Flow:
1. CallbackProxy.sendMessageToUiThreadSync
2. WebViewClassic.destroy()
3. CallbackProxy.blockMessages()
4. CallbackProxy.handleMessage is called via MainThread
5. The WebViewCoreThread deadlock is occured.

The cases we have to call notify method are followings.
OVERRIDE_URL
CREATE_WINDOW
SAVE_PASSWORD
NOTIFY
OPEN_FILE_CHOOSER
JS_ALERT
JS_CONFIRM
JS_PROMPT
JS_UNLOAD
JS_TIMEOUT

Change-Id: I9d95ae500bf6338d77b32b5fa15de7cff5720d0f
parent ddf7a066
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -305,7 +305,12 @@ class CallbackProxy extends Handler {
        // in the UI thread. The WebViewClient and WebChromeClient functions
        // that check for a non-null callback are ok because java ensures atomic
        // 32-bit reads and writes.
        if (messagesBlocked()) return;
        if (messagesBlocked()) {
            synchronized (this) {
                notify();
            }
            return;
        }
        switch (msg.what) {
            case PAGE_STARTED:
                String startedUrl = msg.getData().getString("url");