[PATCH] Execute "javascript:" URIs instead of browsing for them.



This fixes bookmarklet support in -webkit, a regression from -gecko.

---
 embed/ephy-embed-utils.c |    1 +
 embed/ephy-web-view.c    |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby debian org
       `-
From a27baca064083f3920126df556924028a4931e6c Mon Sep 17 00:00:00 2001
From: Chris Lamb <lamby debian org>
Date: Sun, 11 Oct 2009 16:44:44 +0100
Subject: [PATCH] Execute "javascript:" URIs instead of browsing for them.

---
 embed/ephy-embed-utils.c |    1 +
 embed/ephy-web-view.c    |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index 0405de7..d937d2e 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -91,6 +91,7 @@ ephy_embed_utils_address_has_web_scheme (const char *address)
 			  g_str_has_prefix (address, "file:") ||
 			  g_str_has_prefix (address, "data:") ||
 			  g_str_has_prefix (address, "about:") ||
+			  g_str_has_prefix (address, "javascript:") ||
 			  g_str_has_prefix (address, "gopher:"));
 
 	return has_web_scheme;
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index acf3e5f..0d3be0d 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1118,7 +1118,10 @@ ephy_web_view_load_url (EphyWebView *view,
   } else
     effective_url = ephy_embed_utils_normalize_address (url);
 
-  webkit_web_view_open (WEBKIT_WEB_VIEW (view), effective_url);
+  if (g_str_has_prefix (effective_url, "javascript:"))
+    webkit_web_view_execute_script (WEBKIT_WEB_VIEW (view), effective_url);
+  else
+    webkit_web_view_open (WEBKIT_WEB_VIEW (view), effective_url);
 
   if (soup_uri)
     soup_uri_free (soup_uri);
-- 
1.6.4.3

Attachment: signature.asc
Description: PGP signature



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