Changeset 103488 in webkit


Ignore:
Timestamp:
Dec 21, 2011 8:39:15 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-21
Reviewed by Eric Seidel.

Source/JavaScriptCore:

Updated project files to get Windows and Mac builds working.

Source/WebCore:

Implemented the JavaScriptCore binding to allow Web Inspector to
show the function name and line number for an event listener in
the Elements panel.

Tested by opening up a page which has a registered event listener in Safari
and checking if the Elements panel script name and line number are present
and clickable.

  • ForwardingHeaders/runtime/Executable.h: Added.
  • ForwardingHeaders/wtf/SegmentedVector.h: Added.
  • bindings/js/ScriptEventListener.cpp:

(WebCore::eventListenerHandlerLocation):

Location:
trunk/Source
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r103482 r103488  
     12011-12-21  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 Eric Seidel.
     7
     8        Updated project files to get Windows and Mac builds working.
     9
     10        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
     11        * JavaScriptCore.xcodeproj/project.pbxproj:
     12
    1132011-12-21  Filip Pizlo  <fpizlo@apple.com>
    214
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def

    r103083 r103488  
    299299    ?retrieveLastCaller@Interpreter@JSC@@QBEXPAVExecState@2@AAH1AAVUString@2@AAVJSValue@2@@Z
    300300    ?s_globalObjectMethodTable@JSGlobalObject@JSC@@1UGlobalObjectMethodTable@2@B
     301    ?s_info@ExecutableBase@JSC@@2UClassInfo@2@B
    301302    ?setAccessorDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@0I@Z
    302303    ?setConfigurable@PropertyDescriptor@JSC@@QAEX_N@Z
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r102917 r103488  
    142142                1429D8780ED21ACD00B89619 /* ExceptionHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429D8770ED21ACD00B89619 /* ExceptionHelpers.cpp */; };
    143143                1429D8850ED21C3D00B89619 /* SamplingTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429D8830ED21C3D00B89619 /* SamplingTool.cpp */; };
    144                 1429D8860ED21C3D00B89619 /* SamplingTool.h in Headers */ = {isa = PBXBuildFile; fileRef = 1429D8840ED21C3D00B89619 /* SamplingTool.h */; };
     144                1429D8860ED21C3D00B89619 /* SamplingTool.h in Headers */ = {isa = PBXBuildFile; fileRef = 1429D8840ED21C3D00B89619 /* SamplingTool.h */; settings = {ATTRIBUTES = (Private, ); }; };
    145145                1429D8DD0ED2205B00B89619 /* CallFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429D8DB0ED2205B00B89619 /* CallFrame.cpp */; };
    146146                1429D8DE0ED2205B00B89619 /* CallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 1429D8DC0ED2205B00B89619 /* CallFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    363363                86C568E211A213EE0007F7F0 /* MIPSAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86C568DF11A213EE0007F7F0 /* MIPSAssembler.h */; };
    364364                86CA032E1038E8440028A609 /* Executable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CA032D1038E8440028A609 /* Executable.cpp */; };
    365                 86CAFEE31035DDE60028A609 /* Executable.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CAFEE21035DDE60028A609 /* Executable.h */; settings = {ATTRIBUTES = (); }; };
     365                86CAFEE31035DDE60028A609 /* Executable.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CAFEE21035DDE60028A609 /* Executable.h */; settings = {ATTRIBUTES = (Private, ); }; };
    366366                86CC85A10EE79A4700288682 /* JITInlineMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CC85A00EE79A4700288682 /* JITInlineMethods.h */; };
    367367                86CC85A30EE79B7400288682 /* JITCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CC85A20EE79B7400288682 /* JITCall.cpp */; };
     
    403403                90D3469C0E285280009492EE /* RefCountedLeakCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D3469B0E285280009492EE /* RefCountedLeakCounter.h */; settings = {ATTRIBUTES = (Private, ); }; };
    404404                93052C340FB792190048FDC3 /* ParserArena.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93052C320FB792190048FDC3 /* ParserArena.cpp */; };
    405                 93052C350FB792190048FDC3 /* ParserArena.h in Headers */ = {isa = PBXBuildFile; fileRef = 93052C330FB792190048FDC3 /* ParserArena.h */; settings = {ATTRIBUTES = (); }; };
     405                93052C350FB792190048FDC3 /* ParserArena.h in Headers */ = {isa = PBXBuildFile; fileRef = 93052C330FB792190048FDC3 /* ParserArena.h */; settings = {ATTRIBUTES = (Private, ); }; };
    406406                932F5BD30822A1C700736975 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */; };
    407407                932F5BD60822A1C700736975 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 51F0EC0705C86C9A00E6DF1B /* libobjc.dylib */; };
     
    429429                969A072A0ED1CE6900F1F681 /* Label.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07270ED1CE6900F1F681 /* Label.h */; };
    430430                969A072B0ED1CE6900F1F681 /* RegisterID.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07280ED1CE6900F1F681 /* RegisterID.h */; };
    431                 969A072C0ED1CE6900F1F681 /* SegmentedVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07290ED1CE6900F1F681 /* SegmentedVector.h */; };
     431                969A072C0ED1CE6900F1F681 /* SegmentedVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07290ED1CE6900F1F681 /* SegmentedVector.h */; settings = {ATTRIBUTES = (Private, ); }; };
    432432                969A07960ED1D3AE00F1F681 /* CodeBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 969A07900ED1D3AE00F1F681 /* CodeBlock.cpp */; settings = {COMPILER_FLAGS = "-fno-strict-aliasing"; }; };
    433433                969A07970ED1D3AE00F1F681 /* CodeBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07910ED1D3AE00F1F681 /* CodeBlock.h */; settings = {ATTRIBUTES = (); }; };
     
    588588                BC18C43C0E16F5CD00B34460 /* MathObject.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A86B0255597D01FF60F7 /* MathObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
    589589                BC18C43E0E16F5CD00B34460 /* MessageQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE798B0D6CA53D00FEA3BA /* MessageQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
    590                 BC18C43F0E16F5CD00B34460 /* Nodes.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A86E0255597D01FF60F7 /* Nodes.h */; settings = {ATTRIBUTES = (); }; };
     590                BC18C43F0E16F5CD00B34460 /* Nodes.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A86E0255597D01FF60F7 /* Nodes.h */; settings = {ATTRIBUTES = (Private, ); }; };
    591591                BC18C4400E16F5CD00B34460 /* Noncopyable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9303F5690991190000AD71B8 /* Noncopyable.h */; settings = {ATTRIBUTES = (Private, ); }; };
    592592                BC18C4410E16F5CD00B34460 /* NumberConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2680C30E16D4E900A06E92 /* NumberConstructor.h */; };
     
    25852585                                86D3B2C410156BDE002865E7 /* ARMAssembler.h in Headers */,
    25862586                                86ADD1450FDDEA980006EEC2 /* ARMv7Assembler.h in Headers */,
     2587                                1429D8860ED21C3D00B89619 /* SamplingTool.h in Headers */,
     2588                                969A072C0ED1CE6900F1F681 /* SegmentedVector.h in Headers */,
     2589                                93052C350FB792190048FDC3 /* ParserArena.h in Headers */,
     2590                                BC18C43F0E16F5CD00B34460 /* Nodes.h in Headers */,
     2591                                86CAFEE31035DDE60028A609 /* Executable.h in Headers */,
    25872592                                145722861437E140005FDE26 /* StrongInlines.h in Headers */,
    25882593                                0FD82F4B142806A100179C94 /* BitVector.h in Headers */,
     
    26742679                                969A07980ED1D3AE00F1F681 /* EvalCodeCache.h in Headers */,
    26752680                                BC18C4000E16F5CD00B34460 /* ExceptionHelpers.h in Headers */,
    2676                                 86CAFEE31035DDE60028A609 /* Executable.h in Headers */,
    26772681                                A766B44F0EE8DCD1009518CA /* ExecutableAllocator.h in Headers */,
    26782682                                A7FEE67614837B32005DC1A6 /* ExportMacros.h in Headers */,
     
    27822786                                BC02E9130E1839DB000F9297 /* NativeErrorPrototype.h in Headers */,
    27832787                                7EFF00640EC05A9A00AA7C93 /* NodeInfo.h in Headers */,
    2784                                 BC18C43F0E16F5CD00B34460 /* Nodes.h in Headers */,
    27852788                                BC18C4400E16F5CD00B34460 /* Noncopyable.h in Headers */,
    27862789                                65E1A3DF122B894500B26097 /* NonCopyingSort.h in Headers */,
     
    28082811                                8690231512092D5C00630AF9 /* PageReservation.h in Headers */,
    28092812                                BC18C44B0E16F5CD00B34460 /* Parser.h in Headers */,
    2810                                 93052C350FB792190048FDC3 /* ParserArena.h in Headers */,
    28112813                                BCFBE696122560E800309E9D /* PassOwnArrayPtr.h in Headers */,
    28122814                                44DD48530FAEA85000D6B4EB /* PassOwnPtr.h in Headers */,
     
    28562858                                869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */,
    28572859                                BC18C4600E16F5CD00B34460 /* RetainPtr.h in Headers */,
    2858                                 1429D8860ED21C3D00B89619 /* SamplingTool.h in Headers */,
    28592860                                BC18C4610E16F5CD00B34460 /* ScopeChain.h in Headers */,
    2860                                 969A072C0ED1CE6900F1F681 /* SegmentedVector.h in Headers */,
    28612861                                A7C40C0B130B057D00D002A1 /* SentinelLinkedList.h in Headers */,
    28622862                                76FB9F0F12E851860051A2EB /* SHA1.h in Headers */,
  • trunk/Source/WebCore/ChangeLog

    r103487 r103488  
     12011-12-21  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 Eric Seidel.
     7
     8        Implemented the JavaScriptCore binding to allow Web Inspector to
     9        show the function name and line number for an event listener in
     10        the Elements panel.
     11
     12        Tested by opening up a page which has a registered event listener in Safari
     13        and checking if the Elements panel script name and line number are present
     14        and clickable.
     15
     16        * ForwardingHeaders/runtime/Executable.h: Added.
     17        * ForwardingHeaders/wtf/SegmentedVector.h: Added.
     18        * bindings/js/ScriptEventListener.cpp:
     19        (WebCore::eventListenerHandlerLocation):
     20
    1212011-12-21  Chris Guan  <chris.guan@torchmobile.com.cn>
    222
  • trunk/Source/WebCore/bindings/js/ScriptEventListener.cpp

    r102657 r103488  
    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.