@exodus/react-native-webview 13.16.0-exodus.2 → 13.16.0-exodus.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +11 -7
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java +15 -18
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewClient.java +0 -21
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManagerImpl.kt +5 -50
- package/android/src/newarch/com/reactnativecommunity/webview/RNCWebViewManager.java +0 -58
- package/android/src/oldarch/com/reactnativecommunity/webview/RNCWebViewManager.java +0 -40
- package/apple/RNCWebView.mm +0 -8
- package/apple/RNCWebViewDecisionManager.m +17 -0
- package/apple/RNCWebViewImpl.h +0 -10
- package/apple/RNCWebViewImpl.m +24 -72
- package/apple/RNCWebViewManager.mm +0 -8
- package/lib/RNCWebViewNativeComponent.d.ts +0 -26
- package/lib/RNCWebViewNativeComponent.js +1 -1
- package/lib/WebView.android.js +1 -1
- package/lib/WebView.d.ts +2 -2
- package/lib/WebView.ios.js +1 -1
- package/lib/WebViewShared.d.ts +5 -5
- package/lib/WebViewShared.js +1 -1
- package/lib/WebViewTypes.d.ts +5 -358
- package/lib/WebViewTypes.js +1 -1
- package/package.json +4 -11
- package/react-native-webview.podspec +1 -1
- package/src/RNCWebViewNativeComponent.ts +0 -37
- package/src/WebView.android.tsx +293 -284
- package/src/WebView.ios.tsx +223 -256
- package/src/WebView.tsx +2 -8
- package/src/WebViewShared.tsx +2 -11
- package/src/WebViewTypes.ts +2 -396
- package/src/__tests__/WebViewShared-test.js +40 -62
- package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +0 -1
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopHttpErrorEvent.kt +0 -25
- package/lib/WebView.windows.d.ts +0 -17
- package/lib/WebView.windows.js +0 -1
- package/lib/WebViewNativeComponent.windows.d.ts +0 -3
- package/lib/WebViewNativeComponent.windows.js +0 -1
- package/src/WebView.macos.tsx +0 -252
- package/src/WebView.windows.tsx +0 -217
- package/src/WebViewNativeComponent.macos.ts +0 -7
- package/src/WebViewNativeComponent.windows.ts +0 -8
package/android/build.gradle
CHANGED
|
@@ -4,13 +4,17 @@ buildscript {
|
|
|
4
4
|
ext.safeExtGet = {prop ->
|
|
5
5
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : project.properties['ReactNativeWebView_' + prop]
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
// This avoids unnecessary downloads and potential conflicts when the library is included as a
|
|
8
|
+
// module dependency in an application project.
|
|
9
|
+
if (project == rootProject) {
|
|
10
|
+
repositories {
|
|
11
|
+
google()
|
|
12
|
+
gradlePluginPortal()
|
|
13
|
+
}
|
|
14
|
+
dependencies {
|
|
15
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion')}")
|
|
16
|
+
classpath("com.android.tools.build:gradle:7.0.4")
|
|
17
|
+
}
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
20
|
|
|
@@ -157,8 +157,16 @@ public class RNCWebChromeClient extends WebChromeClient implements LifecycleEven
|
|
|
157
157
|
// Exodus: Build origin string for whitelist check
|
|
158
158
|
final Uri originUri = request.getOrigin();
|
|
159
159
|
final String scheme = originUri.getScheme();
|
|
160
|
+
final String host = originUri.getHost();
|
|
160
161
|
final int port = originUri.getPort();
|
|
161
|
-
|
|
162
|
+
|
|
163
|
+
// Exodus: Deny permission if host is null (malformed origin)
|
|
164
|
+
if (host == null) {
|
|
165
|
+
request.deny();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
String origin = scheme + "://" + host;
|
|
162
170
|
|
|
163
171
|
if (port > 0 && (("http".equals(scheme) && port != 80) || ("https".equals(scheme) && port != 443))) {
|
|
164
172
|
origin += ":" + port;
|
|
@@ -177,17 +185,11 @@ public class RNCWebChromeClient extends WebChromeClient implements LifecycleEven
|
|
|
177
185
|
androidPermission = Manifest.permission.CAMERA;
|
|
178
186
|
}
|
|
179
187
|
} else if(requestedResource.equals(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID)) {
|
|
188
|
+
// Exodus: Only grant if allowsProtectedMedia is enabled.
|
|
189
|
+
// RESOURCE_PROTECTED_MEDIA_ID is not a real Android permission,
|
|
190
|
+
// so it cannot be passed to checkSelfPermission.
|
|
180
191
|
if (mAllowsProtectedMedia) {
|
|
181
192
|
grantedPermissions.add(requestedResource);
|
|
182
|
-
} else {
|
|
183
|
-
/**
|
|
184
|
-
* Legacy handling (Kept in case it was working under some conditions (given Android version or something))
|
|
185
|
-
*
|
|
186
|
-
* Try to ask user to grant permission using Activity.requestPermissions
|
|
187
|
-
*
|
|
188
|
-
* Find more details here: https://github.com/react-native-webview/react-native-webview/pull/2732
|
|
189
|
-
*/
|
|
190
|
-
androidPermission = PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID;
|
|
191
193
|
}
|
|
192
194
|
}
|
|
193
195
|
// TODO: RESOURCE_MIDI_SYSEX, RESOURCE_PROTECTED_MEDIA_ID.
|
|
@@ -235,7 +237,8 @@ public class RNCWebChromeClient extends WebChromeClient implements LifecycleEven
|
|
|
235
237
|
requestPermissions(Collections.singletonList(Manifest.permission.ACCESS_FINE_LOCATION));
|
|
236
238
|
|
|
237
239
|
} else {
|
|
238
|
-
|
|
240
|
+
// Exodus: Deny geolocation by default for security
|
|
241
|
+
callback.invoke(origin, false, false);
|
|
239
242
|
}
|
|
240
243
|
}
|
|
241
244
|
|
|
@@ -319,12 +322,6 @@ public class RNCWebChromeClient extends WebChromeClient implements LifecycleEven
|
|
|
319
322
|
shouldAnswerToPermissionRequest = true;
|
|
320
323
|
}
|
|
321
324
|
|
|
322
|
-
if (permission.equals(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID)) {
|
|
323
|
-
if (granted && grantedPermissions != null) {
|
|
324
|
-
grantedPermissions.add(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID);
|
|
325
|
-
}
|
|
326
|
-
shouldAnswerToPermissionRequest = true;
|
|
327
|
-
}
|
|
328
325
|
}
|
|
329
326
|
|
|
330
327
|
if (shouldAnswerToPermissionRequest
|
|
@@ -404,4 +401,4 @@ public class RNCWebChromeClient extends WebChromeClient implements LifecycleEven
|
|
|
404
401
|
public void setCameraPermissionOriginWhitelist(Set<String> whitelist) {
|
|
405
402
|
this.cameraPermissionOriginWhitelist = whitelist;
|
|
406
403
|
}
|
|
407
|
-
}
|
|
404
|
+
}
|
|
@@ -10,12 +10,10 @@ import android.webkit.HttpAuthHandler;
|
|
|
10
10
|
import android.webkit.RenderProcessGoneDetail;
|
|
11
11
|
import android.webkit.SslErrorHandler;
|
|
12
12
|
import android.webkit.WebResourceRequest;
|
|
13
|
-
import android.webkit.WebResourceResponse;
|
|
14
13
|
import android.webkit.WebView;
|
|
15
14
|
import android.webkit.WebViewClient;
|
|
16
15
|
|
|
17
16
|
import androidx.annotation.Nullable;
|
|
18
|
-
import androidx.annotation.RequiresApi;
|
|
19
17
|
import androidx.core.util.Pair;
|
|
20
18
|
|
|
21
19
|
import com.facebook.common.logging.FLog;
|
|
@@ -26,7 +24,6 @@ import com.facebook.react.bridge.WritableMap;
|
|
|
26
24
|
import com.facebook.react.uimanager.ThemedReactContext;
|
|
27
25
|
import com.facebook.react.uimanager.UIManagerHelper;
|
|
28
26
|
import com.reactnativecommunity.webview.events.SubResourceErrorEvent;
|
|
29
|
-
import com.reactnativecommunity.webview.events.TopHttpErrorEvent;
|
|
30
27
|
import com.reactnativecommunity.webview.events.TopLoadingErrorEvent;
|
|
31
28
|
import com.reactnativecommunity.webview.events.TopLoadingFinishEvent;
|
|
32
29
|
import com.reactnativecommunity.webview.events.TopLoadingStartEvent;
|
|
@@ -256,24 +253,6 @@ public class RNCWebViewClient extends WebViewClient {
|
|
|
256
253
|
UIManagerHelper.getEventDispatcherForReactTag((ReactContext) webView.getContext(), reactTag).dispatchEvent(new TopLoadingErrorEvent(reactTag, eventData));
|
|
257
254
|
}
|
|
258
255
|
|
|
259
|
-
@RequiresApi(api = Build.VERSION_CODES.M)
|
|
260
|
-
@Override
|
|
261
|
-
public void onReceivedHttpError(
|
|
262
|
-
WebView webView,
|
|
263
|
-
WebResourceRequest request,
|
|
264
|
-
WebResourceResponse errorResponse) {
|
|
265
|
-
super.onReceivedHttpError(webView, request, errorResponse);
|
|
266
|
-
|
|
267
|
-
if (request.isForMainFrame()) {
|
|
268
|
-
WritableMap eventData = createWebViewEvent(webView, request.getUrl().toString());
|
|
269
|
-
eventData.putInt("statusCode", errorResponse.getStatusCode());
|
|
270
|
-
eventData.putString("description", errorResponse.getReasonPhrase());
|
|
271
|
-
|
|
272
|
-
int reactTag = RNCWebViewWrapper.getReactTagFromWebView(webView);
|
|
273
|
-
UIManagerHelper.getEventDispatcherForReactTag((ReactContext) webView.getContext(), reactTag).dispatchEvent(new TopHttpErrorEvent(reactTag, eventData));
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
256
|
@TargetApi(Build.VERSION_CODES.O)
|
|
278
257
|
@Override
|
|
279
258
|
public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail detail) {
|
|
@@ -48,7 +48,6 @@ class RNCWebViewManagerImpl(private val newArch: Boolean = false) {
|
|
|
48
48
|
private var mPendingSource: ReadableMap? = null
|
|
49
49
|
|
|
50
50
|
private var mUserAgent: String? = null
|
|
51
|
-
private var mUserAgentWithApplicationName: String? = null
|
|
52
51
|
private val HTML_ENCODING = "UTF-8"
|
|
53
52
|
private val HTML_MIME_TYPE = "text/html"
|
|
54
53
|
private val HTTP_METHOD_POST = "POST"
|
|
@@ -84,6 +83,8 @@ class RNCWebViewManagerImpl(private val newArch: Boolean = false) {
|
|
|
84
83
|
settings.allowFileAccessFromFileURLs = false
|
|
85
84
|
settings.allowUniversalAccessFromFileURLs = false
|
|
86
85
|
settings.mixedContentMode = WebSettings.MIXED_CONTENT_NEVER_ALLOW
|
|
86
|
+
// Exodus: Force javaScriptCanOpenWindowsAutomatically = false for security
|
|
87
|
+
settings.javaScriptCanOpenWindowsAutomatically = false
|
|
87
88
|
|
|
88
89
|
// Fixes broken full-screen modals/galleries due to body height being 0.
|
|
89
90
|
webView.layoutParams = ViewGroup.LayoutParams(
|
|
@@ -114,7 +115,9 @@ class RNCWebViewManagerImpl(private val newArch: Boolean = false) {
|
|
|
114
115
|
urlObj = URL(url)
|
|
115
116
|
val baseUrl = urlObj.protocol + "://" + urlObj.host
|
|
116
117
|
val cookie = CookieManager.getInstance().getCookie(baseUrl)
|
|
117
|
-
|
|
118
|
+
if (cookie != null) {
|
|
119
|
+
request.addRequestHeader("Cookie", cookie)
|
|
120
|
+
}
|
|
118
121
|
} catch (e: MalformedURLException) {
|
|
119
122
|
Log.w(TAG, "Error getting cookie for DownloadManager", e)
|
|
120
123
|
}
|
|
@@ -230,28 +233,12 @@ class RNCWebViewManagerImpl(private val newArch: Boolean = false) {
|
|
|
230
233
|
setUserAgentString(viewWrapper)
|
|
231
234
|
}
|
|
232
235
|
|
|
233
|
-
fun setApplicationNameForUserAgent(viewWrapper: RNCWebViewWrapper, applicationName: String?) {
|
|
234
|
-
when {
|
|
235
|
-
applicationName != null -> {
|
|
236
|
-
val defaultUserAgent = WebSettings.getDefaultUserAgent(viewWrapper.webView.context)
|
|
237
|
-
mUserAgentWithApplicationName = "$defaultUserAgent $applicationName"
|
|
238
|
-
}
|
|
239
|
-
else -> {
|
|
240
|
-
mUserAgentWithApplicationName = null
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
setUserAgentString(viewWrapper)
|
|
244
|
-
}
|
|
245
|
-
|
|
246
236
|
private fun setUserAgentString(viewWrapper: RNCWebViewWrapper) {
|
|
247
237
|
val view = viewWrapper.webView
|
|
248
238
|
when {
|
|
249
239
|
mUserAgent != null -> {
|
|
250
240
|
view.settings.userAgentString = mUserAgent
|
|
251
241
|
}
|
|
252
|
-
mUserAgentWithApplicationName != null -> {
|
|
253
|
-
view.settings.userAgentString = mUserAgentWithApplicationName
|
|
254
|
-
}
|
|
255
242
|
else -> {
|
|
256
243
|
view.settings.userAgentString = WebSettings.getDefaultUserAgent(view.context)
|
|
257
244
|
}
|
|
@@ -289,7 +276,6 @@ class RNCWebViewManagerImpl(private val newArch: Boolean = false) {
|
|
|
289
276
|
val COMMAND_RELOAD = 3
|
|
290
277
|
val COMMAND_STOP_LOADING = 4
|
|
291
278
|
val COMMAND_POST_MESSAGE = 5
|
|
292
|
-
val COMMAND_INJECT_JAVASCRIPT = 6
|
|
293
279
|
val COMMAND_LOAD_URL = 7
|
|
294
280
|
val COMMAND_FOCUS = 8
|
|
295
281
|
|
|
@@ -305,7 +291,6 @@ class RNCWebViewManagerImpl(private val newArch: Boolean = false) {
|
|
|
305
291
|
.put("reload", COMMAND_RELOAD)
|
|
306
292
|
.put("stopLoading", COMMAND_STOP_LOADING)
|
|
307
293
|
.put("postMessage", COMMAND_POST_MESSAGE)
|
|
308
|
-
.put("injectJavaScript", COMMAND_INJECT_JAVASCRIPT)
|
|
309
294
|
.put("loadUrl", COMMAND_LOAD_URL)
|
|
310
295
|
.put("requestFocus", COMMAND_FOCUS)
|
|
311
296
|
.put("clearFormData", COMMAND_CLEAR_FORM_DATA)
|
|
@@ -340,7 +325,6 @@ class RNCWebViewManagerImpl(private val newArch: Boolean = false) {
|
|
|
340
325
|
} catch (e: JSONException) {
|
|
341
326
|
throw RuntimeException(e)
|
|
342
327
|
}
|
|
343
|
-
"injectJavaScript" -> webView.evaluateJavascriptWithFallback(args.getString(0))
|
|
344
328
|
"loadUrl" -> {
|
|
345
329
|
val url = args?.getString(0) ?: throw RuntimeException("Arguments for loading an url are null!")
|
|
346
330
|
webView.progressChangedFilter.setWaitingForCommandLoadUrl(false)
|
|
@@ -367,10 +351,6 @@ class RNCWebViewManagerImpl(private val newArch: Boolean = false) {
|
|
|
367
351
|
}
|
|
368
352
|
}
|
|
369
353
|
|
|
370
|
-
fun setAllowUniversalAccessFromFileURLs(viewWrapper: RNCWebViewWrapper, allow: Boolean) {
|
|
371
|
-
viewWrapper.webView.settings.allowUniversalAccessFromFileURLs = allow
|
|
372
|
-
}
|
|
373
|
-
|
|
374
354
|
private fun getDownloadingMessageOrDefault(): String? {
|
|
375
355
|
return mDownloadingMessage ?: DEFAULT_DOWNLOADING_MESSAGE
|
|
376
356
|
}
|
|
@@ -499,26 +479,11 @@ class RNCWebViewManagerImpl(private val newArch: Boolean = false) {
|
|
|
499
479
|
view.injectedJSBeforeContentLoaded = value
|
|
500
480
|
}
|
|
501
481
|
|
|
502
|
-
fun setInjectedJavaScriptForMainFrameOnly(viewWrapper: RNCWebViewWrapper, value: Boolean) {
|
|
503
|
-
val view = viewWrapper.webView
|
|
504
|
-
view.injectedJavaScriptForMainFrameOnly = value
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
fun setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(viewWrapper: RNCWebViewWrapper, value: Boolean) {
|
|
508
|
-
val view = viewWrapper.webView
|
|
509
|
-
view.injectedJavaScriptBeforeContentLoadedForMainFrameOnly = value
|
|
510
|
-
}
|
|
511
|
-
|
|
512
482
|
fun setInjectedJavaScriptObject(viewWrapper: RNCWebViewWrapper, value: String?) {
|
|
513
483
|
val view = viewWrapper.webView
|
|
514
484
|
view.setInjectedJavaScriptObject(value)
|
|
515
485
|
}
|
|
516
486
|
|
|
517
|
-
fun setJavaScriptCanOpenWindowsAutomatically(viewWrapper: RNCWebViewWrapper, value: Boolean) {
|
|
518
|
-
val view = viewWrapper.webView
|
|
519
|
-
view.settings.javaScriptCanOpenWindowsAutomatically = value
|
|
520
|
-
}
|
|
521
|
-
|
|
522
487
|
fun setShowsVerticalScrollIndicator(viewWrapper: RNCWebViewWrapper, value: Boolean) {
|
|
523
488
|
val view = viewWrapper.webView
|
|
524
489
|
view.isVerticalScrollBarEnabled = value
|
|
@@ -549,16 +514,6 @@ class RNCWebViewManagerImpl(private val newArch: Boolean = false) {
|
|
|
549
514
|
view.settings.javaScriptEnabled = enabled
|
|
550
515
|
}
|
|
551
516
|
|
|
552
|
-
fun setAllowFileAccess(viewWrapper: RNCWebViewWrapper, allowFileAccess: Boolean) {
|
|
553
|
-
val view = viewWrapper.webView
|
|
554
|
-
view.settings.allowFileAccess = allowFileAccess;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
fun setAllowFileAccessFromFileURLs(viewWrapper: RNCWebViewWrapper, value: Boolean) {
|
|
558
|
-
val view = viewWrapper.webView
|
|
559
|
-
view.settings.allowFileAccessFromFileURLs = value;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
517
|
fun setAllowsFullscreenVideo(viewWrapper: RNCWebViewWrapper, value: Boolean) {
|
|
563
518
|
val view = viewWrapper.webView
|
|
564
519
|
mAllowsFullscreenVideo = value
|
|
@@ -16,7 +16,6 @@ import com.facebook.react.viewmanagers.RNCWebViewManagerInterface;
|
|
|
16
16
|
import com.facebook.react.views.scroll.ScrollEventType;
|
|
17
17
|
import com.reactnativecommunity.webview.events.TopCustomMenuSelectionEvent;
|
|
18
18
|
import com.reactnativecommunity.webview.events.SubResourceErrorEvent;
|
|
19
|
-
import com.reactnativecommunity.webview.events.TopHttpErrorEvent;
|
|
20
19
|
import com.reactnativecommunity.webview.events.TopLoadingErrorEvent;
|
|
21
20
|
import com.reactnativecommunity.webview.events.TopLoadingFinishEvent;
|
|
22
21
|
import com.reactnativecommunity.webview.events.TopLoadingProgressEvent;
|
|
@@ -63,25 +62,6 @@ public class RNCWebViewManager extends ViewGroupManager<RNCWebViewWrapper>
|
|
|
63
62
|
return mRNCWebViewManagerImpl.createViewInstance(context);
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
@Override
|
|
67
|
-
@ReactProp(name = "allowFileAccess")
|
|
68
|
-
public void setAllowFileAccess(RNCWebViewWrapper view, boolean value) {
|
|
69
|
-
mRNCWebViewManagerImpl.setAllowFileAccess(view, value);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
@Override
|
|
73
|
-
@ReactProp(name = "allowFileAccessFromFileURLs")
|
|
74
|
-
public void setAllowFileAccessFromFileURLs(RNCWebViewWrapper view, boolean value) {
|
|
75
|
-
mRNCWebViewManagerImpl.setAllowFileAccessFromFileURLs(view, value);
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
@Override
|
|
80
|
-
@ReactProp(name = "allowUniversalAccessFromFileURLs")
|
|
81
|
-
public void setAllowUniversalAccessFromFileURLs(RNCWebViewWrapper view, boolean value) {
|
|
82
|
-
mRNCWebViewManagerImpl.setAllowUniversalAccessFromFileURLs(view, value);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
65
|
@Override
|
|
86
66
|
@ReactProp(name = "allowsFullscreenVideo")
|
|
87
67
|
public void setAllowsFullscreenVideo(RNCWebViewWrapper view, boolean value) {
|
|
@@ -100,12 +80,6 @@ public class RNCWebViewManager extends ViewGroupManager<RNCWebViewWrapper>
|
|
|
100
80
|
mRNCWebViewManagerImpl.setAndroidLayerType(view, value);
|
|
101
81
|
}
|
|
102
82
|
|
|
103
|
-
@Override
|
|
104
|
-
@ReactProp(name = "applicationNameForUserAgent")
|
|
105
|
-
public void setApplicationNameForUserAgent(RNCWebViewWrapper view, @Nullable String value) {
|
|
106
|
-
mRNCWebViewManagerImpl.setApplicationNameForUserAgent(view, value);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
83
|
@Override
|
|
110
84
|
@ReactProp(name = "basicAuthCredential")
|
|
111
85
|
public void setBasicAuthCredential(RNCWebViewWrapper view, @Nullable ReadableMap value) {
|
|
@@ -172,31 +146,11 @@ public class RNCWebViewManager extends ViewGroupManager<RNCWebViewWrapper>
|
|
|
172
146
|
mRNCWebViewManagerImpl.setInjectedJavaScriptBeforeContentLoaded(view, value);
|
|
173
147
|
}
|
|
174
148
|
|
|
175
|
-
@Override
|
|
176
|
-
@ReactProp(name = "injectedJavaScriptForMainFrameOnly")
|
|
177
|
-
public void setInjectedJavaScriptForMainFrameOnly(RNCWebViewWrapper view, boolean value) {
|
|
178
|
-
mRNCWebViewManagerImpl.setInjectedJavaScriptForMainFrameOnly(view, value);
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
@Override
|
|
183
|
-
@ReactProp(name = "injectedJavaScriptBeforeContentLoadedForMainFrameOnly")
|
|
184
|
-
public void setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(RNCWebViewWrapper view, boolean value) {
|
|
185
|
-
mRNCWebViewManagerImpl.setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(view, value);
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
|
|
189
149
|
@ReactProp(name = "injectedJavaScriptObject")
|
|
190
150
|
public void setInjectedJavaScriptObject(RNCWebViewWrapper view, @Nullable String value) {
|
|
191
151
|
mRNCWebViewManagerImpl.setInjectedJavaScriptObject(view, value);
|
|
192
152
|
}
|
|
193
153
|
|
|
194
|
-
@Override
|
|
195
|
-
@ReactProp(name = "javaScriptCanOpenWindowsAutomatically")
|
|
196
|
-
public void setJavaScriptCanOpenWindowsAutomatically(RNCWebViewWrapper view, boolean value) {
|
|
197
|
-
mRNCWebViewManagerImpl.setJavaScriptCanOpenWindowsAutomatically(view, value);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
154
|
@ReactProp(name = "javaScriptEnabled")
|
|
201
155
|
public void setJavaScriptEnabled(RNCWebViewWrapper view, boolean enabled) {
|
|
202
156
|
mRNCWebViewManagerImpl.setJavaScriptEnabled(view, enabled);
|
|
@@ -357,9 +311,6 @@ public class RNCWebViewManager extends ViewGroupManager<RNCWebViewWrapper>
|
|
|
357
311
|
@Override
|
|
358
312
|
public void setAllowsPictureInPictureMediaPlayback(RNCWebViewWrapper view, boolean value) {}
|
|
359
313
|
|
|
360
|
-
@Override
|
|
361
|
-
public void setAllowsAirPlayForMediaPlayback(RNCWebViewWrapper view, boolean value) {}
|
|
362
|
-
|
|
363
314
|
@Override
|
|
364
315
|
public void setAllowsLinkPreview(RNCWebViewWrapper view, boolean value) {}
|
|
365
316
|
|
|
@@ -426,9 +377,6 @@ public class RNCWebViewManager extends ViewGroupManager<RNCWebViewWrapper>
|
|
|
426
377
|
@Override
|
|
427
378
|
public void setTextInteractionEnabled(RNCWebViewWrapper view, boolean value) {}
|
|
428
379
|
|
|
429
|
-
@Override
|
|
430
|
-
public void setHasOnFileDownload(RNCWebViewWrapper view, boolean value) {}
|
|
431
|
-
|
|
432
380
|
@Override
|
|
433
381
|
public void setMediaCapturePermissionGrantType(RNCWebViewWrapper view, @Nullable String value) {}
|
|
434
382
|
|
|
@@ -462,11 +410,6 @@ public class RNCWebViewManager extends ViewGroupManager<RNCWebViewWrapper>
|
|
|
462
410
|
view.getWebView().stopLoading();
|
|
463
411
|
}
|
|
464
412
|
|
|
465
|
-
@Override
|
|
466
|
-
public void injectJavaScript(RNCWebViewWrapper view, String javascript) {
|
|
467
|
-
view.getWebView().evaluateJavascriptWithFallback(javascript);
|
|
468
|
-
}
|
|
469
|
-
|
|
470
413
|
@Override
|
|
471
414
|
public void requestFocus(RNCWebViewWrapper view) {
|
|
472
415
|
view.requestFocus();
|
|
@@ -538,7 +481,6 @@ public class RNCWebViewManager extends ViewGroupManager<RNCWebViewWrapper>
|
|
|
538
481
|
export.put(TopLoadingProgressEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadingProgress"));
|
|
539
482
|
export.put(TopShouldStartLoadWithRequestEvent.EVENT_NAME, MapBuilder.of("registrationName", "onShouldStartLoadWithRequest"));
|
|
540
483
|
export.put(ScrollEventType.getJSEventName(ScrollEventType.SCROLL), MapBuilder.of("registrationName", "onScroll"));
|
|
541
|
-
export.put(TopHttpErrorEvent.EVENT_NAME, MapBuilder.of("registrationName", "onHttpError"));
|
|
542
484
|
export.put(TopRenderProcessGoneEvent.EVENT_NAME, MapBuilder.of("registrationName", "onRenderProcessGone"));
|
|
543
485
|
export.put(TopCustomMenuSelectionEvent.EVENT_NAME, MapBuilder.of("registrationName", "onCustomMenuSelection"));
|
|
544
486
|
export.put(TopOpenWindowEvent.EVENT_NAME, MapBuilder.of("registrationName", "onOpenWindow"));
|
|
@@ -12,7 +12,6 @@ import com.facebook.react.uimanager.annotations.ReactProp;
|
|
|
12
12
|
import com.facebook.react.views.scroll.ScrollEventType;
|
|
13
13
|
import com.reactnativecommunity.webview.events.TopCustomMenuSelectionEvent;
|
|
14
14
|
import com.reactnativecommunity.webview.events.SubResourceErrorEvent;
|
|
15
|
-
import com.reactnativecommunity.webview.events.TopHttpErrorEvent;
|
|
16
15
|
import com.reactnativecommunity.webview.events.TopLoadingErrorEvent;
|
|
17
16
|
import com.reactnativecommunity.webview.events.TopLoadingFinishEvent;
|
|
18
17
|
import com.reactnativecommunity.webview.events.TopLoadingProgressEvent;
|
|
@@ -46,22 +45,6 @@ public class RNCWebViewManager extends ViewGroupManager<RNCWebViewWrapper> {
|
|
|
46
45
|
return mRNCWebViewManagerImpl.createViewInstance(context, view);
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
@ReactProp(name = "allowFileAccess")
|
|
50
|
-
public void setAllowFileAccess(RNCWebViewWrapper view, boolean value) {
|
|
51
|
-
mRNCWebViewManagerImpl.setAllowFileAccess(view, value);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
@ReactProp(name = "allowFileAccessFromFileURLs")
|
|
55
|
-
public void setAllowFileAccessFromFileURLs(RNCWebViewWrapper view, boolean value) {
|
|
56
|
-
mRNCWebViewManagerImpl.setAllowFileAccessFromFileURLs(view, value);
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@ReactProp(name = "allowUniversalAccessFromFileURLs")
|
|
61
|
-
public void setAllowUniversalAccessFromFileURLs(RNCWebViewWrapper view, boolean value) {
|
|
62
|
-
mRNCWebViewManagerImpl.setAllowUniversalAccessFromFileURLs(view, value);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
48
|
@ReactProp(name = "allowsFullscreenVideo")
|
|
66
49
|
public void setAllowsFullscreenVideo(RNCWebViewWrapper view, boolean value) {
|
|
67
50
|
mRNCWebViewManagerImpl.setAllowsFullscreenVideo(view, value);
|
|
@@ -77,11 +60,6 @@ public class RNCWebViewManager extends ViewGroupManager<RNCWebViewWrapper> {
|
|
|
77
60
|
mRNCWebViewManagerImpl.setAndroidLayerType(view, value);
|
|
78
61
|
}
|
|
79
62
|
|
|
80
|
-
@ReactProp(name = "applicationNameForUserAgent")
|
|
81
|
-
public void setApplicationNameForUserAgent(RNCWebViewWrapper view, @Nullable String value) {
|
|
82
|
-
mRNCWebViewManagerImpl.setApplicationNameForUserAgent(view, value);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
63
|
@ReactProp(name = "basicAuthCredential")
|
|
86
64
|
public void setBasicAuthCredential(RNCWebViewWrapper view, @Nullable ReadableMap value) {
|
|
87
65
|
mRNCWebViewManagerImpl.setBasicAuthCredential(view, value);
|
|
@@ -137,28 +115,11 @@ public class RNCWebViewManager extends ViewGroupManager<RNCWebViewWrapper> {
|
|
|
137
115
|
mRNCWebViewManagerImpl.setInjectedJavaScriptBeforeContentLoaded(view, value);
|
|
138
116
|
}
|
|
139
117
|
|
|
140
|
-
@ReactProp(name = "injectedJavaScriptForMainFrameOnly")
|
|
141
|
-
public void setInjectedJavaScriptForMainFrameOnly(RNCWebViewWrapper view, boolean value) {
|
|
142
|
-
mRNCWebViewManagerImpl.setInjectedJavaScriptForMainFrameOnly(view, value);
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
@ReactProp(name = "injectedJavaScriptBeforeContentLoadedForMainFrameOnly")
|
|
147
|
-
public void setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(RNCWebViewWrapper view, boolean value) {
|
|
148
|
-
mRNCWebViewManagerImpl.setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(view, value);
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
118
|
@ReactProp(name = "injectedJavaScriptObject")
|
|
153
119
|
public void setInjectedJavaScriptObject(RNCWebViewWrapper view, @Nullable String value) {
|
|
154
120
|
mRNCWebViewManagerImpl.setInjectedJavaScriptObject(view, value);
|
|
155
121
|
}
|
|
156
122
|
|
|
157
|
-
@ReactProp(name = "javaScriptCanOpenWindowsAutomatically")
|
|
158
|
-
public void setJavaScriptCanOpenWindowsAutomatically(RNCWebViewWrapper view, boolean value) {
|
|
159
|
-
mRNCWebViewManagerImpl.setJavaScriptCanOpenWindowsAutomatically(view, value);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
123
|
@ReactProp(name = "javaScriptEnabled")
|
|
163
124
|
public void setJavaScriptEnabled(RNCWebViewWrapper view, boolean enabled) {
|
|
164
125
|
mRNCWebViewManagerImpl.setJavaScriptEnabled(view, enabled);
|
|
@@ -308,7 +269,6 @@ public class RNCWebViewManager extends ViewGroupManager<RNCWebViewWrapper> {
|
|
|
308
269
|
export.put(TopLoadingProgressEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadingProgress"));
|
|
309
270
|
export.put(TopShouldStartLoadWithRequestEvent.EVENT_NAME, MapBuilder.of("registrationName", "onShouldStartLoadWithRequest"));
|
|
310
271
|
export.put(ScrollEventType.getJSEventName(ScrollEventType.SCROLL), MapBuilder.of("registrationName", "onScroll"));
|
|
311
|
-
export.put(TopHttpErrorEvent.EVENT_NAME, MapBuilder.of("registrationName", "onHttpError"));
|
|
312
272
|
export.put(TopRenderProcessGoneEvent.EVENT_NAME, MapBuilder.of("registrationName", "onRenderProcessGone"));
|
|
313
273
|
export.put(TopCustomMenuSelectionEvent.EVENT_NAME, MapBuilder.of("registrationName", "onCustomMenuSelection"));
|
|
314
274
|
export.put(TopOpenWindowEvent.EVENT_NAME, MapBuilder.of("registrationName", "onOpenWindow"));
|
package/apple/RNCWebView.mm
CHANGED
|
@@ -272,17 +272,11 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
272
272
|
REMAP_WEBVIEW_PROP(scrollEnabled)
|
|
273
273
|
REMAP_WEBVIEW_STRING_PROP(injectedJavaScript)
|
|
274
274
|
REMAP_WEBVIEW_STRING_PROP(injectedJavaScriptBeforeContentLoaded)
|
|
275
|
-
REMAP_WEBVIEW_PROP(injectedJavaScriptForMainFrameOnly)
|
|
276
|
-
REMAP_WEBVIEW_PROP(injectedJavaScriptBeforeContentLoadedForMainFrameOnly)
|
|
277
275
|
REMAP_WEBVIEW_STRING_PROP(injectedJavaScriptObject)
|
|
278
276
|
REMAP_WEBVIEW_PROP(javaScriptEnabled)
|
|
279
|
-
REMAP_WEBVIEW_PROP(javaScriptCanOpenWindowsAutomatically)
|
|
280
|
-
REMAP_WEBVIEW_PROP(allowFileAccessFromFileURLs)
|
|
281
|
-
REMAP_WEBVIEW_PROP(allowUniversalAccessFromFileURLs)
|
|
282
277
|
REMAP_WEBVIEW_PROP(allowsInlineMediaPlayback)
|
|
283
278
|
REMAP_WEBVIEW_PROP(allowsPictureInPictureMediaPlayback)
|
|
284
279
|
REMAP_WEBVIEW_PROP(webviewDebuggingEnabled)
|
|
285
|
-
REMAP_WEBVIEW_PROP(allowsAirPlayForMediaPlayback)
|
|
286
280
|
REMAP_WEBVIEW_PROP(mediaPlaybackRequiresUserAction)
|
|
287
281
|
REMAP_WEBVIEW_PROP(automaticallyAdjustContentInsets)
|
|
288
282
|
REMAP_WEBVIEW_PROP(autoManageStatusBarEnabled)
|
|
@@ -290,10 +284,8 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
290
284
|
REMAP_WEBVIEW_PROP(allowsBackForwardNavigationGestures)
|
|
291
285
|
REMAP_WEBVIEW_PROP(incognito)
|
|
292
286
|
REMAP_WEBVIEW_PROP(pagingEnabled)
|
|
293
|
-
REMAP_WEBVIEW_STRING_PROP(applicationNameForUserAgent)
|
|
294
287
|
REMAP_WEBVIEW_PROP(cacheEnabled)
|
|
295
288
|
REMAP_WEBVIEW_PROP(allowsLinkPreview)
|
|
296
|
-
REMAP_WEBVIEW_STRING_PROP(allowingReadAccessToURL)
|
|
297
289
|
REMAP_WEBVIEW_PROP(messagingEnabled)
|
|
298
290
|
#if !TARGET_OS_OSX
|
|
299
291
|
REMAP_WEBVIEW_PROP(fraudulentWebsiteWarningEnabled)
|
|
@@ -33,6 +33,23 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
[self.decisionHandlers setObject:[decisionHandler copy] forKey:@(lockIdentifier)];
|
|
36
|
+
|
|
37
|
+
// Exodus: Deny-by-default timeout
|
|
38
|
+
// If JS doesn't respond within 500ms, deny the navigation for security.
|
|
39
|
+
// setResult:forLockIdentifier: removes the handler, so this is a no-op
|
|
40
|
+
// if JS responded in time.
|
|
41
|
+
NSInteger capturedIdentifier = lockIdentifier;
|
|
42
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(500 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^{
|
|
43
|
+
@synchronized (self) {
|
|
44
|
+
DecisionBlock pendingHandler = [self.decisionHandlers objectForKey:@(capturedIdentifier)];
|
|
45
|
+
if (pendingHandler != nil) {
|
|
46
|
+
RCTLogWarn(@"Navigation decision timeout for lock %ld, denying by default", (long)capturedIdentifier);
|
|
47
|
+
pendingHandler(NO);
|
|
48
|
+
[self.decisionHandlers removeObjectForKey:@(capturedIdentifier)];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
36
53
|
return lockIdentifier;
|
|
37
54
|
}
|
|
38
55
|
}
|
package/apple/RNCWebViewImpl.h
CHANGED
|
@@ -53,13 +53,11 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
|
|
|
53
53
|
#endif // !TARGET_OS_OSX
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
@property (nonatomic, copy) RCTDirectEventBlock onFileDownload;
|
|
57
56
|
@property (nonatomic, copy) RCTDirectEventBlock onLoadingStart;
|
|
58
57
|
@property (nonatomic, copy) RCTDirectEventBlock onLoadingFinish;
|
|
59
58
|
@property (nonatomic, copy) RCTDirectEventBlock onLoadingError;
|
|
60
59
|
@property (nonatomic, copy) RCTDirectEventBlock onLoadingProgress;
|
|
61
60
|
@property (nonatomic, copy) RCTDirectEventBlock onShouldStartLoadWithRequest;
|
|
62
|
-
@property (nonatomic, copy) RCTDirectEventBlock onHttpError;
|
|
63
61
|
@property (nonatomic, copy) RCTDirectEventBlock onMessage;
|
|
64
62
|
@property (nonatomic, copy) RCTDirectEventBlock onScroll;
|
|
65
63
|
@property (nonatomic, copy) RCTDirectEventBlock onContentProcessDidTerminate;
|
|
@@ -71,8 +69,6 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
|
|
|
71
69
|
@property (nonatomic, assign) BOOL messagingEnabled;
|
|
72
70
|
@property (nonatomic, copy) NSString * _Nullable injectedJavaScript;
|
|
73
71
|
@property (nonatomic, copy) NSString * _Nullable injectedJavaScriptBeforeContentLoaded;
|
|
74
|
-
@property (nonatomic, assign) BOOL injectedJavaScriptForMainFrameOnly;
|
|
75
|
-
@property (nonatomic, assign) BOOL injectedJavaScriptBeforeContentLoadedForMainFrameOnly;
|
|
76
72
|
@property (nonatomic, copy) NSString * _Nullable injectedJavaScriptObject;
|
|
77
73
|
@property (nonatomic, assign) BOOL scrollEnabled;
|
|
78
74
|
@property (nonatomic, assign) BOOL sharedCookiesEnabled;
|
|
@@ -82,7 +78,6 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
|
|
|
82
78
|
@property (nonatomic, assign) BOOL allowsInlineMediaPlayback;
|
|
83
79
|
@property (nonatomic, assign) BOOL allowsPictureInPictureMediaPlayback;
|
|
84
80
|
@property (nonatomic, assign) BOOL webviewDebuggingEnabled;
|
|
85
|
-
@property (nonatomic, assign) BOOL allowsAirPlayForMediaPlayback;
|
|
86
81
|
@property (nonatomic, assign) BOOL bounces;
|
|
87
82
|
@property (nonatomic, assign) BOOL mediaPlaybackRequiresUserAction;
|
|
88
83
|
@property (nonatomic, assign) UIEdgeInsets contentInset;
|
|
@@ -93,19 +88,14 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
|
|
|
93
88
|
@property (nonatomic, assign) BOOL incognito;
|
|
94
89
|
@property (nonatomic, assign) BOOL useSharedProcessPool;
|
|
95
90
|
@property (nonatomic, copy) NSString * _Nullable userAgent;
|
|
96
|
-
@property (nonatomic, copy) NSString * _Nullable applicationNameForUserAgent;
|
|
97
91
|
@property (nonatomic, assign) BOOL cacheEnabled;
|
|
98
92
|
@property (nonatomic, assign) BOOL javaScriptEnabled;
|
|
99
|
-
@property (nonatomic, assign) BOOL javaScriptCanOpenWindowsAutomatically;
|
|
100
|
-
@property (nonatomic, assign) BOOL allowFileAccessFromFileURLs;
|
|
101
|
-
@property (nonatomic, assign) BOOL allowUniversalAccessFromFileURLs;
|
|
102
93
|
@property (nonatomic, assign) BOOL allowsLinkPreview;
|
|
103
94
|
@property (nonatomic, assign) BOOL showsHorizontalScrollIndicator;
|
|
104
95
|
@property (nonatomic, assign) BOOL showsVerticalScrollIndicator;
|
|
105
96
|
@property (nonatomic, copy) NSString * _Nullable indicatorStyle;
|
|
106
97
|
@property (nonatomic, assign) BOOL directionalLockEnabled;
|
|
107
98
|
@property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch;
|
|
108
|
-
@property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
|
|
109
99
|
@property (nonatomic, copy) NSDictionary * _Nullable basicAuthCredential;
|
|
110
100
|
@property (nonatomic, assign) BOOL pullToRefreshEnabled;
|
|
111
101
|
@property (nonatomic, assign) BOOL refreshControlLightMode;
|