pichillilorenzo / flutter_inappwebview

A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
https://inappwebview.dev
Apache License 2.0
3.28k stars 1.62k forks source link

throws WebPageProxy::Ignoring request to load this main resource because it is outside the sandbox #688

Closed Anima18 closed 3 years ago

Anima18 commented 3 years ago

Environment

Technology Version
Flutter version 1.27.0-4.0.pre • channel dev
Plugin version
Android version
iOS version 14.5
Xcode version 12.5 beta 2

Device information:

use flutter_inappwebview version:5.0.0-nullsafety.0

Description

child: InAppWebView(
                      initialFile: "assets/html/svg.html",
                      initialHeaders: {
                      },
                      onConsoleMessage: (controller, consoleMessage) {
                        print(consoleMessage);
                      },
                      initialOptions: InAppWebViewGroupOptions(
                          crossPlatform: InAppWebViewOptions(

                        //debuggingEnabled: true,
                            allowUniversalAccessFromFileURLs: true,
                        javaScriptCanOpenWindowsAutomatically: true,
                        javaScriptEnabled: true,
                        transparentBackground: true,
                        horizontalScrollBarEnabled: false,
                        verticalScrollBarEnabled: false,
                      )

Expected behavior: Svg.html is open normally, it is correct on real iOS12 and iOS14 emulator.

Current behavior: On real iOS14 flashback, error log: 2021-02-24 09:11:15.639060+0800 Runner[4834:1772349] [Loading] Received an unexpected URL from the web process 2021-02-24 09:11:15.639132+0800 Runner[4834:1772349] [Process] 0x1030AD018 - [pageProxyID=6, WebPageID =7,PID=4839] WebPageProxy::Ignoring request to load this main resource because it is outside the sandbox

Steps to reproduce

  1. This
  2. Than that
  3. Then

Images

Stacktrace/Logcat

2021-02-24 09:11:12.552546+0800 Runner[4834:1772349] Metal API Validation Enabled 2021-02-24 09:11:13.307291+0800 Runner[4834:1772582] flutter: Observatory listening on http://127.0.0.1:55666/kDzuujyaBGc=/ 2021-02-24 09:11:13.825002+0800 Runner[4834:1772349] [VERBOSE-2:FlutterObservatoryPublisher.mm(101)] Failed to register observatory port with mDNS with error -65555. 2021-02-24 09:11:13.825104+0800 Runner[4834:1772349] [VERBOSE-2:FlutterObservatoryPublisher.mm(103)] On iOS 14+, local network broadcast in apps need to be declared in the app's Info.plist. Debug and profile Flutter apps and modules host VM services on the local network to support debugging features such as hot reload and DevTools. To make your Flutter app or module attachable and debuggable, add a '_dartobservatory._tcp' value to the 'NSBonjourServices' key in your Info.plist for the Debug/Profile configurations. For more information, see https://flutter.dev/docs/development/add-to-app/ios/project-setup#local-network-privacy-permissions 2021-02-24 09:11:13.843582+0800 Runner[4834:1772572] fopen failed for data file: errno = 2 (No such file or directory) 2021-02-24 09:11:13.843648+0800 Runner[4834:1772572] Errors found! Invalidating cache... 2021-02-24 09:11:14.159790+0800 Runner[4834:1772572] fopen failed for data file: errno = 2 (No such file or directory) 2021-02-24 09:11:14.159990+0800 Runner[4834:1772572] Errors found! Invalidating cache... 2021-02-24 09:11:14.724484+0800 Runner[4834:1772349] WF: === Starting WebFilter logging for process Runner 2021-02-24 09:11:14.724603+0800 Runner[4834:1772349] WF: _userSettingsForUser mobile: { filterBlacklist = ( ); filterWhitelist = ( ); restrictWeb = 1; useContentFilter = 0; useContentFilterOverrides = 0; whitelistEnabled = 0; } 2021-02-24 09:11:14.724686+0800 Runner[4834:1772349] WF: _WebFilterIsActive returning: NO 2021-02-24 09:11:15.623754+0800 Runner[4834:1772571] flutter: =========onLoadStop============ 2021-02-24 09:11:15.639060+0800 Runner[4834:1772349] [Loading] Received an unexpected URL from the web process 2021-02-24 09:11:15.639132+0800 Runner[4834:1772349] [Process] 0x1030ad018 - [pageProxyID=6, webPageID=7, PID=4839] WebPageProxy::Ignoring request to load this main resource because it is outside the sandbox

pichillilorenzo commented 3 years ago

Are you sure you are using the 5.0.0 version? The initialHeaders attribute isn't there anymore. Also, have you declared your local files inside the pubspec.yml?

Anima18 commented 3 years ago

Yes it is using the 5.0.0 version, initialHeader forgot to delete.

this is my pubspec.yml:

assets:
     - assets/html/svg.html
     - assets/html/util.js
     - assets/html/svgController.js
     - assets/html/jquery-1.9.0.min.js
     - assets/html/fastclick.js
     - assets/html/constant.js
Anima18 commented 3 years ago

this is the file path problem, HTML files placed in the first level of the directory can be accessed.

pichillilorenzo commented 3 years ago

I just tried on a real iPhone your assets structure (creating an html folder with a simple index.html inside) and I didn't have any problem. I added - assets/html/index.html to my pubspec.yml assets and it worked as expected.

You can also write this:

assets:
     - assets/html/

without listing all the files inside the html folder!

Anima18 commented 3 years ago

I first - assets/htm;/this way, found that throws WebPageProxy: : Ignoring the request to load this main resource because it is outside the sandbox. Check your example using - assets/index.html. I tried it and it worked. I'll go back and try -assets/html/。thanks!

github-actions[bot] commented 11 hours ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.