Post

Replies

Boosts

Views

Activity

WKURLSchemeHandler and fetch
I have an application that displays some HTML content with a WKWebView. I'm using a WKURLSchemeHandler attached to the webview configuration to respond to requests for local resources. This works as expected for img tags. I'm able to handle the requests for those images in my WKURLSchemeHandler instance and see the content displayed in the webview. However, when I try to load a resource with my custom scheme using fetch() I consistently get 3 subsequent error messages in the safari dev console. [blocked] The page at <my pages location> was not allowed to display insecure content from mycustomscheme://<some resource> Not allowed to request resource fetch cannot load mycustomscheme://<some resource> due to access control checks. It seems to be ambiguous in the documentation for WKURLSchemeHandler whether it should be able to service requests from fetch and/or XMLHttpRequest. Is this explicitly not supported or is there perhaps something I'm missing that would make this work?
2
0
2k
Mar ’23
WKWebView JS Execution in test target
My team has a set of XCTestCases which create a new instance of WKWebView, execute some javascript with it, then assert some conditions afterward. Beginning with iOS 16, these tests never succeed because it seems like the WKWebView is experiencing some sort of crash or malfunction in its content process. When executing a single test of the type above, the following is present in the console: [Process] 0x142481000 - [PID=0] WebProcessProxy::didFinishLaunching: Invalid connection identifier (web process failed to launch) [Process] 0x142481000 - [PID=0] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash [Process] 0x7f7d86008220 - [pageProxyID=6, webPageID=7, PID=0] WebPageProxy::processDidTerminate: (pid 0), reason=Crash [Loading] 0x7f7d86008220 - [pageProxyID=6, webPageID=7, PID=0] WebPageProxy::dispatchProcessDidTerminate: reason=Crash [Loading] 0x7f7d86008220 - [pageProxyID=6, webPageID=7, PID=0] WebPageProxy::dispatchProcessDidTerminate: Not eagerly reloading the view because it is not currently visible I've tried ensuring that an app host is present for the test target these tests execute in and that had no effect. I've tried adding the webview to the apps view hierarchy and that had no effect. In iOS 15 and prior these same tests execute and pass fine. Was there some change in iOS 16 that may have caused this or any ideas on how to rectify this?
3
3
1.8k
Sep ’22
WKWebView and Unit Tests
I have a project that interacts with WKWebView. I have a suite of unit tests that verify the interaction between my project and WKWebView. Many of those tests follow the following basic high level approach: 1) Instantiate a webview 2) Load some html and/or evaluate some javascript 3) Wait for a navigation finished delegate call 4) Proceed to verify some behavior What I’m seeing is that when running many of these kinds of tests in quick succession (like when running the entire test suite) step 3 ends up sometimes timing out or requiring an increasing and ludicrous timeout (like 20 seconds). This seems to be worse when testing against an iOS 13 simulator than it is when running against an iOS 12 simulator. I have some guesses as to why this might be happening, but I’m hoping to find an official answer or some advice on how to mitigate this behavior.
1
0
2.1k
Jul ’20