r13674 jmb - /trunk/libdom/bindings/hubbub/parser.c

netsurf at semichrome.net netsurf at semichrome.net
Sun Mar 25 12:03:52 BST 2012


Author: jmb
Date: Sun Mar 25 06:03:52 2012
New Revision: 13674

URL: http://source.netsurf-browser.org?rev=13674&view=rev
Log:
Fix hubbub binding to cope with attributes with bad names

Modified:
    trunk/libdom/bindings/hubbub/parser.c

Modified: trunk/libdom/bindings/hubbub/parser.c
URL: http://source.netsurf-browser.org/trunk/libdom/bindings/hubbub/parser.c?rev=13674&r1=13673&r2=13674&view=diff
==============================================================================
--- trunk/libdom/bindings/hubbub/parser.c (original)
+++ trunk/libdom/bindings/hubbub/parser.c Sun Mar 25 06:03:52 2012
@@ -110,6 +110,14 @@
 	return realloc(ptr, len);
 }
 
+static void dom_hubbub_parser_default_msg(uint32_t severity, void *ctx,
+		const char *msg, ...)
+{
+	UNUSED(severity);
+	UNUSED(ctx);
+	UNUSED(msg);
+}
+
 /**
  * Create a Hubbub parser instance
  *
@@ -141,8 +149,13 @@
 					      : DOM_HUBBUB_ENCODING_SOURCE_DETECTED;
 	parser->complete = false;
 
-	parser->msg = msg;
-	parser->mctx = mctx;
+	if (msg == NULL) {
+		parser->msg = dom_hubbub_parser_default_msg;
+		parser->mctx = NULL;
+	} else {
+		parser->msg = msg;
+		parser->mctx = mctx;
+	}
 
 	error = hubbub_parser_create(enc, fix_enc, dom_hubbub_alloc, NULL, 
 			&parser->parser);
@@ -725,7 +738,6 @@
 				dom_parser->msg(DOM_MSG_CRITICAL, 
 						dom_parser->mctx,
 						"Can't add attribute");
-				goto fail;
 			}
 		} else {
 			err = dom_element_set_attribute_ns(
@@ -738,7 +750,6 @@
 				dom_parser->msg(DOM_MSG_CRITICAL, 
 						dom_parser->mctx,
 						"Can't add attribute ns");
-				goto fail;
 			}
 		}
 	}




More information about the netsurf-commits mailing list