Add support for javascript: bookmarklets

This commit is contained in:
Christian Dywan 2008-12-09 00:02:38 +01:00
parent 426eb74c91
commit aeb71dd7b4
3 changed files with 8 additions and 0 deletions

View file

@ -1551,6 +1551,10 @@ midori_view_set_uri (MidoriView* view,
return; return;
} }
} }
else if (g_str_has_prefix (uri, "javascript:"))
{
midori_view_execute_script (view, &uri[11], NULL);
}
else else
{ {
katze_assign (view->uri, g_strdup (uri)); katze_assign (view->uri, g_strdup (uri));

View file

@ -97,6 +97,9 @@ sokoke_magic_uri (const gchar* uri,
g_return_val_if_fail (!search_engines || g_return_val_if_fail (!search_engines ||
katze_array_is_a (search_engines, KATZE_TYPE_ITEM), NULL); katze_array_is_a (search_engines, KATZE_TYPE_ITEM), NULL);
/* Just return if it's a javascript: uri */
if (g_str_has_prefix (uri, "javascript:"))
return g_strdup (uri);
/* Add file:// if we have a local path */ /* Add file:// if we have a local path */
if (g_path_is_absolute (uri)) if (g_path_is_absolute (uri))
return g_strconcat ("file://", uri, NULL); return g_strconcat ("file://", uri, NULL);

View file

@ -83,6 +83,7 @@ main (int argc,
test_input ("verbose de.po", NULL); test_input ("verbose de.po", NULL);
test_input ("g de.po verbose", NULL); test_input ("g de.po verbose", NULL);
test_input ("sm de.po verbose", SM "de.po verbose"); test_input ("sm de.po verbose", SM "de.po verbose");
test_input ("javascript:alert(1)", "javascript:alert(1)");
return 0; return 0;
} }