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

@ -14,6 +14,7 @@
#include "base/strings/string_split.h"
#include "components/crash/core/common/crash_key.h"
#include "content/public/common/content_switches.h"
#include "electron/fuses.h"
#include "shell/common/electron_constants.h"
#include "shell/common/options_switches.h"
#include "third_party/crashpad/crashpad/client/annotation.h"
@ -100,6 +101,9 @@ void GetCrashKeys(std::map<std::string, std::string>* keys) {
namespace {
bool IsRunningAsNode() {
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
if (!electron::fuses::IsRunAsNodeEnabled())
return false;
return base::Environment::Create()->HasVar(electron::kRunAsNode);
#else
return false;