From 4f1fce384aadc00caf04a562e9914ddc1baee4d7 Mon Sep 17 00:00:00 2001
From: Daniel Carl <danielcarl@gmx.de>
Date: Mon, 27 Aug 2018 23:05:53 +0200
Subject: [PATCH] Check webextension at startup by default.

Also fail with error if webextension could not be read.
---
 src/config.def.h | 3 +++
 src/main.c       | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/config.def.h b/src/config.def.h
index 829a30e..5d36c4b 100644
--- a/src/config.def.h
+++ b/src/config.def.h
@@ -55,3 +55,6 @@
 /* default window dimensions */
 #define WIN_WIDTH                  800
 #define WIN_HEIGHT                 600
+
+/* if set to 1 vimb will check if the webextension could be found. */
+#define CHECK_WEBEXTENSION_ON_STARTUP 1
diff --git a/src/main.c b/src/main.c
index 46d6fcb..071078f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1044,10 +1044,10 @@ static void on_webctx_init_web_extension(WebKitWebContext *webctx, gpointer data
     const char *name;
     GVariant *vdata;
 
-#ifdef DEBUG
+#if (CHECK_WEBEXTENSION_ON_STARTUP)
     char *extension = g_build_filename(EXTENSIONDIR,  "webext_main.so", NULL);
     if (!g_file_test(extension, G_FILE_TEST_IS_REGULAR)) {
-        g_warning("Cannot access web extension %s", extension);
+        g_error("Cannot access web extension %s", extension);
     }
     g_free(extension);
 #endif
-- 
2.20.1