Display web content in windows and implement browser features using WebKit.

Posts under WebKit tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Adding in-app browser - browser never spawns in view.
Preamble: I am creating an iOS build of a Ren'Py game. My coding experience with Swift/ObjC is nearly nonexistent and I've primarily followed tutorials up to this point. Ren'Py uses an underlying framework to create an Xcode project. I do not have control over how this framework does things, but I can add files before actually compiling inside Xcode. I MUST use the pyobjus library to do so based on my current understanding, abilities, and frameworks. The included IAPHelper class processes in-app purchasing and it works great! The following function indicates, however, that there is a rootViewController that I need to attach to. - (void) showDialog { if (alert != nil) { return; } alert = [UIAlertController alertControllerWithTitle:self.dialogTitle message:nil preferredStyle:UIAlertControllerStyleAlert ]; UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge]; // Adjust the indicator so it is up a few pixels from the bottom of the alert indicator.center = CGPointMake(alert.view.bounds.size.width / 2, alert.view.bounds.size.height - 50); [indicator startAnimating]; [alert.view addSubview: indicator]; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated" [UIApplication.sharedApplication.keyWindow.rootViewController presentViewController:alert animated:YES completion:nil]; #pragma clang diagnostic pop } Problem: I am TRYING to implement an in-app browser for Patreon authentication purposes. The files I have put together are as follows: BrowserViewController.h // BrowserViewController.h #import <UIKit/UIKit.h> #import <WebKit/WebKit.h> @interface BrowserViewController : UIViewController - (void)loadURL:(NSString *)urlString; @end BrowserViewController.m // BrowserViewController.m #import "BrowserViewController.h" @interface BrowserViewController () @property (nonatomic, strong) WKWebView *webView; @end @implementation BrowserViewController - (void)viewDidLoad { [super viewDidLoad]; self.webView = [[WKWebView alloc] initWithFrame:self.view.frame]; [self.view addSubview:self.webView]; NSLog(@"viewDidLoad"); } - (void)loadURL:(NSString *)urlString { NSURL *url = [NSURL URLWithString:urlString]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [self.webView loadRequest:request]; NSLog(@"loadURL"); } @end OAuth2Strategy.py init python in auth: from urllib.parse import urlencode, urlparse, parse_qs from urllib.request import urlopen, Request import ssl import certifi from store import webserver, OpenURL import json class OAuth2Strategy(): def __init__(self, authorization_url, token_url, client_id, client_secret, callback_url, scope): self.authorization_url = authorization_url self.token_url = token_url self.client_id = client_id self.client_secret = client_secret self.callback_url = callback_url self.scope = scope self.on_success_callback = None self.on_fail_callback = None def run(self, on_success_callback = None, on_fail_callback = None): self.on_success_callback = on_success_callback self.on_fail_callback = on_fail_callback webserver.start(self) if renpy.renpy.ios: from pyobjus import autoclass, objc_str # Import the Objective-C class BrowserViewController = autoclass('BrowserViewController') # Create an instance of the BrowserViewController browser = BrowserViewController.alloc().init() # Load a URL url = self.make_authorize_url() browser.loadURL_(objc_str(url)) elif renpy.renpy.android: pass else: renpy.run(OpenURL(self.make_authorize_url())) def make_authorize_url(self): return self.authorization_url + "?client_id={client_id}&scope={scope}&redirect_uri={redirect_uri}&response_type=code".format( client_id=self.client_id, scope=self.scope, redirect_uri=self.redirect_uri, ) @property def redirect_uri(self): return "http://127.0.0.1:" + str(webserver.PORT) + self.callback_url def handle_auth(self, request): parsed_path = urlparse(request.path) query = parse_qs(parsed_path.query) code = query.get("code") if not code: request.send_response(400) request.send_header('Content-type', 'text/html') request.end_headers() request.wfile.write(b'Failed to authenticate. You can now close this window.') webserver.stop() if self.on_fail_callback: self.on_fail_callback() return code = code[0] tokens = self.get_tokens(code) request.send_response(200) request.send_header('Content-type', 'text/html') request.end_headers() request.wfile.write(b'Success! You can now close this window.') webserver.stop() if self.on_success_callback: self.on_success_callback(tokens) def get_tokens(self, code): ctx = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=certifi.where()) data = urlencode({ "grant_type": "authorization_code", "code": code, "client_id": self.client_id, "client_secret": self.client_secret, "redirect_uri": self.redirect_uri, }).encode("utf-8") headers = {"Content-Type": "application/x-www-form-urlencoded"} req = Request(self.token_url, data=data, headers=headers, method="POST") response = urlopen(req, context=ctx) data = response.read().decode("utf-8") data = json.loads(data) return data If I use the default OpenURL function Safari opens as the full blown browser rather than in-app, hence why I am trying to override it. When I run my app and click the button that SHOULD spawn the browser, nothing happens. I can see that my URL is getting pushed to the function in the log along with Warning: -[BETextInput attributedMarkedText] is unimplemented and Failed to request allowed query parameters from WebPrivacy. though my admittedly light research indicates this isn't an issue. I have a feeling I'm not attaching my webView to the right hierarchy but I'm not sure exactly what I'm doing wrong.
0
0
44
9h
Safari DNR API timing issues
I created a Xcode project to test the DNR updateDynamicRules API performances on Safari (MacOS). https://github.com/radiolondra/TestUpdateDynamicRules Following the instructions in the README file, it's possible to test the extension on Chromium and Firefox browsers (on Windows). The project uses 2 json files containing static rules, enabled by default in the manifest file. These static rules are automatically installed in the browser when the extension is installed. Using the extension popup it is possible to add/remove just one very simple dynamic rule in the browser, a rule that acts on a predefined test domain (https://iana.org). What we want to measure is the time it takes for each browser to add/remove that one dynamic rule. The results for Safari are unacceptable to say the least: Safari: from 6000 to 8000 MILLISECONDS (6/8 seconds!) <<<<<<<<< Chrome: from 5 to 6 MILLISECONDS Firefox: from 5 to 7 MILLISECONDS Notice the time needed by Safari... It would be a good idea to take a look at this monstrosity. Thanks.
4
0
109
21h
Safari History Delete ISSUE
My Safari Web Extension uses a service worker and an IndexedDB database (IDB). For what hidden reason or perverse logic when deleting the Safari history all service workers are brutally shutted down and the database emptied of all its contents? And I heard about local storage too... It happens all the time in Safari macOS and iOS. Safari is the only browser in the world that takes the liberty of deleting what it shouldn't. Good Job indeed.
0
0
86
1d
Crash on [WKWebView initWithFrame: configuration:]
Crash condition: when I update the Xcode version to 15.3 and run the iPhone to load the app on debug mode with the following diagnosing setting: Hardware Model: iPhone 14 pro Role: Foreground Date/Time: 2024-03-08 11:30 -0800 Launch Time: 2024-03-08 11:30 -0800 OS Version: iPhone OS 17.4(21E219) Exception Type: EXC_BREAKPOINT Exception Codes: (code=1, subcode=0x19b1eba48) Exception Note: EXC_BREAKPOINT Triggered by Thread: 1 Thread 1 Queue : com.apple.main-thread (serial) #0 0x000000019b1eba48 in xzm_malloc_zone_free_slow.cold.1 () #1 0x000000019b1e28d0 in xzm_malloc_zone_free_slow () #2 0x00000001a25ef1c8 in pas_try_deallocate_slow_no_cache () #3 0x00000001a10d32f8 in ***::String::String(__CFString const*) () #4 0x00000001a0494ab8 in WebKit::isFullWebBrowserOrRunningTest() () #5 0x00000001a09e1520 in WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration(WebKit::IsPersistent, WebKit::WebsiteDataStoreConfiguration::ShouldInitializePaths) () #6 0x00000001a09d3ae0 in WebKit::WebsiteDataStore::defaultDataStore() () #7 0x00000001a05bc5e8 in +[WKWebsiteDataStore defaultDataStore] () #8 0x00000001a05b6624 in -[WKWebViewConfiguration websiteDataStore] () #9 0x00000001a0576850 in -[WKWebView _initializeWithConfiguration:] () #10 0x00000001a0577e04 in -[WKWebView initWithFrame:configuration:] () #11 0x0000000104cbf724 in -[AAChartView initConfigurationWithFrame:] at /Users/quinn/Documents/objcio/AAChartKit-master/AAChartKitLib/AAChartCreator/AAChartView.m:133 #12 0x0000000104cbf4e8 in -[AAChartView initWithFrame:] at /Users/quinn/Documents/objcio/AAChartKit-master/AAChartKitLib/AAChartCreator/AAChartView.m:115 #13 0x0000000104c133a4 in -[BasicChartVC setupAAChartView] at /Users/quinn/Documents/objcio/AAChartKit-master/AAChartKitDemo/ChartsDemo/BasicChartVC.m:99 #14 0x0000000104c13208 in -[BasicChartVC drawChart] at /Users/quinn/Documents/objcio/AAChartKit-master/AAChartKitDemo/ChartsDemo/BasicChartVC.m:86 #15 0x0000000104c12f9c in -[BasicChartVC viewDidLoad] at /Users/quinn/Documents/objcio/AAChartKit-master/AAChartKitDemo/ChartsDemo/BasicChartVC.m:66 #16 0x000000018d4e530c in -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] () #17 0x000000018d29bfb4 in -[UIViewController loadViewIfRequired] () #18 0x000000018d29a7a8 in -[UIViewController view] () #19 0x000000018d98a384 in -[UINavigationController _startCustomTransition:] () #20 0x000000018d39dca4 in -[UINavigationController _startDeferredTransitionIfNeeded:] () #21 0x000000018d39d3a0 in -[UINavigationController __viewWillLayoutSubviews] () #22 0x000000018d39d304 in -[UILayoutContainerView layoutSubviews] () #23 0x000000018d2b90f8 in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] () #24 0x000000018c6e3e30 in CA::Layer::layout_if_needed(CA::Transaction*) () #25 0x000000018c6e39b4 in CA::Layer::layout_and_display_if_needed(CA::Transaction*) () #26 0x000000018c6e9bb4 in CA::Context::commit_transaction(CA::Transaction*, double, double*) () #27 0x000000018c6e31bc in CA::Transaction::commit() () #28 0x000000018d331280 in _UIApplicationFlushCATransaction () #29 0x000000018d330d78 in _UIUpdateSequenceRun () #30 0x000000018d330468 in schedulerStepScheduledMainSection () #31 0x000000018d330524 in runloopSourceCallback () #32 0x000000018b04162c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ () #33 0x000000018b0408a8 in __CFRunLoopDoSource0 () #34 0x000000018b03f058 in __CFRunLoopDoSources0 () #35 0x000000018b03dd88 in __CFRunLoopRun () #36 0x000000018b03d968 in CFRunLoopRunSpecific () #37 0x00000001cf33b4e0 in GSEventRunModal () #38 0x000000018d4b0edc in -[UIApplication _run] () #39 0x000000018d4b0518 in UIApplicationMain () #40 0x0000000104d42ba8 in main at /Users/quinn/Documents/objcio/AAChartKit-master/AAChartKitDemo/main.m:38 #41 0x00000001ae55ed84 in start ()
6
0
937
3d
iOS 17.5.1 Xcode WebKit Crash
iOS 17.5.1 Xcode WebKit Crash Hello, I have two iPhone devices that I have. These devices are iOS17.5.1, and all Wk related codes cause Crash. Crash occurs when Xcode Build is complete and the app is running. If you run without connecting to Xcode, Crash does not occur. Error: Thread 1: EXC_BREAKPOINT (code=1, subcode=0x19e88fa18) Xcode 15.4, MacBook Pro 14 Sonoma 14.5 There was no issue with iOS 16.5. WKWebsiteDataStore.default() .fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in records .forEach { WKWebsiteDataStore.default() .removeData(ofTypes: $0.dataTypes, for: [$0], completionHandler: {}) } } let webConfiguration = WKWebViewConfiguration()webConfiguration.preferences.javaScriptCanOpenWindowsAutomatically = true
0
0
166
3d
WKWebView inline media playback issue
I have enabled inline media playback with code as below: let config = WKWebViewConfiguration() config.mediaTypesRequiringUserActionForPlayback = [] config.allowsInlineMediaPlayback = true let webView = WKWebView(frame: .zero, configuration: config) But when user touch play button on the video, it's automatically stopped the video and print out some errors as below: 2023-03-30 08:28:46.961218+0700 [22319:217776] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}> 2023-03-30 08:28:46.961404+0700 [22319:217776] [ProcessSuspension] 0x14dfe8820 - ProcessAssertion: Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=22415, error: Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)} 2023-03-30 08:28:46.966357+0700 [22319:217776] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}> 2023-03-30 08:28:46.966553+0700 [22319:217776] [ProcessSuspension] 0x14dfe8870 - ProcessAssertion: Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=22319, error: Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)} 2023-03-30 08:28:46.968951+0700 [22319:217776] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}> 2023-03-30 08:28:46.969615+0700 [22319:217776] [ProcessSuspension] 0x14dfe88c0 - ProcessAssertion: Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=22422, error: Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)} What's the solution for this issue? Please help!
4
0
1.4k
3d
JavaScriptCore Crash in iOS17.4.1
Our app collected some JavaScriptCore crash information on iOS17 and above systems, but the cause of the error cannot be located. The crash stack is as follows: #27 Heap Helper Thread SIGSEGV 0 JavaScriptCore JSC::MarkedBlock::aboutToMarkSlow(unsigned int) 1 JavaScriptCore JSC::JSFinalObject::visitChildren(JSC::JSCell*, JSC::SlotVisitor&amp;amp;) 2 JavaScriptCore JSC::JSFinalObject::visitChildren(JSC::JSCell*, JSC::SlotVisitor&amp;amp;) 3 JavaScriptCore JSC::SlotVisitor::drain(***::MonotonicTime) 4 JavaScriptCore JSC::SlotVisitor::drainFromShared(JSC::SlotVisitor::SharedDrainMode, ***::MonotonicTime) 5 JavaScriptCore ***::SharedTaskFunctor&amp;lt;void (), JSC::Heap::runBeginPhase(JSC::GCConductor)::$_15&amp;gt;::run() 6 JavaScriptCore ***::ParallelHelperClient::runTask(***::RefPtr&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt;, ***::RawPtrTraits&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt; &amp;gt;, ***::DefaultRefDerefTraits&amp;lt;***::SharedTask &amp;lt;void ()&amp;gt; &amp;gt; &amp;gt; const&amp;amp;) 7 JavaScriptCore ***::ParallelHelperPool::Thread::work() 8 JavaScriptCore ***::Detail::CallableWrapper&amp;lt;***::AutomaticThread::start(***::AbstractLocker const&amp;amp;)::$_0, void&amp;gt;::call() 9 JavaScriptCore ***::Thread::entryPoint(***::Thread::NewThreadContext*) 10 JavaScriptCore ***::wtfThreadEntryPoint(void*) 11 libsystem_pthread.dylib __pthread_start #1 Queue: com.apple.main-thread SIGSEGV 0 libobjc.A.dylib _objc_msgSend 1 UIKitCore -[UIView(Geometry) convertPoint:toView:] #24 JSC Heap Collector Thread SIGSEGV 0 libsystem_kernel.dylib ___psynch_cvwait 1 libsystem_pthread.dylib __pthread_cond_wait 2 JavaScriptCore ***::ThreadCondition::timedWait(***::Mutex&amp;amp;, ***::WallTime) 3 JavaScriptCore ***::ParkingLot::parkConditionallyImpl(void const*, ***::ScopedLambda&amp;lt;bool ()&amp;gt; const&amp;amp;, ***::ScopedLambda&amp;lt;void ()&amp;gt; const&amp;amp;, ***::TimeWithDynamicClockType const&amp;amp;) 4 JavaScriptCore bool ***::Condition::waitUntilUncheckedWTF::Lock(***::Lock&amp;amp;, ***::TimeWithDynamicClockType const&amp;amp;) 5 JavaScriptCore JSC::SlotVisitor::drainFromShared(JSC::SlotVisitor::SharedDrainMode, ***::MonotonicTime) 6 JavaScriptCore JSC::Heap::runConcurrentPhase(JSC::GCConductor) 7 JavaScriptCore JSC::Heap::runCurrentPhase(JSC::GCConductor, JSC::CurrentThreadState*) 8 JavaScriptCore JSC::Heap::HeapThread::work() 9 JavaScriptCore ***::Detail::CallableWrapper&amp;lt;***::AutomaticThread::start(***::AbstractLocker const&amp;amp;)::$_0, void&amp;gt;::call() 10 JavaScriptCore ***::Thread::entryPoint(***::Thread::NewThreadContext*) 11 JavaScriptCore ***::wtfThreadEntryPoint(void*) 12 libsystem_pthread.dylib __pthread_start #25 Heap Helper Thread SIGSEGV 0 libsystem_kernel.dylib ___psynch_cvwait 1 libsystem_pthread.dylib __pthread_cond_wait 2 JavaScriptCore ***::ThreadCondition::timedWait(***::Mutex&amp;amp;, ***::WallTime) 3 JavaScriptCore ***::ParkingLot::parkConditionallyImpl(void const*, ***::ScopedLambda&amp;lt;bool ()&amp;gt; const&amp;amp;, ***::ScopedLambda&amp;lt;void ()&amp;gt; const&amp;amp;, ***::TimeWithDynamicClockType const&amp;amp;) 4 JavaScriptCore bool ***::Condition::waitUntilUncheckedWTF::Lock(***::Lock&amp;amp;, ***::TimeWithDynamicClockType const&amp;amp;) 5 JavaScriptCore JSC::SlotVisitor::drainFromShared(JSC::SlotVisitor::SharedDrainMode, ***::MonotonicTime) 6 JavaScriptCore ***::SharedTaskFunctor&amp;lt;void (), JSC::Heap::runBeginPhase(JSC::GCConductor)::$_15&amp;gt;::run() 7 JavaScriptCore ***::ParallelHelperClient::runTask(***::RefPtr&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt;, ***::RawPtrTraits&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt; &amp;gt;, ***::DefaultRefDerefTraits&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt; &amp;gt; &amp;gt; const&amp;amp;) 8 JavaScriptCore ***::ParallelHelperPool::Thread::work() 9 JavaScriptCore ***::Detail::CallableWrapper&amp;lt;***::AutomaticThread::start(***::AbstractLocker const&amp;amp;)::$_0, void&amp;gt;::call() 10 JavaScriptCore ***::Thread::entryPoint(***::Thread::NewThreadContext*) 11 JavaScriptCore ***::wtfThreadEntryPoint(void*) 12 libsystem_pthread.dylib __pthread_start #27 Heap Helper Thread SIGSEGV 0 libsystem_kernel.dylib ___psynch_cvwait 1 libsystem_pthread.dylib __pthread_cond_wait 2 JavaScriptCore ***::ThreadCondition::timedWait(***::Mutex&amp;amp;, ***::WallTime) 3 JavaScriptCore ***::ParkingLot::parkConditionallyImpl(void const*, ***::ScopedLambda&amp;lt;bool ()&amp;gt; const&amp;amp;, ***::ScopedLambda&amp;lt;void ()&amp;gt; const&amp;amp;, ***::TimeWithDynamicClockType const&amp;amp;) 4 JavaScriptCore bool ***::Condition::waitUntilUncheckedWTF::Lock(***::Lock&amp;amp;, ***::TimeWithDynamicClockType const&amp;amp;) 5 JavaScriptCore JSC::SlotVisitor::drainFromShared(JSC::SlotVisitor::SharedDrainMode, ***::MonotonicTime) 6 JavaScriptCore ***::SharedTaskFunctor&amp;lt;void (), JSC::Heap::runBeginPhase(JSC::GCConductor)::$_15&amp;gt;::run() 7 JavaScriptCore ***::ParallelHelperClient::runTask(***::RefPtr&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt;, ***::RawPtrTraits&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt; &amp;gt;, ***::DefaultRefDerefTraits&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt; &amp;gt; &amp;gt; const&amp;amp;) 8 JavaScriptCore ***::ParallelHelperPool::Thread::work() 9 JavaScriptCore ***::Detail::CallableWrapper&amp;lt;***::AutomaticThread::start(***::AbstractLocker const&amp;amp;)::$_0, void&amp;gt;::call() 10 JavaScriptCore ***::Thread::entryPoint(***::Thread::NewThreadContext*) 11 JavaScriptCore ***::wtfThreadEntryPoint(void*) 12 libsystem_pthread.dylib __pthread_start Please help analyze and locate the cause. Has anyone else encountered this problem?
5
0
332
1w
Webview localStorage gets cleared if navigate away from page on iOS
I'm experiencing an issue with WKWebView and localStorage. I've set up a standard WKWebView with the configuration: configuration.websiteDataStore = WKWebsiteDataStore.default() Everything works fine in the emulator (iOS 16.x, 17.0), but on my iPhone 13 running iOS 17.4, I encounter a problem. When I set a localStorage value on my local HTML page, navigate to another URL within the webview, and then return to the original page, the localStorage is cleared. This behavior is new and wasn't happening before. Has anyone else encountered this or have any suggestions on how to fix it? The localstorage should be persistent as it always has been.
0
0
193
2w
In iOS version 17.4 and above, HTML rendering appears abnormal lines after refocusing
In iOS version 17.4 and above, we have observed that the following code works fine upon the initial opening. However, after minimizing the page and reopening it, there is a chance of encountering issues with abnormal lines. Please note the reproduction conditions: try minimizing the page, opening other apps, and then reopening it multiple times. The code is in the comments section. first time: After minimizing and reopening...
16
3
642
2w
Can't establish mTLS on iOS with WKWebView and ProxyConfiguration
I have a sample iOS app in Xcode that I run in the iOS 17.5 Simulator. It creates a WKWebView and configures a proxy via the ProxyConfiguration API, it works as expected unless the proxy tries to establish mTLS. It seems there is no way to handle the client certificate request when using a proxy. If I navigate to a page that requests mTLS without a proxy configured, it works as expected. Here is a minimal repro: #import "ViewController.h" #import &lt;WebKit/WebKit.h&gt; @import Foundation; @import WebKit; @interface ViewController () &lt;WKNavigationDelegate&gt; @property (nonatomic,strong) WKWebView* webView; @property (nonatomic, strong) WKWebViewConfiguration * webConfig; @end @implementation ViewController - (void)loadView { [super loadView]; nw_protocol_options_t tls_options = nw_tls_create_options(); sec_protocol_options_t sec_options = nw_tls_copy_sec_protocol_options(tls_options); sec_protocol_options_set_challenge_block( sec_options, ^(sec_protocol_metadata_t metadata, sec_protocol_challenge_complete_t challenge_complete) { NSLog(@"Inside of challenge block"); challenge_complete(nil); }, dispatch_get_main_queue()); nw_endpoint_t proxy_endpoint = nw_endpoint_create_host(GetHost(), GetPort()); nw_relay_hop_t relay = nw_relay_hop_create(nil, proxy_endpoint, tls_options); nw_proxy_config_t proxy_config = nw_proxy_config_create_relay(relay, nil); nw_proxy_config_add_match_domain(proxy_config, "api.ipify.org"); self.webConfig = [[WKWebViewConfiguration alloc] init]; self.webConfig.websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore]; self.webConfig.websiteDataStore.proxyConfigurations = @[ proxy_config ]; self.webView = [[WKWebView alloc] initWithFrame:self.view.frame configuration:self.webConfig]; self.webView.navigationDelegate = self; [self.view addSubview:self.webView]; } - (void)viewDidLoad { [super viewDidLoad]; NSLog(@"%s",__func__); NSURL* url = [[NSURL alloc] initWithString:@"https://api.ipify.org"]; NSURLRequest* request = [[NSURLRequest alloc] initWithURL:url]; [self.webView loadRequest:request]; } - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation { NSLog(@"%s",__func__); } - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error { NSLog(@"%s. Error %@",__func__,error); } - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler { NSLog(@"%s",__func__); NSLog(@"protection space: %@", challenge.protectionSpace.authenticationMethod); completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); } @end The logs for this code show: -[ViewController viewDidLoad] -[ViewController webView:didStartProvisionalNavigation:] -[ViewController webView:didFailProvisionalNavigation:withError:]. Error Error Domain=NSURLErrorDomain Code=-1206 "The server “api.ipify.org” requires a client certificate." If we don't set up the ProxyConfiguration and navigate to a site that requires mTLS, the logs look like this: -[ViewController viewDidLoad] -[ViewController webView:didReceiveAuthenticationChallenge:completionHandler:] protection space: NSURLAuthenticationMethodServerTrust -[ViewController webView:didReceiveAuthenticationChallenge:completionHandler:] protection space: NSURLAuthenticationMethodClientCertificate -[ViewController webView:didStartProvisionalNavigation:] //... Eventually the request fails but the key difference is that didReceiveAuthenticationChallenge was invoked. When using the ProxyConfiguration neither that function nor the block we set via sec_protocol_options_set_challenge_block were run. I also tried to provide the client identity via sec_protocol_options_set_local_identity to no avail, and I've tried configuring these options too but they had no effect sec_protocol_options_add_tls_application_protocol(sec_options, "h2"); sec_protocol_options_set_max_tls_protocol_version(sec_options, tls_protocol_version_TLSv13); sec_protocol_options_set_peer_authentication_required(sec_options, true); Am I missing something? Or is this a bug in the ProxyConfiguration API?
0
1
232
2w
WebGPU bugreport: problem with uniform buffer
Hi, in this WebGPU example: https://skal65535.github.io/curl/index_bug_safari.html the lighting is wrong compared to Chrome's reference version. I narrowed the problem to the uniform value 'params.specular' at line 515 not being equal to the expected value 1.2f. The value is set a line at line 1078 in the uniform buffer. Platform: MacBook M1 Pro Sonoma 14.4.1 (23E224) Safari Technology Preview: Release 194 (Safari 17.4, WebKit 19619.1.11.111.2) Works ok with Chrome 124.0.6367.156 (Official Build) (arm64).
6
0
197
2w
Facing live broadcast issue when open the camera feed for face verification in webview
Hi In my app I've to complete the IDV [Identity verification] by capturing the face os user and his/her documents, for this the backend developer provides me the URL from the IDV 3rd party, which URL I do open in webview, so before during loading the camera captureing screen in webview the Live Broadcast screen pops up from no where. I don't want this Live Broadcast screen but somehow it opens anyway. Although it is good thing that my expected camera screen was still open in background so I can go further from there. First time I'm also bit confused like how this kind of screen popsup even if I did't code for it. Also it takes me a little bit time to figure out how to close that screen. Simple peoples/users who're going to use my app they don't know how to close it. Please check the screenshots I attached. Please help me to rid of this popup. Thank You
0
0
250
2w
iOS17.4.1 canvasをクリアしても特定の操作で描画が復活します
【現象】 Safariブラウザでcanvasに対して任意の描画をした後、clearRect()を実行します。 その後、canvasの親divに対して visibility: hidden を設定すると、消したはずの描画が復活します。 但し、親divは正常に visibility: hidden が働いているので描画されなくなります。 また、この現象はブラウザの拡大率が影響をしているようです。 少なくとも後述のリスト内のMacbookAirでは、拡大率が100%の場合にのみ発生しています。 この現象は過去のバージョンでは起きてないようです。 このバグを修正する予定はありますか? 【機種】 機種は以下のリストを確認してください。 Model OS&Version Y/N version MacbookAir M2 2022 macOS Sonoma 14.4.1 y 17.4.1 Mac Studio 2022 Apple M1 Max macOS Monterey 12.5 n 16.0 MacBook Air M1 2020 macOS Sonoma 14.3.1 n 17.3.1 iPadPro gen6 iPadOS 17.4.1 y - iPad gen10 iPadOS 17.4.1 n - 【デモ】 現象を確認するためのデモは以下のHTMLファイルを保存してブラウザで開いてください。 再現手順はボタンを draw -> clear -> hide の順番に押してください。 黄色の親divが非表示になるのに対し、canvasからclearしたはずの黒い四角が表示されます。 <html> <body onload="onLoad()"> <div id="parent" style="background-color: yellow;"> <canvas id="canvas"></canvas> </div> <button onclick="drawCanvas()">draw</button> <button onclick="clearCanvas()">clear</button> <button onclick="showCanvas()">show</button> <button onclick="hideCanvas()">hide</button> <script> let parent let canvas let context2d function onLoad() { parent = document.getElementById("parent") canvas = document.getElementById("canvas") context2d = canvas.getContext('2d') } function drawCanvas() { context2d.fillRect(0, 0, 100, 100) } function clearCanvas() { context2d.clearRect(0, 0, canvas.width, canvas.height) } function showCanvas() { parent.style.visibility = "visible" } function hideCanvas() { parent.style.visibility = "hidden" } </script> </body> </html>
1
0
178
2w
Privacy Manifest Non Tracking Within Webview
We are requesting some information on what should be done in the following case: We have an application that has a privacy manifest, where tracking domains are listed. When the user does not give his/her consent to be tracked, non tracking domains are being used for requests to bring ads. The application in question has a webview where content (ads) are loaded. When a user clicks on an ad, another webview is opened, and this webview does not know that it is in a non tracking flow. Therefore, tracking domains are being used instead of non tracking domains. Since multiple redirections might be in play, there is no way to pass data from the original webview to the one that is opened once the ad is clicked. Would the tracking domains being used in the second webview be blocked? If so, what can we do to circumvent this scenario? Is this even a use case considering privacy manifest? Thanks
0
0
159
2w
window.open() does not return a valid object since MacOS14.4
I have the following html that is opened in a WKWebView. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Popup Window Test</title> </head> <body> <textarea id="myTextarea" cols="5" rows="1">Empty</textarea> <script> function openWindow() { const popup = window.open( "https://www.apple.com/", "PopupSample", "width=400,height=400,dialog=yes,dependent=yes,scrollbars=yes,location=yes" ); console.log("Popup closed: ", popup.closed); document.getElementById("myTextarea").value = popup.closed ? "Closed" : "Open"; const timer = setInterval(() => { console.log(popup.location.href); if (popup.closed) { clearInterval(timer); console.log("Popup closed: ", popup.closed); document.getElementById("myTextarea").value = "Closed"; } }, 1000); } </script> <button onclick="openWindow()">Open Window</button> </body> </html> When I click the button and open page "https://www.apple.com/" in another WKWebView, the javascript code does not work as expected here, the popup object returned from window.open() does not refer to the valid window object, and the closed property is set to true even the new popup window is still alive. This is a regression since MacOS14.4 updated, I've reported to apple DTS, but they said it's out of their scope. Does anyone has any clue about this?
0
0
202
3w
[WKWebView takeSnapshotWithConfiguration:completionHandler:] function does not work
- (void)viewDidLoad { [super viewDidLoad]; UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(rightButtonTapped:)]; self.navigationItem.rightBarButtonItem = rightButton; WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init]; _webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:configuration]; _webView.navigationDelegate = self; [self.view addSubview:_webView]; NSURL *url = [NSURL URLWithString:@"https://www.apple.com"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [_webView loadRequest:request]; } - (void)rightButtonTapped:(UIBarButtonItem *)sender { NSLog(@"self.webView.scrollView.contentSize.height:%f", self.webView.scrollView.contentSize.height); WKSnapshotConfiguration* configuration = [WKSnapshotConfiguration new]; configuration.rect = CGRectMake(0, 0, self.webView.scrollView.contentSize.width, self.webView.scrollView.contentSize.height); // configuration.afterScreenUpdates = NO; [self.webView takeSnapshotWithConfiguration:configuration completionHandler:^(UIImage * _Nullable snapshotImage, NSError * _Nullable error) { if (error) { NSLog(@"fail"); } else { NSLog(@"succ"); } }]; } Running the code above, I get a blank image
0
0
137
3w
WKScriptMessageHandlerWithReply and strict concurrency checking
Hi, I'm trying to implement a type conforming to WKScriptMessageHandlerWithReply while having Swift's strict concurrency checking enabled. It's not been fun. The protocol contains the following method (there's also one with a callback, but we're in 2024): func userContentController( controller: WKUserContentController, didReceive message: WKScriptMessage ) async -> (Any?, String?) WKScriptMessage's properties like body must be accessed on the main thread. But since WKScriptMessageHandlerWithReply is not @MainActor, neither can this method be so marked (same for the conforming type). At the same time WKScriptMessage is not Sendable, so I can't handle it in Task { @MainActor in this method, because that leads to Capture of 'message' with non-sendable type 'WKScriptMessage' in a `@Sendable` closure That leaves me with @preconcurrency import - is that the way to go? Should I file a feedback for this or is it somehow working as intended?
3
0
206
3w