Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning message on Mac about secure coding not enabled #1231

Merged

Conversation

Phillipus
Copy link
Contributor

"WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES."

  • As recommended by Apple, this change adds a new selector for applicationSupportsSecureRestorableState and returns a 1 value (YES) in the callback in the Display class

  • However, this only takes care of the NSApplicationDelegate created in the Display class. The warning message will still appear when a splash screen is created in Equinox JNI code so a fix there is also required. See [Mac Sonoma] "WARNING: Secure coding is not enabled for restorable state" warning message eclipse-equinox/equinox#630

  • This implementation for SWT can be tested by using the -noSplash argument when launching Eclipse

- See eclipse-platform#1228

- On macOS 14 and later a warning message is written to console:

"WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES."

- As recommended by Apple, this change adds a new selector for applicationSupportsSecureRestorableState and returns a 1 value (YES) in the callback in the Display class

- However, this only takes care of the NSApplicationDelegate created in the Display class. The warning message will still appear when a splash screen is created in Equinox JNI code so a fix there is also required. See eclipse-equinox/equinox#630

- This implementation for SWT can be tested by using the -noSplash argument when launching Eclipse
Copy link
Contributor

Test Results

   418 files  ±0     418 suites  ±0   7m 19s ⏱️ -8s
 4 121 tests ±0   4 113 ✅ ±0   8 💤 ±0  0 ❌ ±0 
16 313 runs  ±0  16 221 ✅ ±0  92 💤 ±0  0 ❌ ±0 

Results for commit 986b71c. ± Comparison against base commit d3df796.

Copy link
Member

@lshanmug lshanmug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Phillipus Changes look good. Should we merge for 4.32 RC1?

@Phillipus
Copy link
Contributor Author

@Phillipus Changes look good. Should we merge for 4.32 RC1?

@lshanmug The applicationSupportsSecureRestorableState selector was added in macOS 12 (see here) so I guess the selector is simply ignored on earlier macOS? So I think it's safe to merge.

But as mentioned above, equinox project also need to apply a fix in their native Mac code. I create a PR for that case here.

@lshanmug
Copy link
Member

lshanmug commented May 17, 2024

@Phillipus Changes look good. Should we merge for 4.32 RC1?

@lshanmug The applicationSupportsSecureRestorableState selector was added in macOS 12 (see here) so I guess the selector is simply ignored on earlier macOS? So I think it's safe to merge.

Yes, the selector code will not be called for earlier versions.

But as mentioned above, equinox project also need to apply a fix in their native Mac code. I create a PR for that case here.

The SWT PR can go in anyways, correct?

@Phillipus
Copy link
Contributor Author

The SWT PR can go in anyways correct?

Yes, I think so. If Eclipse is started with the -noSplash option then the SWT selector is invoked and there is no warning message, as desired.

One thing I don't understand is where is the singleton NSApplication created? Equinox references [NSApplication sharedApplication] here and SWT references it in the Display class.

@lshanmug lshanmug merged commit 89055b4 into eclipse-platform:master May 20, 2024
14 checks passed
@lshanmug
Copy link
Member

lshanmug commented May 20, 2024

One thing I don't understand is where is the singleton NSApplication created? Equinox references [NSApplication sharedApplication] here and SWT references it in the Display class.

NSApplication.sharedApplication itself creates the NSApplication instance for the first time and returns it for future calls. Please see doc.

@Phillipus Phillipus deleted the fix1228-mac-warning-message branch May 20, 2024 08:53
Phillipus added a commit to Phillipus/eclipse.platform.swt that referenced this pull request May 20, 2024
amartya4256 pushed a commit to amartya4256/eclipse.platform.swt that referenced this pull request Jun 6, 2024
…latform#1231)

- See eclipse-platform#1228

- On macOS 14 and later a warning message is written to console:

"WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES."

- As recommended by Apple, this change adds a new selector for applicationSupportsSecureRestorableState and returns a 1 value (YES) in the callback in the Display class

- However, this only takes care of the NSApplicationDelegate created in the Display class. The warning message will still appear when a splash screen is created in Equinox JNI code so a fix there is also required. See eclipse-equinox/equinox#630

- This implementation for SWT can be tested by using the -noSplash argument when launching Eclipse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants