Skip to content

Commit

Permalink
Stop Reload Android Webview On Same URL Before
Browse files Browse the repository at this point in the history
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 : facebook#9121
Closes facebook#9126

Differential Revision: D3663685

Pulled By: javache

fbshipit-source-id: f38c9012ee077677543dafcea83c0778a4471bfa
  • Loading branch information
Nam Se Hyun authored and Morgan Pretty committed Aug 24, 2016
1 parent 39eea4a commit c6ccf30
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit c6ccf30

Please sign in to comment.