Changeset 102648 in webkit


Ignore:
Timestamp:
Dec 12, 2011 6:23:18 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Implement the JavaScriptCore bindings for eventListenerHandlerLocation
https://bugs.webkit.org/show_bug.cgi?id=74313

Patch by Konrad Piascik <kpiascik@rim.com> on 2011-12-12
Reviewed by Geoffrey Garen.

Open any page in Web Inspector and look at the event listeners. They should now
link to the script which created them.

  • bindings/js/ScriptEventListener.cpp:

(WebCore::eventListenerHandlerLocation):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r102646 r102648  
     12011-12-12  Konrad Piascik  <kpiascik@rim.com>
     2
     3        Implement the JavaScriptCore bindings for eventListenerHandlerLocation
     4        https://bugs.webkit.org/show_bug.cgi?id=74313
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Open any page in Web Inspector and look at the event listeners. They should now
     9        link to the script which created them.
     10
     11        * bindings/js/ScriptEventListener.cpp:
     12        (WebCore::eventListenerHandlerLocation):
     13
    1142011-12-12  Erik Arvidsson  <arv@chromium.org>
    215
  • trunk/Source/WebCore/bindings/js/ScriptEventListener.cpp

    r99167 r102648  
    3535#include "Document.h"
    3636#include "EventListener.h"
     37#include "Executable.h"
     38#include "JSFunction.h"
    3739#include "JSNode.h"
    3840#include "Frame.h"
     
    104106}
    105107
    106 bool eventListenerHandlerLocation(Document*, EventListener*, String&, int&)
     108bool eventListenerHandlerLocation(Document* document, EventListener* eventListener, String& sourceName, int& lineNumber)
    107109{
    108     // FIXME: Add support for getting function location.
    109     return false;
     110    const JSEventListener* jsListener = JSEventListener::cast(eventListener);
     111    if (!jsListener)
     112        return false;
     113    JSC::JSObject* jsObject = jsListener->jsFunction(document);
     114    if (!jsObject)
     115        return false;
     116    JSC::JSFunction* jsFunction = static_cast<JSFunction*>(jsObject);
     117    if (!jsFunction || jsFunction->isHostFunction())
     118        return false;
     119    JSC::FunctionExecutable* funcExecutable = jsFunction->jsExecutable();
     120    if (!funcExecutable)
     121        return false;
     122    lineNumber = funcExecutable->lineNo();
     123    sourceName = ustringToString(funcExecutable->sourceURL());
     124    return true;
    110125}
    111126
Note: See TracChangeset for help on using the changeset viewer.