commit | 6e6082660b73144e5fedf28545602c1ef6588f8e | [log] [tgz] |
---|---|---|
author | petermnt <petermnt@users.noreply.github.com> | Wed May 01 19:57:45 2024 +0200 |
committer | GitHub <noreply@github.com> | Wed May 01 17:57:45 2024 +0000 |
tree | bed66eb12383f797af53b64b7d345a6b85889715 | |
parent | d500725a8ef3bc21f1e4c12591a0d702eb5a4d17 [diff] |
[webview_flutter_android] Fixes iframe navigation with `onNavigationRequest` (#6335) This PR reintroduces the check on `WebResourceRequest.isForMainFrame` in the `shouldOverrideUrlLoading` callback. This check already existed in the implementation before the change to Pigeon, but was not taken over. See https://github.com/flutter/packages/blob/418bef0d6f3100e7a4bafb86537285e6d2095159/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebViewClient.java#L99 The reasoning was already already in comment there: ``` // Since we cannot call loadUrl for a subframe, we currently only allow the delegate to stop // navigations that target the main frame, if the request is not for the main frame // we just return false to allow the navigation. // // For more details see: https://github.com/flutter/flutter/issues/25329#issuecomment-464863209 ``` Currently when a `NavigationDeletage.onNavigationRequest` is set and a navigation request for an iframe happens it will automatically be blocked and handed to the Flutter `onNavigationRequest`. If the request gets a `NavigationDecision.navigate` it will be loaded into the mainframe through a `loadUrl`. If the request gets a `NavigationDecision.prevent` it will never be executed. This causes an issue when for example an iframe loads local data. Example ```data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>``` An iframe is allowed to do this, but with the current implementation this data will be loaded in the main frame, leading to a white page. Issue: https://github.com/flutter/flutter/issues/145208
This repo is a companion repo to the main flutter repo. It contains the source code for Flutter's first-party packages (i.e., packages developed by the core Flutter team). Check the packages
directory to see all packages.
These packages are also available on pub.
Please file any issues, bugs, or feature requests in the main flutter repo. Issues pertaining to this repository are labeled “package”.
If you wish to contribute a new package to the Flutter ecosystem, please see the documentation for developing packages. You can store your package source code in any GitHub repository (the present repo is only intended for packages developed by the core Flutter team). Once your package is ready you can publish to the pub repository.
If you wish to contribute a change to any of the existing packages in this repo, please review our contribution guide, and send a pull request.
These are the packages hosted in this repository: