afioletov opened a new issue #1134:
URL: https://github.com/apache/cordova-ios/issues/1134


   # Bug Report
   
   ## Problem
   WkWebView cannot open any pages from data container. There are no issues 
with pages in bundle. Application can download and save new pages/resources 
into cache folder (cordova.file.cacheDirectory), but attempts to set 
windows.location to some page in cache folder fail.  
   
   ### What is expected to happen?
   It worked fine with UIWebView, and it would be great to have the same 
possibility with WkWebView
   
   
   ### What does actually happen?
   If we load file directly:
   `<content src="Bootloader.html" />`
   then document location is set to:
   
   
`'file:///private/var/containers/Bundle/Application/GUID/InMotionTestApp.app/www/Bootloader.html'`.
 
   
   We check if cached version exists and try to set location: 
   
`window.location='file:///var/mobile/Containers/Data/Application/GUID/Library/Caches/1.11.00000.0000/www/Default.html'`
 
   
   Such attempts fail with 'outside sandbox' error, while we try to open files 
from sandbox:
   
   ```
   2021-07-30 10:06:33.742306-0400 InMotionTestApp[2318:560700] [Loading] 
Received an unexpected URL from the web process
   2021-07-30 10:06:33.742441-0400 InMotionTestApp[2318:560700] [Process] 
0x10202ca18 - [pageProxyID=11, webPageID=12, PID=2321] WebPageProxy::Ignoring 
request to load this main resource because it is outside the sandbox
   
   
   ```
   If we add schema and hostname to config.xml like it's recommended in blog:
   
   ```
   <content src="app://localhost/Bootloader.html" />
   ...
    <preference name="scheme" value="app" />
    <preference name="hostname" value="localhost" />
   ```
   
   We do not get error in Xcode, but get error in web inspector:
   
   `Not allowed to load local resource: 
file:///var/mobile/Containers/Data/Application/A3E5D945-5503-4D23-A54F-C1135CE08CD8/Library/Caches/1.11.00000.0000/www/Default.html
   `
   
   Replacing 'file://' with 'app://localhost' does not help, it just generates 
404 error.
   
   
   ### Version information
   Cordova CLI 10.0.0
   "cordova-ios": "^6.2.0",
   "cordova-custom-config": "^5.1.0",
   "cordova-plugin-auth-dialog": "^0.1.6",
   "cordova-plugin-camera": "^4.1.0",
   "cordova-plugin-compat": "^1.2.0",
   "cordova-plugin-device": "^2.0.3",
   "cordova-plugin-emm-app-config": "^1.0.2",
   "cordova-plugin-file": "^6.0.2",
   "cordova-plugin-inappbrowser": "^5.0.0",
   "cordova-plugin-network-information": "^2.0.2",
   "cordova-plugin-statusbar": "^2.4.3",
   "cordova-plugin-whitelist": "^1.3.4",
   "cordova-plugin-zeep": "0.0.4"
   
   I debug it on iOS 14.6 from Xcode 12.5.1 on macOS Big Sur 1..5
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [X] I searched for existing GitHub issues
   - [X] I updated all Cordova tooling to most recent version
   - [X] I included all the necessary information above
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to