Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): Reset bridge on onPageStarted only #4634

Merged
merged 3 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
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
@@ -1,5 +1,6 @@
package com.getcapacitor;

import android.graphics.Bitmap;
import android.net.Uri;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
Expand Down Expand Up @@ -43,4 +44,10 @@ public void onPageFinished(WebView view, String url) {
}
}
}

@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
bridge.reset();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ private WebResourceResponse handleLocalRequest(WebResourceRequest request, PathH

responseStream = jsInjector.getInjectedStream(responseStream);

bridge.reset();
int statusCode = getStatusCode(responseStream, handler.getStatusCode());
return new WebResourceResponse(
"text/html",
Expand Down Expand Up @@ -295,7 +294,6 @@ private WebResourceResponse handleLocalRequest(WebResourceRequest request, PathH
// TODO: Conjure up a bit more subtlety than this
if (ext.equals(".html")) {
responseStream = jsInjector.getInjectedStream(responseStream);
bridge.reset();
}

String mimeType = getMimeType(path, responseStream);
Expand Down Expand Up @@ -351,7 +349,6 @@ private WebResourceResponse handleProxyRequest(WebResourceRequest request, PathH
}
InputStream responseStream = conn.getInputStream();
responseStream = jsInjector.getInjectedStream(responseStream);
bridge.reset();
return new WebResourceResponse(
"text/html",
handler.getEncoding(),
Expand Down