Skip to content

Commit 611b77f

Browse files
author
Capacitor+ Bot
committed
chore: sync upstream PR ionic-team#7987 from @merbin2012
2 parents 270d700 + f0d274c commit 611b77f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

android/capacitor/src/main/java/com/getcapacitor/BridgeWebViewClient.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public void onReceivedHttpError(WebView view, WebResourceRequest request, WebRes
9191
@Override
9292
public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) {
9393
super.onRenderProcessGone(view, detail);
94+
9495
boolean result = false;
9596

9697
List<WebViewListener> webViewListeners = bridge.getWebViewListeners();
@@ -100,6 +101,18 @@ public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail)
100101
}
101102
}
102103

104+
if (!result) {
105+
// If no one handled it, handle it ourselves!
106+
107+
view.post(() -> {
108+
Toast.makeText(view.getContext(), "Reloading due to low memory issue", Toast.LENGTH_SHORT).show();
109+
});
110+
111+
view.reload(); // Safely reload WebView
112+
113+
return true;
114+
}
115+
103116
return result;
104117
}
105118
}

0 commit comments

Comments
 (0)