Hi,

as a followup to an earlier thread ("A bunch of issues and questions")
where Daniel identified Webkit's popup blocker as the cause of
the synthetic hinting clicks sometimes not working and following a
related bug report on IRC, here is a patch which

- Makes popup behaviour configurable (":set popups=true" disables the
  popup blocker)
- Fixes an isse of a wrong URL being loaded in a Javascript
  generated popup under certain circumstances

As usual, testing and feedback would be appreciated!

Hannes
diff --git a/config.h b/config.h
index 617e649..19335a9 100644
--- a/config.h
+++ b/config.h
@@ -22,6 +22,7 @@ char acceptlanguage[MAX_SETTING_SIZE] = "";
 static const gboolean enablePlugins     = TRUE; /* TRUE keeps plugins enabled */
 static const gboolean enableJava        = TRUE; /* FALSE disables Java applets */
 static const gboolean enablePagecache   = FALSE; /* TRUE turns on the page cache. */
+static const gboolean javascriptPopups  = FALSE; /* TRUE disables Webkit's popup blocker */
 static gboolean escape_input_on_load    = TRUE; /* TRUE will disable automatic focusing of input fields via Javascript*/
 char temp_dir[MAX_SETTING_SIZE]         = "/tmp"; /* location of temporary files, default will be overridden if TEMPDIR is set */
 
@@ -207,6 +208,7 @@ static Setting browsersettings[] = {
     { "stylesheet",      NULL,               "user-stylesheet-uri",         FALSE,          FALSE,           FALSE,          FALSE  },
     { "resizetextareas", NULL,               "resizable-text-areas",        FALSE,          TRUE,            FALSE,          FALSE  },
     { "webinspector",    NULL,               "enable-developer-extras",     FALSE,          TRUE,            FALSE,          FALSE  },
+    { "popups",          NULL,               "javascript-can-open-windows-automatically",FALSE,TRUE,         FALSE,          FALSE  },
 
     { "homepage",        startpage,          "",                            FALSE,          FALSE,           FALSE,          FALSE  },
     { "statusbgcolor",   statusbgcolor,      "",                            FALSE,          FALSE,           TRUE,           TRUE   },
diff --git a/main.c b/main.c
index d70f88a..64d9bae 100644
--- a/main.c
+++ b/main.c
@@ -215,13 +215,6 @@ webview_open_js_window_cb(WebKitWebView* temp_view, GParamSpec param_spec) {
 
 static WebKitWebView *
 webview_open_in_new_window_cb(WebKitWebView *webview, WebKitWebFrame *frame, gpointer user_data) {
-    if (client.state.rememberedURI != NULL && strlen(client.state.rememberedURI) > 0) {
-        if (strncmp(client.state.rememberedURI, "javascript:", 11) != 0) {
-            Arg a = { .i = TargetNew, .s = client.state.rememberedURI };
-            open_arg(&a);
-            return NULL;
-        }
-    }
     /* create a temporary webview to execute the script in */
     WebKitWebView *temp_view = WEBKIT_WEB_VIEW(webkit_web_view_new());
     /* wait until the new webview receives its new URI */
@@ -2675,6 +2668,7 @@ setup_settings() {
     g_object_set(G_OBJECT(settings), "enable-plugins", enablePlugins, NULL);
     g_object_set(G_OBJECT(settings), "enable-java-applet", enableJava, NULL);
     g_object_set(G_OBJECT(settings), "enable-page-cache", enablePagecache, NULL);
+    g_object_set(G_OBJECT(settings), "javascript-can-open-windows-automatically", javascriptPopups, NULL);
     filename = g_strdup_printf(USER_STYLESHEET);
     file_url = g_strdup_printf("file://%s", filename);
     g_object_set(G_OBJECT(settings), "user-stylesheet-uri", file_url, NULL);
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Vimprobable-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vimprobable-users

Reply via email to