Changeset 102656 in webkit


Ignore:
Timestamp:
Dec 12, 2011 8:07:48 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

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

    r102653 r102656  
    11/*
    22 * Copyright (C) 2009 Google Inc. All rights reserved.
     3 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3738#include "JSNode.h"
    3839#include "Frame.h"
     40#include <runtime/Executable.h>
     41#include <runtime/JSFunction.h>
    3942#include <runtime/JSLock.h>
    4043
     
    104107}
    105108
    106 bool eventListenerHandlerLocation(Document*, EventListener*, String&, int&)
     109bool eventListenerHandlerLocation(Document* document, EventListener* eventListener, String& sourceName, int& lineNumber)
    107110{
    108     // FIXME: Add support for getting function location.
    109     return false;
     111    const JSEventListener* jsListener = JSEventListener::cast(eventListener);
     112    if (!jsListener)
     113        return false;
     114    JSC::JSObject* jsObject = jsListener->jsFunction(document);
     115    if (!jsObject)
     116        return false;
     117    JSC::JSFunction* jsFunction = static_cast<JSFunction*>(jsObject);
     118    if (!jsFunction || jsFunction->isHostFunction())
     119        return false;
     120    JSC::FunctionExecutable* funcExecutable = jsFunction->jsExecutable();
     121    if (!funcExecutable)
     122        return false;
     123    lineNumber = funcExecutable->lineNo();
     124    sourceName = ustringToString(funcExecutable->sourceURL());
     125    return true;
    110126}
    111127
Note: See TracChangeset for help on using the changeset viewer.