[Webkit-unassigned] [Bug 27433] enable toString function under gobject bindings

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 21 12:18:19 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=27433


Luke Kenneth Casson Leighton <lkcl at lkcl.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #33067|review-                     |review?
               Flag|                            |




--- Comment #7 from Luke Kenneth Casson Leighton <lkcl at lkcl.net>  2009-07-21 12:18:19 PDT ---
(From update of attachment 33067)
come on, mark - the burden on developers to "recreate" toString is immense. 
every language-bindings developer will have to create a secondary wrapper,
doing something like this:

def toString(element):
    if ENGINE.type != "webkit":
        return element.toString()

    # ok, xulrunner and MSHTML have toString,
    # but webkit's team are being a pain, forcing
    # us to work out what the element type is
    # and... never mind, let's just get on with it

    # first determine what type of element this is
    if hasattr(element, "nodetype"):
       # ok it's likely to be an HTML element.
       # now we work out if it's a comment
       # etc. etc.
       if element.nodetype == 1:
           # ok, it's an HTML element.
           nodename = element.nodename
           return "<%s>" % nodename +
                  element.innerHTML +
                  "</%s>" % nodename

    # ok, it wasn't an HTML element - is
    # it an exception?  let's guess...

    if hasattr(element, "message") and
       hasattr(element, "name"):

        # ok - exceptions have name and
        # message.

        return element.name + element.message

    # ok, what about DOMSelection?

    # etc.

    # etc.



so you can see that to burden even _one_ dynamic
language with this kind of stuff is just absolutely
ridiculous - and that's just one application.

all applications will need to apply this same
awful trick - i don't dare to think what a mess
of spaghetti code there would be if someone
wanted to do this in native c!

all that spaghetti goes away if there are toString
functions which can be assumed to be in each of
the objects.  in the case of the pyjamas API
which uses pywebkitgtk, python takes care of
the mapping, and it's a 2-line function:

def toString(element):
    return element.toString()


if these functions weren't available to all language bindings in XULrunner,
KHTML and MSHTML, i wouldn't be pushing this issue - yes, i'd simply not bother
and would even consider removing toString from the pyjamas API, and let users
get on with it.

but - it's there, and it's in the GWT API so we have to conform with it.

so, very sorry, but i'm re-raising the review flag until this is properly
looked at.

an answer "yes we have looked at the research material which shows yes that the
all of the current web browser competitor technology to webkit can clearly seen
to support the fact that toString is part of de-facto standards... <complete
sentence>" is what i expect.

if there is anything which does not mention "the research material has been
examined" i will instantly re-submit the patch for review.

sorry.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list