feat: Electron Fuses, package time feature toggles (#24241)

* feat: add new 'fuses' feature for package-time build-flag style feature control

* feat: put ENABLE_RUN_AS_NODE behind a fuse as well

* chore: address PR feedback

* build: move FUSE_EXPORT to headers

* build: use hex codes for kFuseWire char[]

* docs: add fuse wire documentation

* chore: update fuses.json info

* Apply suggestions from code review

Co-authored-by: Jeremy Rose <jeremya@chromium.org>

* chore: add link to fuse schema

* Update shell/app/electron_library_main.mm

Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
This commit is contained in:
Samuel Attard 2020-10-27 10:49:25 -07:00 committed by GitHub
parent 422190e1ff
commit dbf2931f0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 195 additions and 5 deletions

View file

@ -9,6 +9,7 @@
#include "base/mac/bundle_locations.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "content/public/app/content_main.h"
#include "electron/fuses.h"
#include "shell/app/electron_main_delegate.h"
#include "shell/app/node_main.h"
#include "shell/common/electron_command_line.h"
@ -25,6 +26,11 @@ int ElectronMain(int argc, char* argv[]) {
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
int ElectronInitializeICUandStartNode(int argc, char* argv[]) {
if (!electron::fuses::IsRunAsNodeEnabled()) {
CHECK(false) << "run_as_node fuse is disabled";
return 1;
}
base::AtExitManager atexit_manager;
base::mac::ScopedNSAutoreleasePool pool;
base::mac::SetOverrideFrameworkBundlePath(