Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.Rect;
Expand Down Expand Up @@ -200,9 +201,12 @@
applyWindowGravity(getDialog().getWindow(), "onCreateView");
}

webView = new IterableWebView(getContext());
webView = createWebViewSafely(getContext());
if (webView == null) {
dismissAllowingStateLoss();
return null;
}
webView.setId(R.id.webView);

webView.createWithHtml(this, htmlString);

if (orientationListener == null) {
Expand Down Expand Up @@ -324,7 +328,9 @@
*/
@Override
public void onStop() {
orientationListener.disable();
if (orientationListener != null) {
orientationListener.disable();
}

super.onStop();
}
Expand Down Expand Up @@ -747,6 +753,18 @@
return InAppLayout.CENTER;
}
}

private IterableWebView createWebViewSafely(Context context) {
try {
return new IterableWebView(context);

Check warning

Code scanning / CodeQL

Android WebView settings allows access to content links Medium

Sensitive information may be exposed via a malicious link due to access to content:// links being allowed in this WebView.
} catch (Resources.NotFoundException e) {
IterableLogger.e(TAG, "Failed to create WebView - system WebView resource issue", e);
return null;
} catch (RuntimeException e) {
IterableLogger.e(TAG, "Failed to create WebView - unexpected error", e);
return null;
}
}
}

enum InAppLayout {
Expand Down
Loading