[Webkit-unassigned] [Bug 114406] New: Calling console.{log, info, error, ...} should not require this === console

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 10 19:09:32 PDT 2013


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

           Summary: Calling console.{log, info, error, ...} should not
                    require this === console
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: WebCore JavaScript
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: costan at gmail.com


This is a bug for a patch that I will attach very soon.

In a nutshell, this change will make the code below not throw an exception:

f = console.log;
f("Hello world");

This comes in handy when debugging asynchronous code in the Web Inspector, because console.log can be passed as a callback that prints its arguments. For example, given a node.js-style asynchronous function perform(action, error, callback) can be called as follows in the Inspector, for quick debugging.

perform(action, console.warn, console.log);

In order to achieve this, the patch introduces the [LenientThis] WebKitIDL attribute, which is heavily inspired from the LenientThis WebIDL.
http://www.w3.org/TR/WebIDL/#LenientThis

I implemented LenientThis for methods.  I figured the only way to not require a specific type for "this" is to completely ignore the value, so a LenientThis method calls a static method in WebCore. A LenientMethod is similar to a static method, but it can be accessed as a property of the interface instances, instead of being a property of the interface object. I hope this makes sense, and I look forward to feedback.

-- 
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