+2008-08-31 Emmanuele Bassi <ebassi@gnome.org>
+
+ Bug 550096 – GBookmarkFile parser is not forward compatible
+
+ * glib/gbookmarkfile.c:
+ (parse_bookmark_element), (parse_application_element),
+ (parse_mime_type_element), (parse_icon_element): Relax the
+ attributes checking of the GBookmarkFile parser for the
+ attributes that the desktop bookmark file specification
+ defines and controls. This allows adding new attributes to
+ the existing elements in newer versions without breaking the
+ parser in older ones.
+
2008-08-28 Ryan Lortie <desrt@desrt.ca>
Fixup for test case in previous commit.
visited = attribute_values[i];
else
{
+ /* bookmark is defined by the XBEL spec, so we need
+ * to error out if the element has different or
+ * missing attributes
+ */
g_set_error (error, G_MARKUP_ERROR,
G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
_("Unexpected attribute '%s' for element '%s'"),
stamp = attribute_values[i];
else if (IS_ATTRIBUTE (attr, BOOKMARK_MODIFIED_ATTRIBUTE))
modified = attribute_values[i];
- else
- {
- g_set_error (error, G_MARKUP_ERROR,
- G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
- _("Unexpected attribute '%s' for element '%s'"),
- attr,
- BOOKMARK_APPLICATION_ELEMENT);
- return;
- }
}
+ /* the "name" and "exec" attributes are mandatory */
if (!name)
{
g_set_error (error, G_MARKUP_ERROR,
{
if (IS_ATTRIBUTE (attr, MIME_TYPE_ATTRIBUTE))
type = attribute_values[i];
- else
- {
- g_set_error (error, G_MARKUP_ERROR,
- G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
- _("Unexpected attribute '%s' for element '%s'"),
- attr,
- MIME_TYPE_ELEMENT);
- return;
- }
}
if (!type)
href = attribute_values[i];
else if (IS_ATTRIBUTE (attr, BOOKMARK_TYPE_ATTRIBUTE))
type = attribute_values[i];
- else
- {
- g_set_error (error, G_MARKUP_ERROR,
- G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
- _("Unexpected attribute '%s' for element '%s'"),
- attr,
- BOOKMARK_ICON_ELEMENT);
- return;
- }
}
+ /* the "href" attribute is mandatory */
if (!href)
{
g_set_error (error, G_MARKUP_ERROR,