fix: guard WKPreferences.inactiveSchedulingPolicy behind macOS 14.0+ runtime check#322
Merged
validatedev merged 1 commit intorobinebers:mainfrom Mar 29, 2026
Conversation
…lingPolicy The `setInactiveSchedulingPolicy` API on `WKPreferences` was introduced in macOS 14.0 (Sonoma). Calling it unconditionally causes a crash on macOS 13.x (Ventura) with "unrecognized selector sent to instance". This adds a lightweight runtime version guard using `NSProcessInfo.operatingSystemVersion`. On macOS 14.0+ the behavior is unchanged. On older systems the call is skipped gracefully with a log message. App Nap prevention (handled separately in `app_nap.rs`) still works on all supported macOS versions. Tested on macOS 13.7 Ventura (Darwin 22.6.0, Intel x86_64). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
|
LGTM, thank you @beznazwiska |
robinebers
approved these changes
Mar 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenUsage crashes on launch on macOS 13.x (Ventura) with:
WKPreferences.setInactiveSchedulingPolicywas introduced in macOS 14.0 (Sonoma). The current code inwebkit_config.rscalls it unconditionally, which sends an unrecognized selector on older systems and causes an immediate abort.Changes
NSProcessInfo.operatingSystemVersion(already available via theobjc2-foundationdependency)setInactiveSchedulingPolicy(.none)is called as beforeapp_nap.rs) is unaffected and continues to work on all macOS versionsThe change is minimal (12 lines added, 0 removed from the original logic) and introduces no new dependencies.
Test plan
cargo build --releasecompiles without warnings🤖 Generated with Claude Code
Summary by cubic
Fixes a launch crash on macOS 13 by guarding
WKPreferences.setInactiveSchedulingPolicybehind a macOS 14.0+ runtime check. macOS 14+ behavior is unchanged.NSProcessInfo.operatingSystemVersion(fromobjc2-foundation).src-tauri/src/webkit_config.rs.Written for commit e8c6647. Summary will update on new commits.