From eb2c06cd2548487d60b92dfc1250a09785e64caf Mon Sep 17 00:00:00 2001 From: bjoern Date: Fri, 4 Mar 2022 20:37:43 +0100 Subject: [PATCH] enable `Window.sessionStorage`, `Window.localStorage` and `IndexedDB` APIs (#2221) * enable Window.sessionStorage, Window.localStorage and IndexedDB APIs * scope localStorage per message when using a custom scheme as `webxdc`, different messages will share the same localStorage, even though different domains are in use. not sure if that is an Android bug, however, using `https` as the scheme scopes messages correctly, so we are just using that. --- src/org/thoughtcrime/securesms/WebxdcActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/WebxdcActivity.java b/src/org/thoughtcrime/securesms/WebxdcActivity.java index a10e83d59..b9847c791 100644 --- a/src/org/thoughtcrime/securesms/WebxdcActivity.java +++ b/src/org/thoughtcrime/securesms/WebxdcActivity.java @@ -70,13 +70,15 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE webSettings.setGeolocationEnabled(false); webSettings.setAllowFileAccessFromFileURLs(false); webSettings.setAllowUniversalAccessFromFileURLs(false); + webSettings.setDatabaseEnabled(true); + webSettings.setDomStorageEnabled(true); webView.addJavascriptInterface(new InternalJSApi(), "InternalJSApi"); // `msg_id` in the subdomain makes sure, different apps using same files do not share the same cache entry // (WebView may use a global cache shared across objects). // (a random-id would also work, but would need maintenance and does not add benefits as we regard the file-part interceptRequest() only, // also a random-id is not that useful for debugging) - webView.loadUrl("webxdc://msg" + appMessageId + ".localhost/index.html"); + webView.loadUrl("https://msg" + appMessageId + ".localhost/index.html"); Util.runOnAnyBackgroundThread(() -> { JSONObject info = this.dcAppMsg.getWebxdcInfo();