libdom: branch master updated. ab88f11bb45322003b5882a98f35e9e4e9061e5b

NetSurf Browser Project (Commit Mailer) no-reply at netsurf-browser.org
Fri Nov 2 11:01:39 GMT 2012


Gitweb links:

...log http://git.netsurf-browser.org/libdom.git/shortlog/ab88f11bb45322003b5882a98f35e9e4e9061e5b
...commit http://git.netsurf-browser.org/libdom.git/commit/ab88f11bb45322003b5882a98f35e9e4e9061e5b
...tree http://git.netsurf-browser.org/libdom.git/tree/ab88f11bb45322003b5882a98f35e9e4e9061e5b

The branch, master has been updated
       via  ab88f11bb45322003b5882a98f35e9e4e9061e5b (commit)
      from  733d2632b8640c3e6185e2b999778eba6b171aa5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libdom.git/commitdiff/ab88f11bb45322003b5882a98f35e9e4e9061e5b
commit ab88f11bb45322003b5882a98f35e9e4e9061e5b
Author: Vincent Sanders <vince at kyllikki.org>
Commit: Vincent Sanders <vince at kyllikki.org>

    alter when the id name is set to before the hubbub parse completion so id based searches work during dom creation

diff --git a/bindings/hubbub/parser.c b/bindings/hubbub/parser.c
index 8296fe8..95c2043 100644
--- a/bindings/hubbub/parser.c
+++ b/bindings/hubbub/parser.c
@@ -742,6 +742,7 @@ dom_hubbub_parser_create(const char *enc,
 	hubbub_parser_optparams params;
 	hubbub_error error;
 	dom_exception err;
+	dom_string *idname = NULL;
 
 	/* check result parameter */
 	if (document == NULL) {
@@ -813,6 +814,21 @@ dom_hubbub_parser_create(const char *enc,
 			     HUBBUB_PARSER_ENABLE_SCRIPTING,
 			     &params);
 
+	/* set the document id parameter before the parse so searches
+	 * based on id succeed.
+	 */
+	err = dom_string_create_interned((const uint8_t *) "id",
+					 SLEN("id"),
+					 &idname);
+	if (err != DOM_NO_ERR) {
+		hubbub_parser_destroy(parser->parser);
+		free(parser);
+		msg(DOM_MSG_ERROR, mctx, "Can't set DOM document id name");
+		return NULL;
+	}
+	_dom_document_set_id_name(parser->doc, idname);
+	dom_string_unref(idname);
+
 	/* set return parameter */
 	*document = (dom_document *)dom_node_ref(parser->doc);
 
@@ -880,9 +896,7 @@ dom_hubbub_error dom_hubbub_parser_parse_chunk(dom_hubbub_parser *parser,
  */
 dom_hubbub_error dom_hubbub_parser_completed(dom_hubbub_parser *parser)
 {
-	dom_exception derr;
 	hubbub_error err;
-	dom_string *name = NULL;
 
 	err = hubbub_parser_completed(parser->parser);
 	if (err != HUBBUB_OK) {
@@ -893,14 +907,6 @@ dom_hubbub_error dom_hubbub_parser_completed(dom_hubbub_parser *parser)
 
 	parser->complete = true;
 
-	derr = dom_string_create_interned((const uint8_t *) "id", SLEN("id"),
-			&name);
-	if (derr != DOM_NO_ERR)
-		return DOM_HUBBUB_HUBBUB_ERR | HUBBUB_UNKNOWN;
-
-	_dom_document_set_id_name(parser->doc, name);
-	dom_string_unref(name);
-
 	return DOM_HUBBUB_OK;
 }
 


-----------------------------------------------------------------------

Summary of changes:
 bindings/hubbub/parser.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/bindings/hubbub/parser.c b/bindings/hubbub/parser.c
index 8296fe8..95c2043 100644
--- a/bindings/hubbub/parser.c
+++ b/bindings/hubbub/parser.c
@@ -742,6 +742,7 @@ dom_hubbub_parser_create(const char *enc,
 	hubbub_parser_optparams params;
 	hubbub_error error;
 	dom_exception err;
+	dom_string *idname = NULL;
 
 	/* check result parameter */
 	if (document == NULL) {
@@ -813,6 +814,21 @@ dom_hubbub_parser_create(const char *enc,
 			     HUBBUB_PARSER_ENABLE_SCRIPTING,
 			     &params);
 
+	/* set the document id parameter before the parse so searches
+	 * based on id succeed.
+	 */
+	err = dom_string_create_interned((const uint8_t *) "id",
+					 SLEN("id"),
+					 &idname);
+	if (err != DOM_NO_ERR) {
+		hubbub_parser_destroy(parser->parser);
+		free(parser);
+		msg(DOM_MSG_ERROR, mctx, "Can't set DOM document id name");
+		return NULL;
+	}
+	_dom_document_set_id_name(parser->doc, idname);
+	dom_string_unref(idname);
+
 	/* set return parameter */
 	*document = (dom_document *)dom_node_ref(parser->doc);
 
@@ -880,9 +896,7 @@ dom_hubbub_error dom_hubbub_parser_parse_chunk(dom_hubbub_parser *parser,
  */
 dom_hubbub_error dom_hubbub_parser_completed(dom_hubbub_parser *parser)
 {
-	dom_exception derr;
 	hubbub_error err;
-	dom_string *name = NULL;
 
 	err = hubbub_parser_completed(parser->parser);
 	if (err != HUBBUB_OK) {
@@ -893,14 +907,6 @@ dom_hubbub_error dom_hubbub_parser_completed(dom_hubbub_parser *parser)
 
 	parser->complete = true;
 
-	derr = dom_string_create_interned((const uint8_t *) "id", SLEN("id"),
-			&name);
-	if (derr != DOM_NO_ERR)
-		return DOM_HUBBUB_HUBBUB_ERR | HUBBUB_UNKNOWN;
-
-	_dom_document_set_id_name(parser->doc, name);
-	dom_string_unref(name);
-
 	return DOM_HUBBUB_OK;
 }
 


-- 
Document Object Model library



More information about the netsurf-commits mailing list