static void wxgtk_initialize_web_extensions(WebKitWebContext *context, GDBusServer *dbusServer) { const char *address = g_dbus_server_get_client_address(dbusServer); GVariant *user_data = g_variant_new("(s)", address); webkit_web_context_set_web_extensions_directory(context, WX_WEB_EXTENSIONS_DIRECTORY); webkit_web_context_set_web_extensions_initialization_user_data(context, user_data); }
static void initialize_web_extensions (WebKitWebContext* web_context, EphyEmbedShell *shell) { EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell); GVariant *user_data; gboolean private_profile; char *web_extension_id; static guint web_extension_count = 0; webkit_web_context_set_web_extensions_directory (web_context, EPHY_WEB_EXTENSIONS_DIR); web_extension_id = g_strdup_printf ("%u-%u", getpid (), ++web_extension_count); ephy_embed_shell_watch_web_extension (shell, web_extension_id); private_profile = EPHY_EMBED_SHELL_MODE_HAS_PRIVATE_PROFILE (priv->mode); user_data = g_variant_new ("(ssb)", web_extension_id, ephy_dot_dir (), private_profile); webkit_web_context_set_web_extensions_initialization_user_data (web_context, user_data); }
static void initialize_web_extensions_cb(WebKitWebContext *context, gpointer socket_path) { #if DEVELOPMENT_PATHS gchar *extension_dir = g_get_current_dir(); #else const gchar *extension_dir = LUAKIT_INSTALL_PATH; #endif /* * FIXME: Check prevents installation from AUR, since luakit is ran to generate * documentation as part of the installation process. */ #if 0 char *extension_file = g_build_filename(extension_dir, "luakit.so", NULL); if (access(extension_file, R_OK)) { #if DEVELOPMENT_PATHS # define DEVPATHS "\nLuakit was built with DEVELOPMENT_PATHS=1; are you running luakit correctly?" #else # define DEVPATHS "" #endif fatal("Cannot access luakit extension '%s': %s" DEVPATHS, extension_file, strerror(errno)); #undef DEVPATHS } g_free(extension_file); #endif /* There's a potential race condition here; the accept thread might not run * until after the web extension process has already started (and failed to * connect). TODO: add a busy wait */ GVariant *payload = g_variant_new_string(socket_path); webkit_web_context_set_web_extensions_initialization_user_data(context, payload); webkit_web_context_set_web_extensions_directory(context, extension_dir); #if DEVELOPMENT_PATHS g_free(extension_dir); #endif }