[webkit-dev] gdom_x_path_evaluator_create_ns_resolver [was: webkit #16401]

Leon Winter lwi at ring0.de
Mon Jun 8 07:13:53 PDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
> not being funny or anything, but are you _sure_ you need a
> GdomXPathEvaluator object?
>
>  if you look in GdomDocument.h, yo can see this:
>
> WEBKIT_API GdomXPathResult *
> gdom_document_evaluate (GdomDocument *thiz, gchar * expression,
> GdomNode * context_node, GdomXPathNSResolver * resolver, gushort type,
> GdomXPathResult * in_result);
>
> which again looks pretty damn similar to the [isolated and
> inaccessible] gdom_x_path_evaluator_evaluate function, to me :)
Its really strange why there a these similar functions. I will pick up
the gdom_document*-ones.
>
>>
>>
>>  I mentioned GdomXPathEvaluator :)
>
>  ok, let me try and walk it through.
>
>  in GdomXPathEvaluator.h, you have this:
>
> WEBKIT_API GdomXPathNSResolver *
> gdom_x_path_evaluator_create_ns_resolver (GdomXPathEvaluator *thiz,
> GdomNode * node_resolver);
>
> and in GdomDocument, mark indirectly points out that you have this:
>
> WEBKIT_API GdomXPathNSResolver *
> gdom_document_create_ns_resolver (GdomDocument *thiz, GdomNode *
node_resolver);
>
> so - uhnnn.. oh.  ah.  oops.
>
> ok - can anyone explain what the difference between an XPathNSResolver
> return result from Document.createNSResolver and from
> XPathEvaluator.createNSResolver is?
I would be interested in the difference, too.
>
> can leon just use gdom_document_create_ns_resolver() and basically
> completely ignore the (self-contained and apparently isolated)
> XPathNSEvaluator class and (inaccessible) functions?
>
>      GdomXPathResult *res;
>      char *exp = "//html:select";
>      GdomDocument *doc = get_dom_document();
>      GdomNodeList *els = gdom_document_get_elements_by_tag_name(doc,
>   "body");
>      GdomNode *body = gdom_node_list_item(els, 0);
>      GdomXPathNSResolver *resolver =
>   gdom_document_create_ns_resolver(doc, body);
>
>    /* now you use this */
>    res =    gdom_document_evaluate (doc, expression,
GDOM_NODE(context_node),
>                           resolver, gushort type, in_result);
>    */
Well I tried:

    GdomXPathResult *res;
    char* exp = "//html:select";
    GdomDocument *doc = get_dom_document();
    GdomNodeList *els = gdom_document_get_elements_by_tag_name(doc,
"body");
    GdomNode *body = gdom_node_list_item(els, 0);
    GdomXPathNSResolver *resolver =
gdom_document_create_ns_resolver(doc, body);

    g_warning("init completed");

    gdom_document_evaluate(doc, exp, GDOM_NODE(body), resolver, 0, res);

The warning is printed followed by a segfault.

gdb told me (relevant parts):

#0  0x00007fb6215ea058 in g_type_check_instance_cast () from
/usr/lib/libgobject-2.0.so.0
#1  0x00007fb623d21cb9 in WebKit::core () from
/usr/local/lib/libwebkit-1.0.so.2
#2  0x00007fb623cc55ab in gdom_document_evaluate () from
/usr/local/lib/libwebkit-1.0.so.2

It seems like an argument is broken.

Regards,
Leon Winter
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkotHKEACgkQ3qn9m9SfDYeSNgCdHqPDLNz8MQx0ES1+jdRN/Wf/
zikAn1fVT3CSf2z/Pm0sT/6QAjCmAQdR
=6/uR
-----END PGP SIGNATURE-----


More information about the webkit-dev mailing list