Changeset 70300 in webkit


Ignore:
Timestamp:
Oct 22, 2010 4:40:11 AM (13 years ago)
Author:
yurys@chromium.org
Message:

2010-10-21 Yury Semikhatsky <yurys@chromium.org>

Unreviewed, rolling out r70298.WebKit win compilation failure.
http://trac.webkit.org/changeset/70298
https://bugs.webkit.org/show_bug.cgi?id=48122

Location:
trunk/WebCore
Files:
3 deleted
29 edited
1 copied
7 moved

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/Android.jscbindings.mk

    r70298 r70300  
    167167        bindings/js/ScriptArray.cpp \
    168168        bindings/js/ScriptCachedFrameData.cpp \
    169         bindings/js/ScriptCallStackFactory.cpp \
     169        bindings/js/ScriptCallFrame.cpp \
     170        bindings/js/ScriptCallStack.cpp \
    170171        bindings/js/ScriptController.cpp \
    171172        bindings/js/ScriptEventListener.cpp \
  • trunk/WebCore/Android.v8bindings.mk

    r70298 r70300  
    5050        bindings/v8/ScopedDOMDataStore.cpp \
    5151        bindings/v8/ScriptArray.cpp \
    52         bindings/v8/ScriptCallStackFactory.cpp \
     52        bindings/v8/ScriptCallFrame.cpp \
     53        bindings/v8/ScriptCallStack.cpp \
    5354        bindings/v8/ScriptController.cpp \
    5455        bindings/v8/ScriptEventListener.cpp \
  • trunk/WebCore/CMakeLists.txt

    r70298 r70300  
    687687    bindings/js/ScheduledAction.cpp
    688688    bindings/js/ScriptCachedFrameData.cpp
    689     bindings/js/ScriptCallStackFactory.cpp
     689    bindings/js/ScriptCallFrame.cpp
     690    bindings/js/ScriptCallStack.cpp
    690691    bindings/js/ScriptController.cpp
    691692    bindings/js/ScriptDebugServer.cpp
     
    11231124    inspector/InspectorStorageAgent.cpp
    11241125    inspector/InspectorTimelineAgent.cpp
    1125     inspector/ScriptArguments.cpp
    11261126    inspector/ScriptBreakpoint.cpp
    1127     inspector/ScriptCallFrame.cpp
    1128     inspector/ScriptCallStack.cpp
    11291127    inspector/TimelineRecordFactory.cpp
    11301128
  • trunk/WebCore/ChangeLog

    r70298 r70300  
     12010-10-21  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Unreviewed, rolling out r70298.WebKit win compilation failure.
     4        http://trac.webkit.org/changeset/70298
     5        https://bugs.webkit.org/show_bug.cgi?id=48122
     6
    172010-10-21  Yury Semikhatsky  <yurys@chromium.org>
    28
  • trunk/WebCore/GNUmakefile.am

    r70298 r70300  
    817817        WebCore/bindings/js/ScriptCachedFrameData.cpp \
    818818        WebCore/bindings/js/ScriptCachedFrameData.h \
    819         WebCore/bindings/js/ScriptCallStackFactory.cpp \
    820         WebCore/bindings/js/ScriptCallStackFactory.h \
     819        WebCore/bindings/js/ScriptCallFrame.cpp \
     820        WebCore/bindings/js/ScriptCallFrame.h \
     821        WebCore/bindings/js/ScriptCallStack.cpp \
     822        WebCore/bindings/js/ScriptCallStack.h \
    821823        WebCore/bindings/js/ScriptController.cpp \
    822824        WebCore/bindings/js/ScriptController.h \
     
    18511853        WebCore/inspector/InspectorValues.h \
    18521854        WebCore/inspector/InspectorWorkerResource.h \
    1853         WebCore/inspector/ScriptArguments.cpp \
    1854         WebCore/inspector/ScriptArguments.h \
    18551855        WebCore/inspector/ScriptBreakpoint.cpp \
    18561856        WebCore/inspector/ScriptBreakpoint.h \
    1857         WebCore/inspector/ScriptCallFrame.cpp \
    1858         WebCore/inspector/ScriptCallFrame.h \
    1859         WebCore/inspector/ScriptCallStack.cpp \
    1860         WebCore/inspector/ScriptCallStack.h \
    18611857        WebCore/inspector/ScriptDebugListener.h \
    18621858        WebCore/inspector/ScriptGCEventListener.h \
  • trunk/WebCore/WebCore.gypi

    r70298 r70300  
    700700            'bindings/js/ScriptCachedFrameData.cpp',
    701701            'bindings/js/ScriptCachedFrameData.h',
     702            'bindings/js/ScriptCallFrame.cpp',
     703            'bindings/js/ScriptCallFrame.h',
     704            'bindings/js/ScriptCallStack.cpp',
     705            'bindings/js/ScriptCallStack.h',
    702706            'bindings/js/ScriptController.cpp',
    703707            'bindings/js/ScriptController.h',
     
    866870            'bindings/v8/ScopedDOMDataStore.h',
    867871            'bindings/v8/ScriptCachedFrameData.h',
    868             'bindings/v8/ScriptCallStackFactory.cpp',
    869             'bindings/v8/ScriptCallStackFactory.h',
     872            'bindings/v8/ScriptCallFrame.cpp',
     873            'bindings/v8/ScriptCallFrame.h',
     874            'bindings/v8/ScriptCallStack.cpp',
     875            'bindings/v8/ScriptCallStack.h',
    870876            'bindings/v8/ScriptController.cpp',
    871877            'bindings/v8/ScriptController.h',
     
    19491955            'inspector/ScriptBreakpoint.cpp',
    19501956            'inspector/ScriptBreakpoint.h',
    1951             'inspector/ScriptArguments.cpp',
    1952             'inspector/ScriptArguments.h',
    1953             'inspector/ScriptCallFrame.cpp',
    1954             'inspector/ScriptCallFrame.h',
    1955             'inspector/ScriptCallStack.cpp',
    1956             'inspector/ScriptCallStack.h',
    19571957            'inspector/ScriptDebugListener.h',
    19581958            'inspector/ScriptGCEventListener.h',
  • trunk/WebCore/WebCore.pro

    r70298 r70300  
    352352#        bindings/v8/ScriptArray.cpp \
    353353        bindings/v8/ScriptCachedFrameData.cpp \
    354         bindings/v8/ScriptCallStackFactory.cpp \
     354        bindings/v8/ScriptCallFrame.cpp \
     355        bindings/v8/ScriptCallStack.cpp \
    355356        bindings/ScriptControllerBase.cpp \
    356357        bindings/v8/ScriptController.cpp \
     
    574575        bindings/js/JSWorkerContextErrorHandler.cpp \
    575576        bindings/js/ScriptCachedFrameData.cpp \
    576         bindings/js/ScriptCallStackFactory.cpp \
     577        bindings/js/ScriptCallFrame.cpp \
     578        bindings/js/ScriptCallStack.cpp \
    577579        bindings/js/ScriptController.cpp \
    578580        bindings/js/ScriptDebugServer.cpp \
     
    10111013    inspector/InspectorTimelineAgent.cpp \
    10121014    inspector/InspectorValues.cpp \
    1013     inspector/ScriptArguments.cpp \
    10141015    inspector/ScriptBreakpoint.cpp \
    1015     inspector/ScriptCallFrame.cpp \
    1016     inspector/ScriptCallStack.cpp \
    10171016    inspector/TimelineRecordFactory.cpp \
    10181017    loader/archive/ArchiveFactory.cpp \
     
    13901389#        bindings/v8/ScriptArray.h \
    13911390        bindings/v8/ScriptCachedFrameData.h \
     1391        bindings/v8/ScriptCallFrame.h \
     1392        bindings/v8/ScriptCallStack.h \
    13921393        bindings/v8/ScriptController.h \
    13931394        bindings/v8/ScriptEventListener.h \
     
    14721473        bindings/js/ScheduledAction.h \
    14731474        bindings/js/ScriptCachedFrameData.h \
     1475        bindings/js/ScriptCallFrame.h \
     1476        bindings/js/ScriptCallStack.h \
    14741477        bindings/js/ScriptController.h \
    14751478        bindings/js/ScriptEventListener.h \
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r70298 r70300  
    6039960399                                </File>
    6040060400                                <File
    60401                                         RelativePath="..\bindings\js\ScriptCallStackFactory.cpp"
     60401                                        RelativePath="..\bindings\js\ScriptCallFrame.cpp"
    6040260402                                        >
    6040360403                                        <FileConfiguration
     
    6045160451                                </File>
    6045260452                                <File
    60453                                         RelativePath="..\bindings\js\ScriptCallStackFactory.h"
     60453                                        RelativePath="..\bindings\js\ScriptCallFrame.h"
     60454                                        >
     60455                                </File>
     60456                                <File
     60457                                        RelativePath="..\bindings\js\ScriptCallStack.cpp"
     60458                                        >
     60459                                        <FileConfiguration
     60460                                                Name="Debug|Win32"
     60461                                                ExcludedFromBuild="true"
     60462                                                >
     60463                                                <Tool
     60464                                                        Name="VCCLCompilerTool"
     60465                                                />
     60466                                        </FileConfiguration>
     60467                                        <FileConfiguration
     60468                                                Name="Release|Win32"
     60469                                                ExcludedFromBuild="true"
     60470                                                >
     60471                                                <Tool
     60472                                                        Name="VCCLCompilerTool"
     60473                                                />
     60474                                        </FileConfiguration>
     60475                                        <FileConfiguration
     60476                                                Name="Debug_Internal|Win32"
     60477                                                ExcludedFromBuild="true"
     60478                                                >
     60479                                                <Tool
     60480                                                        Name="VCCLCompilerTool"
     60481                                                />
     60482                                        </FileConfiguration>
     60483                                        <FileConfiguration
     60484                                                Name="Debug_Cairo|Win32"
     60485                                                ExcludedFromBuild="true"
     60486                                                >
     60487                                                <Tool
     60488                                                        Name="VCCLCompilerTool"
     60489                                                />
     60490                                        </FileConfiguration>
     60491                                        <FileConfiguration
     60492                                                Name="Release_Cairo|Win32"
     60493                                                ExcludedFromBuild="true"
     60494                                                >
     60495                                                <Tool
     60496                                                        Name="VCCLCompilerTool"
     60497                                                />
     60498                                        </FileConfiguration>
     60499                                        <FileConfiguration
     60500                                                Name="Debug_All|Win32"
     60501                                                ExcludedFromBuild="true"
     60502                                                >
     60503                                                <Tool
     60504                                                        Name="VCCLCompilerTool"
     60505                                                />
     60506                                        </FileConfiguration>
     60507                                </File>
     60508                                <File
     60509                                        RelativePath="..\bindings\js\ScriptCallStack.h"
    6045460510                                        >
    6045560511                                </File>
     
    6334463400                        </File>
    6334563401                        <File
    63346                                 RelativePath="..\inspector\ScriptArguments.cpp"
    63347                                 >
    63348                         </File>
    63349                         <File
    63350                                 RelativePath="..\inspector\ScriptArguments.h"
    63351                                 >
    63352                         </File>
    63353                         <File
    6335463402                                RelativePath="..\inspector\ScriptBreakpoint.cpp"
    6335563403                                >
     
    6335763405                        <File
    6335863406                                RelativePath="..\inspector\ScriptBreakpoint.h"
    63359                                 >
    63360                         </File>
    63361                         <File
    63362                                 RelativePath="..\inspector\ScriptCallFrame.cpp"
    63363                                 >
    63364                         </File>
    63365                         <File
    63366                                 RelativePath="..\inspector\ScriptCallFrame.h"
    63367                                 >
    63368                         </File>
    63369                         <File
    63370                                 RelativePath="..\inspector\ScriptCallStack.cpp"
    63371                                 >
    63372                         </File>
    63373                         <File
    63374                                 RelativePath="..\inspector\ScriptCallStack.h"
    6337563407                                >
    6337663408                        </File>
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r70298 r70300  
    54615461                F3644B001119805900E0D537 /* InjectedScript.h in Headers */ = {isa = PBXBuildFile; fileRef = F3644AFE1119805900E0D537 /* InjectedScript.h */; };
    54625462                F375CC071150D300008DDB81 /* InspectorWorkerResource.h in Headers */ = {isa = PBXBuildFile; fileRef = F375CC061150D300008DDB81 /* InspectorWorkerResource.h */; };
    5463                 F392249C126F11AE00A926D9 /* ScriptCallStackFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F392249A126F11AE00A926D9 /* ScriptCallStackFactory.cpp */; };
    5464                 F392249D126F11AE00A926D9 /* ScriptCallStackFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = F392249B126F11AE00A926D9 /* ScriptCallStackFactory.h */; };
    5465                 F39BE95B12673BF400E0A674 /* ScriptArguments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F39BE95912673BF400E0A674 /* ScriptArguments.cpp */; };
    5466                 F39BE95C12673BF400E0A674 /* ScriptArguments.h in Headers */ = {isa = PBXBuildFile; fileRef = F39BE95A12673BF400E0A674 /* ScriptArguments.h */; };
    54675463                F3D461481161D53200CA0D09 /* JSWorkerContextErrorHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3D461461161D53200CA0D09 /* JSWorkerContextErrorHandler.cpp */; };
    54685464                F3D461491161D53200CA0D09 /* JSWorkerContextErrorHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = F3D461471161D53200CA0D09 /* JSWorkerContextErrorHandler.h */; };
     
    1149311489                F3644AFE1119805900E0D537 /* InjectedScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScript.h; sourceTree = "<group>"; };
    1149411490                F375CC061150D300008DDB81 /* InspectorWorkerResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorWorkerResource.h; sourceTree = "<group>"; };
    11495                 F392249A126F11AE00A926D9 /* ScriptCallStackFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallStackFactory.cpp; sourceTree = "<group>"; };
    11496                 F392249B126F11AE00A926D9 /* ScriptCallStackFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallStackFactory.h; sourceTree = "<group>"; };
    11497                 F39BE95912673BF400E0A674 /* ScriptArguments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptArguments.cpp; sourceTree = "<group>"; };
    11498                 F39BE95A12673BF400E0A674 /* ScriptArguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptArguments.h; sourceTree = "<group>"; };
    1149911491                F3D461461161D53200CA0D09 /* JSWorkerContextErrorHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerContextErrorHandler.cpp; sourceTree = "<group>"; };
    1150011492                F3D461471161D53200CA0D09 /* JSWorkerContextErrorHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerContextErrorHandler.h; sourceTree = "<group>"; };
     
    1226912261                                1C81BA050E97348300266E07 /* JavaScriptCallFrame.idl */,
    1227012262                                BCC64F5F0DCFB84E0081EF3B /* localizedStrings.js */,
    12271                                 F39BE95912673BF400E0A674 /* ScriptArguments.cpp */,
    12272                                 F39BE95A12673BF400E0A674 /* ScriptArguments.h */,
    1227312263                                200B190811C277D900DCCD3A /* ScriptBreakpoint.cpp */,
    1227412264                                7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */,
    12275                                 416E75CA0EDF90C700360E1D /* ScriptCallFrame.cpp */,
    12276                                 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */,
    12277                                 416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */,
    12278                                 416E75BC0EDF8FD700360E1D /* ScriptCallStack.h */,
    1227912265                                7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */,
    1228012266                                9FA37EEF1172FD4100C4CD55 /* ScriptProfile.idl */,
     
    1679316779                                41F1D21E0EF35C2A00DA8753 /* ScriptCachedFrameData.cpp */,
    1679416780                                41F1D21D0EF35C2A00DA8753 /* ScriptCachedFrameData.h */,
    16795                                 F392249A126F11AE00A926D9 /* ScriptCallStackFactory.cpp */,
    16796                                 F392249B126F11AE00A926D9 /* ScriptCallStackFactory.h */,
     16781                                416E75CA0EDF90C700360E1D /* ScriptCallFrame.cpp */,
     16782                                416E75C90EDF90C700360E1D /* ScriptCallFrame.h */,
     16783                                416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */,
     16784                                416E75BC0EDF8FD700360E1D /* ScriptCallStack.h */,
    1679716785                                93B70D5309EB0C7C009D8468 /* ScriptController.cpp */,
    1679816786                                93B70D5409EB0C7C009D8468 /* ScriptController.h */,
     
    2057120559                                5162C7F511F77EFB00612EFE /* SchemeRegistry.h in Headers */,
    2057220560                                BCEC01BE0C274DAC009F4EC9 /* Screen.h in Headers */,
    20573                                 F39BE95C12673BF400E0A674 /* ScriptArguments.h in Headers */,
    2057420561                                A84D82C111D3474800972990 /* ScriptableDocumentParser.h in Headers */,
    2057520562                                7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */,
     
    2114721134                                081CDFBA126ECFDB00D215CA /* DeprecatedSVGAnimatedTemplate.h in Headers */,
    2114821135                                081CDFBF126ECFE800D215CA /* SVGAnimatedPropertySynchronizer.h in Headers */,
    21149                                 F392249D126F11AE00A926D9 /* ScriptCallStackFactory.h in Headers */,
    2115021136                                088A0E04126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h in Headers */,
    2115121137                                088A0E05126EF1DB00978F7A /* SVGAnimatedProperty.h in Headers */,
     
    2320323189                                BCEC01BD0C274DAC009F4EC9 /* Screen.cpp in Sources */,
    2320423190                                A84D82C211D3474800972990 /* ScriptableDocumentParser.cpp in Sources */,
    23205                                 F39BE95B12673BF400E0A674 /* ScriptArguments.cpp in Sources */,
    2320623191                                200B190911C277D900DCCD3A /* ScriptBreakpoint.cpp in Sources */,
    2320723192                                41F1D2200EF35C2A00DA8753 /* ScriptCachedFrameData.cpp in Sources */,
     
    2371223697                                E18772F1126E2629003DD586 /* Language.cpp in Sources */,
    2371323698                                7A1F2B52126C61B20006A7E6 /* InspectorClient.cpp in Sources */,
    23714                                 F392249C126F11AE00A926D9 /* ScriptCallStackFactory.cpp in Sources */,
    2371523699                        );
    2371623700                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/bindings/js/JSBindingsAllInOne.cpp

    r70298 r70300  
    142142#include "ScheduledAction.cpp"
    143143#include "ScriptCachedFrameData.cpp"
    144 #include "ScriptCallStackFactory.cpp"
     144#include "ScriptCallFrame.cpp"
     145#include "ScriptCallStack.cpp"
    145146#include "ScriptController.cpp"
    146147#include "ScriptControllerWin.cpp"
  • trunk/WebCore/bindings/js/JSConsoleCustom.cpp

    r70298 r70300  
    3030#include "Console.h"
    3131#include "JSScriptProfile.h"
    32 #include "ScriptCallStack.h"
    33 #include "ScriptCallStackFactory.h"
    3432#include "ScriptProfile.h"
    3533#include <runtime/JSArray.h>
    36 #include <wtf/OwnPtr.h>
    3734
    3835using namespace JSC;
     
    5653}
    5754
    58 JSValue JSConsole::profile(ExecState* exec)
    59 {
    60     OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, 1));
    61     const String& title = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
    62     if (exec->hadException())
    63         return jsUndefined();
    64 
    65     impl()->profile(title, exec, callStack.release());
    66     return jsUndefined();
    67 }
    68 
    69 JSValue JSConsole::profileEnd(ExecState* exec)
    70 {
    71     OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, 1));
    72     const String& title = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
    73     if (exec->hadException())
    74         return jsUndefined();
    75 
    76     impl()->profileEnd(title, exec, callStack.release());
    77     return jsUndefined();
    78 }
    79 
    8055#endif
    8156
  • trunk/WebCore/bindings/js/ScriptCallFrame.cpp

    r70299 r70300  
    11/*
    2  * Copyright (c) 2010 Google Inc. All rights reserved.
     2 * Copyright (c) 2008, Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929 */
    3030
    31 #ifndef ScriptCallStackFactory_h
    32 #define ScriptCallStackFactory_h
     31#include "config.h"
     32#include "ScriptCallFrame.h"
    3333
    34 #include <wtf/PassOwnPtr.h>
     34#include <runtime/ArgList.h>
     35#include <runtime/UString.h>
    3536
    36 namespace JSC {
    37 class ExecState;
    38 }
     37using namespace JSC;
    3938
    4039namespace WebCore {
    4140
    42 class ScriptArguments;
    43 class ScriptCallStack;
     41ScriptCallFrame::ScriptCallFrame(const UString& functionName, const UString& urlString, int lineNumber, ExecState* exec, unsigned skipArgumentCount)
     42    : m_functionName(ustringToString(functionName))
     43    , m_sourceURL(ustringToString(urlString))
     44    , m_lineNumber(lineNumber)
     45{
     46    if (!exec)
     47        return;
     48    size_t argumentCount = exec->argumentCount();
     49    for (size_t i = skipArgumentCount; i < argumentCount; ++i)
     50        m_arguments.append(ScriptValue(exec->argument(i)));
     51}
    4452
    45 PassOwnPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState*, size_t maxStackSize);
    46 PassOwnPtr<ScriptArguments> createScriptArguments(JSC::ExecState*, unsigned skipArgumentCount);
     53ScriptCallFrame::~ScriptCallFrame()
     54{
     55}
     56
     57const ScriptValue &ScriptCallFrame::argumentAt(unsigned index) const
     58{
     59    ASSERT(m_arguments.size() > index);
     60    return m_arguments[index];
     61}
    4762
    4863} // namespace WebCore
    49 
    50 #endif // ScriptCallStackFactory_h
  • trunk/WebCore/bindings/js/ScriptCallFrame.h

    r70299 r70300  
    11/*
    2  * Copyright (c) 2010 Google Inc. All rights reserved.
     2 * Copyright (c) 2008, Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3333
    3434#include "PlatformString.h"
    35 #include <wtf/PassRefPtr.h>
     35#include "ScriptValue.h"
     36#include <wtf/Vector.h>
     37
     38namespace JSC {
     39class ExecState;
     40class UString;
     41}
    3642
    3743namespace WebCore {
    3844
    39 class InspectorObject;
    40 
    4145class ScriptCallFrame  {
    4246public:
    43     ScriptCallFrame(const String& functionName, const String& urlString, unsigned lineNumber);
     47    ScriptCallFrame(const JSC::UString& functionName, const JSC::UString& urlString, int lineNumber, JSC::ExecState*, unsigned skipArgumentCount);
    4448    ~ScriptCallFrame();
    4549
     
    4852    unsigned lineNumber() const { return m_lineNumber; }
    4953
    50     bool isEqual(const ScriptCallFrame&) const;
    51     PassRefPtr<InspectorObject> buildInspectorObject() const;
     54    // argument retrieval methods
     55    const ScriptValue& argumentAt(unsigned) const;
     56    unsigned argumentCount() const { return m_arguments.size(); }
    5257
    5358private:
     
    5560    String m_sourceURL;
    5661    unsigned m_lineNumber;
     62
     63    Vector<ScriptValue> m_arguments;
    5764};
    5865
  • trunk/WebCore/bindings/js/ScriptCallStack.cpp

    r70299 r70300  
    11/*
    2  * Copyright (c) 2010 Google Inc. All rights reserved.
     2 * Copyright (c) 2008, Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3030
    3131#include "config.h"
    32 #include "ScriptCallStackFactory.h"
     32#include "ScriptCallStack.h"
    3333
    34 #include "JSDOMBinding.h"
    35 #include "ScriptArguments.h"
    36 #include "ScriptCallFrame.h"
    37 #include "ScriptCallStack.h"
    38 #include "ScriptValue.h"
    3934#include <interpreter/CallFrame.h>
    4035#include <interpreter/Interpreter.h>
    41 #include <runtime/ArgList.h>
    4236#include <runtime/JSFunction.h>
    43 #include <runtime/JSGlobalData.h>
    4437#include <runtime/JSValue.h>
    4538#include <runtime/UString.h>
     39#include <runtime/JSGlobalData.h>
    4640
    4741using namespace JSC;
     
    4943namespace WebCore {
    5044
    51 PassOwnPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t maxStackSize)
     45ScriptCallStack::ScriptCallStack(ExecState* exec, unsigned skipArgumentCount)
     46    : m_initialized(false)
     47    , m_exec(exec)
     48    , m_caller(0)
    5249{
    53     Vector<ScriptCallFrame> frames;
    54     CallFrame* callFrame = exec;
     50    int signedLineNumber;
     51    intptr_t sourceID;
     52    UString urlString;
     53    JSValue function;
     54
     55    exec->interpreter()->retrieveLastCaller(exec, signedLineNumber, sourceID, urlString, function);
     56
     57    unsigned lineNumber = signedLineNumber >= 0 ? signedLineNumber : 0;
     58
     59    if (function) {
     60        m_caller = asFunction(function);
     61        m_frames.append(ScriptCallFrame(m_caller->name(m_exec), urlString, lineNumber, m_exec, skipArgumentCount));
     62    } else {
     63        // Caller is unknown, but we should still add the frame, because
     64        // something called us, and gave us arguments.
     65        m_frames.append(ScriptCallFrame(UString(), urlString, lineNumber, m_exec, skipArgumentCount));
     66    }
     67}
     68
     69ScriptCallStack::~ScriptCallStack()
     70{
     71}
     72
     73const ScriptCallFrame &ScriptCallStack::at(unsigned index)
     74{
     75    // First frame is pre-populated in constructor, so don't trigger
     76    // initialization unless looking beyond the first frame.
     77    if (index > 0)
     78        initialize();
     79    ASSERT(m_frames.size() > index);
     80    return m_frames[index];
     81}
     82
     83unsigned ScriptCallStack::size()
     84{
     85    initialize();
     86    return m_frames.size();
     87}
     88
     89void ScriptCallStack::initialize()
     90{
     91    if (!m_caller || m_initialized)
     92        return;
     93
     94    int signedLineNumber;
     95    intptr_t sourceID;
     96    UString urlString;
     97    JSValue function;
     98    // callFrame must exist if m_caller is not null.
     99    CallFrame* callFrame = m_exec->callerFrame();
    55100    while (true) {
    56101        ASSERT(callFrame);
    57         int signedLineNumber;
    58         intptr_t sourceID;
    59         UString urlString;
    60         JSValue function;
    61 
    62         exec->interpreter()->retrieveLastCaller(callFrame, signedLineNumber, sourceID, urlString, function);
    63         UString functionName;
    64         if (function)
    65             functionName = asFunction(function)->name(exec);
    66         else {
    67             // Caller is unknown, but if frames is empty we should still add the frame, because
    68             // something called us, and gave us arguments.
    69             if (!frames.isEmpty())
    70                 break;
    71         }
     102        m_exec->interpreter()->retrieveLastCaller(callFrame, signedLineNumber, sourceID, urlString, function);
     103        if (!function)
     104            break;
     105        JSFunction* jsFunction = asFunction(function);
    72106        unsigned lineNumber = signedLineNumber >= 0 ? signedLineNumber : 0;
    73         frames.append(ScriptCallFrame(ustringToString(functionName), ustringToString(urlString), lineNumber));
    74         if (!function || frames.size() == maxStackSize)
    75             break;
     107        m_frames.append(ScriptCallFrame(jsFunction->name(m_exec), urlString, lineNumber, m_exec, 0));
    76108        callFrame = callFrame->callerFrame();
    77109    }
    78     return new ScriptCallStack(frames);
    79 }
    80 
    81 PassOwnPtr<ScriptArguments> createScriptArguments(JSC::ExecState* exec, unsigned skipArgumentCount)
    82 {
    83     Vector<ScriptValue> arguments;
    84     size_t argumentCount = exec->argumentCount();
    85     for (size_t i = skipArgumentCount; i < argumentCount; ++i)
    86         arguments.append(ScriptValue(exec->argument(i)));
    87     return new ScriptArguments(exec, arguments);
     110    m_initialized = true;
    88111}
    89112
  • trunk/WebCore/bindings/js/ScriptCallStack.h

    r70299 r70300  
    11/*
    2  * Copyright (c) 2008, 2010 Google Inc. All rights reserved.
     2 * Copyright (c) 2008, Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3333
    3434#include "ScriptCallFrame.h"
     35#include "ScriptState.h"
    3536#include <wtf/Noncopyable.h>
    36 #include <wtf/Vector.h>
     37#include <wtf/RefPtr.h>
     38
     39namespace JSC {
     40    class ExecState;
     41    class JSValue;
     42}
    3743
    3844namespace WebCore {
    3945
    40 class InspectorArray;
     46    class InspectorArray;
    4147
    42 class ScriptCallStack : public Noncopyable {
    43 public:
    44     static const size_t maxCallStackSizeToCapture = 200;
     48    class ScriptCallStack : public Noncopyable {
     49    public:
     50        ScriptCallStack(JSC::ExecState*, unsigned skipArgumentCount = 0);
     51        ~ScriptCallStack();
    4552
    46     ScriptCallStack(Vector<ScriptCallFrame>&);
    47     ~ScriptCallStack();
     53        ScriptState* state() const { return m_exec; }
     54        ScriptState* globalState() const { return m_exec->lexicalGlobalObject()->globalExec(); }
     55        // frame retrieval methods
     56        const ScriptCallFrame &at(unsigned);
     57        unsigned size();
     58        static bool stackTrace(int, const RefPtr<InspectorArray>&);
    4859
    49     const ScriptCallFrame &at(size_t);
    50     size_t size();
    51     static bool stackTrace(int, const RefPtr<InspectorArray>&);
     60    private:
     61        void initialize();
     62        bool m_initialized;
    5263
    53     bool isEqual(ScriptCallStack*) const;
    54     PassRefPtr<InspectorArray> buildInspectorObject() const;
    55 
    56 private:
    57     Vector<ScriptCallFrame> m_frames;
    58 };
     64        JSC::ExecState* m_exec;
     65        Vector<ScriptCallFrame> m_frames;
     66        JSC::JSFunction* m_caller;
     67    };
    5968
    6069} // namespace WebCore
  • trunk/WebCore/bindings/js/ScriptState.h

    r70298 r70300  
    3333#define ScriptState_h
    3434
    35 #include <interpreter/CallFrame.h>
    36 #include <runtime/JSGlobalObject.h>
     35#include "JSDOMBinding.h"
    3736#include <runtime/Protect.h>
    3837#include <wtf/Noncopyable.h>
     
    5453    ScriptStateProtectedPtr() { }
    5554    ScriptStateProtectedPtr(ScriptState* scriptState) : m_globalObject(scriptState->lexicalGlobalObject()) { }
    56     ScriptState* get() const
     55    ScriptState* get()
    5756    {
    5857        if (m_globalObject)
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r70298 r70300  
    19671967
    19681968                    if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
    1969                         push(@implContent, "    OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, $numParameters));\n");
    1970                         push(@implContent, "    size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;\n");
    1971                         push(@implContent, "    OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));\n");
    1972                         $implIncludes{"ScriptArguments.h"} = 1;
     1969                        push(@implContent, "    ScriptCallStack callStack(exec, $numParameters);\n");
    19731970                        $implIncludes{"ScriptCallStack.h"} = 1;
    1974                         $implIncludes{"ScriptCallStackFactory.h"} = 1;
    19751971                    }
    19761972
     
    23622358    if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
    23632359        $functionString .= ", " if $paramIndex;
    2364         $paramIndex += 2;
    2365         $functionString .= "scriptArguments.release(), callStack.release()";
     2360        ++$paramIndex;
     2361        $functionString .= "&callStack";
    23662362    }
    23672363
  • trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r70298 r70300  
    13051305    if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
    13061306        push(@implContentDecls, <<END);
    1307     OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, $numParameters));
    1308     size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;
    1309     OwnPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize));
     1307    OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(args, $numParameters));
    13101308    if (!callStack)
    13111309        return v8::Undefined();
    13121310END
    1313         $implIncludes{"ScriptArguments.h"} = 1;
    13141311        $implIncludes{"ScriptCallStack.h"} = 1;
    1315         $implIncludes{"ScriptCallStackFactory.h"} = 1;
    13161312    }
    13171313    if ($function->signature->extendedAttributes->{"SVGCheckSecurityDocument"}) {
     
    27242720    if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
    27252721        $functionString .= ", " if $index;
    2726         $functionString .= "scriptArguments.release(), callStack.release()";
    2727         $index += 2;
     2722        $functionString .= "callStack.get()";
     2723        $index++;
    27282724    }
    27292725
  • trunk/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r70298 r70300  
    3232#include "JSlog.h"
    3333#include "KURL.h"
    34 #include "ScriptArguments.h"
    3534#include "ScriptCallStack.h"
    36 #include "ScriptCallStackFactory.h"
    3735#include "SerializedScriptValue.h"
    3836#include "TestObj.h"
     
    997995    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    998996    ExceptionCode ec = 0;
    999     OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 1));
    1000     size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;
    1001     OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));
     997    ScriptCallStack callStack(exec, 1);
    1002998    log* intArg = tolog(exec->argument(0));
    1003999    if (exec->hadException())
    10041000        return JSValue::encode(jsUndefined());
    10051001
    1006     imp->customArgsAndException(intArg, scriptArguments.release(), callStack.release(), ec);
     1002    imp->customArgsAndException(intArg, &callStack, ec);
    10071003    setDOMException(exec, ec);
    10081004    return JSValue::encode(jsUndefined());
  • trunk/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r70298 r70300  
    2727#include "IDBKey.h"
    2828#include "RuntimeEnabledFeatures.h"
    29 #include "ScriptArguments.h"
    3029#include "ScriptCallStack.h"
    31 #include "ScriptCallStackFactory.h"
    3230#include "SerializedScriptValue.h"
    3331#include "V8Binding.h"
     
    708706    ExceptionCode ec = 0;
    709707    {
    710     OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1));
    711     size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;
    712     OwnPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize));
     708    OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(args, 1));
    713709    if (!callStack)
    714710        return v8::Undefined();
    715711    EXCEPTION_BLOCK(log*, intArg, V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
    716     imp->customArgsAndException(intArg, scriptArguments.release(), callStack.release(), ec);
     712    imp->customArgsAndException(intArg, callStack.get(), ec);
    717713    if (UNLIKELY(ec))
    718714        goto fail;
  • trunk/WebCore/bindings/v8/ScriptCallFrame.cpp

    r70299 r70300  
    11/*
    2  * Copyright (c) 2010 Google Inc. All rights reserved.
    3  * 
     2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
     3 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are
    66 * met:
    7  * 
     7 *
    88 *     * Redistributions of source code must retain the above copyright
    99 * notice, this list of conditions and the following disclaimer.
     
    3232#include "ScriptCallFrame.h"
    3333
    34 #include "InspectorValues.h"
    35 #include <wtf/RefPtr.h>
     34#include <v8.h>
     35
     36#include "PlatformString.h"
     37#include "V8Binding.h"
     38#include "V8Proxy.h"
     39#include "ScriptValue.h"
    3640
    3741namespace WebCore {
    3842
    39 ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlString, unsigned lineNumber)
     43ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber, const v8::Arguments& arguments, unsigned skipArgumentCount)
     44    : m_functionName(functionName)
     45    , m_sourceURL(urlString)
     46    , m_lineNumber(lineNumber)
     47{
     48    for (int i = skipArgumentCount; i < arguments.Length(); ++i)
     49        m_arguments.append(ScriptValue(arguments[i]));
     50}
     51
     52ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber)
    4053    : m_functionName(functionName)
    4154    , m_sourceURL(urlString)
     
    4861}
    4962
    50 bool ScriptCallFrame::isEqual(const ScriptCallFrame& o) const
     63const ScriptValue& ScriptCallFrame::argumentAt(unsigned index) const
    5164{
    52     return m_functionName == o.m_functionName
    53         && m_sourceURL == o.m_sourceURL
    54         && m_lineNumber == o.m_lineNumber;
    55 }
    56 
    57 PassRefPtr<InspectorObject> ScriptCallFrame::buildInspectorObject() const
    58 {
    59     RefPtr<InspectorObject> frame = InspectorObject::create();
    60     frame->setString("functionName", m_functionName);
    61     frame->setString("sourceURL", m_sourceURL);
    62     frame->setNumber("lineNumber", m_lineNumber);
    63     return frame;
     65    ASSERT(m_arguments.size() > index);
     66    return m_arguments[index];
    6467}
    6568
  • trunk/WebCore/bindings/v8/ScriptCallFrame.h

    r70299 r70300  
    11/*
    2  * Copyright (c) 2010 Google Inc. All rights reserved.
    3  * 
     2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
     3 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are
    66 * met:
    7  * 
     7 *
    88 *     * Redistributions of source code must retain the above copyright
    99 * notice, this list of conditions and the following disclaimer.
     
    2929 */
    3030
    31 #ifndef ScriptArguments_h
    32 #define ScriptArguments_h
     31#ifndef ScriptCallFrame_h
     32#define ScriptCallFrame_h
    3333
    34 #include "PlatformString.h"
    35 #include "ScriptState.h"
     34#include "KURL.h"
     35
    3636#include <wtf/Vector.h>
    3737
     38namespace v8 {
     39    class Arguments;
     40}
     41
    3842namespace WebCore {
     43    class ScriptValue;
    3944
    40 class ScriptValue;
     45    // FIXME: Implement retrieving line number and source URL and storing here
     46    // for all call frames, not just the first one.
     47    // See <https://bugs.webkit.org/show_bug.cgi?id=22556> and
     48    // <https://bugs.webkit.org/show_bug.cgi?id=21180>
     49    class ScriptCallFrame  {
     50    public:
     51        ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber, const v8::Arguments&, unsigned skipArgumentCount);
     52        ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber);
     53        ~ScriptCallFrame();
    4154
    42 class ScriptArguments {
    43 public:
    44     ScriptArguments(ScriptState*, Vector<ScriptValue>& arguments);
    45     ~ScriptArguments();
     55        const String& functionName() const { return m_functionName; }
     56        const String& sourceURL() const { return m_sourceURL; }
     57        unsigned lineNumber() const { return m_lineNumber; }
    4658
    47     const ScriptValue& argumentAt(size_t) const;
    48     size_t argumentCount() const { return m_arguments.size(); }
     59        // argument retrieval methods
     60        const ScriptValue& argumentAt(unsigned) const;
     61        unsigned argumentCount() const { return m_arguments.size(); }
    4962
    50     ScriptState* globalState() const;
     63    private:
     64        String m_functionName;
     65        String m_sourceURL;
     66        unsigned m_lineNumber;
    5167
    52     bool getFirstArgumentAsString(WTF::String& result, bool checkForNullOrUndefined = false);
    53     bool isEqual(ScriptArguments*) const;
    54 
    55 private:
    56     ScriptStateProtectedPtr m_scriptState;
    57     Vector<ScriptValue> m_arguments;
    58 };
     68        Vector<ScriptValue> m_arguments;
     69    };
    5970
    6071} // namespace WebCore
    6172
    62 #endif // ScriptArguments_h
     73#endif // ScriptCallFrame_h
  • trunk/WebCore/bindings/v8/ScriptCallStack.cpp

    r70299 r70300  
    11/*
    2  * Copyright (c) 2010 Google Inc. All rights reserved.
    3  * 
     2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
     3 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are
    66 * met:
    7  * 
     7 *
    88 *     * Redistributions of source code must retain the above copyright
    99 * notice, this list of conditions and the following disclaimer.
     
    3030
    3131#include "config.h"
    32 #include "ScriptCallStackFactory.h"
     32#include "ScriptCallStack.h"
    3333
    3434#include "InspectorValues.h"
    35 #include "ScriptArguments.h"
    36 #include "ScriptCallFrame.h"
    37 #include "ScriptCallStack.h"
     35#include "ScriptController.h"
     36#include "ScriptDebugServer.h"
    3837#include "ScriptScope.h"
    39 #include "ScriptValue.h"
    4038#include "V8Binding.h"
    4139
     
    4442namespace WebCore {
    4543
    46 static ScriptCallFrame toScriptCallFrame(v8::Handle<v8::StackFrame> frame)
     44static void getFrameLocation(v8::Handle<v8::StackFrame> frame, String* sourceName, int* sourceLineNumber, String* functionName)
     45{
     46    ASSERT(!frame.IsEmpty());
     47    v8::Local<v8::String> sourceNameValue(frame->GetScriptNameOrSourceURL());
     48    v8::Local<v8::String> functionNameValue(frame->GetFunctionName());
     49    *sourceName = sourceNameValue.IsEmpty() ? "" : toWebCoreString(sourceNameValue);
     50    *functionName = functionNameValue.IsEmpty() ? "" : toWebCoreString(functionNameValue);
     51    *sourceLineNumber = frame->GetLineNumber();
     52}
     53
     54static void getTopFrameLocation(v8::Handle<v8::StackTrace> stackTrace, String* sourceName, int* sourceLineNumber, String* functionName)
     55{
     56    if (stackTrace->GetFrameCount() <= 0) {
     57        // Successfully grabbed stack trace, but there are no frames. It may happen in case of a syntax error for example.
     58        // Fallback to setting lineNumber to 0, and source and function name to "undefined".
     59        *sourceName = "undefined";
     60        *sourceLineNumber = 0;
     61        *functionName = "undefined";
     62    } else {
     63        v8::Handle<v8::StackFrame> frame = stackTrace->GetFrame(0);
     64        getFrameLocation(frame, sourceName, sourceLineNumber, functionName);
     65    }
     66}
     67
     68static PassOwnPtr<ScriptCallFrame> toScriptCallFrame(v8::Handle<v8::StackFrame> frame)
    4769{
    4870    String sourceName;
    49     v8::Local<v8::String> sourceNameValue(frame->GetScriptNameOrSourceURL());
    50     if (!sourceNameValue.IsEmpty())
    51         sourceName = toWebCoreString(sourceNameValue);
    52 
     71    int sourceLineNumber;
    5372    String functionName;
    54     v8::Local<v8::String> functionNameValue(frame->GetFunctionName());
    55     if (!functionNameValue.IsEmpty())
    56         functionName = toWebCoreString(functionNameValue);
    57 
    58     int sourceLineNumber = frame->GetLineNumber();
    59     return ScriptCallFrame(functionName, sourceName, sourceLineNumber);
     73    getFrameLocation(frame, &sourceName, &sourceLineNumber, &functionName);
     74    return new ScriptCallFrame(functionName, sourceName, sourceLineNumber);
    6075}
    6176
    62 static void toScriptCallFramesVector(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, Vector<ScriptCallFrame>& scriptCallFrames, size_t maxStackSize)
     77static void toScriptCallFramesVector(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, Vector<OwnPtr<ScriptCallFrame> >& scriptCallFrames)
    6378{
    64     // TODO(yurys): remove this???
    6579    v8::Context::Scope contextScope(context);
    6680    int frameCount = stackTrace->GetFrameCount();
    67     if (frameCount > static_cast<int>(maxStackSize))
    68         frameCount = maxStackSize;
    6981    for (int i = 0; i < frameCount; i++) {
    7082        v8::Local<v8::StackFrame> stackFrame = stackTrace->GetFrame(i);
    7183        scriptCallFrames.append(toScriptCallFrame(stackFrame));
    7284    }
    73    
    74     if (!frameCount) {
    75         // Successfully grabbed stack trace, but there are no frames. It may happen in case of a syntax error for example.
    76         // Fallback to setting lineNumber to 0, and source and function name to "undefined".
    77         scriptCallFrames.append(ScriptCallFrame("undefined", "undefined", 0));
    78     }
    7985}
    8086
    81 PassOwnPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, size_t maxStackSize)
    82 {
    83     v8::HandleScope scope;
    84     v8::Context::Scope contextScope(context);
     87const int ScriptCallStack::maxCallStackSizeToCapture = 200;
     88const v8::StackTrace::StackTraceOptions ScriptCallStack::stackTraceOptions = static_cast<v8::StackTrace::StackTraceOptions>(
     89     v8::StackTrace::kLineNumber
     90    | v8::StackTrace::kColumnOffset
     91    | v8::StackTrace::kScriptNameOrSourceURL
     92    | v8::StackTrace::kFunctionName);
    8593
    86     Vector<ScriptCallFrame> scriptCallFrames;
    87     toScriptCallFramesVector(context, stackTrace, scriptCallFrames, maxStackSize);
    88     return new ScriptCallStack(scriptCallFrames);
    89 }
    9094
    91 PassOwnPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize)
     95PassOwnPtr<ScriptCallStack> ScriptCallStack::create(const v8::Arguments& arguments, unsigned skipArgumentCount, int framCountLimit)
    9296{
    9397    v8::HandleScope scope;
    9498    v8::Local<v8::Context> context = v8::Context::GetCurrent();
    95     // TODO(yurys): remove?
    9699    v8::Context::Scope contextScope(context);
    97     v8::Handle<v8::StackTrace> stackTrace(v8::StackTrace::CurrentStackTrace(maxStackSize, stackTraceOptions));
    98     return createScriptCallStack(context, stackTrace, maxStackSize);
     100    v8::Handle<v8::StackTrace> stackTrace(v8::StackTrace::CurrentStackTrace(framCountLimit, ScriptCallStack::stackTraceOptions));
     101
     102    if (stackTrace.IsEmpty())
     103        return 0;
     104
     105    String sourceName;
     106    int sourceLineNumber;
     107    String functionName;
     108    getTopFrameLocation(stackTrace, &sourceName, &sourceLineNumber, &functionName);
     109
     110    Vector<OwnPtr<ScriptCallFrame> > scriptCallFrames;
     111    if (framCountLimit > 1)
     112        toScriptCallFramesVector(context, stackTrace, scriptCallFrames);
     113
     114    return new ScriptCallStack(ScriptState::forContext(context), new ScriptCallFrame(functionName, sourceName, sourceLineNumber, arguments, skipArgumentCount), scriptCallFrames);
    99115}
    100116
    101 PassOwnPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount)
     117PassOwnPtr<ScriptCallStack> ScriptCallStack::create(ScriptState* state, v8::Handle<v8::StackTrace> stackTrace)
    102118{
    103119    v8::HandleScope scope;
    104     v8::Local<v8::Context> context = v8::Context::GetCurrent();
    105     ScriptState* state = ScriptState::forContext(context);
     120    Vector<OwnPtr<ScriptCallFrame> > scriptCallFrames;
     121    toScriptCallFramesVector(state->context(), stackTrace, scriptCallFrames);
    106122
    107     Vector<ScriptValue> arguments;
    108     for (int i = skipArgumentCount; i < v8arguments.Length(); ++i)
    109         arguments.append(ScriptValue(v8arguments[i]));
     123    String sourceName;
     124    int sourceLineNumber;
     125    String functionName;
     126    getTopFrameLocation(stackTrace, &sourceName, &sourceLineNumber, &functionName);
    110127
    111     return new ScriptArguments(state, arguments);
     128    return new ScriptCallStack(state, new ScriptCallFrame(functionName, sourceName, sourceLineNumber), scriptCallFrames);
    112129}
     130
     131ScriptCallStack::ScriptCallStack(ScriptState* scriptState, PassOwnPtr<ScriptCallFrame> topFrame, Vector<OwnPtr<ScriptCallFrame> >& scriptCallFrames)
     132    : m_topFrame(topFrame)
     133    , m_scriptState(scriptState)
     134{
     135    m_scriptCallFrames.swap(scriptCallFrames);
     136}
     137
     138ScriptCallStack::~ScriptCallStack()
     139{
     140}
     141
     142const ScriptCallFrame& ScriptCallStack::at(unsigned index)
     143{
     144    if (!index && m_topFrame)
     145        return *m_topFrame;
     146    return *m_scriptCallFrames.at(index);
     147}
     148
     149unsigned ScriptCallStack::size()
     150{
     151    if (m_scriptCallFrames.isEmpty())
     152        return 1;
     153    return m_scriptCallFrames.size();
     154}
     155
    113156
    114157bool ScriptCallStack::stackTrace(int frameLimit, const RefPtr<InspectorArray>& stackTrace)
  • trunk/WebCore/bindings/v8/ScriptCallStack.h

    r70299 r70300  
    11/*
    2  * Copyright (c) 2008, 2010 Google Inc. All rights reserved.
    3  * 
     2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
     3 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are
    66 * met:
    7  * 
     7 *
    88 *     * Redistributions of source code must retain the above copyright
    99 * notice, this list of conditions and the following disclaimer.
     
    3333
    3434#include "ScriptCallFrame.h"
     35#include "ScriptState.h"
     36#include "ScriptValue.h"
    3537#include <wtf/Noncopyable.h>
    36 #include <wtf/Vector.h>
     38#include <wtf/RefPtr.h>
     39
     40namespace v8 {
     41    class Arguments;
     42}
    3743
    3844namespace WebCore {
     
    4248class ScriptCallStack : public Noncopyable {
    4349public:
    44     static const size_t maxCallStackSizeToCapture = 200;
     50    static const int maxCallStackSizeToCapture;
     51    static const v8::StackTrace::StackTraceOptions stackTraceOptions;
    4552
    46     ScriptCallStack(Vector<ScriptCallFrame>&);
     53    static PassOwnPtr<ScriptCallStack> create(const v8::Arguments&, unsigned skipArgumentCount = 0, int framCountLimit = 1);
     54    static PassOwnPtr<ScriptCallStack> create(ScriptState*, v8::Handle<v8::StackTrace>);
    4755    ~ScriptCallStack();
    4856
    49     const ScriptCallFrame &at(size_t);
    50     size_t size();
    51     static bool stackTrace(int, const RefPtr<InspectorArray>&);
     57    // Returns false if there is no running JavaScript or if fetching the stack failed.
     58    // Sets stackTrace to be an array of stack frame objects.
     59    // A stack frame object looks like:
     60    // {
     61    //   scriptName: <file name for the associated script resource>
     62    //   functionName: <name of the JavaScript function>
     63    //   lineNumber: <1 based line number>
     64    //   column: <1 based column offset on the line>
     65    // }
     66    static bool stackTrace(int frameLimit, const RefPtr<InspectorArray>& stackTrace);
    5267
    53     bool isEqual(ScriptCallStack*) const;
    54     PassRefPtr<InspectorArray> buildInspectorObject() const;
     68    const ScriptCallFrame& at(unsigned);
     69    unsigned size();
     70
     71    ScriptState* state() const { return m_scriptState; }
     72    ScriptState* globalState() const { return m_scriptState; }
    5573
    5674private:
    57     Vector<ScriptCallFrame> m_frames;
     75    ScriptCallStack(ScriptState* scriptState, PassOwnPtr<ScriptCallFrame> topFrame, Vector<OwnPtr<ScriptCallFrame> >& scriptCallFrames);
     76    ScriptCallStack(ScriptState* scriptState, v8::Handle<v8::StackTrace> stackTrace);
     77
     78    OwnPtr<ScriptCallFrame> m_topFrame;
     79    ScriptState* m_scriptState;
     80    Vector<OwnPtr<ScriptCallFrame> > m_scriptCallFrames;
    5881};
    5982
  • trunk/WebCore/bindings/v8/ScriptController.cpp

    r70298 r70300  
    3636#include "Document.h"
    3737#include "ScriptCallStack.h"
    38 #include "ScriptCallStackFactory.h"
    3938#include "ScriptableDocumentParser.h"
    4039#include "DOMWindow.h"
     
    470469void ScriptController::setCaptureCallStackForUncaughtExceptions(bool value)
    471470{
    472     v8::V8::SetCaptureStackTraceForUncaughtExceptions(value, ScriptCallStack::maxCallStackSizeToCapture, stackTraceOptions);
     471    v8::V8::SetCaptureStackTraceForUncaughtExceptions(value, ScriptCallStack::maxCallStackSizeToCapture, ScriptCallStack::stackTraceOptions);
    473472}
    474473#endif
  • trunk/WebCore/bindings/v8/ScriptState.h

    r70298 r70300  
    9696        }
    9797    }
    98     ScriptState* get() const { return m_scriptState; }
     98    ScriptState* get() { return m_scriptState; }
    9999private:
    100100    ScriptState* m_scriptState;
  • trunk/WebCore/bindings/v8/V8ConsoleMessage.cpp

    r70298 r70300  
    3838#include "Page.h"
    3939#include "ScriptCallStack.h"
    40 #include "ScriptCallStackFactory.h"
    4140#include "V8Binding.h"
    4241#include "V8Proxy.h"
     
    119118    if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) {
    120119        v8::Local<v8::Context> context = v8::Context::GetEntered();
    121         callStack = createScriptCallStack(context, stackTrace, ScriptCallStack::maxCallStackSizeToCapture);
     120        ScriptState* scriptState = ScriptState::forContext(context);
     121        callStack = ScriptCallStack::create(scriptState, stackTrace);
    122122    }
    123123
     
    126126    String resourceNameString = useURL ? frame->document()->url() : toWebCoreString(resourceName);
    127127    V8ConsoleMessage consoleMessage(errorMessage, resourceNameString, message->GetLineNumber());
    128     consoleMessage.dispatchNow(page, callStack.release());
     128    consoleMessage.dispatchNow(page, callStack.get());
    129129}
    130130
    131 void V8ConsoleMessage::dispatchNow(Page* page, PassOwnPtr<ScriptCallStack> callStack)
     131void V8ConsoleMessage::dispatchNow(Page* page, ScriptCallStack* callStack)
    132132{
    133133    ASSERT(page);
  • trunk/WebCore/bindings/v8/V8ConsoleMessage.h

    r70298 r70300  
    3434#include "PlatformString.h"
    3535#include <v8.h>
    36 #include <wtf/PassOwnPtr.h>
    3736#include <wtf/Vector.h>
    3837
     
    8382        const unsigned m_lineNumber;
    8483
    85         void dispatchNow(Page*, PassOwnPtr<ScriptCallStack>);
     84        void dispatchNow(Page*, ScriptCallStack*);
    8685
    8786        // All delayed messages are stored in this vector. If the vector
  • trunk/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp

    • Property svn:executable deleted
    r70298 r70300  
    3434
    3535#include "Console.h"
    36 #include "ScriptArguments.h"
    3736#include "ScriptCallStack.h"
    38 #include "ScriptCallStackFactory.h"
    3937#include "ScriptProfile.h"
    4038#include "V8Binding.h"
    41 #include "V8BindingMacros.h"
    4239#include "V8Proxy.h"
    4340#include "V8ScriptProfile.h"
     
    6663    INC_STATS("DOM.Console.traceCallback");
    6764    Console* imp = V8Console::toNative(args.Holder());
    68     OwnPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture));
    69     OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 0));
    70     imp->trace(scriptArguments.release(), callStack.release());
     65    v8::HandleScope handleScope;
     66    ScriptState* scriptState = ScriptState::current();
     67    v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(ScriptCallStack::maxCallStackSizeToCapture, ScriptCallStack::stackTraceOptions);
     68    OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(scriptState, stackTrace));
     69    imp->trace(callStack.get());
    7170    return v8::Handle<v8::Value>();
    7271}
     
    7675    INC_STATS("DOM.Console.assertCallback");
    7776    Console* imp = V8Console::toNative(args.Holder());
    78     OwnPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture));
     77    OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(args, 1, ScriptCallStack::maxCallStackSizeToCapture));
    7978    bool condition = args[0]->BooleanValue();
    80     OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1));
    81     imp->assertCondition(condition, scriptArguments.release(), callStack.release());
    82     return v8::Handle<v8::Value>();
    83 }
    84 
    85 v8::Handle<v8::Value> V8Console::profileCallback(const v8::Arguments& args)
    86 {
    87     INC_STATS("DOM.Console.profile");
    88     Console* imp = V8Console::toNative(args.Holder());
    89     OwnPtr<ScriptCallStack> callStack(createScriptCallStack(1));
    90     if (!callStack)
    91         return v8::Undefined();
    92     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<WithUndefinedOrNullCheck>, title, args[0]);
    93     imp->profile(title, ScriptState::current(), callStack.release());
    94     return v8::Handle<v8::Value>();
    95 }
    96 
    97 v8::Handle<v8::Value> V8Console::profileEndCallback(const v8::Arguments& args)
    98 {
    99     INC_STATS("DOM.Console.profileEnd");
    100     Console* imp = V8Console::toNative(args.Holder());
    101     OwnPtr<ScriptCallStack> callStack(createScriptCallStack(1));
    102     if (!callStack)
    103         return v8::Undefined();
    104     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<WithUndefinedOrNullCheck>, title, args[0]);
    105     imp->profileEnd(title, ScriptState::current(), callStack.release());
     79    imp->assertCondition(condition, callStack.get());
    10680    return v8::Handle<v8::Value>();
    10781}
  • trunk/WebCore/dom/NodeFilter.h

    r70298 r70300  
    2626#define NodeFilter_h
    2727
    28 #include "DOMWrapperWorld.h"
    2928#include "NodeFilterCondition.h"
    3029#include <wtf/RefPtr.h>
  • trunk/WebCore/inspector/ConsoleMessage.cpp

    r70298 r70300  
    3434#include "InjectedScript.h"
    3535#include "InjectedScriptHost.h"
    36 #include "InspectorFrontend.h"
    3736#include "InspectorValues.h"
    38 #include "ScriptArguments.h"
    3937#include "ScriptCallStack.h"
    4038#include "ScriptValue.h"
    41 #include <wtf/PassOwnPtr.h>
     39
     40#if ENABLE(INSPECTOR)
     41#include "InspectorFrontend.h"
     42#endif
    4243
    4344namespace WebCore {
     45
     46ConsoleMessage::CallFrame::CallFrame(const ScriptCallFrame& frame)
     47    : m_functionName(frame.functionName())
     48    , m_sourceURL(frame.sourceURL())
     49    , m_lineNumber(frame.lineNumber())
     50{
     51}
     52
     53ConsoleMessage::CallFrame::CallFrame()
     54    : m_lineNumber(0)
     55{
     56}
     57
     58bool ConsoleMessage::CallFrame::isEqual(const ConsoleMessage::CallFrame& o) const
     59{
     60    return m_functionName == o.m_functionName
     61        && m_sourceURL == o.m_sourceURL
     62        && m_lineNumber == o.m_lineNumber;
     63}
     64
     65#if ENABLE(INSPECTOR)
     66PassRefPtr<InspectorObject> ConsoleMessage::CallFrame::buildInspectorObject() const
     67{
     68    RefPtr<InspectorObject> frame = InspectorObject::create();
     69    frame->setString("functionName", m_functionName);
     70    frame->setString("sourceURL", m_sourceURL);
     71    frame->setNumber("lineNumber", m_lineNumber);
     72    return frame;
     73}
     74#endif
    4475
    4576ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, const String& m, unsigned li, const String& u, unsigned g)
     
    5586}
    5687
    57 ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, const String& m, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack, unsigned g)
     88ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, const String& m, ScriptCallStack* callStack, unsigned g, bool storeTrace)
    5889    : m_source(s)
    5990    , m_type(t)
    6091    , m_level(l)
    6192    , m_message(m)
    62     , m_arguments(arguments)
    63     , m_callStack(callStack)
     93#if ENABLE(INSPECTOR)
     94    , m_arguments(callStack->at(0).argumentCount())
     95    , m_scriptState(callStack->globalState())
     96#endif
     97    , m_frames(storeTrace ? callStack->size() : 0)
    6498    , m_groupLevel(g)
    6599    , m_repeatCount(1)
    66100{
    67     const ScriptCallFrame& lastCaller = m_callStack->at(0);
     101    const ScriptCallFrame& lastCaller = callStack->at(0);
    68102    m_line = lastCaller.lineNumber();
    69103    m_url = lastCaller.sourceURL();
    70104
     105    if (storeTrace) {
     106        for (unsigned i = 0; i < callStack->size(); ++i)
     107            m_frames[i] = ConsoleMessage::CallFrame(callStack->at(i));
     108    }
    71109
    72     bool storeTrace = (t == TraceMessageType || t == UncaughtExceptionMessageType || t == AssertMessageType);
    73     if (!storeTrace)
    74         m_callStack.clear();
     110#if ENABLE(INSPECTOR)
     111    for (unsigned i = 0; i < lastCaller.argumentCount(); ++i)
     112        m_arguments[i] = lastCaller.argumentAt(i);
     113#endif
    75114}
    76115
     116#if ENABLE(INSPECTOR)
    77117void ConsoleMessage::addToFrontend(InspectorFrontend* frontend, InjectedScriptHost* injectedScriptHost)
    78118{
     
    86126    jsonObj->setNumber("repeatCount", static_cast<int>(m_repeatCount));
    87127    jsonObj->setString("message", m_message);
    88     if (m_arguments && m_arguments->argumentCount()) {
    89         InjectedScript injectedScript = injectedScriptHost->injectedScriptFor(m_arguments->globalState());
     128    if (!m_arguments.isEmpty()) {
     129        InjectedScript injectedScript = injectedScriptHost->injectedScriptFor(m_scriptState.get());
    90130        if (!injectedScript.hasNoValue()) {
    91131            RefPtr<InspectorArray> jsonArgs = InspectorArray::create();
    92             for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) {
    93                 RefPtr<InspectorValue> inspectorValue = injectedScript.wrapForConsole(m_arguments->argumentAt(i));
     132            for (unsigned i = 0; i < m_arguments.size(); ++i) {
     133                RefPtr<InspectorValue> inspectorValue = injectedScript.wrapForConsole(m_arguments[i]);
    94134                if (!inspectorValue) {
    95135                    ASSERT_NOT_REACHED();
     
    101141        }
    102142    }
    103     if (m_callStack)
    104         jsonObj->setArray("stackTrace", m_callStack->buildInspectorObject());
     143    if (!m_frames.isEmpty()) {
     144        RefPtr<InspectorArray> frames = InspectorArray::create();
     145        for (unsigned i = 0; i < m_frames.size(); i++)
     146            frames->pushObject(m_frames.at(i).buildInspectorObject());
     147        jsonObj->setArray("stackTrace", frames);
     148    }
    105149    frontend->addConsoleMessage(jsonObj);
    106150}
     
    110154    frontend->updateConsoleMessageRepeatCount(m_repeatCount);
    111155}
     156#endif // ENABLE(INSPECTOR)
    112157
    113158bool ConsoleMessage::isEqual(ConsoleMessage* msg) const
    114159{
    115     if (m_arguments) {
    116         if (!m_arguments->isEqual(msg->m_arguments.get()))
     160#if ENABLE(INSPECTOR)
     161    if (msg->m_arguments.size() != m_arguments.size())
     162        return false;
     163    if (!msg->m_scriptState.get() && msg->m_arguments.size()) {
     164        ASSERT_NOT_REACHED();
     165        return false;
     166    }
     167
     168    for (size_t i = 0; i < m_arguments.size(); ++i) {
     169        if (!m_arguments[i].isEqual(msg->m_scriptState.get(), msg->m_arguments[i]))
    117170            return false;
    118     } else if (msg->m_arguments)
     171    }
     172#endif // ENABLE(INSPECTOR)
     173
     174    size_t frameCount = msg->m_frames.size();
     175    if (frameCount != m_frames.size())
    119176        return false;
    120177
    121     if (m_callStack) {
    122         if (!m_callStack->isEqual(msg->m_callStack.get()))
     178    for (size_t i = 0; i < frameCount; ++i) {
     179        if (!m_frames[i].isEqual(msg->m_frames[i]))
    123180            return false;
    124     } else if (msg->m_callStack)
    125         return false;
     181    }
    126182
    127183    return msg->m_source == m_source
  • trunk/WebCore/inspector/ConsoleMessage.h

    r70298 r70300  
    22 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
    4  * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
     4 * Copyright (C) 2009 Google Inc. All rights reserved.
    55 *
    66 * Redistribution and use in source and binary forms, with or without
     
    3333
    3434#include "Console.h"
     35#include "KURL.h"
    3536#include "ScriptState.h"
    3637
    37 #include <wtf/Forward.h>
    3838#include <wtf/Vector.h>
    3939
     
    4242class InspectorFrontend;
    4343class InspectorObject;
    44 class ScriptArguments;
    4544class ScriptCallFrame;
    4645class ScriptCallStack;
     
    5049public:
    5150    ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, unsigned li, const String& u, unsigned g);
    52     ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>, unsigned g);
     51    ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, ScriptCallStack*, unsigned g, bool storeTrace = false);
    5352
     53#if ENABLE(INSPECTOR)
    5454    void addToFrontend(InspectorFrontend*, InjectedScriptHost*);
    5555    void updateRepeatCountInConsole(InspectorFrontend* frontend);
     56#endif
    5657    void incrementCount() { ++m_repeatCount; }
    5758    bool isEqual(ConsoleMessage* msg) const;
     
    6162
    6263private:
     64    class CallFrame {
     65    public:
     66        explicit CallFrame(const ScriptCallFrame& frame);
     67        CallFrame();
     68        bool isEqual(const CallFrame& o) const;
     69#if ENABLE(INSPECTOR)
     70        PassRefPtr<InspectorObject> buildInspectorObject() const;
     71#endif
     72
     73    private:
     74        String m_functionName;
     75        String m_sourceURL;
     76        unsigned m_lineNumber;
     77    };
     78
    6379    MessageSource m_source;
    6480    MessageType m_type;
    6581    MessageLevel m_level;
    6682    String m_message;
    67     OwnPtr<ScriptArguments> m_arguments;
    68     OwnPtr<ScriptCallStack> m_callStack;
     83#if ENABLE(INSPECTOR)
     84    Vector<ScriptValue> m_arguments;
     85    ScriptStateProtectedPtr m_scriptState;
     86#endif
     87    Vector<CallFrame> m_frames;
    6988    unsigned m_line;
    7089    String m_url;
  • trunk/WebCore/inspector/InspectorController.cpp

    r70298 r70300  
    8383#include "ResourceRequest.h"
    8484#include "ResourceResponse.h"
    85 #include "ScriptArguments.h"
    8685#include "ScriptCallStack.h"
    8786#include "ScriptFunctionCall.h"
     
    341340}
    342341
    343 void InspectorController::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
    344 {
    345     if (!enabled())
    346         return;
    347 
    348     addConsoleMessage(new ConsoleMessage(source, type, level, message, arguments, callStack, m_groupLevel));
     342void InspectorController::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, ScriptCallStack* callStack, const String& message)
     343{
     344    if (!enabled())
     345        return;
     346
     347    bool storeStackTrace = type == TraceMessageType || type == UncaughtExceptionMessageType || type == AssertMessageType;
     348    addConsoleMessage(new ConsoleMessage(source, type, level, message, callStack, m_groupLevel, storeStackTrace));
    349349}
    350350
     
    392392}
    393393
    394 void InspectorController::startGroup(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack, bool collapsed)
     394void InspectorController::startGroup(MessageSource source, ScriptCallStack* callStack, bool collapsed)
    395395{
    396396    ++m_groupLevel;
    397397
    398     addConsoleMessage(new ConsoleMessage(JSMessageSource, collapsed ? StartGroupCollapsedMessageType : StartGroupMessageType, LogMessageLevel, "", arguments, callStack, m_groupLevel));
     398    addConsoleMessage(new ConsoleMessage(source, collapsed ? StartGroupCollapsedMessageType : StartGroupMessageType, LogMessageLevel, String(), callStack, m_groupLevel));
    399399}
    400400
  • trunk/WebCore/inspector/InspectorController.h

    r70298 r70300  
    8282class ResourceResponse;
    8383class ResourceError;
    84 class ScriptArguments;
    8584class ScriptCallStack;
    8685class ScriptProfile;
     
    147146
    148147    void setConsoleMessagesEnabled(bool enabled, bool* newState);
    149     void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack>);
    150     void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String&);
     148    void addMessageToConsole(MessageSource, MessageType, MessageLevel, ScriptCallStack*, const String& message);
     149    void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
    151150    void clearConsoleMessages();
    152151    const Vector<OwnPtr<ConsoleMessage> >& consoleMessages() const { return m_consoleMessages; }
     
    234233    bool stopTiming(const String& title, double& elapsed);
    235234
    236     void startGroup(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack> callFrame, bool collapsed = false);
     235    void startGroup(MessageSource source, ScriptCallStack* callFrame, bool collapsed = false);
    237236    void endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL);
    238237
  • trunk/WebCore/page/Console.cpp

    r70298 r70300  
    4242#include "PlatformString.h"
    4343
    44 #include "ScriptArguments.h"
    4544#include "ScriptCallStack.h"
    4645#include "ScriptProfile.h"
     
    7978}
    8079
     80static bool getFirstArgumentAsString(ScriptState* scriptState, const ScriptCallFrame& callFrame, String& result, bool checkForNullOrUndefined = false)
     81{
     82    if (!callFrame.argumentCount())
     83        return false;
     84
     85    const ScriptValue& value = callFrame.argumentAt(0);
     86    if (checkForNullOrUndefined && (value.isNull() || value.isUndefined()))
     87        return false;
     88
     89    result = value.toString(scriptState);
     90    return true;
     91}
     92
    8193static void printMessageSourceAndLevelPrefix(MessageSource source, MessageLevel level)
    8294{
     
    133145}
    134146
    135 void Console::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
    136 {
    137     addMessage(source, type, level, message, lineNumber, sourceURL, 0);
    138 }
    139 
    140 void Console::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL, PassOwnPtr<ScriptCallStack> callStack)
     147void Console::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL, ScriptCallStack* callStack)
    141148{
    142149    Page* page = this->page();
     
    149156#if ENABLE(INSPECTOR)
    150157    if (callStack)
    151         page->inspectorController()->addMessageToConsole(source, type, level, message, 0, callStack);
     158        page->inspectorController()->addMessageToConsole(source, type, level, callStack, message);
    152159    else
    153160        page->inspectorController()->addMessageToConsole(source, type, level, message, lineNumber, sourceURL);
     
    163170}
    164171
    165 void Console::addMessage(MessageType type, MessageLevel level, PassOwnPtr<ScriptArguments> arguments,  PassOwnPtr<ScriptCallStack> callStack, bool acceptNoArguments)
    166 {
    167     Page* page = this->page();
    168     if (!page)
    169         return;
    170 
    171     const ScriptCallFrame& lastCaller = callStack->at(0);
    172 
    173     if (!acceptNoArguments && !arguments->argumentCount())
     172void Console::addMessage(MessageType type, MessageLevel level, ScriptCallStack* callStack, bool acceptNoArguments)
     173{
     174    Page* page = this->page();
     175    if (!page)
     176        return;
     177
     178    const ScriptCallFrame& lastCaller = callStack->at(0);
     179
     180    if (!acceptNoArguments && !lastCaller.argumentCount())
    174181        return;
    175182
    176183    String message;
    177     if (arguments->getFirstArgumentAsString(message))
     184    if (getFirstArgumentAsString(callStack->state(), lastCaller, message))
    178185        page->chrome()->client()->addMessageToConsole(JSMessageSource, type, level, message, lastCaller.lineNumber(), lastCaller.sourceURL());
    179186
    180187#if ENABLE(INSPECTOR)
    181     page->inspectorController()->addMessageToConsole(JSMessageSource, type, level, "", arguments, callStack);
     188    page->inspectorController()->addMessageToConsole(JSMessageSource, type, level, callStack, message);
    182189#endif
    183190
     
    188195    printMessageSourceAndLevelPrefix(JSMessageSource, level);
    189196
    190     for (unsigned i = 0; i < arguments->argumentCount(); ++i) {
     197    for (unsigned i = 0; i < lastCaller.argumentCount(); ++i) {
    191198        String argAsString;
    192         if (arguments->argumentAt(i).getString(arguments->globalState(), argAsString))
     199        if (lastCaller.argumentAt(i).getString(callStack->state(), argAsString))
    193200            printf(" %s", argAsString.utf8().data());
    194201    }
     
    196203}
    197204
    198 void Console::debug(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
     205void Console::debug(ScriptCallStack* callStack)
    199206{
    200207    // In Firebug, console.debug has the same behavior as console.log. So we'll do the same.
    201     log(arguments, callStack);
    202 }
    203 
    204 void Console::error(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
    205 {
    206     addMessage(LogMessageType, ErrorMessageLevel, arguments, callStack);
    207 }
    208 
    209 void Console::info(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
    210 {
    211     log(arguments, callStack);
    212 }
    213 
    214 void Console::log(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
    215 {
    216     addMessage(LogMessageType, LogMessageLevel, arguments, callStack);
    217 }
    218 
    219 void Console::dir(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
    220 {
    221     addMessage(ObjectMessageType, LogMessageLevel, arguments, callStack);
    222 }
    223 
    224 void Console::dirxml(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
     208    log(callStack);
     209}
     210
     211void Console::error(ScriptCallStack* callStack)
     212{
     213    addMessage(LogMessageType, ErrorMessageLevel, callStack);
     214}
     215
     216void Console::info(ScriptCallStack* callStack)
     217{
     218    log(callStack);
     219}
     220
     221void Console::log(ScriptCallStack* callStack)
     222{
     223    addMessage(LogMessageType, LogMessageLevel, callStack);
     224}
     225
     226void Console::dir(ScriptCallStack* callStack)
     227{
     228    addMessage(ObjectMessageType, LogMessageLevel, callStack);
     229}
     230
     231void Console::dirxml(ScriptCallStack* callStack)
    225232{
    226233    // The standard behavior of our console.log will print the DOM tree for nodes.
    227     log(arguments, callStack);
    228 }
    229 
    230 void Console::trace(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
    231 {
    232     addMessage(TraceMessageType, LogMessageLevel, arguments, callStack, true);
     234    log(callStack);
     235}
     236
     237void Console::trace(ScriptCallStack* callStack)
     238{
     239    addMessage(TraceMessageType, LogMessageLevel, callStack, true);
    233240
    234241    if (!shouldPrintExceptions())
     
    242249}
    243250
    244 void Console::assertCondition(bool condition, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
     251void Console::assertCondition(bool condition, ScriptCallStack* callStack)
    245252{
    246253    if (condition)
    247254        return;
    248255
    249     addMessage(AssertMessageType, ErrorMessageLevel, arguments, callStack, true);
    250 }
    251 
    252 void Console::count(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
     256    addMessage(AssertMessageType, ErrorMessageLevel, callStack, true);
     257}
     258
     259void Console::count(ScriptCallStack* callStack)
    253260{
    254261#if ENABLE(INSPECTOR)
     
    261268    // the same bucket as no argument
    262269    String title;
    263     arguments->getFirstArgumentAsString(title);
     270    getFirstArgumentAsString(callStack->state(), lastCaller, title);
    264271
    265272    page->inspectorController()->count(title, lastCaller.lineNumber(), lastCaller.sourceURL());
     
    269276}
    270277
    271 void Console::markTimeline(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack>)
    272 {
    273 #if ENABLE(INSPECTOR)
    274     Page* page = this->page();
    275     if (!page)
    276         return;
    277 
     278void Console::markTimeline(ScriptCallStack* callStack)
     279{
     280#if ENABLE(INSPECTOR)
     281    Page* page = this->page();
     282    if (!page)
     283        return;
     284
     285    const ScriptCallFrame& lastCaller = callStack->at(0);
    278286    String message;
    279     arguments->getFirstArgumentAsString(message);
     287    getFirstArgumentAsString(callStack->state(), lastCaller, message);
    280288
    281289    page->inspectorController()->markTimeline(message);
    282290#else
    283     UNUSED_PARAM(arguments);
     291    UNUSED_PARAM(callStack);
    284292#endif
    285293}
     
    314322#if ENABLE(JAVASCRIPT_DEBUGGER)
    315323
    316 void Console::profile(const String& title, ScriptState* state, PassOwnPtr<ScriptCallStack> callStack)
     324void Console::profile(const String& title, ScriptCallStack* callStack)
    317325{
    318326    Page* page = this->page();
     
    335343#endif
    336344
    337     ScriptProfiler::start(state, resolvedTitle);
     345    ScriptProfiler::start(callStack->state(), resolvedTitle);
    338346
    339347#if ENABLE(INSPECTOR)
     
    343351}
    344352
    345 void Console::profileEnd(const String& title, ScriptState* state, PassOwnPtr<ScriptCallStack> callStack)
     353void Console::profileEnd(const String& title, ScriptCallStack* callStack)
    346354{
    347355    Page* page = this->page();
     
    355363#endif
    356364
    357     RefPtr<ScriptProfile> profile = ScriptProfiler::stop(state, title);
     365    RefPtr<ScriptProfile> profile = ScriptProfiler::stop(callStack->state(), title);
    358366    if (!profile)
    359367        return;
     
    387395}
    388396
    389 void Console::timeEnd(const String& title, PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack> callStack)
     397void Console::timeEnd(const String& title, ScriptCallStack* callStack)
    390398{
    391399#if ENABLE(INSPECTOR)
     
    413421}
    414422
    415 void Console::group(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
    416 {
    417 #if ENABLE(INSPECTOR)
    418     Page* page = this->page();
    419     if (!page)
    420         return;
    421 
    422     page->inspectorController()->startGroup(arguments, callStack);
    423 #else
    424     UNUSED_PARAM(arguments);
     423void Console::group(ScriptCallStack* callStack)
     424{
     425#if ENABLE(INSPECTOR)
     426    Page* page = this->page();
     427    if (!page)
     428        return;
     429
     430    page->inspectorController()->startGroup(JSMessageSource, callStack);
     431#else
    425432    UNUSED_PARAM(callStack);
    426433#endif
    427434}
    428435
    429 void Console::groupCollapsed(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
    430 {
    431 #if ENABLE(INSPECTOR)
    432     Page* page = this->page();
    433     if (!page)
    434         return;
    435 
    436     page->inspectorController()->startGroup(arguments, callStack, true);
    437 #else
    438     UNUSED_PARAM(arguments);
     436void Console::groupCollapsed(ScriptCallStack* callStack)
     437{
     438#if ENABLE(INSPECTOR)
     439    Page* page = this->page();
     440    if (!page)
     441        return;
     442
     443    page->inspectorController()->startGroup(JSMessageSource, callStack, true);
     444#else
    439445    UNUSED_PARAM(callStack);
    440446#endif
     
    452458}
    453459
    454 bool Console::shouldCaptureFullStackTrace() const
    455 {
    456 #if ENABLE(INSPECTOR)
    457     Page* page = this->page();
    458     if (!page)
    459         return false;
    460 
    461     return page->inspectorController()->hasFrontend();
    462 #else
    463     return false;
    464 #endif
    465 }
    466 
    467 void Console::warn(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
    468 {
    469     addMessage(LogMessageType, WarningMessageLevel, arguments, callStack);
     460void Console::warn(ScriptCallStack* callStack)
     461{
     462    addMessage(LogMessageType, WarningMessageLevel, callStack);
    470463}
    471464
  • trunk/WebCore/page/Console.h

    r70298 r70300  
    3333#include "PlatformString.h"
    3434#include "ScriptProfile.h"
    35 #include "ScriptState.h"
    3635
    3736#include <wtf/Forward.h>
     
    4039
    4140namespace WebCore {
    42 
    43 class ScriptArguments;
    4441
    4542#if ENABLE(JAVASCRIPT_DEBUGGER)
     
    8784    void disconnectFrame();
    8885
    89     void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
    90     void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL, PassOwnPtr<ScriptCallStack> callStack);
     86    void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL, ScriptCallStack* callStack = 0);
    9187
    92     void debug(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
    93     void error(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
    94     void info(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
    95     void log(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
    96     void warn(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
    97     void dir(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
    98     void dirxml(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
    99     void trace(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
    100     void assertCondition(bool condition, PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
    101     void count(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
    102     void markTimeline(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
     88    void debug(ScriptCallStack*);
     89    void error(ScriptCallStack*);
     90    void info(ScriptCallStack*);
     91    void log(ScriptCallStack*);
     92    void warn(ScriptCallStack*);
     93    void dir(ScriptCallStack*);
     94    void dirxml(ScriptCallStack*);
     95    void trace(ScriptCallStack*);
     96    void assertCondition(bool condition, ScriptCallStack*);
     97    void count(ScriptCallStack*);
     98    void markTimeline(ScriptCallStack*);
    10399#if ENABLE(WML)
    104100    String lastWMLErrorMessage() const;
    105101#endif
    106102#if ENABLE(JAVASCRIPT_DEBUGGER)
    107     const ProfilesArray& profiles() const { return m_profiles; }
    108     void profile(const String&, ScriptState*, PassOwnPtr<ScriptCallStack>);
    109     void profileEnd(const String&, ScriptState*, PassOwnPtr<ScriptCallStack>);
     103    void profile(const String&, ScriptCallStack*);
     104    void profileEnd(const String&, ScriptCallStack*);
    110105#endif
    111106    void time(const String&);
    112     void timeEnd(const String&, PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
    113     void group(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
    114     void groupCollapsed(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
     107    void timeEnd(const String&, ScriptCallStack*);
     108    void group(ScriptCallStack*);
     109    void groupCollapsed(ScriptCallStack*);
    115110    void groupEnd();
    116 
    117     bool shouldCaptureFullStackTrace() const;
    118111
    119112    static bool shouldPrintExceptions();
    120113    static void setShouldPrintExceptions(bool);
     114
     115#if ENABLE(JAVASCRIPT_DEBUGGER)
     116    const ProfilesArray& profiles() const { return m_profiles; }
     117#endif
    121118
    122119    MemoryInfo* memory() const;
     
    124121private:
    125122    inline Page* page() const;
    126     void addMessage(MessageType, MessageLevel, PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>, bool acceptNoArguments = false);
     123    void addMessage(MessageType, MessageLevel, ScriptCallStack*, bool acceptNoArguments = false);
    127124
    128125    Console(Frame*);
  • trunk/WebCore/page/Console.idl

    r70298 r70300  
    3131    interface [OmitConstructor] Console {
    3232
     33#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
     34        readonly attribute [CustomGetter] Array profiles;
     35#endif
     36   
    3337        [CustomArgumentHandling] void debug();
    3438        [CustomArgumentHandling] void error();
     
    4852
    4953#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
    50         readonly attribute [CustomGetter] Array profiles;
    51         [Custom] void profile(in DOMString title);
    52         [Custom] void profileEnd(in DOMString title);
     54        [CustomArgumentHandling] void profile(in [ConvertUndefinedOrNullToNullString] DOMString title);
     55        [CustomArgumentHandling] void profileEnd(in [ConvertUndefinedOrNullToNullString] DOMString title);
    5356#endif
    5457
Note: See TracChangeset for help on using the changeset viewer.