Пример #1
0
int
main(int argc, char **argv)
{
    gchar *c;
    int opt, i;

    gtk_init(&argc, &argv);

    grab_environment_configuration();

    while ((opt = getopt(argc, argv, "e:CT")) != -1)
    {
        switch (opt)
        {
            case 'e':
                embed = atol(optarg);
                tabbed_automagic = FALSE;
                break;
            case 'C':
                cooperative_instances = FALSE;
                break;
            case 'T':
                tabbed_automagic = FALSE;
                break;
            default:
                fprintf(stderr, "Usage: "__NAME__" [OPTION]... [URI]...\n");
                exit(EXIT_FAILURE);
        }
    }

    keywords_load();
    if (cooperative_instances)
        cooperation_setup();
    downloadmanager_setup();

    if (tabbed_automagic && !(cooperative_instances && !cooperative_alone))
        embed = tabbed_launch();

    if (!cooperative_instances || cooperative_alone)
    {
        c = g_build_filename(g_get_user_data_dir(), __NAME__, "web_extensions",
                             NULL);
        webkit_web_context_set_web_extensions_directory(
            webkit_web_context_get_default(), c
        );
    }

    if (optind >= argc)
        client_new(home_uri);
    else
    {
        for (i = optind; i < argc; i++)
            client_new(argv[i]);
    }

    if (!cooperative_instances || cooperative_alone)
        gtk_main();
    exit(EXIT_SUCCESS);
}
Пример #2
0
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);
}
Пример #3
0
void beforeAll()
{
    kServer = new WebKitTestServer();
    kServer->run(serverCallback);

    testRunner = new WebProcessTestRunner();
    webkit_web_context_set_web_extensions_directory(webkit_web_context_get_default(), WEBKIT_TEST_WEB_EXTENSIONS_DIR);

    WebViewTest::add("WebKitDOMXPathNSResolver", "native", testWebKitDOMXPathNSResolverNative);
    WebViewTest::add("WebKitDOMXPathNSResolver", "custom", testWebKitDOMXPathNSResolverCustom);
}
void beforeAll()
{
    webkit_web_context_set_web_extensions_directory(webkit_web_context_get_default(), WEBKIT_TEST_WEB_EXTENSIONS_DIR);
    bus = new WebKitTestBus();
    if (!bus->run())
        return;

    WebViewTest::add("WebKitWebExtension", "dom-document-title", testWebExtensionGetTitle);
    WebViewTest::add("WebKitWebExtension", "document-loaded-signal", testDocumentLoadedSignal);
    WebViewTest::add("WebKitWebView", "web-process-crashed", testWebKitWebViewProcessCrashed);
}
Пример #5
0
JNIEXPORT void JNICALL Java_org_gnome_webKit_WebView_setExtensionsDirectory
  (JNIEnv *env, jclass cls, jstring _directory)
{
  	gchar* directory;
	directory = (gchar*) bindings_java_getString(env, _directory);
	if (directory == NULL) {
		return; // Java Exception already thrown
	}

    g_printf("Extensions Directory:%s\n", directory);

    webkit_web_context_set_web_extensions_directory(webkit_web_context_get_default (), directory);

    bindings_java_releaseString(directory);
}
Пример #6
0
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);
}
Пример #7
0
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
}