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
1=== modified file 'midori/sokoke.c'
2--- midori/sokoke.c 2013-05-19 09:33:02 +0000
3+++ midori/sokoke.c 2013-05-27 00:20:32 +0000
4@@ -136,7 +136,7 @@
5 gtk_widget_destroy (dialog);
6 }
7
8-static GAppInfo*
9+GAppInfo*
10 sokoke_default_for_uri (const gchar* uri,
11 gchar** scheme_ptr)
12 {
13@@ -474,10 +474,12 @@
14 {
15 GAppInfo* info;
16
17- if (!uri || !strncmp (uri, "http", 4)
18- || !strncmp (uri, "file", 4)
19- || !strncmp (uri, "geo", 3)
20- || !strncmp (uri, "about:", 6))
21+ /* URI schemes are case-insensitive, followed by ':' - rfc3986 */
22+ if (!uri || !strncasecmp (uri, "http:", 5)
23+ || !strncasecmp (uri, "https:", 6)
24+ || !strncasecmp (uri, "file:", 5)
25+ || !strncasecmp (uri, "geo:", 4)
26+ || !strncasecmp (uri, "about:", 6))
27 return FALSE;
28
29 info = sokoke_default_for_uri (uri, NULL);
30
31=== modified file 'tests/magic-uri.c'
32--- tests/magic-uri.c 2013-03-12 17:09:26 +0000
33+++ tests/magic-uri.c 2013-05-27 00:20:32 +0000
34@@ -386,6 +386,37 @@
35 }
36 }
37
38+GAppInfo* sokoke_default_for_uri (const gchar* uri, gchar** scheme_ptr);
39+
40+static gboolean uri_has_default (const gchar* uri)
41+{
42+ GAppInfo* info = sokoke_default_for_uri (uri, NULL);
43+ if (info)
44+ g_object_unref (info);
45+ return info != NULL;
46+}
47+
48+static void
49+magic_uri_protocols (void)
50+{
51+ g_assert (!sokoke_external_uri (NULL));
52+ g_assert (!sokoke_external_uri (""));
53+
54+ g_assert (!sokoke_external_uri ("http://google.com"));
55+ g_assert (!sokoke_external_uri ("https://google.com"));
56+ g_assert (!sokoke_external_uri ("file:///home/"));
57+ g_assert (!sokoke_external_uri ("geo:100,3000"));
58+ g_assert (!sokoke_external_uri ("about:blank"));
59+
60+ g_assert (!sokoke_external_uri ("https://"));
61+ g_assert (!sokoke_external_uri ("http://"));
62+ g_assert (!sokoke_external_uri ("http:/"));
63+ g_assert (!sokoke_external_uri ("http"));
64+ g_assert (sokoke_external_uri ("ftp://ftphost.org") == uri_has_default ("ftp://ftphost.org"));
65+ g_assert (sokoke_external_uri ("geometry:bar") == uri_has_default ("geometry:bar"));
66+ g_assert (sokoke_external_uri ("httparty:woo") == uri_has_default ("httparty:woo"));
67+}
68+
69 int
70 main (int argc,
71 char** argv)
72@@ -404,6 +435,7 @@
73 g_test_add_func ("/magic-uri/prefix", magic_uri_prefix);
74 g_test_add_func ("/magic-uri/prefetch", magic_uri_prefetch);
75 g_test_add_func ("/magic-uri/commands", magic_uri_commands);
76+ g_test_add_func ("/magic-uri/protocols", magic_uri_protocols);
77
78 return g_test_run ();
79 }

Subscribers

People subscribed via source and target branches

to all changes: