react-native/React
adamjmcgrath 23a34d4c65 Ignore "Frame load interrupted" errors in UIWebView
Summary:
Am writing an OAuth flow using `WebView`, when the OAuth provider redirects back to the [redirect_uri](https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow#logindialog) I intercept the request using `onShouldStartLoadWithRequest`, get the access token from the url and close the `WebView`.

The problem I see is that when the OAuth provider redirects to the `redirect_uri` and I intercept it by returning false from `onShouldStartLoadWithRequest`, I get a WebKitErrorDomain error code 102 ("Frame load interrupted").

Looking at some other iOS libraries that implement OAuth with a WebView - it seems that the error can be ignored. eg.

https://github.com/facebook/facebook-ios-sdk/blob/master/FBSDKCoreKit/FBSDKCoreKit/Internal/WebDialog/FBSDKWebDialogView.m#L146

https://github.com/evernote/evernote-sdk-ios/blob/master/evernote-sdk-ios/internal/ENOAuthViewController.m#L147

You can recreate the error using a url that automatically redirects, eg http://www.facebook.com -> https://www.facebook.com

```js
<WebView
  source={{ uri: 'http://www.facebook.com' }}
  onShouldStartLoadWithRequest={(event) => {
    if (event.url.startsWith('https://www.facebook.com')) {
      return false;
    }
    return true;
  }}
/>
```
Closes https://github.com/facebook/react-native/pull/12482

Differential Revision: D5154115

Pulled By: shergin

fbshipit-source-id: 25151d00a1f97e17760617ee5aac6a0140c733c8
2017-05-31 00:16:13 -07:00
..
Base Add message to remind user to enable wifi 2017-05-30 20:49:48 -07:00
CxxBridge Fix some issues with the React podspec for the Cxx bridge 2017-05-30 11:15:19 -07:00
CxxModule Improve systrace markers 2017-05-12 18:07:49 -07:00
CxxUtils Explicitly cast to (bool) where needed on objc with folly::dynamic 2017-04-18 15:36:20 -07:00
DevSupport Fix packager reload command not working 2017-05-15 10:30:36 -07:00
Executors Remove RCTBatchedBridge rule and all uses from the tree 2017-04-19 17:00:43 -07:00
Modules iOS: Introduce API for making screen reader announcements 2017-05-30 04:46:08 -07:00
Profiler Fix memory leak in RN fbsystrace support 2017-05-15 03:47:15 -07:00
React.xcodeproj Move packager launcher scripts outside of `packager/` 2017-05-23 16:17:09 -07:00
ReactLegacy.xcodeproj RCTTextField was spliited into two classes 2017-05-29 16:01:11 -07:00
Views Ignore "Frame load interrupted" errors in UIWebView 2017-05-31 00:16:13 -07:00
third-party.xcconfig More attempts to fix Travis CI runs 2017-05-10 04:32:54 -07:00