[epiphany/mcatanzaro/is-web-application: 2/2] web-extension: improve robustness of isWebApplication callback



commit 41d66a2678471382417afbf2b9a34bcc2e4fe3be
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Wed Mar 20 15:42:56 2019 -0500

    web-extension: improve robustness of isWebApplication callback
    
    If the signature of ephy_profile_dir_is_web_application() ever changes,
    this will break. It's too fragile.

 embed/web-extension/ephy-web-extension.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index 996e5b17e..6680327e3 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -639,6 +639,12 @@ js_auto_fill (JSCValue   *js_element,
   webkit_dom_element_html_input_element_set_editing_value (element, value);
 }
 
+static gboolean
+js_is_web_application (void)
+{
+  return ephy_profile_dir_is_web_application ();
+}
+
 static gboolean
 js_is_edited (JSCValue *js_element)
 {
@@ -750,7 +756,7 @@ window_object_cleared_cb (WebKitScriptWorld *world,
 
   js_function = jsc_value_new_function (js_context,
                                         "isWebApplication",
-                                        G_CALLBACK (ephy_profile_dir_is_web_application), NULL, NULL,
+                                        G_CALLBACK (js_is_web_application), NULL, NULL,
                                         G_TYPE_BOOLEAN, 0);
   jsc_value_object_set_property (js_ephy, "isWebApplication", js_function);
   g_clear_object (&js_function);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]