From e33296a451f979d10e3ec2189d3c7a5ad6bb6c1d Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 27 Nov 2024 10:51:05 -0500 Subject: [PATCH] mac: Add applicationSupportsSecureRestorableState Requests that any state restoration archive be created with secure encoding (macOS 12+ only). See https://crrev.com/c737387656 for details. This also fixes an issue with macOS default behavior incorrectly restoring windows after hard reset (holding down the power button). --- tests/cefclient/cefclient_mac.mm | 8 ++++++++ tests/cefsimple/cefsimple_mac.mm | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/tests/cefclient/cefclient_mac.mm b/tests/cefclient/cefclient_mac.mm index 16dd355b9..9c09f6a83 100644 --- a/tests/cefclient/cefclient_mac.mm +++ b/tests/cefclient/cefclient_mac.mm @@ -522,6 +522,14 @@ void RemoveMenuItem(NSMenu* menu, SEL action_selector) { } return NO; } + +// Requests that any state restoration archive be created with secure encoding +// (macOS 12+ only). See https://crrev.com/c737387656 for details. This also +// fixes an issue with macOS default behavior incorrectly restoring windows +// after hard reset (holding down the power button). +- (BOOL)applicationSupportsSecureRestorableState:(NSApplication*)app { + return YES; +} @end namespace client { diff --git a/tests/cefsimple/cefsimple_mac.mm b/tests/cefsimple/cefsimple_mac.mm index 939fd9955..7121f6665 100644 --- a/tests/cefsimple/cefsimple_mac.mm +++ b/tests/cefsimple/cefsimple_mac.mm @@ -119,6 +119,14 @@ } return NO; } + +// Requests that any state restoration archive be created with secure encoding +// (macOS 12+ only). See https://crrev.com/c737387656 for details. This also +// fixes an issue with macOS default behavior incorrectly restoring windows +// after hard reset (holding down the power button). +- (BOOL)applicationSupportsSecureRestorableState:(NSApplication*)app { + return YES; +} @end // Entry point function for the browser process.