aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.html
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-04-23 01:59:21 +0200
committerLibravatar GitHub <noreply@github.com>2022-04-22 23:59:21 +0000
commitd02644f7c41150709795e57bfd40351b4da35a7b (patch)
tree2403fb76bd5fae1703f8b55172ffce9e0a5d2bce /src/index.html
parentComplete tray icons redesign for all platforms (#28) (diff)
downloadferdium-app-d02644f7c41150709795e57bfd40351b4da35a7b.tar.gz
ferdium-app-d02644f7c41150709795e57bfd40351b4da35a7b.tar.zst
ferdium-app-d02644f7c41150709795e57bfd40351b4da35a7b.zip
Preload safe debug shim (#29)
In https://github.com/ferdium/ferdium-app/pull/23 we removed usages of the debug package due to an electron bug. This patch aims to restore some debug functionality by introducing a shim. The shim detect whether if it is being introduced in a preload script where the electron but would be triggered, and falls back to a simple replacement for debug. However, in the main and renderer processes, where a preload script is not being used, we still get full debug functionality. In this way, a module can be used both in a preload script and outside of it, while still preserving debug functionality whenever possible. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'src/index.html')
-rw-r--r--src/index.html3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/index.html b/src/index.html
index 23fbb6b20..d86e36de9 100644
--- a/src/index.html
+++ b/src/index.html
@@ -28,6 +28,9 @@
28 require('./sentry'); 28 require('./sentry');
29 const { isDevMode } = require('./environment-remote'); 29 const { isDevMode } = require('./environment-remote');
30 if (isDevMode) { 30 if (isDevMode) {
31 // Here we must access `debug` directly (instead of through `preload-safe-debug`),
32 // because we need to set the log level.
33 // However, this is safe, because we aren't in a preload script.
31 const debugging = require('debug'); 34 const debugging = require('debug');
32 debugging.enable(process.env.DEBUG); 35 debugging.enable(process.env.DEBUG);
33 36