mirror of
https://github.com/flutter/packages.git
synced 2025-06-30 23:03:11 +08:00
[webview_flutter_wkwebview] Only set limitsNavigationsToAppBoundDomains
when it is set to true (#5137)
This changes the flag to only flag to only call the method if it sets it to `true`. Fixes https://github.com/flutter/flutter/issues/136449
This commit is contained in:
@ -1,3 +1,8 @@
|
||||
## 3.9.2
|
||||
|
||||
* Fixes error caused by calling `WKWebViewConfiguration.limitsNavigationsToAppBoundDomains` on
|
||||
versions below 14.
|
||||
|
||||
## 3.9.1
|
||||
|
||||
* Fixes bug where `WebkitWebViewController.getUserAgent` was incorrectly returning an empty String.
|
||||
|
@ -70,8 +70,14 @@ class WebKitWebViewControllerCreationParams
|
||||
);
|
||||
}
|
||||
_configuration.setAllowsInlineMediaPlayback(allowsInlineMediaPlayback);
|
||||
_configuration.setLimitsNavigationsToAppBoundDomains(
|
||||
limitsNavigationsToAppBoundDomains);
|
||||
// `WKWebViewConfiguration.limitsNavigationsToAppBoundDomains` is only
|
||||
// supported on iOS versions 14+. So this only calls it if the value is set
|
||||
// to true.
|
||||
if (limitsNavigationsToAppBoundDomains) {
|
||||
_configuration.setLimitsNavigationsToAppBoundDomains(
|
||||
limitsNavigationsToAppBoundDomains,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Constructs a [WebKitWebViewControllerCreationParams] using a
|
||||
|
@ -2,7 +2,7 @@ name: webview_flutter_wkwebview
|
||||
description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control.
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
|
||||
version: 3.9.1
|
||||
version: 3.9.2
|
||||
|
||||
environment:
|
||||
sdk: ">=2.19.0 <4.0.0"
|
||||
|
@ -160,6 +160,25 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
'limitsNavigationsToAppBoundDomains is not called if it uses default value (false)',
|
||||
() {
|
||||
final MockWKWebViewConfiguration mockConfiguration =
|
||||
MockWKWebViewConfiguration();
|
||||
|
||||
WebKitWebViewControllerCreationParams(
|
||||
webKitProxy: WebKitProxy(
|
||||
createWebViewConfiguration: ({InstanceManager? instanceManager}) {
|
||||
return mockConfiguration;
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
verifyNever(
|
||||
mockConfiguration.setLimitsNavigationsToAppBoundDomains(any),
|
||||
);
|
||||
});
|
||||
|
||||
test('mediaTypesRequiringUserAction', () {
|
||||
final MockWKWebViewConfiguration mockConfiguration =
|
||||
MockWKWebViewConfiguration();
|
||||
|
Reference in New Issue
Block a user