Skip to content
Merged
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 @@ -94,6 +94,15 @@ public void onPageStarted(WebView webView, String url, Bitmap favicon) {

RNCWebView reactWebView = (RNCWebView) webView;

// Block initial loads to non-allowed domains (shouldOverrideUrlLoading
// doesn't fire for the initial source URL)
String host = Uri.parse(url).getHost();
if (host != null && !reactWebView.isHostAllowed(host)) {
reactWebView.stopLoading();
this.onReceivedError(webView, -1, "Navigation blocked by sandbox: " + url, url);
return;
}

reactWebView.callInjectedJavaScriptBeforeContentLoaded();
}

Expand All @@ -103,6 +112,7 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
final boolean isJsDebugging = rncWebView.getReactApplicationContext().getJavaScriptContextHolder().get() == 0;
if(!rncWebView.isHostAllowed(Uri.parse(url).getHost())){
rncWebView.stopLoading();
this.onReceivedError(view, -1, "Navigation blocked by sandbox: " + url, url);
return true;
}

Expand Down