Commit Graph

105 Commits

Author SHA1 Message Date
Christian Nilsson 53c0382cd0
fix(android): changed initial value of nextLockIdentifier from 0 to 1 (#1689)
Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>
2020-12-08 04:56:28 +01:00
Lorenzo Sciandra 194c6a2335
feat(android): Introduce setSupportMultipleWindows to mitigate CVE-2020-6506 (#1747 by @mrcoinbase and @kelset -- THANK YOU!)
BREAKING CHANGE:

This release introduces the `setSupportMultipleWindows` prop for Android. This sets the underlying Android WebView setting `setSupportMultipleWindows`. This prop defaults to `true` (previously `false`), and serves to mitigate the security advisory [CVE-2020-6506](https://github.com/react-native-webview/react-native-webview/security/advisories/GHSA-36j3-xxf7-4pqg).

The primary way this new behavior changes existing React Native WebView implementations on Android is that links that open in new tabs/windows (such as `<a target="_blank">`) will now prompt to open in the system browser, rather than re-using the current WebView.

If this behavior is not desirable, you can set this new prop to `false`, but be aware that this exposes your app to the security vulnerability listed above. Make sure you have read and understand the whole advisory and relevant links.

iOS & Windows are unaffected.

```jsx
<WebView
  // ...
  setSupportMultipleWindows={true} // default: true
/>
```

Thanks to @mrcoinbase, @kelset, and @Titozzz for their work on this.
2020-11-24 09:15:19 -08:00
Harsh Chokshi c95c0ea923
fix(android): Unset mWebChromeClient on WebViewManager rather than WebView (#1720) 2020-11-07 00:05:18 +01:00
Alesandro Ortiz ef48d35e95
fix(android): Update SSL error handling (#1466)
* Update SSL error handling for Android WebView

Update SSL error handling to call onReceivedError() only on top-level navigations. This prevents iframes and other subresources from causing user-visible SSL error messages. The desired behavior is only to have top-level navigations show user-visible error messages. All other requests should be cancelled automatically with no user-visible error message.

* Update RNCWebViewManager.java

Clarify comments and add warning on blocked subresource

Co-authored-by: Thibault Malbranche <thibault.malbranche@epitech.eu>
2020-10-22 09:35:31 +02:00
Daniel Vicory 4d4b5e2387
Synchronously decide if Android WebView should load a URL or not. (#1590)
This solves a class of issues when the WebView loses "context"
that a subsequent page load is the same as what was attempted
to be loaded previously. This solves a bug where a HTTP redirect
in combination with history manipulations causes a user to be
stuck and prevented from going back. Since WebView requests are
allowed to happen normally, debugging the WebView and tracking
redirects and page load initiators is more accurate and easier.
This will also bypass bridge latency and provide a faster navigation.

To do this, we must lock in the shouldOverrideUrlLoading callback
and send an event to JS. Currently, this callback is ran on
the main UI thread, of which we have no control over. This is
problematic as using the bridge in most ways seems to require
the main UI thread, which will cause a deadlock. However, using
BatchedBridge for Java->JS and a synchronous method for JS->Java
doesn't cause any problems. Additionally, it's been designed so
that if WebView suddenly runs the callback on a different thread
allowing for concurrency, it will continue to work.
2020-08-26 08:59:51 +02:00
oliviacaraiman 9ffca8f9db
feat(android): Add androidLayerType as prop (#1588)
* Add androidLayerType as a prop

* Deprecate "androidHardwareAccelerationDisabled" prop

* Update reference

Co-authored-by: Olivia Caraiman <olcaraim@microsoft.com>
2020-08-24 14:23:38 +02:00
Caleb Clarke 6a9116f2d1
feat(events): Add isTopFrame to shouldStartLoadForRequest (#1537)
* Add isTopFrame to shouldStartLoadForRequest on iOS

onLoadingStart is not raised for inner frames, but onShouldStartLoadWithRequest still is. This keeps that behavior but adds isTopFrame to onShouldStartLoadWithRequest so that apps can perform their own filtering if desired.

* Update docs

Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>
2020-08-15 11:21:38 +02:00
Jason Kelly 63c584c647
fix(incognito): Ensures that incognito doesn't clear cookies when not enabled (#1447 by @jasonkellydk)
Co-authored-by: Jason Kelly <jason.kelly@isobar.com>
Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>
Co-authored-by: Jason Safaiyeh <safaiyeh@protonmail.com>
2020-08-14 20:04:20 -07:00
cristianoccazinsp 8a8b7ceb98
feat(android): WebView crash handling (#1480)
Co-authored-by: Cristiano Coelho <cristianocca@hotmail.com>
2020-08-06 22:21:01 +02:00
Rinku Kumari 5f823bb77b
fix(android sdk 28): build issue (#1469)
Co-authored-by: Rinku Kumari <rinku@ideaboard.xyz>
2020-06-26 16:04:44 +02:00
Alesandro Ortiz 1bd5961255
fix(android): Add SSL error handling for Android WebView (#1450 by @thephpjedi)
Based on PR #668. Fixes #259.
2020-06-13 14:24:56 -07:00
Salvatore Randazzo ac4e05e0f2
feat(android): Add support for injectedJavaScriptBeforeContentLoaded on Android (#1099 by @SRandazzo and @ @shirakaba) 2020-06-13 13:54:48 -07:00
Jacob Müller 2f8c4c5067
fix(android): duplicate `setWebChromeClient()` overwrite (#1417) 2020-05-29 11:21:24 -05:00
michael hancock 0317a4b4a5
fix(android): Fixes black screen on back button press (#1298 by @michan85)
Co-authored-by: michael hancock <michael.hancock@24.com>
Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>
2020-05-28 18:05:53 -07:00
Jason Chia-Hsien Ho b97d16c23d
fix(android): Improve onLoadProgress consistency (#1373 by @hojason117)
[skip ci]

Co-authored-by: Tyler Coffman <tyler.coffman@appfolio.com>
Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>
2020-05-28 17:21:20 -07:00
Karthik Subramaniam 03dbcb870e
fix(android): Updated permissions for Android Q and above (#1384 by @Karthz) 2020-05-28 16:47:26 -07:00
trcoffman 91df544fae
feat(webview): Allow javascript to open windows automatically (#1409 by @trcoffman)
[skip ci]
2020-05-28 09:54:20 -07:00
Thibault Malbranche 7ab2afbab7
fix(android): Broken build due to conditional import of kotlin (#1412) 2020-05-28 13:18:13 +02:00
Jason Chia-Hsien Ho 89886c820d
fix(android): Fix several Android file upload issues (#1302 by @hojason117)
[skip ci]
2020-05-26 19:59:08 -07:00
Benjamin Rau 4f0f0afe70
fix(android): add missing null check for fileTypes (#1368 by @bengy) 2020-05-26 14:59:18 -07:00
SaeedZhiany 2639d523e9
fix(gradle): Load Android Gradle Plugin conditionally (#1230 by @SaeedZhiany)
BREAKING CHANGE:

The Android Gradle plugin is only required when opening the project stand-alone, not when it is included as a dependency. By doing this, the project opens correctly in Android Studio, and it can also be consumed as a native module dependency from an application project without affecting the app project (avoiding unnecessary downloads/conflicts/etc).

Also moved getExtOrDefault to buildScript block to able to use everywhere in the file

This change shouldn't break any apps, but we are marking it as a breaking change in case there are some use cases we've missed.

[skip ci]
2020-05-26 14:57:40 -07:00
trcoffman 5d88af44fa
fix(Android): Workaround for chromium bugs 1023678 and 1050635. (#1221)
There is a bug in the WebView that causes a spurious call to onReceivedError
whenever you download a file.

This commit is a workaround for that bug. The idea here is to try and detect
these spurious errors and drop them before they cause problems.

This commit should be reverted once those chromium bugs are fixed.
2020-04-10 13:41:53 -07:00
ivari 04f9fb23ba
fix(Android): Ensure each mounted WebView binds their personal onMessage handler (#1301)
* Ensure each mounted WebView binds their personal onMessage handler

* Changed unique ref generation to uuid

Uses `uuid` npm package.
Dashes are removed from the ref for sanity.
2020-04-09 08:05:44 -07:00
ivari c88e380762
feat(Android): Implement direct communication between Android code and JS (#1203) 2020-04-06 10:25:28 -07:00
trcoffman 24702450f3
fix(Android): Don't log the cookie when downloading file. (#1224) 2020-02-21 11:02:50 -08:00
Daniel Vicory 4093682e08
fix(Android): Don't show camera options for a file upload when they can not be used (#1210)
* Don't show camera options for a file upload that would result in nothing happening for the user.

On Android, if the application declares the camera permission, then even intents
that use the camera require permission to be granted. This is a problem for apps
that combine an in-app camera with a WebView that has file uploading and the user
has not given permission for the camera.

Note, this will not request permission for camera. This will simply prevent
showing the camera options that would be a no-op action for users. It does this
by checking if the camera permission is declared, and if so, checks that the
user has granted permission.

More information: https://blog.egorand.me/taking-photos-not-so-simply-how-i-got-bitten-by-action_image_capture/

* Add example and documentation about camera option availability in file uploads for Android.
2020-02-18 18:40:30 -08:00
Dulmandakh e6241cbb6a
chore(Android): Convert RNCWebViewPackage to Kotlin (#1194)
* RN is implementation dependency

* renamed:    RNCWebViewPackage.java -> RNCWebViewPackage.kt

* migrate RNCWebViewPackage to Kotlin

Co-authored-by: Jason Safaiyeh <safaiyeh@protonmail.com>
2020-02-12 17:12:24 -08:00
Daniel Vicory 344aab591a
fix(Android): Revert "Redirected URLs now redirect correctly. (#991)" (#1177)
This reverts commit acf1ad7560.
2020-01-29 19:18:35 -08:00
hanlh1 acf1ad7560 fix(Android): Redirected URLs now redirect correctly. (#991)
Co-authored-by: Jamon Holmgren <jamon@infinite.red>
Co-authored-by: Jason Safaiyeh <safaiyeh@protonmail.com>
2020-01-26 00:25:24 -08:00
Conner Owen 5b0c634f15 fix(build): Android build errors when using Gradle 6.0 (#1037)
* Fix Android build errors when using Gradle 6.0

* Update gradle.properties

* Remove newline at end of file

* newline
2019-11-26 10:41:16 +01:00
Vladimir d8acd9086c fix(android): Added fallback poster image to prevent crashes (#1036) 2019-11-26 10:40:38 +01:00
Andrei Pfeiffer 71a375f898 chore(cleaning): Remove old comments (#1019) 2019-11-14 10:48:58 +01:00
Nikhil Chitlur Navakiran 7e68da4ffe fix(android): Fix ClassCastException when doing native things(#987) 2019-11-13 10:36:08 +01:00
Stanislav Shakirov 4a4f4a2c45 feat(android): add clearHistory, clearCache and clearFormData (#450)
* add clearHistory, clearCache and clearFormData android webview api.

* remove pointless `async`

* add docs for new android webview methods

* Update Reference.md

* update commands types

* add more strict type for RNCWebViewUIManager `Commands` property
2019-11-12 10:09:16 +01:00
thanakij fab77dc82f fix(android): possible NullPointerException (#965) 2019-10-22 09:56:50 +02:00
Tom Targosz 0b783da0a4 fix(lint android): Add TargetAPI to onPermissionRequest (#940) 2019-10-11 10:45:22 +02:00
Borut Balazek 4db3d84dda feat(android): allowFileAccessFromFileURLs prop added (#831)
* add allowFileAccessFromFileURLs propery to do the expected on android

* Added types

* Update WebViewTypes.ts
2019-09-29 15:50:39 +02:00
Andres Castano 5da59251ce feat(android): Expose cacheMode property (#895) 2019-09-29 15:45:20 +02:00
Thibault Malbranche 8f2ddf4542
fix(android): Revert scroll update from #281 (#889)
fixes #878
2019-09-23 15:40:40 +02:00
Tyler Alves fc59cae4bf fix(android): Filter extra onLoadProgress & add url event (#643)
* Filter out extra onLoadProgress calls; add url to onLoadProgress

* remove note about onLoadProgress not having the url property in docs

* Update Reference.md
2019-09-23 10:35:49 +02:00
thanakij 9e25e42cee fix(Android): hardware acceleration issue (#854)
* Fix https://github.com/react-native-community/react-native-webview/issues/575

* Check if hardware acceleration is available also

* Alternative way to check isHarewareAccelerated
2019-09-23 00:03:42 +02:00
Jason Chia-Hsien Ho 552472c414 feat(new prop): onHttpError callback (#885) 2019-09-21 02:43:28 +02:00
masako-yamada a5cb7ba65c fix(android): Allow scrolling inside ScrollView (#281) 2019-09-18 11:33:08 +02:00
Greg Price b2cd6b54fa fix(android): Move noisy debug logging out of "quiet" log level. (#844)
Each time building our app, this library causes a message like this
one to be printed, sometimes twice:

  > Configure project :react-native-webview
  :react-native-webview:reactNativeAndroidRoot /home/greg/z/mobile/node_modules/react-native/android

Worse, the message comes through even if I silence all normal
progress messages and warnings, with `./gradlew --quiet`.

It turns out that the `logger.quiet` method which these log lines are
using has a confusing name.  It doesn't mean "log quietly", but more
like the opposite: "log even when asked to keep things quiet".  See
documentation on Gradle log levels:
  https://docs.gradle.org/current/userguide/logging.html

So, remove the noise by switching to `logger.info`.  This avoids
bothering the user by default, and keeps the information readily
available if desired by passing `--info` to Gradle.
2019-09-04 09:22:23 +02:00
tekmin 47e9a0b97d fix(android): webview crash with incognito in Android Lollipop (#799) 2019-08-29 16:47:48 +02:00
MAHAVIR VATALIYA 39e5373d3e Update RNCWebViewModule.java (#509)
In Devices moto e5 play and Samsung Galaxy Note 9 Video Capture via camera return data as null.
2019-08-29 16:46:42 +02:00
Akeem McLennon 1ea05d3115 fix(android): Allow user to rotate fullscreen video (Android X) (#816)
* Allow user to rotate fullscreen video on Android

* Update RNCWebViewManager.java

* Update RNCWebViewManager.java
2019-08-29 16:38:25 +02:00
Roc 12db6956a9 fix(android): add null reference check for onMessage on android (#770) 2019-08-09 10:53:00 +02:00
DemMarcupan 6f053bad7b feat(focus): Add functionality to imperatively focus webview (#567)
*  - add focus functionality for devices without touch screen
 (faced problem while developing for android TV, cause there only remote controller for device)

* Reimplement as a ref method.

*  - remove redundant requestFocus
2019-08-06 10:56:59 +02:00
Eze bb79ae80ee feat(Android): webrtc permission request - conflicts fixed (#719)
* fix(Android): WebRTC permission request (#231)

* fix(Android):  Avoid unintentionally granting requests for new permissions (#231)

* ContextCompat import migrated to androidx new artifact

* RNCWebViewManager.java original format restored
2019-08-02 17:23:59 +02:00