summaryrefslogtreecommitdiff
path: root/tests/surfuri_js.patch
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2010-11-14 22:47:04 +0000
committerNick White <git@njw.me.uk>2010-11-14 22:47:04 +0000
commit3d29579a6cb3be321296c12e27dfbf90fc9e26f9 (patch)
tree15c9e095193955bab61f2264adee7a5ee69c8a37 /tests/surfuri_js.patch
parent159527a972b0a929aeda3dcbd71c71f1367189de (diff)
Add tests
Diffstat (limited to 'tests/surfuri_js.patch')
-rw-r--r--tests/surfuri_js.patch19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/surfuri_js.patch b/tests/surfuri_js.patch
new file mode 100644
index 0000000..bed2a46
--- /dev/null
+++ b/tests/surfuri_js.patch
@@ -0,0 +1,19 @@
+diff -r a62107a88a10 surf.c
+--- a/surf.c Sun Aug 08 17:32:38 2010 +0100
++++ b/surf.c Sun Nov 14 21:28:00 2010 +0000
+@@ -464,6 +464,15 @@
+
+ if(strcmp(uri, "") == 0)
+ return;
++ if(g_strrstr(uri, "javascript:")) {
++ JSStringRef jsscript;
++ JSValueRef exception = NULL;
++ jsscript = JSStringCreateWithUTF8CString(g_strdup(uri));
++ WebKitWebFrame* frame = webkit_web_view_get_main_frame(c->view);
++ JSContextRef js = webkit_web_frame_get_global_context(frame);
++ JSEvaluateScript(js, jsscript, JSContextGetGlobalObject(js), NULL, 0, &exception);
++ return;
++ }
+ u = g_strrstr(uri, "://") ? g_strdup(uri)
+ : g_strdup_printf("http://%s", uri);
+ /* prevents endless loop */