Permalink
Browse files

Stop Reload Android Webview On Same URL Before

Summary:
Because it is react, the url could be changed on redirection or some other ways.
The iOS version's WebView has controled that on [here](https://github.com/facebook/react-native/blob/master/React/Views/RCTWebView.m#L106).
But the Android's one is not.

Check the url is same with privous url. If it is true, cancel loading.
This logic is same with iOS's.

the ```method``` hasn't compared.

Test urls as we can.
The Google Map(https://map.google.com) was one of the site which has occur error before this commit.

related issue : #9121
Closes #9126

Differential Revision: D3663685

Pulled By: javache

fbshipit-source-id: f38c9012ee077677543dafcea83c0778a4471bfa
1 parent 0093dcc commit 9fa4fe2fa5701240e8d90b27829d4b3e1f8141f3 @skatpgusskat skatpgusskat committed with Facebook Github Bot 4 Aug 4, 2016
@@ -329,6 +329,10 @@ public void setSource(WebView view, @Nullable ReadableMap source) {
}
if (source.hasKey("uri")) {
String url = source.getString("uri");
+ String previousUrl = view.getUrl();
+ if (previousUrl != null && previousUrl.equals(url)) {
+ return;
+ }
if (source.hasKey("method")) {
String method = source.getString("method");
if (method.equals(HTTP_METHOD_POST)) {

0 comments on commit 9fa4fe2

Please sign in to comment.