]>
Commit | Line | Data |
---|---|---|
43e0fed8 ER |
1 | from https://extensions.gnome.org/about/#old-version: |
2 | browser-plugin: Set that we need XEmbed | |
3 | browser-plugin: Use g_strndup to get a string property | |
4 | browser-plugin: Make sure to use the UTF8Length parameter | |
5 | browser-plugin: Fix memory leak when passing an invalid UUID | |
6 | ||
7 | From 2c2729f7be6ff4d8946c51ff8b59187fe38052d1 Mon Sep 17 00:00:00 2001 | |
8 | From: Jasper St. Pierre <jstpierre@mecheye.net> | |
9 | Date: Fri, 11 Nov 2011 03:35:41 +0000 | |
10 | Subject: browser-plugin: Set that we need XEmbed | |
11 | ||
12 | This makes the plugin work under WebKit-based browsers such as Chromium and | |
13 | Epiphany. See http://code.google.com/p/chromium/issues/detail?id=38229 and | |
14 | WindowedCreatePlugin() in | |
15 | http://src.chromium.org/viewvc/chrome/trunk/src/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc?revision=86823&content-type=text%2Fplain | |
16 | for more information. | |
17 | ||
18 | https://bugzilla.gnome.org/show_bug.cgi?id=663823 | |
19 | --- | |
20 | diff --git a/browser-plugin/browser-plugin.c b/browser-plugin/browser-plugin.c | |
21 | index 0ab2d78..2daa0dd 100644 | |
22 | --- a/browser-plugin/browser-plugin.c | |
23 | +++ b/browser-plugin/browser-plugin.c | |
24 | @@ -816,6 +816,11 @@ NPP_GetValue(NPP instance, | |
25 | ||
26 | *(NPObject**)value = funcs.createobject (instance, &plugin_class); | |
27 | break; | |
28 | + | |
29 | + case NPPVpluginNeedsXEmbed: | |
30 | + *(bool *)value = TRUE; | |
31 | + break; | |
32 | + | |
33 | default: | |
34 | ; | |
35 | } | |
36 | -- | |
37 | cgit v0.9.0.2 | |
38 | From 9bc1a68fe48a0b1e8f377597387baea7a90a3a5b Mon Sep 17 00:00:00 2001 | |
39 | From: Jasper St. Pierre <jstpierre@mecheye.net> | |
40 | Date: Fri, 11 Nov 2011 04:57:39 +0000 | |
41 | Subject: browser-plugin: Use g_strndup to get a string property | |
42 | ||
43 | WebKit-based browsers like Chromium and Epiphany may insert extra junk at the | |
44 | end of NPStrings, so we cannot depend on the strlen matching. | |
45 | ||
46 | https://bugzilla.gnome.org/show_bug.cgi?id=663823 | |
47 | --- | |
48 | diff --git a/browser-plugin/browser-plugin.c b/browser-plugin/browser-plugin.c | |
49 | index 2daa0dd..b717889 100644 | |
50 | --- a/browser-plugin/browser-plugin.c | |
51 | +++ b/browser-plugin/browser-plugin.c | |
52 | @@ -71,10 +71,7 @@ get_string_property (NPP instance, | |
53 | goto out; | |
54 | ||
55 | result_str = NPVARIANT_TO_STRING (result); | |
56 | - if (strlen (result_str.UTF8Characters) != result_str.UTF8Length) | |
57 | - goto out; | |
58 | - | |
59 | - result_copy = g_strdup (result_str.UTF8Characters); | |
60 | + result_copy = g_strndup (result_str.UTF8Characters, result_str.UTF8Length); | |
61 | ||
62 | out: | |
63 | funcs.releasevariantvalue (&result); | |
64 | -- | |
65 | cgit v0.9.0.2 | |
66 | From ab6a7773ce0bf0b6614fe81acc26521739723853 Mon Sep 17 00:00:00 2001 | |
67 | From: Jasper St. Pierre <jstpierre@mecheye.net> | |
68 | Date: Thu, 17 Nov 2011 04:47:35 +0000 | |
69 | Subject: browser-plugin: Make sure to use the UTF8Length parameter | |
70 | ||
71 | Some plugin hosts may have junk after the UTF8Characters that we need to strip | |
72 | off. No current browsers that I know of do this, but it still helps to be | |
73 | correct. | |
74 | --- | |
75 | diff --git a/browser-plugin/browser-plugin.c b/browser-plugin/browser-plugin.c | |
76 | index 385550c..e9f9950 100644 | |
77 | --- a/browser-plugin/browser-plugin.c | |
78 | +++ b/browser-plugin/browser-plugin.c | |
79 | @@ -455,7 +455,7 @@ plugin_enable_extension (PluginObject *obj, | |
80 | NPString uuid, | |
81 | gboolean enabled) | |
82 | { | |
83 | - const gchar *uuid_str = uuid.UTF8Characters; | |
84 | + gchar *uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); | |
85 | if (!uuid_is_valid (uuid_str)) | |
86 | return FALSE; | |
87 | ||
88 | @@ -468,6 +468,8 @@ plugin_enable_extension (PluginObject *obj, | |
89 | NULL, /* callback */ | |
90 | NULL /* user_data */); | |
91 | ||
92 | + g_free (uuid_str); | |
93 | + | |
94 | return TRUE; | |
95 | } | |
96 | ||
97 | @@ -476,7 +478,7 @@ plugin_install_extension (PluginObject *obj, | |
98 | NPString uuid, | |
99 | NPString version_tag) | |
100 | { | |
101 | - const gchar *uuid_str = uuid.UTF8Characters; | |
102 | + gchar *uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); | |
103 | if (!uuid_is_valid (uuid_str)) | |
104 | return FALSE; | |
105 | ||
106 | @@ -491,6 +493,8 @@ plugin_install_extension (PluginObject *obj, | |
107 | NULL, /* callback */ | |
108 | NULL /* user_data */); | |
109 | ||
110 | + g_free (uuid_str); | |
111 | + | |
112 | return TRUE; | |
113 | } | |
114 | ||
115 | @@ -501,9 +505,9 @@ plugin_uninstall_extension (PluginObject *obj, | |
116 | { | |
117 | GError *error = NULL; | |
118 | GVariant *res; | |
119 | - const gchar *uuid_str; | |
120 | + gchar *uuid_str; | |
121 | ||
122 | - uuid_str = uuid.UTF8Characters; | |
123 | + uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); | |
124 | if (!uuid_is_valid (uuid_str)) | |
125 | return FALSE; | |
126 | ||
127 | @@ -516,6 +520,8 @@ plugin_uninstall_extension (PluginObject *obj, | |
128 | NULL, /* cancellable */ | |
129 | &error); | |
130 | ||
131 | + g_free (uuid_str); | |
132 | + | |
133 | if (!res) | |
134 | { | |
135 | g_warning ("Failed to uninstall extension: %s", error->message); | |
136 | @@ -533,9 +539,9 @@ plugin_get_info (PluginObject *obj, | |
137 | { | |
138 | GError *error = NULL; | |
139 | GVariant *res; | |
140 | - const gchar *uuid_str; | |
141 | + gchar *uuid_str; | |
142 | ||
143 | - uuid_str = uuid.UTF8Characters; | |
144 | + uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); | |
145 | if (!uuid_is_valid (uuid_str)) | |
146 | return FALSE; | |
147 | ||
148 | @@ -547,6 +553,8 @@ plugin_get_info (PluginObject *obj, | |
149 | NULL, /* cancellable */ | |
150 | &error); | |
151 | ||
152 | + g_free (uuid_str); | |
153 | + | |
154 | if (!res) | |
155 | { | |
156 | g_warning ("Failed to retrieve extension metadata: %s", error->message); | |
157 | @@ -564,9 +572,9 @@ plugin_get_errors (PluginObject *obj, | |
158 | { | |
159 | GError *error = NULL; | |
160 | GVariant *res; | |
161 | - const gchar *uuid_str; | |
162 | + gchar *uuid_str; | |
163 | ||
164 | - uuid_str = uuid.UTF8Characters; | |
165 | + uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); | |
166 | if (!uuid_is_valid (uuid_str)) | |
167 | return FALSE; | |
168 | ||
169 | @@ -578,6 +586,8 @@ plugin_get_errors (PluginObject *obj, | |
170 | NULL, /* cancellable */ | |
171 | &error); | |
172 | ||
173 | + g_free (uuid_str); | |
174 | + | |
175 | if (!res) | |
176 | { | |
177 | g_warning ("Failed to retrieve errors: %s", error->message); | |
178 | -- | |
179 | cgit v0.9.0.2 | |
180 | From 02af8eb824bde8cc21b58365772d67e0d6c5992f Mon Sep 17 00:00:00 2001 | |
181 | From: Jasper St. Pierre <jstpierre@mecheye.net> | |
182 | Date: Tue, 06 Dec 2011 20:00:52 +0000 | |
183 | Subject: browser-plugin: Fix memory leak when passing an invalid UUID | |
184 | ||
185 | https://bugzilla.gnome.org/show_bug.cgi?id=665261 | |
186 | --- | |
187 | diff --git a/browser-plugin/browser-plugin.c b/browser-plugin/browser-plugin.c | |
188 | index fccb061..a80a492 100644 | |
189 | --- a/browser-plugin/browser-plugin.c | |
190 | +++ b/browser-plugin/browser-plugin.c | |
191 | @@ -480,7 +480,10 @@ plugin_install_extension (PluginObject *obj, | |
192 | { | |
193 | gchar *uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); | |
194 | if (!uuid_is_valid (uuid_str)) | |
195 | - return FALSE; | |
196 | + { | |
197 | + g_free (uuid_str); | |
198 | + return FALSE; | |
199 | + } | |
200 | ||
201 | g_dbus_proxy_call (obj->proxy, | |
202 | "InstallRemoteExtension", | |
203 | @@ -509,7 +512,10 @@ plugin_uninstall_extension (PluginObject *obj, | |
204 | ||
205 | uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); | |
206 | if (!uuid_is_valid (uuid_str)) | |
207 | - return FALSE; | |
208 | + { | |
209 | + g_free (uuid_str); | |
210 | + return FALSE; | |
211 | + } | |
212 | ||
213 | res = g_dbus_proxy_call_sync (obj->proxy, | |
214 | "UninstallExtension", | |
215 | @@ -543,7 +549,10 @@ plugin_get_info (PluginObject *obj, | |
216 | ||
217 | uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); | |
218 | if (!uuid_is_valid (uuid_str)) | |
219 | - return FALSE; | |
220 | + { | |
221 | + g_free (uuid_str); | |
222 | + return FALSE; | |
223 | + } | |
224 | ||
225 | res = g_dbus_proxy_call_sync (obj->proxy, | |
226 | "GetExtensionInfo", | |
227 | @@ -576,7 +585,10 @@ plugin_get_errors (PluginObject *obj, | |
228 | ||
229 | uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); | |
230 | if (!uuid_is_valid (uuid_str)) | |
231 | - return FALSE; | |
232 | + { | |
233 | + g_free (uuid_str); | |
234 | + return FALSE; | |
235 | + } | |
236 | ||
237 | res = g_dbus_proxy_call_sync (obj->proxy, | |
238 | "GetExtensionErrors", | |
239 | -- | |
240 | cgit v0.9.0.2 |