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: disable remote layer APIs in MAS build #20965

Merged
merged 2 commits into from Feb 24, 2020
Merged

fix: disable remote layer APIs in MAS build #20965

merged 2 commits into from Feb 24, 2020

Conversation

@zcbenz
Copy link
Member

@zcbenz zcbenz commented Nov 5, 2019

Description of Change

Close #20027.

This PR disables following private macOS APIs used in Chromium:

  • CAContext
  • CALayerHost

Chromium has 2 ways of rendering on macOS: one is using official IOSurface way, and one is CARemoteLayer API. The IOSurface way is used when software compositing is enabled, and when the remote layer API is not available.

This PR forces using IOSurface even when remote layer API is available, it essentially behaves the same with passing the --disable-remote-core-animation command line flag.

More information can be found at https://bugs.chromium.org/p/chromium/issues/detail?id=312462.

  • NSAccessibilityRemoteUIElement

All related code using this class are disabled. It would affect accessibility when remote layer API is used, but we should be fine since remote layer API is disabled too.

  • NSNextStepFrame
  • NSThemeFrame

Chromium overrides these private classes to implement custom frame. All related code are disabled so custom frame would not work.

Since in Electron we only support standard frame and simple frameless window, we are not affected.

  • NSURLFileTypeMappings

Chromium uses it to guess mime type from extension names, the iOS version of Chromium does not use it. The fallback detection should be enough for us.

Checklist

Release Notes

Notes: Fix Electron apps getting rejected to Mac App Store.

@zcbenz
Copy link
Member Author

@zcbenz zcbenz commented Nov 5, 2019

The original issue should be kept open since this PR does not patch fileport_makefd and fileport_makeport, and I don't know if it is needed.

(I hope it is not needed since these two are really difficult to get rid of.)

@trop
Copy link
Contributor

@trop trop bot commented Nov 5, 2019

@zcbenz has manually backported this PR to "8-x-y", please check out #20966

@trop
Copy link
Contributor

@trop trop bot commented Nov 5, 2019

@zcbenz has manually backported this PR to "7-1-x", please check out #20967

@trop
Copy link
Contributor

@trop trop bot commented Nov 5, 2019

@zcbenz has manually backported this PR to "6-1-x", please check out #20970

Copy link
Member

@deepak1556 deepak1556 left a comment

Thanks @zcbenz !

The RemoteMacViews are gonna stay for a long time https://bugs.chromium.org/p/chromium/issues/detail?id=859152
https://bugs.chromium.org/p/chromium/issues/detail?id=958255

We should look into the possibility of pushing the remote implementation behind a buildflag in upstream to reduce our patch in future. Thoughts ?

]

+ if (is_mas_build) {
+ sources -= [
Copy link
Member

@deepak1556 deepak1556 Nov 5, 2019

Choose a reason for hiding this comment

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

why are we excluding them here ?

Copy link
Member Author

@zcbenz zcbenz Nov 5, 2019

Choose a reason for hiding this comment

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

remote_accessibility_api.mm implements ui::RemoteAccessibility which uses private APIs, excluding it is simpler than commenting out the whole file.

Copy link
Member

@deepak1556 deepak1556 Nov 5, 2019

Choose a reason for hiding this comment

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

But we also seem to be patching them below is that needed ?

Copy link
Member Author

@zcbenz zcbenz Nov 5, 2019

Choose a reason for hiding this comment

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

In theory it is fine leaving remote_accessibility_api.h untouched, but by commenting out the declarations defined in remote_accessibility_api.h, any other file that uses the private APIs would trigger compilation error early, so we won't miss things when updating/backporting the patch.

@deepak1556
Copy link
Member

@deepak1556 deepak1556 commented Nov 5, 2019

3-1-x and 4-2-x are not supported release lines, hence removed their backport labels

@zcbenz
Copy link
Member Author

@zcbenz zcbenz commented Nov 5, 2019

We should look into the possibility of pushing the remote implementation behind a buildflag in upstream to reduce our patch in future. Thoughts ?

It is definitely good idea, it would also keep Chromium maintaining the code path we use.

@deepak1556 deepak1556 requested a review from Nov 5, 2019
@zcbenz zcbenz force-pushed the mas-patch-remote-layer branch from 77fc428 to a160a4d Feb 20, 2020
@zcbenz zcbenz changed the title fix: disable more private macOS APIs in MAS build fix: disable remote layer APIs in MAS build Feb 20, 2020
@trop
Copy link
Contributor

@trop trop bot commented Feb 20, 2020

@zcbenz has manually backported this PR to "8-x-y", please check out #22298

@trop
Copy link
Contributor

@trop trop bot commented Feb 20, 2020

@zcbenz has manually backported this PR to "7-1-x", please check out #22299

@zcbenz zcbenz force-pushed the mas-patch-remote-layer branch from a160a4d to a088dac Feb 20, 2020
@zcbenz zcbenz merged commit 41931aa into master Feb 24, 2020
15 of 16 checks passed
@release-clerk
Copy link

@release-clerk release-clerk bot commented Feb 24, 2020

Release Notes Persisted

Fix Electron apps getting rejected to Mac App Store.

@zcbenz zcbenz deleted the mas-patch-remote-layer branch Feb 24, 2020
@trop
Copy link
Contributor

@trop trop bot commented Feb 24, 2020

I have automatically backported this PR to "9-x-y", please check out #22354

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
9-x-y
Fixed in 9.0.0-beta.3
Linked issues

Successfully merging this pull request may close these issues.

10 participants