Merge lp:~gue5t/midori/fix-bug1183979 into lp:midori

Proposed by gue5t gue5t
Status: Superseded
Proposed branch: lp:~gue5t/midori/fix-bug1183979
Merge into: lp:midori
Diff against target: 79 lines (+39/-5)
2 files modified
midori/sokoke.c (+7/-5)
tests/magic-uri.c (+32/-0)
To merge this branch: bzr merge lp:~gue5t/midori/fix-bug1183979
Reviewer Review Type Date Requested Status
Midori Devs Pending
Review via email: mp+165786@code.launchpad.net

This proposal has been superseded by a proposal from 2013-05-27.

To post a comment you must log in.
lp:~gue5t/midori/fix-bug1183979 updated
6175. By gue5t <email address hidden>

add unit test for sokoke_external_uri protocol handling

6176. By gue5t <email address hidden>

add test cases to tests/magic-uri/protocols to check case insensitivity

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'midori/sokoke.c'
--- midori/sokoke.c 2013-05-19 09:33:02 +0000
+++ midori/sokoke.c 2013-05-27 00:20:32 +0000
@@ -136,7 +136,7 @@
136 gtk_widget_destroy (dialog);136 gtk_widget_destroy (dialog);
137}137}
138138
139static GAppInfo*139GAppInfo*
140sokoke_default_for_uri (const gchar* uri,140sokoke_default_for_uri (const gchar* uri,
141 gchar** scheme_ptr)141 gchar** scheme_ptr)
142{142{
@@ -474,10 +474,12 @@
474{474{
475 GAppInfo* info;475 GAppInfo* info;
476476
477 if (!uri || !strncmp (uri, "http", 4)477 /* URI schemes are case-insensitive, followed by ':' - rfc3986 */
478 || !strncmp (uri, "file", 4)478 if (!uri || !strncasecmp (uri, "http:", 5)
479 || !strncmp (uri, "geo", 3)479 || !strncasecmp (uri, "https:", 6)
480 || !strncmp (uri, "about:", 6))480 || !strncasecmp (uri, "file:", 5)
481 || !strncasecmp (uri, "geo:", 4)
482 || !strncasecmp (uri, "about:", 6))
481 return FALSE;483 return FALSE;
482484
483 info = sokoke_default_for_uri (uri, NULL);485 info = sokoke_default_for_uri (uri, NULL);
484486
=== modified file 'tests/magic-uri.c'
--- tests/magic-uri.c 2013-03-12 17:09:26 +0000
+++ tests/magic-uri.c 2013-05-27 00:20:32 +0000
@@ -386,6 +386,37 @@
386 }386 }
387}387}
388388
389GAppInfo* sokoke_default_for_uri (const gchar* uri, gchar** scheme_ptr);
390
391static gboolean uri_has_default (const gchar* uri)
392{
393 GAppInfo* info = sokoke_default_for_uri (uri, NULL);
394 if (info)
395 g_object_unref (info);
396 return info != NULL;
397}
398
399static void
400magic_uri_protocols (void)
401{
402 g_assert (!sokoke_external_uri (NULL));
403 g_assert (!sokoke_external_uri (""));
404
405 g_assert (!sokoke_external_uri ("http://google.com"));
406 g_assert (!sokoke_external_uri ("https://google.com"));
407 g_assert (!sokoke_external_uri ("file:///home/"));
408 g_assert (!sokoke_external_uri ("geo:100,3000"));
409 g_assert (!sokoke_external_uri ("about:blank"));
410
411 g_assert (!sokoke_external_uri ("https://"));
412 g_assert (!sokoke_external_uri ("http://"));
413 g_assert (!sokoke_external_uri ("http:/"));
414 g_assert (!sokoke_external_uri ("http"));
415 g_assert (sokoke_external_uri ("ftp://ftphost.org") == uri_has_default ("ftp://ftphost.org"));
416 g_assert (sokoke_external_uri ("geometry:bar") == uri_has_default ("geometry:bar"));
417 g_assert (sokoke_external_uri ("httparty:woo") == uri_has_default ("httparty:woo"));
418}
419
389int420int
390main (int argc,421main (int argc,
391 char** argv)422 char** argv)
@@ -404,6 +435,7 @@
404 g_test_add_func ("/magic-uri/prefix", magic_uri_prefix);435 g_test_add_func ("/magic-uri/prefix", magic_uri_prefix);
405 g_test_add_func ("/magic-uri/prefetch", magic_uri_prefetch);436 g_test_add_func ("/magic-uri/prefetch", magic_uri_prefetch);
406 g_test_add_func ("/magic-uri/commands", magic_uri_commands);437 g_test_add_func ("/magic-uri/commands", magic_uri_commands);
438 g_test_add_func ("/magic-uri/protocols", magic_uri_protocols);
407439
408 return g_test_run ();440 return g_test_run ();
409}441}

Subscribers

People subscribed via source and target branches

to all changes: