[webkit-dev] Adding LenientThis to WebKitIDL

Victor Costan costan at gmail.com
Wed Apr 10 15:02:03 PDT 2013


Dear WebKit devs,


I would like to make console.log and related functions work without
requiring that "this" is set to the console object. This would make
debugging from Web Inspector easier, because console.log could be
passed directly to functions that require a callback, instead of
having to pass function(arg) { console.log(arg); }

In order to make this happen, I need a static method that shows up on
the console object (or its prototype). The closest thing I could find
in WebIDL is the [LenientThis] attribute. In WebIDL it's only intended
for attributes, but I think it would be very useful for methods.

If it makes a difference, Firefox supports using console.log without
"this" being the console object, and this feature has been requested
on the Chromium bug tracker, so it is useful to people other than
myself.


Before I embark on a quest to learn Perl so I can change the code
generator, I would like to check if this is worthwhile. Would a patch
along these lines be considered for WebKit? Is there another
established pattern for achieving my goal? (e.g. some form of const
attribute that returns a function?)

Thank you very much for your help,
    Victor


More information about the webkit-dev mailing list