Skip to content

[Refactor] Add version check for WKWebView API call #1678

@pewsheen

Description

@pewsheen

We fixed some issues caused by calling the OS API that was introduced in a higher OS version than the client's version.
Maybe we should at least scan our codebase and find out those APIs require a higher version than Tauri's minimum platform support, which is macOS 10.15+ and iOS 9+

Roadmap

API List

(Showing those higher than the minimum support version only)

Guarded APIs

They are either guarded by checking os version, or using respondsToSelector

API Required
WKWebsiteDataStore.dataStoreForIdentifier(_:) macOS 14+, iOS 17+
WKWebViewConfiguration.setLimitsNavigationsToAppBoundDomains(_:) macOS 11+, iOS 14+
WKWebView.setUnderPageBackgroundColor(_:) macOS 12+, iOS 15+
WKPreferences KVC inactiveSchedulingPolicy macOS 14+, iOS 17+
WKWebView.setInspectable(_:) macOS 13.3+, iOS 16.4+
NSWindow.setTitlebarSeparatorStyle(_:) macOS 11+
NSApplication.activate() macOS 14+
WKWebView.printOperationWithPrintInfo(_:) macOS 11+
NSHTTPCookie.sameSitePolicy macOS 10.15+, iOS 13+
WKNavigationAction.shouldPerformDownload macOS 11.3+, iOS 14.5+

Not yet guarded

API Required
WKWebViewConfiguration.urlSchemeHandlerForURLScheme(_:) macOS 10.13+, iOS 11+
WKWebViewConfiguration.setURLSchemeHandler(_:forURLScheme:) macOS 10.13+, iOS 11+
WKWebViewConfiguration.defaultWebpagePreferences + WKWebpagePreferences.setAllowsContentJavaScript(_:) macOS 10.15+, iOS 13+
WKWebViewConfiguration.setMediaTypesRequiringUserActionForPlayback(_:) macOS 10.12+, iOS 10+
WKWebView.setPageZoom(_:) macOS 11+, iOS 14+
WKWebsiteDataStore.httpCookieStore / WKHTTPCookieStore.getAllCookies(_:) macOS 10.13+, iOS 11+
WKWebsiteDataStore.httpCookieStore / WKHTTPCookieStore.setCookie(_:completionHandler:) macOS 10.13+, iOS 11+
WKWebsiteDataStore.httpCookieStore / WKHTTPCookieStore.deleteCookie(_:completionHandler:) macOS 10.13+, iOS 11+
WKWebsiteDataStore.fetchAllDataStoreIdentifiers(_:) macOS 14+, iOS 17+
WKWebsiteDataStore.removeDataStoreForIdentifier(_:completionHandler:) macOS 14+, iOS 17+

Private API / KVC

These are the API / KVCs that are not listed on the public document

Key / API
allowsPictureInPictureMediaPlayback
drawsBackground
fullScreenEnabled
developerExtrasEnabled

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions