[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
yurys at chromium.org
yurys at chromium.org
Wed Dec 22 14:49:44 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit afeee581a0f6c11687eee5933c5404d56532a47b
Author: yurys at chromium.org <yurys at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 21 13:58:06 2010 +0000
2010-10-21 Yury Semikhatsky <yurys at chromium.org>
Unreviewed. Revert r70232. Chromium compilation failure.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70235 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/Android.jscbindings.mk b/WebCore/Android.jscbindings.mk
index eea3537..3288059 100644
--- a/WebCore/Android.jscbindings.mk
+++ b/WebCore/Android.jscbindings.mk
@@ -166,7 +166,8 @@ LOCAL_SRC_FILES += \
bindings/js/ScheduledAction.cpp \
bindings/js/ScriptArray.cpp \
bindings/js/ScriptCachedFrameData.cpp \
- bindings/js/ScriptCallStackFactory.cpp \
+ bindings/js/ScriptCallFrame.cpp \
+ bindings/js/ScriptCallStack.cpp \
bindings/js/ScriptController.cpp \
bindings/js/ScriptEventListener.cpp \
bindings/js/ScriptFunctionCall.cpp \
diff --git a/WebCore/Android.v8bindings.mk b/WebCore/Android.v8bindings.mk
index 692b453..fdee6fb 100644
--- a/WebCore/Android.v8bindings.mk
+++ b/WebCore/Android.v8bindings.mk
@@ -49,7 +49,8 @@ LOCAL_SRC_FILES += \
bindings/v8/ScheduledAction.cpp \
bindings/v8/ScopedDOMDataStore.cpp \
bindings/v8/ScriptArray.cpp \
- bindings/v8/ScriptCallStackFactory.cpp \
+ bindings/v8/ScriptCallFrame.cpp \
+ bindings/v8/ScriptCallStack.cpp \
bindings/v8/ScriptController.cpp \
bindings/v8/ScriptEventListener.cpp \
bindings/v8/ScriptFunctionCall.cpp \
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index 8f5d621..42e344a 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -686,7 +686,8 @@ SET(WebCore_SOURCES
bindings/js/JSXSLTProcessorCustom.cpp
bindings/js/ScheduledAction.cpp
bindings/js/ScriptCachedFrameData.cpp
- bindings/js/ScriptCallStackFactory.cpp
+ bindings/js/ScriptCallFrame.cpp
+ bindings/js/ScriptCallStack.cpp
bindings/js/ScriptController.cpp
bindings/js/ScriptDebugServer.cpp
bindings/js/ScriptEventListener.cpp
@@ -1122,10 +1123,7 @@ SET(WebCore_SOURCES
inspector/InspectorState.cpp
inspector/InspectorStorageAgent.cpp
inspector/InspectorTimelineAgent.cpp
- inspector/ScriptArguments.cpp
inspector/ScriptBreakpoint.cpp
- inspector/ScriptCallFrame.cpp
- inspector/ScriptCallStack.cpp
inspector/TimelineRecordFactory.cpp
loader/Cache.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1370ec1..6cf8210 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,19 @@
2010-10-21 Yury Semikhatsky <yurys at chromium.org>
+ Unreviewed. Revert r70232. Chromium compilation failure.
+
+2010-10-21 Yury Semikhatsky <yurys at chromium.org>
+
+ Unreviewed. Revert r70233. Too many failures.
+
+2010-10-21 Yury Semikhatsky <yurys at chromium.org>
+
+ Unreviewed. Remove references to deleted headers from WebCore.pro
+
+ * WebCore.pro:
+
+2010-10-21 Yury Semikhatsky <yurys at chromium.org>
+
Reviewed by Pavel Feldman.
Web Inspector: decouple ScriptArguments from ScriptCallStack
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index be11b79..1f25500 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -816,8 +816,10 @@ webcore_sources += \
WebCore/bindings/js/ScheduledAction.h \
WebCore/bindings/js/ScriptCachedFrameData.cpp \
WebCore/bindings/js/ScriptCachedFrameData.h \
- WebCore/bindings/js/ScriptCallStackFactory.cpp \
- WebCore/bindings/js/ScriptCallStackFactory.h \
+ WebCore/bindings/js/ScriptCallFrame.cpp \
+ WebCore/bindings/js/ScriptCallFrame.h \
+ WebCore/bindings/js/ScriptCallStack.cpp \
+ WebCore/bindings/js/ScriptCallStack.h \
WebCore/bindings/js/ScriptController.cpp \
WebCore/bindings/js/ScriptController.h \
WebCore/bindings/js/ScriptDebugServer.cpp \
@@ -1849,14 +1851,8 @@ webcore_sources += \
WebCore/inspector/InspectorValues.cpp \
WebCore/inspector/InspectorValues.h \
WebCore/inspector/InspectorWorkerResource.h \
- WebCore/inspector/ScriptArguments.cpp \
- WebCore/inspector/ScriptArguments.h \
WebCore/inspector/ScriptBreakpoint.cpp \
WebCore/inspector/ScriptBreakpoint.h \
- WebCore/inspector/ScriptCallFrame.cpp \
- WebCore/inspector/ScriptCallFrame.h \
- WebCore/inspector/ScriptCallStack.cpp \
- WebCore/inspector/ScriptCallStack.h \
WebCore/inspector/ScriptDebugListener.h \
WebCore/inspector/ScriptGCEventListener.h \
WebCore/inspector/TimelineRecordFactory.cpp \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 0a78d9e..705a430 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -699,6 +699,10 @@
'bindings/js/ScheduledAction.h',
'bindings/js/ScriptCachedFrameData.cpp',
'bindings/js/ScriptCachedFrameData.h',
+ 'bindings/js/ScriptCallFrame.cpp',
+ 'bindings/js/ScriptCallFrame.h',
+ 'bindings/js/ScriptCallStack.cpp',
+ 'bindings/js/ScriptCallStack.h',
'bindings/js/ScriptController.cpp',
'bindings/js/ScriptController.h',
'bindings/js/ScriptControllerGtk.cpp',
@@ -865,8 +869,10 @@
'bindings/v8/ScopedDOMDataStore.cpp',
'bindings/v8/ScopedDOMDataStore.h',
'bindings/v8/ScriptCachedFrameData.h',
- 'bindings/v8/ScriptCallStackFactory.cpp',
- 'bindings/v8/ScriptCallStackFactory.h',
+ 'bindings/v8/ScriptCallFrame.cpp',
+ 'bindings/v8/ScriptCallFrame.h',
+ 'bindings/v8/ScriptCallStack.cpp',
+ 'bindings/v8/ScriptCallStack.h',
'bindings/v8/ScriptController.cpp',
'bindings/v8/ScriptController.h',
'bindings/v8/ScriptDebugServer.cpp',
@@ -1947,12 +1953,6 @@
'inspector/InspectorWorkerResource.h',
'inspector/ScriptBreakpoint.cpp',
'inspector/ScriptBreakpoint.h',
- 'inspector/ScriptArguments.cpp',
- 'inspector/ScriptArguments.h',
- 'inspector/ScriptCallFrame.cpp',
- 'inspector/ScriptCallFrame.h',
- 'inspector/ScriptCallStack.cpp',
- 'inspector/ScriptCallStack.h',
'inspector/ScriptDebugListener.h',
'inspector/ScriptGCEventListener.h',
'inspector/TimelineRecordFactory.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 9c09188..b6ac4ae 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -351,7 +351,8 @@ v8 {
bindings/v8/ScopedDOMDataStore.cpp \
# bindings/v8/ScriptArray.cpp \
bindings/v8/ScriptCachedFrameData.cpp \
- bindings/v8/ScriptCallStackFactory.cpp \
+ bindings/v8/ScriptCallFrame.cpp \
+ bindings/v8/ScriptCallStack.cpp \
bindings/ScriptControllerBase.cpp \
bindings/v8/ScriptController.cpp \
bindings/v8/ScriptEventListener.cpp \
@@ -573,7 +574,8 @@ v8 {
bindings/js/JSPopStateEventCustom.cpp \
bindings/js/JSWorkerContextErrorHandler.cpp \
bindings/js/ScriptCachedFrameData.cpp \
- bindings/js/ScriptCallStackFactory.cpp \
+ bindings/js/ScriptCallFrame.cpp \
+ bindings/js/ScriptCallStack.cpp \
bindings/js/ScriptController.cpp \
bindings/js/ScriptDebugServer.cpp \
bindings/js/ScriptEventListener.cpp \
@@ -1010,10 +1012,7 @@ SOURCES += \
inspector/InspectorStyleSheet.cpp \
inspector/InspectorTimelineAgent.cpp \
inspector/InspectorValues.cpp \
- inspector/ScriptArguments.cpp \
inspector/ScriptBreakpoint.cpp \
- inspector/ScriptCallFrame.cpp \
- inspector/ScriptCallStack.cpp \
inspector/TimelineRecordFactory.cpp \
loader/archive/ArchiveFactory.cpp \
loader/archive/ArchiveResource.cpp \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 6d863c2..fd9421c 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -60394,7 +60394,7 @@
>
</File>
<File
- RelativePath="..\bindings\js\ScriptCallStackFactory.cpp"
+ RelativePath="..\bindings\js\ScriptCallFrame.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -60446,7 +60446,63 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\ScriptCallStackFactory.h"
+ RelativePath="..\bindings\js\ScriptCallFrame.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\ScriptCallStack.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\bindings\js\ScriptCallStack.h"
>
</File>
<File
@@ -63339,14 +63395,6 @@
>
</File>
<File
- RelativePath="..\inspector\ScriptArguments.cpp"
- >
- </File>
- <File
- RelativePath="..\inspector\ScriptArguments.h"
- >
- </File>
- <File
RelativePath="..\inspector\ScriptBreakpoint.cpp"
>
</File>
@@ -63355,22 +63403,6 @@
>
</File>
<File
- RelativePath="..\inspector\ScriptCallFrame.cpp"
- >
- </File>
- <File
- RelativePath="..\inspector\ScriptCallFrame.h"
- >
- </File>
- <File
- RelativePath="..\inspector\ScriptCallStack.cpp"
- >
- </File>
- <File
- RelativePath="..\inspector\ScriptCallStack.h"
- >
- </File>
- <File
RelativePath="..\inspector\ScriptDebugListener.h"
>
</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 87d8928..5bc440b 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -5459,10 +5459,6 @@
F3644AFF1119805900E0D537 /* InjectedScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3644AFD1119805900E0D537 /* InjectedScript.cpp */; };
F3644B001119805900E0D537 /* InjectedScript.h in Headers */ = {isa = PBXBuildFile; fileRef = F3644AFE1119805900E0D537 /* InjectedScript.h */; };
F375CC071150D300008DDB81 /* InspectorWorkerResource.h in Headers */ = {isa = PBXBuildFile; fileRef = F375CC061150D300008DDB81 /* InspectorWorkerResource.h */; };
- F392249C126F11AE00A926D9 /* ScriptCallStackFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F392249A126F11AE00A926D9 /* ScriptCallStackFactory.cpp */; };
- F392249D126F11AE00A926D9 /* ScriptCallStackFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = F392249B126F11AE00A926D9 /* ScriptCallStackFactory.h */; };
- F39BE95B12673BF400E0A674 /* ScriptArguments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F39BE95912673BF400E0A674 /* ScriptArguments.cpp */; };
- F39BE95C12673BF400E0A674 /* ScriptArguments.h in Headers */ = {isa = PBXBuildFile; fileRef = F39BE95A12673BF400E0A674 /* ScriptArguments.h */; };
F3D461481161D53200CA0D09 /* JSWorkerContextErrorHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3D461461161D53200CA0D09 /* JSWorkerContextErrorHandler.cpp */; };
F3D461491161D53200CA0D09 /* JSWorkerContextErrorHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = F3D461471161D53200CA0D09 /* JSWorkerContextErrorHandler.h */; };
F4EAF4AE10C742B1009100D3 /* OpenTypeSanitizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4EAF4AC10C742B1009100D3 /* OpenTypeSanitizer.cpp */; };
@@ -11489,10 +11485,6 @@
F3644AFD1119805900E0D537 /* InjectedScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScript.cpp; sourceTree = "<group>"; };
F3644AFE1119805900E0D537 /* InjectedScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScript.h; sourceTree = "<group>"; };
F375CC061150D300008DDB81 /* InspectorWorkerResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorWorkerResource.h; sourceTree = "<group>"; };
- F392249A126F11AE00A926D9 /* ScriptCallStackFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallStackFactory.cpp; sourceTree = "<group>"; };
- F392249B126F11AE00A926D9 /* ScriptCallStackFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallStackFactory.h; sourceTree = "<group>"; };
- F39BE95912673BF400E0A674 /* ScriptArguments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptArguments.cpp; sourceTree = "<group>"; };
- F39BE95A12673BF400E0A674 /* ScriptArguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptArguments.h; sourceTree = "<group>"; };
F3D461461161D53200CA0D09 /* JSWorkerContextErrorHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerContextErrorHandler.cpp; sourceTree = "<group>"; };
F3D461471161D53200CA0D09 /* JSWorkerContextErrorHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerContextErrorHandler.h; sourceTree = "<group>"; };
F4EAF4AC10C742B1009100D3 /* OpenTypeSanitizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OpenTypeSanitizer.cpp; path = opentype/OpenTypeSanitizer.cpp; sourceTree = "<group>"; };
@@ -12264,14 +12256,8 @@
F375CC061150D300008DDB81 /* InspectorWorkerResource.h */,
1C81BA050E97348300266E07 /* JavaScriptCallFrame.idl */,
BCC64F5F0DCFB84E0081EF3B /* localizedStrings.js */,
- F39BE95912673BF400E0A674 /* ScriptArguments.cpp */,
- F39BE95A12673BF400E0A674 /* ScriptArguments.h */,
200B190811C277D900DCCD3A /* ScriptBreakpoint.cpp */,
7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */,
- 416E75CA0EDF90C700360E1D /* ScriptCallFrame.cpp */,
- 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */,
- 416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */,
- 416E75BC0EDF8FD700360E1D /* ScriptCallStack.h */,
7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */,
9FA37EEF1172FD4100C4CD55 /* ScriptProfile.idl */,
9FA37EF01172FD4100C4CD55 /* ScriptProfileNode.idl */,
@@ -16787,8 +16773,10 @@
BCA378BB0D15F64200B793D6 /* ScheduledAction.h */,
41F1D21E0EF35C2A00DA8753 /* ScriptCachedFrameData.cpp */,
41F1D21D0EF35C2A00DA8753 /* ScriptCachedFrameData.h */,
- F392249A126F11AE00A926D9 /* ScriptCallStackFactory.cpp */,
- F392249B126F11AE00A926D9 /* ScriptCallStackFactory.h */,
+ 416E75CA0EDF90C700360E1D /* ScriptCallFrame.cpp */,
+ 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */,
+ 416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */,
+ 416E75BC0EDF8FD700360E1D /* ScriptCallStack.h */,
93B70D5309EB0C7C009D8468 /* ScriptController.cpp */,
93B70D5409EB0C7C009D8468 /* ScriptController.h */,
A83E1C720E49042B00140B9C /* ScriptControllerMac.mm */,
@@ -20564,7 +20552,6 @@
1CEFC9B90D78DC8C007D2579 /* SchedulePair.h in Headers */,
5162C7F511F77EFB00612EFE /* SchemeRegistry.h in Headers */,
BCEC01BE0C274DAC009F4EC9 /* Screen.h in Headers */,
- F39BE95C12673BF400E0A674 /* ScriptArguments.h in Headers */,
A84D82C111D3474800972990 /* ScriptableDocumentParser.h in Headers */,
7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */,
41F1D21F0EF35C2A00DA8753 /* ScriptCachedFrameData.h in Headers */,
@@ -21139,7 +21126,6 @@
081CDFB9126ECFDB00D215CA /* DeprecatedSVGAnimatedPropertyTraits.h in Headers */,
081CDFBA126ECFDB00D215CA /* DeprecatedSVGAnimatedTemplate.h in Headers */,
081CDFBF126ECFE800D215CA /* SVGAnimatedPropertySynchronizer.h in Headers */,
- F392249D126F11AE00A926D9 /* ScriptCallStackFactory.h in Headers */,
088A0E04126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h in Headers */,
088A0E05126EF1DB00978F7A /* SVGAnimatedProperty.h in Headers */,
088A0E06126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h in Headers */,
@@ -23193,7 +23179,6 @@
5162C7F411F77EFB00612EFE /* SchemeRegistry.cpp in Sources */,
BCEC01BD0C274DAC009F4EC9 /* Screen.cpp in Sources */,
A84D82C211D3474800972990 /* ScriptableDocumentParser.cpp in Sources */,
- F39BE95B12673BF400E0A674 /* ScriptArguments.cpp in Sources */,
200B190911C277D900DCCD3A /* ScriptBreakpoint.cpp in Sources */,
41F1D2200EF35C2A00DA8753 /* ScriptCachedFrameData.cpp in Sources */,
416E75CC0EDF90C700360E1D /* ScriptCallFrame.cpp in Sources */,
@@ -23702,7 +23687,6 @@
9728C3131268E4390041E89B /* MarkupAccumulator.cpp in Sources */,
E18772F1126E2629003DD586 /* Language.cpp in Sources */,
7A1F2B52126C61B20006A7E6 /* InspectorClient.cpp in Sources */,
- F392249C126F11AE00A926D9 /* ScriptCallStackFactory.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp
index e2012ce..cf08ca9 100644
--- a/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -141,7 +141,8 @@
#include "MemoryInfo.cpp"
#include "ScheduledAction.cpp"
#include "ScriptCachedFrameData.cpp"
-#include "ScriptCallStackFactory.cpp"
+#include "ScriptCallFrame.cpp"
+#include "ScriptCallStack.cpp"
#include "ScriptController.cpp"
#include "ScriptControllerWin.cpp"
#include "ScriptDebugServer.cpp"
diff --git a/WebCore/bindings/js/ScriptCallFrame.cpp b/WebCore/bindings/js/ScriptCallFrame.cpp
new file mode 100644
index 0000000..2f74b96
--- /dev/null
+++ b/WebCore/bindings/js/ScriptCallFrame.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2008, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ScriptCallFrame.h"
+
+#include <runtime/ArgList.h>
+#include <runtime/UString.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+ScriptCallFrame::ScriptCallFrame(const UString& functionName, const UString& urlString, int lineNumber, ExecState* exec, unsigned skipArgumentCount)
+ : m_functionName(ustringToString(functionName))
+ , m_sourceURL(ustringToString(urlString))
+ , m_lineNumber(lineNumber)
+{
+ if (!exec)
+ return;
+ size_t argumentCount = exec->argumentCount();
+ for (size_t i = skipArgumentCount; i < argumentCount; ++i)
+ m_arguments.append(ScriptValue(exec->argument(i)));
+}
+
+ScriptCallFrame::~ScriptCallFrame()
+{
+}
+
+const ScriptValue &ScriptCallFrame::argumentAt(unsigned index) const
+{
+ ASSERT(m_arguments.size() > index);
+ return m_arguments[index];
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptCallFrame.h b/WebCore/bindings/js/ScriptCallFrame.h
new file mode 100644
index 0000000..31aec7e
--- /dev/null
+++ b/WebCore/bindings/js/ScriptCallFrame.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2008, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScriptCallFrame_h
+#define ScriptCallFrame_h
+
+#include "PlatformString.h"
+#include "ScriptValue.h"
+#include <wtf/Vector.h>
+
+namespace JSC {
+class ExecState;
+class UString;
+}
+
+namespace WebCore {
+
+class ScriptCallFrame {
+public:
+ ScriptCallFrame(const JSC::UString& functionName, const JSC::UString& urlString, int lineNumber, JSC::ExecState*, unsigned skipArgumentCount);
+ ~ScriptCallFrame();
+
+ const String& functionName() const { return m_functionName; }
+ const String& sourceURL() const { return m_sourceURL; }
+ unsigned lineNumber() const { return m_lineNumber; }
+
+ // argument retrieval methods
+ const ScriptValue& argumentAt(unsigned) const;
+ unsigned argumentCount() const { return m_arguments.size(); }
+
+private:
+ String m_functionName;
+ String m_sourceURL;
+ unsigned m_lineNumber;
+
+ Vector<ScriptValue> m_arguments;
+};
+
+} // namespace WebCore
+
+#endif // ScriptCallFrame_h
diff --git a/WebCore/bindings/js/ScriptCallStack.cpp b/WebCore/bindings/js/ScriptCallStack.cpp
new file mode 100644
index 0000000..de61b07
--- /dev/null
+++ b/WebCore/bindings/js/ScriptCallStack.cpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2008, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ScriptCallStack.h"
+
+#include <interpreter/CallFrame.h>
+#include <interpreter/Interpreter.h>
+#include <runtime/JSFunction.h>
+#include <runtime/JSValue.h>
+#include <runtime/UString.h>
+#include <runtime/JSGlobalData.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+ScriptCallStack::ScriptCallStack(ExecState* exec, unsigned skipArgumentCount)
+ : m_initialized(false)
+ , m_exec(exec)
+ , m_caller(0)
+{
+ int signedLineNumber;
+ intptr_t sourceID;
+ UString urlString;
+ JSValue function;
+
+ exec->interpreter()->retrieveLastCaller(exec, signedLineNumber, sourceID, urlString, function);
+
+ unsigned lineNumber = signedLineNumber >= 0 ? signedLineNumber : 0;
+
+ if (function) {
+ m_caller = asFunction(function);
+ m_frames.append(ScriptCallFrame(m_caller->name(m_exec), urlString, lineNumber, m_exec, skipArgumentCount));
+ } else {
+ // Caller is unknown, but we should still add the frame, because
+ // something called us, and gave us arguments.
+ m_frames.append(ScriptCallFrame(UString(), urlString, lineNumber, m_exec, skipArgumentCount));
+ }
+}
+
+ScriptCallStack::~ScriptCallStack()
+{
+}
+
+const ScriptCallFrame &ScriptCallStack::at(unsigned index)
+{
+ // First frame is pre-populated in constructor, so don't trigger
+ // initialization unless looking beyond the first frame.
+ if (index > 0)
+ initialize();
+ ASSERT(m_frames.size() > index);
+ return m_frames[index];
+}
+
+unsigned ScriptCallStack::size()
+{
+ initialize();
+ return m_frames.size();
+}
+
+void ScriptCallStack::initialize()
+{
+ if (!m_caller || m_initialized)
+ return;
+
+ int signedLineNumber;
+ intptr_t sourceID;
+ UString urlString;
+ JSValue function;
+ // callFrame must exist if m_caller is not null.
+ CallFrame* callFrame = m_exec->callerFrame();
+ while (true) {
+ ASSERT(callFrame);
+ m_exec->interpreter()->retrieveLastCaller(callFrame, signedLineNumber, sourceID, urlString, function);
+ if (!function)
+ break;
+ JSFunction* jsFunction = asFunction(function);
+ unsigned lineNumber = signedLineNumber >= 0 ? signedLineNumber : 0;
+ m_frames.append(ScriptCallFrame(jsFunction->name(m_exec), urlString, lineNumber, m_exec, 0));
+ callFrame = callFrame->callerFrame();
+ }
+ m_initialized = true;
+}
+
+bool ScriptCallStack::stackTrace(int, const RefPtr<InspectorArray>&)
+{
+ return false;
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptCallStack.h b/WebCore/bindings/js/ScriptCallStack.h
new file mode 100644
index 0000000..17d1c46
--- /dev/null
+++ b/WebCore/bindings/js/ScriptCallStack.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2008, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScriptCallStack_h
+#define ScriptCallStack_h
+
+#include "ScriptCallFrame.h"
+#include "ScriptState.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/RefPtr.h>
+
+namespace JSC {
+ class ExecState;
+ class JSValue;
+}
+
+namespace WebCore {
+
+ class InspectorArray;
+
+ class ScriptCallStack : public Noncopyable {
+ public:
+ ScriptCallStack(JSC::ExecState*, unsigned skipArgumentCount = 0);
+ ~ScriptCallStack();
+
+ ScriptState* state() const { return m_exec; }
+ ScriptState* globalState() const { return m_exec->lexicalGlobalObject()->globalExec(); }
+ // frame retrieval methods
+ const ScriptCallFrame &at(unsigned);
+ unsigned size();
+ static bool stackTrace(int, const RefPtr<InspectorArray>&);
+
+ private:
+ void initialize();
+ bool m_initialized;
+
+ JSC::ExecState* m_exec;
+ Vector<ScriptCallFrame> m_frames;
+ JSC::JSFunction* m_caller;
+ };
+
+} // namespace WebCore
+
+#endif // ScriptCallStack_h
diff --git a/WebCore/bindings/js/ScriptCallStackFactory.cpp b/WebCore/bindings/js/ScriptCallStackFactory.cpp
deleted file mode 100644
index 25fabdd..0000000
--- a/WebCore/bindings/js/ScriptCallStackFactory.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ScriptCallStackFactory.h"
-
-#include "JSDOMBinding.h"
-#include "ScriptArguments.h"
-#include "ScriptCallFrame.h"
-#include "ScriptCallStack.h"
-#include "ScriptValue.h"
-#include <interpreter/CallFrame.h>
-#include <interpreter/Interpreter.h>
-#include <runtime/ArgList.h>
-#include <runtime/JSFunction.h>
-#include <runtime/JSGlobalData.h>
-#include <runtime/JSValue.h>
-#include <runtime/UString.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-PassOwnPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t maxStackSize)
-{
- Vector<ScriptCallFrame> frames;
- CallFrame* callFrame = exec;
- while (true) {
- ASSERT(callFrame);
- int signedLineNumber;
- intptr_t sourceID;
- UString urlString;
- JSValue function;
-
- exec->interpreter()->retrieveLastCaller(callFrame, signedLineNumber, sourceID, urlString, function);
- UString functionName;
- if (function)
- functionName = asFunction(function)->name(exec);
- else {
- // Caller is unknown, but if frames is empty we should still add the frame, because
- // something called us, and gave us arguments.
- if (!frames.isEmpty())
- break;
- }
- unsigned lineNumber = signedLineNumber >= 0 ? signedLineNumber : 0;
- frames.append(ScriptCallFrame(ustringToString(functionName), ustringToString(urlString), lineNumber));
- if (!function || frames.size() == maxStackSize)
- break;
- callFrame = callFrame->callerFrame();
- }
- return new ScriptCallStack(frames);
-}
-
-PassOwnPtr<ScriptArguments> createScriptArguments(JSC::ExecState* exec, unsigned skipArgumentCount)
-{
- Vector<ScriptValue> arguments;
- size_t argumentCount = exec->argumentCount();
- for (size_t i = skipArgumentCount; i < argumentCount; ++i)
- arguments.append(ScriptValue(exec->argument(i)));
- return new ScriptArguments(exec, arguments);
-}
-
-bool ScriptCallStack::stackTrace(int, const RefPtr<InspectorArray>&)
-{
- return false;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptCallStackFactory.h b/WebCore/bindings/js/ScriptCallStackFactory.h
deleted file mode 100644
index 744d88d..0000000
--- a/WebCore/bindings/js/ScriptCallStackFactory.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ScriptCallStackFactory_h
-#define ScriptCallStackFactory_h
-
-#include <wtf/PassOwnPtr.h>
-
-namespace JSC {
-class ExecState;
-}
-
-namespace WebCore {
-
-class ScriptArguments;
-class ScriptCallStack;
-
-PassOwnPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState*, size_t maxStackSize);
-PassOwnPtr<ScriptArguments> createScriptArguments(JSC::ExecState*, unsigned skipArgumentCount);
-
-} // namespace WebCore
-
-#endif // ScriptCallStackFactory_h
diff --git a/WebCore/bindings/js/ScriptState.h b/WebCore/bindings/js/ScriptState.h
index ce43516..6bef4f7 100644
--- a/WebCore/bindings/js/ScriptState.h
+++ b/WebCore/bindings/js/ScriptState.h
@@ -52,7 +52,7 @@ class ScriptStateProtectedPtr : public Noncopyable {
public:
ScriptStateProtectedPtr() { }
ScriptStateProtectedPtr(ScriptState* scriptState) : m_globalObject(scriptState->lexicalGlobalObject()) { }
- ScriptState* get() const
+ ScriptState* get()
{
if (m_globalObject)
return m_globalObject->globalExec();
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 23db957..0b56f13 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -1966,12 +1966,8 @@ sub GenerateImplementation
my $hasOptionalArguments = 0;
if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
- push(@implContent, " OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, $numParameters));\n");
- push(@implContent, " size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;\n");
- push(@implContent, " OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));\n");
- $implIncludes{"ScriptArguments.h"} = 1;
+ push(@implContent, " ScriptCallStack callStack(exec, $numParameters);\n");
$implIncludes{"ScriptCallStack.h"} = 1;
- $implIncludes{"ScriptCallStackFactory.h"} = 1;
}
my $callWith = $function->signature->extendedAttributes->{"CallWith"};
@@ -2361,8 +2357,8 @@ sub GenerateImplementationFunctionCall()
if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
$functionString .= ", " if $paramIndex;
- $paramIndex += 2;
- $functionString .= "scriptArguments.release(), callStack.release()";
+ ++$paramIndex;
+ $functionString .= "&callStack";
}
if (@{$function->raisesExceptions}) {
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 0c79e64..751e350 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -1304,15 +1304,11 @@ END
if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
push(@implContentDecls, <<END);
- OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, $numParameters));
- size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize));
+ OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(args, $numParameters));
if (!callStack)
return v8::Undefined();
END
- $implIncludes{"ScriptArguments.h"} = 1;
$implIncludes{"ScriptCallStack.h"} = 1;
- $implIncludes{"ScriptCallStackFactory.h"} = 1;
}
if ($function->signature->extendedAttributes->{"SVGCheckSecurityDocument"}) {
push(@implContentDecls, <<END);
@@ -2723,8 +2719,8 @@ sub GenerateFunctionCallString()
if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
$functionString .= ", " if $index;
- $functionString .= "scriptArguments.release(), callStack.release()";
- $index += 2;
+ $functionString .= "callStack.get()";
+ $index++;
}
if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) {
diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
index 7e06068..5236267 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
+++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
@@ -31,9 +31,7 @@
#include "JSTestObj.h"
#include "JSlog.h"
#include "KURL.h"
-#include "ScriptArguments.h"
#include "ScriptCallStack.h"
-#include "ScriptCallStackFactory.h"
#include "SerializedScriptValue.h"
#include "TestObj.h"
#include <runtime/Error.h>
@@ -996,14 +994,12 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(Ex
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
ExceptionCode ec = 0;
- OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 1));
- size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));
+ ScriptCallStack callStack(exec, 1);
log* intArg = tolog(exec->argument(0));
if (exec->hadException())
return JSValue::encode(jsUndefined());
- imp->customArgsAndException(intArg, scriptArguments.release(), callStack.release(), ec);
+ imp->customArgsAndException(intArg, &callStack, ec);
setDOMException(exec, ec);
return JSValue::encode(jsUndefined());
}
diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
index 3441b73..44f0d3e 100644
--- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
+++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
@@ -26,9 +26,7 @@
#include "IDBBindingUtilities.h"
#include "IDBKey.h"
#include "RuntimeEnabledFeatures.h"
-#include "ScriptArguments.h"
#include "ScriptCallStack.h"
-#include "ScriptCallStackFactory.h"
#include "SerializedScriptValue.h"
#include "V8Binding.h"
#include "V8BindingMacros.h"
@@ -707,13 +705,11 @@ static v8::Handle<v8::Value> customArgsAndExceptionCallback(const v8::Arguments&
TestObj* imp = V8TestObj::toNative(args.Holder());
ExceptionCode ec = 0;
{
- OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1));
- size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize));
+ OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(args, 1));
if (!callStack)
return v8::Undefined();
EXCEPTION_BLOCK(log*, intArg, V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
- imp->customArgsAndException(intArg, scriptArguments.release(), callStack.release(), ec);
+ imp->customArgsAndException(intArg, callStack.get(), ec);
if (UNLIKELY(ec))
goto fail;
return v8::Handle<v8::Value>();
diff --git a/WebCore/bindings/v8/ScriptCallFrame.cpp b/WebCore/bindings/v8/ScriptCallFrame.cpp
new file mode 100644
index 0000000..f0c7343
--- /dev/null
+++ b/WebCore/bindings/v8/ScriptCallFrame.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ScriptCallFrame.h"
+
+#include <v8.h>
+
+#include "PlatformString.h"
+#include "V8Binding.h"
+#include "V8Proxy.h"
+#include "ScriptValue.h"
+
+namespace WebCore {
+
+ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber, const v8::Arguments& arguments, unsigned skipArgumentCount)
+ : m_functionName(functionName)
+ , m_sourceURL(urlString)
+ , m_lineNumber(lineNumber)
+{
+ for (int i = skipArgumentCount; i < arguments.Length(); ++i)
+ m_arguments.append(ScriptValue(arguments[i]));
+}
+
+ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber)
+ : m_functionName(functionName)
+ , m_sourceURL(urlString)
+ , m_lineNumber(lineNumber)
+{
+}
+
+ScriptCallFrame::~ScriptCallFrame()
+{
+}
+
+const ScriptValue& ScriptCallFrame::argumentAt(unsigned index) const
+{
+ ASSERT(m_arguments.size() > index);
+ return m_arguments[index];
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptCallFrame.h b/WebCore/bindings/v8/ScriptCallFrame.h
new file mode 100644
index 0000000..ff77d4a
--- /dev/null
+++ b/WebCore/bindings/v8/ScriptCallFrame.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScriptCallFrame_h
+#define ScriptCallFrame_h
+
+#include "KURL.h"
+
+#include <wtf/Vector.h>
+
+namespace v8 {
+ class Arguments;
+}
+
+namespace WebCore {
+ class ScriptValue;
+
+ // FIXME: Implement retrieving line number and source URL and storing here
+ // for all call frames, not just the first one.
+ // See <https://bugs.webkit.org/show_bug.cgi?id=22556> and
+ // <https://bugs.webkit.org/show_bug.cgi?id=21180>
+ class ScriptCallFrame {
+ public:
+ ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber, const v8::Arguments&, unsigned skipArgumentCount);
+ ScriptCallFrame(const String& functionName, const String& urlString, int lineNumber);
+ ~ScriptCallFrame();
+
+ const String& functionName() const { return m_functionName; }
+ const String& sourceURL() const { return m_sourceURL; }
+ unsigned lineNumber() const { return m_lineNumber; }
+
+ // argument retrieval methods
+ const ScriptValue& argumentAt(unsigned) const;
+ unsigned argumentCount() const { return m_arguments.size(); }
+
+ private:
+ String m_functionName;
+ String m_sourceURL;
+ unsigned m_lineNumber;
+
+ Vector<ScriptValue> m_arguments;
+ };
+
+} // namespace WebCore
+
+#endif // ScriptCallFrame_h
diff --git a/WebCore/bindings/v8/ScriptCallStack.cpp b/WebCore/bindings/v8/ScriptCallStack.cpp
new file mode 100644
index 0000000..3e29c7a
--- /dev/null
+++ b/WebCore/bindings/v8/ScriptCallStack.cpp
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ScriptCallStack.h"
+
+#include "InspectorValues.h"
+#include "ScriptController.h"
+#include "ScriptDebugServer.h"
+#include "ScriptScope.h"
+#include "V8Binding.h"
+
+#include <v8-debug.h>
+
+namespace WebCore {
+
+static void getFrameLocation(v8::Handle<v8::StackFrame> frame, String* sourceName, int* sourceLineNumber, String* functionName)
+{
+ ASSERT(!frame.IsEmpty());
+ v8::Local<v8::String> sourceNameValue(frame->GetScriptNameOrSourceURL());
+ v8::Local<v8::String> functionNameValue(frame->GetFunctionName());
+ *sourceName = sourceNameValue.IsEmpty() ? "" : toWebCoreString(sourceNameValue);
+ *functionName = functionNameValue.IsEmpty() ? "" : toWebCoreString(functionNameValue);
+ *sourceLineNumber = frame->GetLineNumber();
+}
+
+static void getTopFrameLocation(v8::Handle<v8::StackTrace> stackTrace, String* sourceName, int* sourceLineNumber, String* functionName)
+{
+ if (stackTrace->GetFrameCount() <= 0) {
+ // Successfully grabbed stack trace, but there are no frames. It may happen in case of a syntax error for example.
+ // Fallback to setting lineNumber to 0, and source and function name to "undefined".
+ *sourceName = "undefined";
+ *sourceLineNumber = 0;
+ *functionName = "undefined";
+ } else {
+ v8::Handle<v8::StackFrame> frame = stackTrace->GetFrame(0);
+ getFrameLocation(frame, sourceName, sourceLineNumber, functionName);
+ }
+}
+
+static PassOwnPtr<ScriptCallFrame> toScriptCallFrame(v8::Handle<v8::StackFrame> frame)
+{
+ String sourceName;
+ int sourceLineNumber;
+ String functionName;
+ getFrameLocation(frame, &sourceName, &sourceLineNumber, &functionName);
+ return new ScriptCallFrame(functionName, sourceName, sourceLineNumber);
+}
+
+static void toScriptCallFramesVector(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, Vector<OwnPtr<ScriptCallFrame> >& scriptCallFrames)
+{
+ v8::Context::Scope contextScope(context);
+ int frameCount = stackTrace->GetFrameCount();
+ for (int i = 0; i < frameCount; i++) {
+ v8::Local<v8::StackFrame> stackFrame = stackTrace->GetFrame(i);
+ scriptCallFrames.append(toScriptCallFrame(stackFrame));
+ }
+}
+
+const int ScriptCallStack::maxCallStackSizeToCapture = 200;
+const v8::StackTrace::StackTraceOptions ScriptCallStack::stackTraceOptions = static_cast<v8::StackTrace::StackTraceOptions>(
+ v8::StackTrace::kLineNumber
+ | v8::StackTrace::kColumnOffset
+ | v8::StackTrace::kScriptNameOrSourceURL
+ | v8::StackTrace::kFunctionName);
+
+
+PassOwnPtr<ScriptCallStack> ScriptCallStack::create(const v8::Arguments& arguments, unsigned skipArgumentCount, int framCountLimit)
+{
+ v8::HandleScope scope;
+ v8::Local<v8::Context> context = v8::Context::GetCurrent();
+ v8::Context::Scope contextScope(context);
+ v8::Handle<v8::StackTrace> stackTrace(v8::StackTrace::CurrentStackTrace(framCountLimit, ScriptCallStack::stackTraceOptions));
+
+ if (stackTrace.IsEmpty())
+ return 0;
+
+ String sourceName;
+ int sourceLineNumber;
+ String functionName;
+ getTopFrameLocation(stackTrace, &sourceName, &sourceLineNumber, &functionName);
+
+ Vector<OwnPtr<ScriptCallFrame> > scriptCallFrames;
+ if (framCountLimit > 1)
+ toScriptCallFramesVector(context, stackTrace, scriptCallFrames);
+
+ return new ScriptCallStack(ScriptState::forContext(context), new ScriptCallFrame(functionName, sourceName, sourceLineNumber, arguments, skipArgumentCount), scriptCallFrames);
+}
+
+PassOwnPtr<ScriptCallStack> ScriptCallStack::create(ScriptState* state, v8::Handle<v8::StackTrace> stackTrace)
+{
+ v8::HandleScope scope;
+ Vector<OwnPtr<ScriptCallFrame> > scriptCallFrames;
+ toScriptCallFramesVector(state->context(), stackTrace, scriptCallFrames);
+
+ String sourceName;
+ int sourceLineNumber;
+ String functionName;
+ getTopFrameLocation(stackTrace, &sourceName, &sourceLineNumber, &functionName);
+
+ return new ScriptCallStack(state, new ScriptCallFrame(functionName, sourceName, sourceLineNumber), scriptCallFrames);
+}
+
+ScriptCallStack::ScriptCallStack(ScriptState* scriptState, PassOwnPtr<ScriptCallFrame> topFrame, Vector<OwnPtr<ScriptCallFrame> >& scriptCallFrames)
+ : m_topFrame(topFrame)
+ , m_scriptState(scriptState)
+{
+ m_scriptCallFrames.swap(scriptCallFrames);
+}
+
+ScriptCallStack::~ScriptCallStack()
+{
+}
+
+const ScriptCallFrame& ScriptCallStack::at(unsigned index)
+{
+ if (!index && m_topFrame)
+ return *m_topFrame;
+ return *m_scriptCallFrames.at(index);
+}
+
+unsigned ScriptCallStack::size()
+{
+ if (m_scriptCallFrames.isEmpty())
+ return 1;
+ return m_scriptCallFrames.size();
+}
+
+
+bool ScriptCallStack::stackTrace(int frameLimit, const RefPtr<InspectorArray>& stackTrace)
+{
+#if ENABLE(INSPECTOR)
+ if (!v8::Context::InContext())
+ return false;
+ v8::Handle<v8::Context> context = v8::Context::GetCurrent();
+ if (context.IsEmpty())
+ return false;
+ v8::HandleScope scope;
+ v8::Context::Scope contextScope(context);
+ v8::Handle<v8::StackTrace> trace(v8::StackTrace::CurrentStackTrace(frameLimit));
+ int frameCount = trace->GetFrameCount();
+ if (trace.IsEmpty() || !frameCount)
+ return false;
+ for (int i = 0; i < frameCount; ++i) {
+ v8::Handle<v8::StackFrame> frame = trace->GetFrame(i);
+ RefPtr<InspectorObject> frameObject = InspectorObject::create();
+ v8::Local<v8::String> scriptName = frame->GetScriptName();
+ frameObject->setString("scriptName", scriptName.IsEmpty() ? "" : toWebCoreString(scriptName));
+ v8::Local<v8::String> functionName = frame->GetFunctionName();
+ frameObject->setString("functionName", functionName.IsEmpty() ? "" : toWebCoreString(functionName));
+ frameObject->setNumber("lineNumber", frame->GetLineNumber());
+ frameObject->setNumber("column", frame->GetColumn());
+ stackTrace->pushObject(frameObject);
+ }
+ return true;
+#else
+ return false;
+#endif
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptCallStack.h b/WebCore/bindings/v8/ScriptCallStack.h
new file mode 100644
index 0000000..98e5195
--- /dev/null
+++ b/WebCore/bindings/v8/ScriptCallStack.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScriptCallStack_h
+#define ScriptCallStack_h
+
+#include "ScriptCallFrame.h"
+#include "ScriptState.h"
+#include "ScriptValue.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/RefPtr.h>
+
+namespace v8 {
+ class Arguments;
+}
+
+namespace WebCore {
+
+class InspectorArray;
+
+class ScriptCallStack : public Noncopyable {
+public:
+ static const int maxCallStackSizeToCapture;
+ static const v8::StackTrace::StackTraceOptions stackTraceOptions;
+
+ static PassOwnPtr<ScriptCallStack> create(const v8::Arguments&, unsigned skipArgumentCount = 0, int framCountLimit = 1);
+ static PassOwnPtr<ScriptCallStack> create(ScriptState*, v8::Handle<v8::StackTrace>);
+ ~ScriptCallStack();
+
+ // Returns false if there is no running JavaScript or if fetching the stack failed.
+ // Sets stackTrace to be an array of stack frame objects.
+ // A stack frame object looks like:
+ // {
+ // scriptName: <file name for the associated script resource>
+ // functionName: <name of the JavaScript function>
+ // lineNumber: <1 based line number>
+ // column: <1 based column offset on the line>
+ // }
+ static bool stackTrace(int frameLimit, const RefPtr<InspectorArray>& stackTrace);
+
+ const ScriptCallFrame& at(unsigned);
+ unsigned size();
+
+ ScriptState* state() const { return m_scriptState; }
+ ScriptState* globalState() const { return m_scriptState; }
+
+private:
+ ScriptCallStack(ScriptState* scriptState, PassOwnPtr<ScriptCallFrame> topFrame, Vector<OwnPtr<ScriptCallFrame> >& scriptCallFrames);
+ ScriptCallStack(ScriptState* scriptState, v8::Handle<v8::StackTrace> stackTrace);
+
+ OwnPtr<ScriptCallFrame> m_topFrame;
+ ScriptState* m_scriptState;
+ Vector<OwnPtr<ScriptCallFrame> > m_scriptCallFrames;
+};
+
+} // namespace WebCore
+
+#endif // ScriptCallStack_h
diff --git a/WebCore/bindings/v8/ScriptCallStackFactory.cpp b/WebCore/bindings/v8/ScriptCallStackFactory.cpp
deleted file mode 100644
index 62fbeef..0000000
--- a/WebCore/bindings/v8/ScriptCallStackFactory.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ScriptCallStackFactory.h"
-
-#include "InspectorValues.h"
-#include "ScriptArguments.h"
-#include "ScriptCallFrame.h"
-#include "ScriptCallStack.h"
-#include "ScriptScope.h"
-#include "ScriptValue.h"
-#include "V8Binding.h"
-
-#include <v8-debug.h>
-
-namespace WebCore {
-
-static ScriptCallFrame toScriptCallFrame(v8::Handle<v8::StackFrame> frame)
-{
- String sourceName;
- v8::Local<v8::String> sourceNameValue(frame->GetScriptNameOrSourceURL());
- if (!sourceNameValue.IsEmpty())
- sourceName = toWebCoreString(sourceNameValue);
-
- String functionName;
- v8::Local<v8::String> functionNameValue(frame->GetFunctionName());
- if (!functionNameValue.IsEmpty())
- functionName = toWebCoreString(functionNameValue);
-
- int sourceLineNumber = frame->GetLineNumber();
- return ScriptCallFrame(functionName, sourceName, sourceLineNumber);
-}
-
-static void toScriptCallFramesVector(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, Vector<ScriptCallFrame>& scriptCallFrames, size_t maxStackSize)
-{
- // TODO(yurys): remove this???
- v8::Context::Scope contextScope(context);
- int frameCount = stackTrace->GetFrameCount();
- if (frameCount > static_cast<int>(maxStackSize))
- frameCount = maxStackSize;
- for (int i = 0; i < frameCount; i++) {
- v8::Local<v8::StackFrame> stackFrame = stackTrace->GetFrame(i);
- scriptCallFrames.append(toScriptCallFrame(stackFrame));
- }
-
- if (!frameCount) {
- // Successfully grabbed stack trace, but there are no frames. It may happen in case of a syntax error for example.
- // Fallback to setting lineNumber to 0, and source and function name to "undefined".
- scriptCallFrames.append(ScriptCallFrame("undefined", "undefined", 0));
- }
-}
-
-PassOwnPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, size_t maxStackSize)
-{
- v8::HandleScope scope;
- v8::Context::Scope contextScope(context);
-
- Vector<ScriptCallFrame> scriptCallFrames;
- toScriptCallFramesVector(context, stackTrace, scriptCallFrames, maxStackSize);
- return new ScriptCallStack(scriptCallFrames);
-}
-
-PassOwnPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize)
-{
- v8::HandleScope scope;
- v8::Local<v8::Context> context = v8::Context::GetCurrent();
- // TODO(yurys): remove?
- v8::Context::Scope contextScope(context);
- v8::Handle<v8::StackTrace> stackTrace(v8::StackTrace::CurrentStackTrace(maxStackSize, stackTraceOptions));
- return createScriptCallStack(context, stackTrace, maxStackSize);
-}
-
-PassOwnPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount)
-{
- v8::HandleScope scope;
- v8::Local<v8::Context> context = v8::Context::GetCurrent();
- ScriptState* state = ScriptState::forContext(context);
-
- Vector<ScriptValue> arguments;
- for (int i = skipArgumentCount; i < v8arguments.Length(); ++i)
- arguments.append(ScriptValue(v8arguments[i]));
-
- return new ScriptArguments(state, arguments);
-}
-
-bool ScriptCallStack::stackTrace(int frameLimit, const RefPtr<InspectorArray>& stackTrace)
-{
-#if ENABLE(INSPECTOR)
- if (!v8::Context::InContext())
- return false;
- v8::Handle<v8::Context> context = v8::Context::GetCurrent();
- if (context.IsEmpty())
- return false;
- v8::HandleScope scope;
- v8::Context::Scope contextScope(context);
- v8::Handle<v8::StackTrace> trace(v8::StackTrace::CurrentStackTrace(frameLimit));
- int frameCount = trace->GetFrameCount();
- if (trace.IsEmpty() || !frameCount)
- return false;
- for (int i = 0; i < frameCount; ++i) {
- v8::Handle<v8::StackFrame> frame = trace->GetFrame(i);
- RefPtr<InspectorObject> frameObject = InspectorObject::create();
- v8::Local<v8::String> scriptName = frame->GetScriptName();
- frameObject->setString("scriptName", scriptName.IsEmpty() ? "" : toWebCoreString(scriptName));
- v8::Local<v8::String> functionName = frame->GetFunctionName();
- frameObject->setString("functionName", functionName.IsEmpty() ? "" : toWebCoreString(functionName));
- frameObject->setNumber("lineNumber", frame->GetLineNumber());
- frameObject->setNumber("column", frame->GetColumn());
- stackTrace->pushObject(frameObject);
- }
- return true;
-#else
- return false;
-#endif
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptCallStackFactory.h b/WebCore/bindings/v8/ScriptCallStackFactory.h
deleted file mode 100644
index 613af7b..0000000
--- a/WebCore/bindings/v8/ScriptCallStackFactory.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ScriptCallStackFactory_h
-#define ScriptCallStackFactory_h
-
-#include <v8.h>
-#include <wtf/PassOwnPtr.h>
-
-namespace WebCore {
-
-class ScriptState;
-
-const v8::StackTrace::StackTraceOptions stackTraceOptions = static_cast<v8::StackTrace::StackTraceOptions>(
- v8::StackTrace::kLineNumber
- | v8::StackTrace::kColumnOffset
- | v8::StackTrace::kScriptNameOrSourceURL
- | v8::StackTrace::kFunctionName);
-
-class ScriptArguments;
-class ScriptCallStack;
-
-PassOwnPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context>, v8::Handle<v8::StackTrace>, size_t maxStackSize);
-PassOwnPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize);
-PassOwnPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount);
-
-} // namespace WebCore
-
-#endif // ScriptCallStackFactory_h
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index fa37c38..4904a4e 100644
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ b/WebCore/bindings/v8/ScriptController.cpp
@@ -35,7 +35,6 @@
#include "PlatformBridge.h"
#include "Document.h"
#include "ScriptCallStack.h"
-#include "ScriptCallStackFactory.h"
#include "ScriptableDocumentParser.h"
#include "DOMWindow.h"
#include "Event.h"
@@ -469,7 +468,7 @@ void ScriptController::clearWindowShell(bool)
#if ENABLE(INSPECTOR)
void ScriptController::setCaptureCallStackForUncaughtExceptions(bool value)
{
- v8::V8::SetCaptureStackTraceForUncaughtExceptions(value, ScriptCallStack::maxCallStackSizeToCapture, stackTraceOptions);
+ v8::V8::SetCaptureStackTraceForUncaughtExceptions(value, ScriptCallStack::maxCallStackSizeToCapture, ScriptCallStack::stackTraceOptions);
}
#endif
diff --git a/WebCore/bindings/v8/ScriptState.h b/WebCore/bindings/v8/ScriptState.h
index 11813b0..ce350da 100644
--- a/WebCore/bindings/v8/ScriptState.h
+++ b/WebCore/bindings/v8/ScriptState.h
@@ -95,7 +95,7 @@ public:
m_context.Clear();
}
}
- ScriptState* get() const { return m_scriptState; }
+ ScriptState* get() { return m_scriptState; }
private:
ScriptState* m_scriptState;
v8::Persistent<v8::Context> m_context;
diff --git a/WebCore/bindings/v8/V8ConsoleMessage.cpp b/WebCore/bindings/v8/V8ConsoleMessage.cpp
index 40f9a7a..8b6bb17 100644
--- a/WebCore/bindings/v8/V8ConsoleMessage.cpp
+++ b/WebCore/bindings/v8/V8ConsoleMessage.cpp
@@ -37,7 +37,6 @@
#include "OwnPtr.h"
#include "Page.h"
#include "ScriptCallStack.h"
-#include "ScriptCallStackFactory.h"
#include "V8Binding.h"
#include "V8Proxy.h"
@@ -118,17 +117,18 @@ void V8ConsoleMessage::handler(v8::Handle<v8::Message> message, v8::Handle<v8::V
// Currently stack trace is only collected when inspector is open.
if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) {
v8::Local<v8::Context> context = v8::Context::GetEntered();
- callStack = createScriptCallStack(context, stackTrace, ScriptCallStack::maxCallStackSizeToCapture);
+ ScriptState* scriptState = ScriptState::forContext(context);
+ callStack = ScriptCallStack::create(scriptState, stackTrace);
}
v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
bool useURL = resourceName.IsEmpty() || !resourceName->IsString();
String resourceNameString = useURL ? frame->document()->url() : toWebCoreString(resourceName);
V8ConsoleMessage consoleMessage(errorMessage, resourceNameString, message->GetLineNumber());
- consoleMessage.dispatchNow(page, callStack.release());
+ consoleMessage.dispatchNow(page, callStack.get());
}
-void V8ConsoleMessage::dispatchNow(Page* page, PassOwnPtr<ScriptCallStack> callStack)
+void V8ConsoleMessage::dispatchNow(Page* page, ScriptCallStack* callStack)
{
ASSERT(page);
diff --git a/WebCore/bindings/v8/V8ConsoleMessage.h b/WebCore/bindings/v8/V8ConsoleMessage.h
index 6b892dd..387b5ee 100644
--- a/WebCore/bindings/v8/V8ConsoleMessage.h
+++ b/WebCore/bindings/v8/V8ConsoleMessage.h
@@ -33,7 +33,6 @@
#include "PlatformString.h"
#include <v8.h>
-#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
@@ -82,7 +81,7 @@ namespace WebCore {
const String m_sourceID;
const unsigned m_lineNumber;
- void dispatchNow(Page*, PassOwnPtr<ScriptCallStack>);
+ void dispatchNow(Page*, ScriptCallStack*);
// All delayed messages are stored in this vector. If the vector
// is 0, there are no delayed messages.
diff --git a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
index e585cc8..fc83b61 100644
--- a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
@@ -33,9 +33,7 @@
#include "V8Console.h"
#include "Console.h"
-#include "ScriptArguments.h"
#include "ScriptCallStack.h"
-#include "ScriptCallStackFactory.h"
#include "ScriptProfile.h"
#include "V8Binding.h"
#include "V8Proxy.h"
@@ -64,9 +62,11 @@ v8::Handle<v8::Value> V8Console::traceCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Console.traceCallback");
Console* imp = V8Console::toNative(args.Holder());
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture));
- OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 0));
- imp->trace(scriptArguments.release(), callStack.release());
+ v8::HandleScope handleScope;
+ ScriptState* scriptState = ScriptState::current();
+ v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(ScriptCallStack::maxCallStackSizeToCapture, ScriptCallStack::stackTraceOptions);
+ OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(scriptState, stackTrace));
+ imp->trace(callStack.get());
return v8::Handle<v8::Value>();
}
@@ -74,10 +74,9 @@ v8::Handle<v8::Value> V8Console::assertCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Console.assertCallback");
Console* imp = V8Console::toNative(args.Holder());
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture));
+ OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(args, 1, ScriptCallStack::maxCallStackSizeToCapture));
bool condition = args[0]->BooleanValue();
- OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1));
- imp->assertCondition(condition, scriptArguments.release(), callStack.release());
+ imp->assertCondition(condition, callStack.get());
return v8::Handle<v8::Value>();
}
diff --git a/WebCore/inspector/ConsoleMessage.cpp b/WebCore/inspector/ConsoleMessage.cpp
index 5c0fb38..67930cd 100644
--- a/WebCore/inspector/ConsoleMessage.cpp
+++ b/WebCore/inspector/ConsoleMessage.cpp
@@ -33,14 +33,46 @@
#include "InjectedScript.h"
#include "InjectedScriptHost.h"
-#include "InspectorFrontend.h"
#include "InspectorValues.h"
-#include "ScriptArguments.h"
#include "ScriptCallStack.h"
#include "ScriptValue.h"
+#if ENABLE(INSPECTOR)
+#include "InspectorFrontend.h"
+#endif
+
namespace WebCore {
+ConsoleMessage::CallFrame::CallFrame(const ScriptCallFrame& frame)
+ : m_functionName(frame.functionName())
+ , m_sourceURL(frame.sourceURL())
+ , m_lineNumber(frame.lineNumber())
+{
+}
+
+ConsoleMessage::CallFrame::CallFrame()
+ : m_lineNumber(0)
+{
+}
+
+bool ConsoleMessage::CallFrame::isEqual(const ConsoleMessage::CallFrame& o) const
+{
+ return m_functionName == o.m_functionName
+ && m_sourceURL == o.m_sourceURL
+ && m_lineNumber == o.m_lineNumber;
+}
+
+#if ENABLE(INSPECTOR)
+PassRefPtr<InspectorObject> ConsoleMessage::CallFrame::buildInspectorObject() const
+{
+ RefPtr<InspectorObject> frame = InspectorObject::create();
+ frame->setString("functionName", m_functionName);
+ frame->setString("sourceURL", m_sourceURL);
+ frame->setNumber("lineNumber", m_lineNumber);
+ return frame;
+}
+#endif
+
ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, const String& m, unsigned li, const String& u, unsigned g)
: m_source(s)
, m_type(t)
@@ -53,26 +85,35 @@ ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, c
{
}
-ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, const String& m, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack, unsigned g)
+ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, const String& m, ScriptCallStack* callStack, unsigned g, bool storeTrace)
: m_source(s)
, m_type(t)
, m_level(l)
, m_message(m)
- , m_arguments(arguments)
- , m_callStack(callStack)
+#if ENABLE(INSPECTOR)
+ , m_arguments(callStack->at(0).argumentCount())
+ , m_scriptState(callStack->globalState())
+#endif
+ , m_frames(storeTrace ? callStack->size() : 0)
, m_groupLevel(g)
, m_repeatCount(1)
{
- const ScriptCallFrame& lastCaller = m_callStack->at(0);
+ const ScriptCallFrame& lastCaller = callStack->at(0);
m_line = lastCaller.lineNumber();
m_url = lastCaller.sourceURL();
+ if (storeTrace) {
+ for (unsigned i = 0; i < callStack->size(); ++i)
+ m_frames[i] = ConsoleMessage::CallFrame(callStack->at(i));
+ }
- bool storeTrace = (t == TraceMessageType || t == UncaughtExceptionMessageType || t == AssertMessageType);
- if (!storeTrace)
- m_callStack.clear();
+#if ENABLE(INSPECTOR)
+ for (unsigned i = 0; i < lastCaller.argumentCount(); ++i)
+ m_arguments[i] = lastCaller.argumentAt(i);
+#endif
}
+#if ENABLE(INSPECTOR)
void ConsoleMessage::addToFrontend(InspectorFrontend* frontend, InjectedScriptHost* injectedScriptHost)
{
RefPtr<InspectorObject> jsonObj = InspectorObject::create();
@@ -84,12 +125,12 @@ void ConsoleMessage::addToFrontend(InspectorFrontend* frontend, InjectedScriptHo
jsonObj->setNumber("groupLevel", static_cast<int>(m_groupLevel));
jsonObj->setNumber("repeatCount", static_cast<int>(m_repeatCount));
jsonObj->setString("message", m_message);
- if (m_arguments && m_arguments->argumentCount()) {
- InjectedScript injectedScript = injectedScriptHost->injectedScriptFor(m_arguments->globalState());
+ if (!m_arguments.isEmpty()) {
+ InjectedScript injectedScript = injectedScriptHost->injectedScriptFor(m_scriptState.get());
if (!injectedScript.hasNoValue()) {
RefPtr<InspectorArray> jsonArgs = InspectorArray::create();
- for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) {
- RefPtr<InspectorValue> inspectorValue = injectedScript.wrapForConsole(m_arguments->argumentAt(i));
+ for (unsigned i = 0; i < m_arguments.size(); ++i) {
+ RefPtr<InspectorValue> inspectorValue = injectedScript.wrapForConsole(m_arguments[i]);
if (!inspectorValue) {
ASSERT_NOT_REACHED();
return;
@@ -99,8 +140,12 @@ void ConsoleMessage::addToFrontend(InspectorFrontend* frontend, InjectedScriptHo
jsonObj->setArray("parameters", jsonArgs);
}
}
- if (m_callStack)
- jsonObj->setArray("stackTrace", m_callStack->buildInspectorObject());
+ if (!m_frames.isEmpty()) {
+ RefPtr<InspectorArray> frames = InspectorArray::create();
+ for (unsigned i = 0; i < m_frames.size(); i++)
+ frames->pushObject(m_frames.at(i).buildInspectorObject());
+ jsonObj->setArray("stackTrace", frames);
+ }
frontend->addConsoleMessage(jsonObj);
}
@@ -108,21 +153,33 @@ void ConsoleMessage::updateRepeatCountInConsole(InspectorFrontend* frontend)
{
frontend->updateConsoleMessageRepeatCount(m_repeatCount);
}
+#endif // ENABLE(INSPECTOR)
bool ConsoleMessage::isEqual(ConsoleMessage* msg) const
{
- if (m_arguments) {
- if (!m_arguments->isEqual(msg->m_arguments.get()))
- return false;
- } else if (msg->m_arguments)
+#if ENABLE(INSPECTOR)
+ if (msg->m_arguments.size() != m_arguments.size())
+ return false;
+ if (!msg->m_scriptState.get() && msg->m_arguments.size()) {
+ ASSERT_NOT_REACHED();
return false;
+ }
- if (m_callStack) {
- if (!m_callStack->isEqual(msg->m_callStack.get()))
+ for (size_t i = 0; i < m_arguments.size(); ++i) {
+ if (!m_arguments[i].isEqual(msg->m_scriptState.get(), msg->m_arguments[i]))
return false;
- } else if (msg->m_callStack)
+ }
+#endif // ENABLE(INSPECTOR)
+
+ size_t frameCount = msg->m_frames.size();
+ if (frameCount != m_frames.size())
return false;
+ for (size_t i = 0; i < frameCount; ++i) {
+ if (!m_frames[i].isEqual(msg->m_frames[i]))
+ return false;
+ }
+
return msg->m_source == m_source
&& msg->m_type == m_type
&& msg->m_level == m_level
diff --git a/WebCore/inspector/ConsoleMessage.h b/WebCore/inspector/ConsoleMessage.h
index 23720bf..6c3f2c7 100644
--- a/WebCore/inspector/ConsoleMessage.h
+++ b/WebCore/inspector/ConsoleMessage.h
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2008 Matt Lilek <webkit at mattlilek.com>
- * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,6 +32,7 @@
#define ConsoleMessage_h
#include "Console.h"
+#include "KURL.h"
#include "ScriptState.h"
#include <wtf/Vector.h>
@@ -40,7 +41,6 @@ namespace WebCore {
class InjectedScriptHost;
class InspectorFrontend;
class InspectorObject;
-class ScriptArguments;
class ScriptCallFrame;
class ScriptCallStack;
class ScriptValue;
@@ -48,10 +48,12 @@ class ScriptValue;
class ConsoleMessage : public Noncopyable {
public:
ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, unsigned li, const String& u, unsigned g);
- ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>, unsigned g);
+ ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, ScriptCallStack*, unsigned g, bool storeTrace = false);
+#if ENABLE(INSPECTOR)
void addToFrontend(InspectorFrontend*, InjectedScriptHost*);
void updateRepeatCountInConsole(InspectorFrontend* frontend);
+#endif
void incrementCount() { ++m_repeatCount; }
bool isEqual(ConsoleMessage* msg) const;
@@ -59,12 +61,30 @@ public:
const String& message() const { return m_message; }
private:
+ class CallFrame {
+ public:
+ explicit CallFrame(const ScriptCallFrame& frame);
+ CallFrame();
+ bool isEqual(const CallFrame& o) const;
+#if ENABLE(INSPECTOR)
+ PassRefPtr<InspectorObject> buildInspectorObject() const;
+#endif
+
+ private:
+ String m_functionName;
+ String m_sourceURL;
+ unsigned m_lineNumber;
+ };
+
MessageSource m_source;
MessageType m_type;
MessageLevel m_level;
String m_message;
- OwnPtr<ScriptArguments> m_arguments;
- OwnPtr<ScriptCallStack> m_callStack;
+#if ENABLE(INSPECTOR)
+ Vector<ScriptValue> m_arguments;
+ ScriptStateProtectedPtr m_scriptState;
+#endif
+ Vector<CallFrame> m_frames;
unsigned m_line;
String m_url;
unsigned m_groupLevel;
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index b195c38..f99d487 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -82,7 +82,6 @@
#include "RenderInline.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
-#include "ScriptArguments.h"
#include "ScriptCallStack.h"
#include "ScriptFunctionCall.h"
#include "ScriptObject.h"
@@ -340,12 +339,13 @@ void InspectorController::setConsoleMessagesEnabled(bool enabled)
m_consoleMessages[i]->addToFrontend(m_frontend.get(), m_injectedScriptHost.get());
}
-void InspectorController::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void InspectorController::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, ScriptCallStack* callStack, const String& message)
{
if (!enabled())
return;
- addConsoleMessage(new ConsoleMessage(source, type, level, message, arguments, callStack, m_groupLevel));
+ bool storeStackTrace = type == TraceMessageType || type == UncaughtExceptionMessageType || type == AssertMessageType;
+ addConsoleMessage(new ConsoleMessage(source, type, level, message, callStack, m_groupLevel, storeStackTrace));
}
void InspectorController::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
@@ -391,11 +391,11 @@ void InspectorController::clearConsoleMessages()
m_frontend->consoleMessagesCleared();
}
-void InspectorController::startGroup(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack, bool collapsed)
+void InspectorController::startGroup(MessageSource source, ScriptCallStack* callStack, bool collapsed)
{
++m_groupLevel;
- addConsoleMessage(new ConsoleMessage(JSMessageSource, collapsed ? StartGroupCollapsedMessageType : StartGroupMessageType, LogMessageLevel, "", arguments, callStack, m_groupLevel));
+ addConsoleMessage(new ConsoleMessage(source, collapsed ? StartGroupCollapsedMessageType : StartGroupMessageType, LogMessageLevel, String(), callStack, m_groupLevel));
}
void InspectorController::endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL)
diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h
index 68aa147..6d4d9e0 100644
--- a/WebCore/inspector/InspectorController.h
+++ b/WebCore/inspector/InspectorController.h
@@ -81,7 +81,6 @@ class Page;
class ResourceRequest;
class ResourceResponse;
class ResourceError;
-class ScriptArguments;
class ScriptCallStack;
class ScriptProfile;
class SharedBuffer;
@@ -146,8 +145,8 @@ public:
void disconnectFrontend();
void setConsoleMessagesEnabled(bool enabled, bool* newState);
- void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack>);
- void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String&);
+ void addMessageToConsole(MessageSource, MessageType, MessageLevel, ScriptCallStack*, const String& message);
+ void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
void clearConsoleMessages();
const Vector<OwnPtr<ConsoleMessage> >& consoleMessages() const { return m_consoleMessages; }
@@ -233,7 +232,7 @@ public:
void startTiming(const String& title);
bool stopTiming(const String& title, double& elapsed);
- void startGroup(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack> callFrame, bool collapsed = false);
+ void startGroup(MessageSource source, ScriptCallStack* callFrame, bool collapsed = false);
void endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL);
void markTimeline(const String& message);
diff --git a/WebCore/inspector/ScriptArguments.cpp b/WebCore/inspector/ScriptArguments.cpp
deleted file mode 100644
index e30e135..0000000
--- a/WebCore/inspector/ScriptArguments.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ScriptArguments.h"
-
-#include "ScriptValue.h"
-
-namespace WebCore {
-
-ScriptArguments::ScriptArguments(ScriptState* scriptState, Vector<ScriptValue>& arguments)
- : m_scriptState(scriptState)
-{
- m_arguments.swap(arguments);
-}
-
-ScriptArguments::~ScriptArguments()
-{
-}
-
-const ScriptValue &ScriptArguments::argumentAt(size_t index) const
-{
- ASSERT(m_arguments.size() > index);
- return m_arguments[index];
-}
-
-ScriptState* ScriptArguments::globalState() const
-{
- return m_scriptState.get();
-}
-
-bool ScriptArguments::getFirstArgumentAsString(String& result, bool checkForNullOrUndefined)
-{
- if (!argumentCount())
- return false;
-
- const ScriptValue& value = argumentAt(0);
- if (checkForNullOrUndefined && (value.isNull() || value.isUndefined()))
- return false;
-
- if (!globalState()) {
- ASSERT_NOT_REACHED();
- return false;
- }
-
- result = value.toString(globalState());
- return true;
-}
-
-bool ScriptArguments::isEqual(ScriptArguments* other) const
-{
- if (!other)
- return false;
-
- if (m_arguments.size() != other->m_arguments.size())
- return false;
- if (!globalState() && m_arguments.size())
- return false;
-
- for (size_t i = 0; i < m_arguments.size(); ++i) {
- if (!m_arguments[i].isEqual(other->globalState(), other->m_arguments[i]))
- return false;
- }
- return true;
-}
-
-} // namespace WebCore
diff --git a/WebCore/inspector/ScriptArguments.h b/WebCore/inspector/ScriptArguments.h
deleted file mode 100644
index fdf05ab..0000000
--- a/WebCore/inspector/ScriptArguments.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ScriptArguments_h
-#define ScriptArguments_h
-
-#include "PlatformString.h"
-#include "ScriptState.h"
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class ScriptValue;
-
-class ScriptArguments {
-public:
- ScriptArguments(ScriptState*, Vector<ScriptValue>& arguments);
- ~ScriptArguments();
-
- const ScriptValue& argumentAt(size_t) const;
- size_t argumentCount() const { return m_arguments.size(); }
-
- ScriptState* globalState() const;
-
- bool getFirstArgumentAsString(WTF::String& result, bool checkForNullOrUndefined = false);
- bool isEqual(ScriptArguments*) const;
-
-private:
- ScriptStateProtectedPtr m_scriptState;
- Vector<ScriptValue> m_arguments;
-};
-
-} // namespace WebCore
-
-#endif // ScriptArguments_h
diff --git a/WebCore/inspector/ScriptCallFrame.cpp b/WebCore/inspector/ScriptCallFrame.cpp
deleted file mode 100644
index 5455d25..0000000
--- a/WebCore/inspector/ScriptCallFrame.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ScriptCallFrame.h"
-
-#include "InspectorValues.h"
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlString, unsigned lineNumber)
- : m_functionName(functionName)
- , m_sourceURL(urlString)
- , m_lineNumber(lineNumber)
-{
-}
-
-ScriptCallFrame::~ScriptCallFrame()
-{
-}
-
-bool ScriptCallFrame::isEqual(const ScriptCallFrame& o) const
-{
- return m_functionName == o.m_functionName
- && m_sourceURL == o.m_sourceURL
- && m_lineNumber == o.m_lineNumber;
-}
-
-PassRefPtr<InspectorObject> ScriptCallFrame::buildInspectorObject() const
-{
- RefPtr<InspectorObject> frame = InspectorObject::create();
- frame->setString("functionName", m_functionName);
- frame->setString("sourceURL", m_sourceURL);
- frame->setNumber("lineNumber", m_lineNumber);
- return frame;
-}
-
-} // namespace WebCore
diff --git a/WebCore/inspector/ScriptCallFrame.h b/WebCore/inspector/ScriptCallFrame.h
deleted file mode 100644
index 60d77e1..0000000
--- a/WebCore/inspector/ScriptCallFrame.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ScriptCallFrame_h
-#define ScriptCallFrame_h
-
-#include "PlatformString.h"
-#include <wtf/PassRefPtr.h>
-
-namespace WebCore {
-
-class InspectorObject;
-
-class ScriptCallFrame {
-public:
- ScriptCallFrame(const String& functionName, const String& urlString, unsigned lineNumber);
- ~ScriptCallFrame();
-
- const String& functionName() const { return m_functionName; }
- const String& sourceURL() const { return m_sourceURL; }
- unsigned lineNumber() const { return m_lineNumber; }
-
- bool isEqual(const ScriptCallFrame&) const;
- PassRefPtr<InspectorObject> buildInspectorObject() const;
-
-private:
- String m_functionName;
- String m_sourceURL;
- unsigned m_lineNumber;
-};
-
-} // namespace WebCore
-
-#endif // ScriptCallFrame_h
diff --git a/WebCore/inspector/ScriptCallStack.cpp b/WebCore/inspector/ScriptCallStack.cpp
deleted file mode 100644
index 8d010bb..0000000
--- a/WebCore/inspector/ScriptCallStack.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2008, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ScriptCallStack.h"
-
-#include "InspectorValues.h"
-
-namespace WebCore {
-
-ScriptCallStack::ScriptCallStack(Vector<ScriptCallFrame>& frames)
-{
- m_frames.swap(frames);
-}
-
-ScriptCallStack::~ScriptCallStack()
-{
-}
-
-const ScriptCallFrame &ScriptCallStack::at(size_t index)
-{
- ASSERT(m_frames.size() > index);
- return m_frames[index];
-}
-
-size_t ScriptCallStack::size()
-{
- return m_frames.size();
-}
-
-bool ScriptCallStack::isEqual(ScriptCallStack* o) const
-{
- if (!o)
- return false;
-
- size_t frameCount = o->m_frames.size();
- if (frameCount != m_frames.size())
- return false;
-
- for (size_t i = 0; i < frameCount; ++i) {
- if (!m_frames[i].isEqual(o->m_frames[i]))
- return false;
- }
-
- return true;
-}
-
-PassRefPtr<InspectorArray> ScriptCallStack::buildInspectorObject() const
-{
- RefPtr<InspectorArray> frames = InspectorArray::create();
- for (size_t i = 0; i < m_frames.size(); i++)
- frames->pushObject(m_frames.at(i).buildInspectorObject());
- return frames;
-}
-
-} // namespace WebCore
diff --git a/WebCore/inspector/ScriptCallStack.h b/WebCore/inspector/ScriptCallStack.h
deleted file mode 100644
index 54c6bba..0000000
--- a/WebCore/inspector/ScriptCallStack.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2008, 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ScriptCallStack_h
-#define ScriptCallStack_h
-
-#include "ScriptCallFrame.h"
-#include <wtf/Noncopyable.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class InspectorArray;
-
-class ScriptCallStack : public Noncopyable {
-public:
- static const size_t maxCallStackSizeToCapture = 200;
-
- ScriptCallStack(Vector<ScriptCallFrame>&);
- ~ScriptCallStack();
-
- const ScriptCallFrame &at(size_t);
- size_t size();
- static bool stackTrace(int, const RefPtr<InspectorArray>&);
-
- bool isEqual(ScriptCallStack*) const;
- PassRefPtr<InspectorArray> buildInspectorObject() const;
-
-private:
- Vector<ScriptCallFrame> m_frames;
-};
-
-} // namespace WebCore
-
-#endif // ScriptCallStack_h
diff --git a/WebCore/page/Console.cpp b/WebCore/page/Console.cpp
index 7dd85a6..2d4cc98 100644
--- a/WebCore/page/Console.cpp
+++ b/WebCore/page/Console.cpp
@@ -41,7 +41,6 @@
#include "PageGroup.h"
#include "PlatformString.h"
-#include "ScriptArguments.h"
#include "ScriptCallStack.h"
#include "ScriptProfile.h"
#include "ScriptProfiler.h"
@@ -78,6 +77,19 @@ static void printSourceURLAndLine(const String& sourceURL, unsigned lineNumber)
}
}
+static bool getFirstArgumentAsString(ScriptState* scriptState, const ScriptCallFrame& callFrame, String& result, bool checkForNullOrUndefined = false)
+{
+ if (!callFrame.argumentCount())
+ return false;
+
+ const ScriptValue& value = callFrame.argumentAt(0);
+ if (checkForNullOrUndefined && (value.isNull() || value.isUndefined()))
+ return false;
+
+ result = value.toString(scriptState);
+ return true;
+}
+
static void printMessageSourceAndLevelPrefix(MessageSource source, MessageLevel level)
{
const char* sourceString;
@@ -132,12 +144,7 @@ static void printMessageSourceAndLevelPrefix(MessageSource source, MessageLevel
printf("%s %s:", sourceString, levelString);
}
-void Console::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
-{
- addMessage(source, type, level, message, lineNumber, sourceURL, 0);
-}
-
-void Console::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL, PassOwnPtr<ScriptCallStack> callStack)
+void Console::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL, ScriptCallStack* callStack)
{
Page* page = this->page();
if (!page)
@@ -148,7 +155,7 @@ void Console::addMessage(MessageSource source, MessageType type, MessageLevel le
#if ENABLE(INSPECTOR)
if (callStack)
- page->inspectorController()->addMessageToConsole(source, type, level, message, 0, callStack);
+ page->inspectorController()->addMessageToConsole(source, type, level, callStack, message);
else
page->inspectorController()->addMessageToConsole(source, type, level, message, lineNumber, sourceURL);
#endif
@@ -162,7 +169,7 @@ void Console::addMessage(MessageSource source, MessageType type, MessageLevel le
printf(" %s\n", message.utf8().data());
}
-void Console::addMessage(MessageType type, MessageLevel level, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack, bool acceptNoArguments)
+void Console::addMessage(MessageType type, MessageLevel level, ScriptCallStack* callStack, bool acceptNoArguments)
{
Page* page = this->page();
if (!page)
@@ -170,15 +177,15 @@ void Console::addMessage(MessageType type, MessageLevel level, PassOwnPtr<Script
const ScriptCallFrame& lastCaller = callStack->at(0);
- if (!acceptNoArguments && !arguments->argumentCount())
+ if (!acceptNoArguments && !lastCaller.argumentCount())
return;
String message;
- if (arguments->getFirstArgumentAsString(message))
+ if (getFirstArgumentAsString(callStack->state(), lastCaller, message))
page->chrome()->client()->addMessageToConsole(JSMessageSource, type, level, message, lastCaller.lineNumber(), lastCaller.sourceURL());
#if ENABLE(INSPECTOR)
- page->inspectorController()->addMessageToConsole(JSMessageSource, type, level, "", arguments, callStack);
+ page->inspectorController()->addMessageToConsole(JSMessageSource, type, level, callStack, message);
#endif
if (!Console::shouldPrintExceptions())
@@ -187,49 +194,49 @@ void Console::addMessage(MessageType type, MessageLevel level, PassOwnPtr<Script
printSourceURLAndLine(lastCaller.sourceURL(), 0);
printMessageSourceAndLevelPrefix(JSMessageSource, level);
- for (unsigned i = 0; i < arguments->argumentCount(); ++i) {
+ for (unsigned i = 0; i < lastCaller.argumentCount(); ++i) {
String argAsString;
- if (arguments->argumentAt(i).getString(arguments->globalState(), argAsString))
+ if (lastCaller.argumentAt(i).getString(callStack->state(), argAsString))
printf(" %s", argAsString.utf8().data());
}
printf("\n");
}
-void Console::debug(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::debug(ScriptCallStack* callStack)
{
// In Firebug, console.debug has the same behavior as console.log. So we'll do the same.
- log(arguments, callStack);
+ log(callStack);
}
-void Console::error(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::error(ScriptCallStack* callStack)
{
- addMessage(LogMessageType, ErrorMessageLevel, arguments, callStack);
+ addMessage(LogMessageType, ErrorMessageLevel, callStack);
}
-void Console::info(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::info(ScriptCallStack* callStack)
{
- log(arguments, callStack);
+ log(callStack);
}
-void Console::log(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::log(ScriptCallStack* callStack)
{
- addMessage(LogMessageType, LogMessageLevel, arguments, callStack);
+ addMessage(LogMessageType, LogMessageLevel, callStack);
}
-void Console::dir(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::dir(ScriptCallStack* callStack)
{
- addMessage(ObjectMessageType, LogMessageLevel, arguments, callStack);
+ addMessage(ObjectMessageType, LogMessageLevel, callStack);
}
-void Console::dirxml(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::dirxml(ScriptCallStack* callStack)
{
// The standard behavior of our console.log will print the DOM tree for nodes.
- log(arguments, callStack);
+ log(callStack);
}
-void Console::trace(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::trace(ScriptCallStack* callStack)
{
- addMessage(TraceMessageType, LogMessageLevel, arguments, callStack, true);
+ addMessage(TraceMessageType, LogMessageLevel, callStack, true);
if (!shouldPrintExceptions())
return;
@@ -241,15 +248,15 @@ void Console::trace(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCall
}
}
-void Console::assertCondition(bool condition, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::assertCondition(bool condition, ScriptCallStack* callStack)
{
if (condition)
return;
- addMessage(AssertMessageType, ErrorMessageLevel, arguments, callStack, true);
+ addMessage(AssertMessageType, ErrorMessageLevel, callStack, true);
}
-void Console::count(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::count(ScriptCallStack* callStack)
{
#if ENABLE(INSPECTOR)
Page* page = this->page();
@@ -260,7 +267,7 @@ void Console::count(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCall
// Follow Firebug's behavior of counting with null and undefined title in
// the same bucket as no argument
String title;
- arguments->getFirstArgumentAsString(title);
+ getFirstArgumentAsString(callStack->state(), lastCaller, title);
page->inspectorController()->count(title, lastCaller.lineNumber(), lastCaller.sourceURL());
#else
@@ -268,19 +275,20 @@ void Console::count(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCall
#endif
}
-void Console::markTimeline(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack>)
+void Console::markTimeline(ScriptCallStack* callStack)
{
#if ENABLE(INSPECTOR)
Page* page = this->page();
if (!page)
return;
+ const ScriptCallFrame& lastCaller = callStack->at(0);
String message;
- arguments->getFirstArgumentAsString(message);
+ getFirstArgumentAsString(callStack->state(), lastCaller, message);
page->inspectorController()->markTimeline(message);
#else
- UNUSED_PARAM(arguments);
+ UNUSED_PARAM(callStack);
#endif
}
@@ -313,7 +321,7 @@ String Console::lastWMLErrorMessage() const
#if ENABLE(JAVASCRIPT_DEBUGGER)
-void Console::profile(const String& title, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::profile(const String& title, ScriptCallStack* callStack)
{
Page* page = this->page();
if (!page)
@@ -334,7 +342,7 @@ void Console::profile(const String& title, PassOwnPtr<ScriptArguments> arguments
resolvedTitle = "";
#endif
- ScriptProfiler::start(arguments->globalState(), resolvedTitle);
+ ScriptProfiler::start(callStack->state(), resolvedTitle);
#if ENABLE(INSPECTOR)
const ScriptCallFrame& lastCaller = callStack->at(0);
@@ -342,7 +350,7 @@ void Console::profile(const String& title, PassOwnPtr<ScriptArguments> arguments
#endif
}
-void Console::profileEnd(const String& title, PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::profileEnd(const String& title, ScriptCallStack* callStack)
{
Page* page = this->page();
if (!page)
@@ -354,7 +362,7 @@ void Console::profileEnd(const String& title, PassOwnPtr<ScriptArguments> argume
return;
#endif
- RefPtr<ScriptProfile> profile = ScriptProfiler::stop(arguments->globalState(), title);
+ RefPtr<ScriptProfile> profile = ScriptProfiler::stop(callStack->state(), title);
if (!profile)
return;
@@ -386,7 +394,7 @@ void Console::time(const String& title)
#endif
}
-void Console::timeEnd(const String& title, PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack> callStack)
+void Console::timeEnd(const String& title, ScriptCallStack* callStack)
{
#if ENABLE(INSPECTOR)
Page* page = this->page();
@@ -412,30 +420,28 @@ void Console::timeEnd(const String& title, PassOwnPtr<ScriptArguments>, PassOwnP
#endif
}
-void Console::group(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::group(ScriptCallStack* callStack)
{
#if ENABLE(INSPECTOR)
Page* page = this->page();
if (!page)
return;
- page->inspectorController()->startGroup(arguments, callStack);
+ page->inspectorController()->startGroup(JSMessageSource, callStack);
#else
- UNUSED_PARAM(arguments);
UNUSED_PARAM(callStack);
#endif
}
-void Console::groupCollapsed(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::groupCollapsed(ScriptCallStack* callStack)
{
#if ENABLE(INSPECTOR)
Page* page = this->page();
if (!page)
return;
- page->inspectorController()->startGroup(arguments, callStack, true);
+ page->inspectorController()->startGroup(JSMessageSource, callStack, true);
#else
- UNUSED_PARAM(arguments);
UNUSED_PARAM(callStack);
#endif
}
@@ -451,22 +457,9 @@ void Console::groupEnd()
#endif
}
-bool Console::shouldCaptureFullStackTrace() const
-{
-#if ENABLE(INSPECTOR)
- Page* page = this->page();
- if (!page)
- return false;
-
- return page->inspectorController()->hasFrontend();
-#else
- return false;
-#endif
-}
-
-void Console::warn(PassOwnPtr<ScriptArguments> arguments, PassOwnPtr<ScriptCallStack> callStack)
+void Console::warn(ScriptCallStack* callStack)
{
- addMessage(LogMessageType, WarningMessageLevel, arguments, callStack);
+ addMessage(LogMessageType, WarningMessageLevel, callStack);
}
MemoryInfo* Console::memory() const
diff --git a/WebCore/page/Console.h b/WebCore/page/Console.h
index 9a48fb6..ab62525 100644
--- a/WebCore/page/Console.h
+++ b/WebCore/page/Console.h
@@ -39,8 +39,6 @@
namespace WebCore {
-class ScriptArguments;
-
#if ENABLE(JAVASCRIPT_DEBUGGER)
typedef Vector<RefPtr<ScriptProfile> > ProfilesArray;
#endif
@@ -85,35 +83,32 @@ public:
Frame* frame() const;
void disconnectFrame();
- void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
- void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL, PassOwnPtr<ScriptCallStack> callStack);
-
- void debug(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
- void error(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
- void info(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
- void log(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
- void warn(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
- void dir(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
- void dirxml(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
- void trace(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
- void assertCondition(bool condition, PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
- void count(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
- void markTimeline(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
+ void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL, ScriptCallStack* callStack = 0);
+
+ void debug(ScriptCallStack*);
+ void error(ScriptCallStack*);
+ void info(ScriptCallStack*);
+ void log(ScriptCallStack*);
+ void warn(ScriptCallStack*);
+ void dir(ScriptCallStack*);
+ void dirxml(ScriptCallStack*);
+ void trace(ScriptCallStack*);
+ void assertCondition(bool condition, ScriptCallStack*);
+ void count(ScriptCallStack*);
+ void markTimeline(ScriptCallStack*);
#if ENABLE(WML)
String lastWMLErrorMessage() const;
#endif
#if ENABLE(JAVASCRIPT_DEBUGGER)
- void profile(const String&, PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
- void profileEnd(const String&, PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
+ void profile(const String&, ScriptCallStack*);
+ void profileEnd(const String&, ScriptCallStack*);
#endif
void time(const String&);
- void timeEnd(const String&, PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
- void group(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
- void groupCollapsed(PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>);
+ void timeEnd(const String&, ScriptCallStack*);
+ void group(ScriptCallStack*);
+ void groupCollapsed(ScriptCallStack*);
void groupEnd();
- bool shouldCaptureFullStackTrace() const;
-
static bool shouldPrintExceptions();
static void setShouldPrintExceptions(bool);
@@ -125,7 +120,7 @@ public:
private:
inline Page* page() const;
- void addMessage(MessageType, MessageLevel, PassOwnPtr<ScriptArguments>, PassOwnPtr<ScriptCallStack>, bool acceptNoArguments = false);
+ void addMessage(MessageType, MessageLevel, ScriptCallStack*, bool acceptNoArguments = false);
Console(Frame*);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list