Skip to content

fix: disable remote layer APIs in MAS build - #20965

Merged
zcbenz merged 2 commits into
masterfrom
mas-patch-remote-layer
Feb 24, 2020
Merged

zcbenz merged 2 commits into
masterfrom
mas-patch-remote-layer

Conversation

@zcbenz

@zcbenz zcbenz commented Nov 5, 2019 •

Copy link
Copy Markdown
Contributor

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
zcbenz requested a review from a team as a code owner November 5, 2019 05:11
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Nov 5, 2019
@zcbenz

zcbenz commented Nov 5, 2019

Copy link
Copy Markdown
Contributor Author

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

trop Bot commented Nov 5, 2019

Copy link
Copy Markdown
Contributor

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

@trop

trop Bot commented Nov 5, 2019

Copy link
Copy Markdown
Contributor

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

@trop

trop Bot commented Nov 5, 2019

Copy link
Copy Markdown
Contributor

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

@deepak1556 deepak1556 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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
Copy Markdown
Member

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
Copy Markdown
Contributor Author

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
Copy Markdown
Member

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
Copy Markdown
Contributor Author

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
Copy Markdown
Member

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

@zcbenz

zcbenz commented Nov 5, 2019

Copy link
Copy Markdown
Contributor Author

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 a team November 5, 2019 19:11
@zcbenz
zcbenz force-pushed the mas-patch-remote-layer branch from 77fc428 to a160a4d Compare February 20, 2020 10:19
@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

trop Bot commented Feb 20, 2020

Copy link
Copy Markdown
Contributor

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

@trop

trop Bot commented Feb 20, 2020

Copy link
Copy Markdown
Contributor

@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 Compare February 20, 2020 23:10
@zcbenz
zcbenz merged commit 41931aa into master Feb 24, 2020
@release-clerk

release-clerk Bot commented Feb 24, 2020

Copy link
Copy Markdown

Release Notes Persisted

Fix Electron apps getting rejected to Mac App Store.

@zcbenz
zcbenz deleted the mas-patch-remote-layer branch February 24, 2020 03:09
@trop

trop Bot commented Feb 24, 2020

Copy link
Copy Markdown
Contributor

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mac App Store Private API Rejection: Electron 5.0.10

10 participants