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: use xib file to construct macOS Menu #20615

Merged
merged 3 commits into from Oct 21, 2019
Merged

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Oct 16, 2019

Description of Change

Resolves #20503.

When we removed the .xib file menu construction, it unfortunately nuked the recentDocuments role, which unexpectedly is near-impossible to replicate manually with obj-c without doing terrifying hacky things or using private APIs (see this blog post). As a result, our only real path forward here was to revert to xib-based functionality removed originally removed in this commit. I needed to re-implement the xib template in GN removed upstream but otherwise I mostly just needed to re-add the xib file and revert to the older recentDocuments menu role business logic in the menu_controller.

Tested to work with this repro case.

cc @MarshallOfSound @nornagon (& @bigtimebuddy!)

Checklist

Release Notes

Notes: Fixed a regression in the recentDocuments role on macOS.

@deepak1556
Copy link
Member

Not a review but some thoughts , the reason chrome is doing this refactor is they are trying to remove dependency on system XCode and make builds deterministic https://bugs.chromium.org/p/chromium/issues/detail?id=330262, which again aligns with one of our upcoming projects from security WG , making electron builds deterministic.

Once this transition is complete on chrome end and we still deviate from it then its going to be a technical debt similar to libc++ one which I would like to avoid at all cost. So reiterating on this PR, I would suggest to look into the programmatic implementation or revisit the position of this api through the API WG.

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Oct 17, 2019
@nornagon
Copy link
Member

Thanks for the context @deepak1556! Since this is just a dependency on ibtool, not a dependency on any compiler/linker tool from Xcode, do you think it would be OK? A quick test on my machine produced identical output from multiple runs of ibtool on identical inputs, showing that it's at least timestamp-independent. I also tested running in a different directory (different pwd, input and output paths) and got identical bytes out of ibtool.

In general I agree with wanting to drop Xcode as a dependency, and aligning with Chromium, but this doesn't seem like it would impact our ability to produce deterministic builds. Additionally, doing this programmatically requires calling private APIs which may or may not be rejected by MAS.

@codebytere
Copy link
Member Author

Additionally, doing this programmatically requires calling private APIs which may or may not be rejected by MAS.

This is also my primary consideration here; i'd rather have the system handle this where possible and not endanger users' ability to ship via the mac app store.

At the very least, i'd like to get this into versions where it's supposed to work and then perhaps consider deprecating it in future versions when Chromium does totally drop Xcode 🤔

@deepak1556
Copy link
Member

Sorry for the delayed response, comments inline.

Since this is just a dependency on ibtool, not a dependency on any compiler/linker tool from Xcode, do you think it would be OK?

Yeah dependency on ibtool is fine, it used to be non-deterministic in the past. I was originally worried about a situation when chromium gets rid of all its xib files, they would start shipping the minimal set of binaries and SDK for the build. We would have to rely on the system installation for this one, but since it doesn't change the determinism of the build, should be ok!

Additionally, doing this programmatically requires calling private APIs which may or may not be rejected by MAS.

Moving forward, implementations that require this should be considered by the API WG and see if it can be made as a userland module or expose the right parts to make it possible.

@codebytere
Copy link
Member Author

Moving forward, implementations that require this should be considered by the API WG and see if it can be made as a userland module or expose the right parts to make it possible.

@deepak1556 do you wish for the API group to vote on this PR, or are you comfortable with this PR as it stands and wish for us to vote on future PRs affecting similar build components?

@deepak1556
Copy link
Member

deepak1556 commented Oct 21, 2019

@codebytere sorry my comment wasn't clear, I was talking about future PR's . This one is good as it stands 👍

Copy link
Member

@nornagon nornagon left a comment

Choose a reason for hiding this comment

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

lgtm with nits

build/rules.gni Show resolved Hide resolved
shell/browser/resources/mac/Info.plist Outdated Show resolved Hide resolved
Copy link
Member

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

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

LGTM

@codebytere codebytere merged commit 9a5cd4c into master Oct 21, 2019
@release-clerk
Copy link

release-clerk bot commented Oct 21, 2019

Release Notes Persisted

Fixed a regression in the recentDocuments role on macOS.

@codebytere codebytere deleted the recent-documents-add branch October 21, 2019 21:11
@trop
Copy link
Contributor

trop bot commented Oct 21, 2019

I was unable to backport this PR to "6-1-x" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Oct 21, 2019

I have automatically backported this PR to "7-0-x", please check out #20670

@bigtimebuddy
Copy link

Could someone manually back-port this to 6.1.x? Doesn't look like it showed up in the latest release.

@trop
Copy link
Contributor

trop bot commented Oct 31, 2019

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

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.

Regression of recentDocuments file list on macOS
4 participants