[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
yurys at chromium.org
yurys at chromium.org
Wed Dec 22 18:01:36 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit aab39dee4000409cd4e93d53ea2b89f89b11842e
Author: yurys at chromium.org <yurys at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Dec 6 10:13:38 2010 +0000
2010-12-03 Yury Semikhatsky <yurys at chromium.org>
Reviewed by Pavel Feldman.
[v8] Web Inspector: remove duplicate code for capturing stack trace
https://bugs.webkit.org/show_bug.cgi?id=50461
No new tests. Covered with existing inspector tests.
* bindings/js/ScriptCallStackFactory.cpp:
(WebCore::createScriptCallStack):
* bindings/js/ScriptCallStackFactory.h:
* bindings/v8/ScriptCallStackFactory.cpp:
(WebCore::toScriptCallFrame):
(WebCore::toScriptCallFramesVector):
(WebCore::createScriptCallStack):
* bindings/v8/ScriptCallStackFactory.h:
* bindings/v8/V8ConsoleMessage.cpp:
(WebCore::V8ConsoleMessage::handler):
* inspector/ScriptCallFrame.cpp:
(WebCore::ScriptCallFrame::ScriptCallFrame):
(WebCore::ScriptCallFrame::isEqual):
(WebCore::ScriptCallFrame::buildInspectorObject):
* inspector/ScriptCallFrame.h:
(WebCore::ScriptCallFrame::sourceURL):
* inspector/ScriptCallStack.h:
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createGenericRecord):
* inspector/front-end/ConsoleView.js:
(WebInspector.ConsoleMessage.prototype._populateStackTraceTreeElement):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1721526..5336675 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,34 @@
+2010-12-03 Yury Semikhatsky <yurys at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ [v8] Web Inspector: remove duplicate code for capturing stack trace
+ https://bugs.webkit.org/show_bug.cgi?id=50461
+
+ No new tests. Covered with existing inspector tests.
+
+ * bindings/js/ScriptCallStackFactory.cpp:
+ (WebCore::createScriptCallStack):
+ * bindings/js/ScriptCallStackFactory.h:
+ * bindings/v8/ScriptCallStackFactory.cpp:
+ (WebCore::toScriptCallFrame):
+ (WebCore::toScriptCallFramesVector):
+ (WebCore::createScriptCallStack):
+ * bindings/v8/ScriptCallStackFactory.h:
+ * bindings/v8/V8ConsoleMessage.cpp:
+ (WebCore::V8ConsoleMessage::handler):
+ * inspector/ScriptCallFrame.cpp:
+ (WebCore::ScriptCallFrame::ScriptCallFrame):
+ (WebCore::ScriptCallFrame::isEqual):
+ (WebCore::ScriptCallFrame::buildInspectorObject):
+ * inspector/ScriptCallFrame.h:
+ (WebCore::ScriptCallFrame::sourceURL):
+ * inspector/ScriptCallStack.h:
+ * inspector/TimelineRecordFactory.cpp:
+ (WebCore::TimelineRecordFactory::createGenericRecord):
+ * inspector/front-end/ConsoleView.js:
+ (WebInspector.ConsoleMessage.prototype._populateStackTraceTreeElement):
+
2010-12-06 Sergio Villar Senin <svillar at igalia.com>
Reviewed by Martin Robinson.
diff --git a/WebCore/bindings/js/ScriptCallStackFactory.cpp b/WebCore/bindings/js/ScriptCallStackFactory.cpp
index 9a64ffc..a8d8d56 100644
--- a/WebCore/bindings/js/ScriptCallStackFactory.cpp
+++ b/WebCore/bindings/js/ScriptCallStackFactory.cpp
@@ -48,6 +48,11 @@ using namespace JSC;
namespace WebCore {
+PassRefPtr<ScriptCallStack> createScriptCallStack(size_t)
+{
+ return 0;
+}
+
PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t maxStackSize)
{
Vector<ScriptCallFrame> frames;
@@ -87,9 +92,4 @@ PassRefPtr<ScriptArguments> createScriptArguments(JSC::ExecState* exec, unsigned
return ScriptArguments::create(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
index 9fbfc78..67483d1 100644
--- a/WebCore/bindings/js/ScriptCallStackFactory.h
+++ b/WebCore/bindings/js/ScriptCallStackFactory.h
@@ -42,6 +42,7 @@ namespace WebCore {
class ScriptArguments;
class ScriptCallStack;
+PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize);
PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState*, size_t maxStackSize);
PassRefPtr<ScriptArguments> createScriptArguments(JSC::ExecState*, unsigned skipArgumentCount);
diff --git a/WebCore/bindings/v8/ScriptCallStackFactory.cpp b/WebCore/bindings/v8/ScriptCallStackFactory.cpp
index 5d4e146..4563a28 100644
--- a/WebCore/bindings/v8/ScriptCallStackFactory.cpp
+++ b/WebCore/bindings/v8/ScriptCallStackFactory.cpp
@@ -56,13 +56,13 @@ static ScriptCallFrame toScriptCallFrame(v8::Handle<v8::StackFrame> frame)
functionName = toWebCoreString(functionNameValue);
int sourceLineNumber = frame->GetLineNumber();
- return ScriptCallFrame(functionName, sourceName, sourceLineNumber);
+ int sourceColumn = frame->GetColumn();
+ return ScriptCallFrame(functionName, sourceName, sourceLineNumber, sourceColumn);
}
-static void toScriptCallFramesVector(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, Vector<ScriptCallFrame>& scriptCallFrames, size_t maxStackSize)
+static void toScriptCallFramesVector(v8::Handle<v8::StackTrace> stackTrace, Vector<ScriptCallFrame>& scriptCallFrames, size_t maxStackSize)
{
- // TODO(yurys): remove this???
- v8::Context::Scope contextScope(context);
+ ASSERT(v8::Context::InContext());
int frameCount = stackTrace->GetFrameCount();
if (frameCount > static_cast<int>(maxStackSize))
frameCount = maxStackSize;
@@ -70,32 +70,24 @@ static void toScriptCallFramesVector(v8::Local<v8::Context> context, v8::Handle<
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));
- }
}
-PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, size_t maxStackSize)
+PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Handle<v8::StackTrace> stackTrace, size_t maxStackSize)
{
+ ASSERT(v8::Context::InContext());
v8::HandleScope scope;
- v8::Context::Scope contextScope(context);
-
Vector<ScriptCallFrame> scriptCallFrames;
- toScriptCallFramesVector(context, stackTrace, scriptCallFrames, maxStackSize);
+ toScriptCallFramesVector(stackTrace, scriptCallFrames, maxStackSize);
return ScriptCallStack::create(scriptCallFrames);
}
PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize)
{
- v8::HandleScope scope;
- v8::Local<v8::Context> context = v8::Context::GetCurrent();
- // TODO(yurys): remove?
- v8::Context::Scope contextScope(context);
+ if (!v8::Context::InContext())
+ return 0;
+ v8::HandleScope handleScope;
v8::Handle<v8::StackTrace> stackTrace(v8::StackTrace::CurrentStackTrace(maxStackSize, stackTraceOptions));
- return createScriptCallStack(context, stackTrace, maxStackSize);
+ return createScriptCallStack(stackTrace, maxStackSize);
}
PassRefPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount)
@@ -111,35 +103,4 @@ PassRefPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8argumen
return ScriptArguments::create(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
index 66e44f5..6f1bbab 100644
--- a/WebCore/bindings/v8/ScriptCallStackFactory.h
+++ b/WebCore/bindings/v8/ScriptCallStackFactory.h
@@ -46,7 +46,7 @@ const v8::StackTrace::StackTraceOptions stackTraceOptions = static_cast<v8::Stac
| v8::StackTrace::kScriptNameOrSourceURL
| v8::StackTrace::kFunctionName);
-PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context>, v8::Handle<v8::StackTrace>, size_t maxStackSize);
+PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Handle<v8::StackTrace>, size_t maxStackSize);
PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize);
PassRefPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount);
diff --git a/WebCore/bindings/v8/V8ConsoleMessage.cpp b/WebCore/bindings/v8/V8ConsoleMessage.cpp
index 9e6e267..5dc79fd 100644
--- a/WebCore/bindings/v8/V8ConsoleMessage.cpp
+++ b/WebCore/bindings/v8/V8ConsoleMessage.cpp
@@ -117,8 +117,7 @@ void V8ConsoleMessage::handler(v8::Handle<v8::Message> message, v8::Handle<v8::V
RefPtr<ScriptCallStack> callStack;
// 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);
+ callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture);
}
v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
diff --git a/WebCore/inspector/ScriptCallFrame.cpp b/WebCore/inspector/ScriptCallFrame.cpp
index c4dab3c..0b5204b 100644
--- a/WebCore/inspector/ScriptCallFrame.cpp
+++ b/WebCore/inspector/ScriptCallFrame.cpp
@@ -36,10 +36,11 @@
namespace WebCore {
-ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlString, unsigned lineNumber)
+ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& scriptName, unsigned lineNumber, unsigned column)
: m_functionName(functionName)
- , m_sourceURL(urlString)
+ , m_scriptName(scriptName)
, m_lineNumber(lineNumber)
+ , m_column(column)
{
}
@@ -50,7 +51,7 @@ ScriptCallFrame::~ScriptCallFrame()
bool ScriptCallFrame::isEqual(const ScriptCallFrame& o) const
{
return m_functionName == o.m_functionName
- && m_sourceURL == o.m_sourceURL
+ && m_scriptName == o.m_scriptName
&& m_lineNumber == o.m_lineNumber;
}
@@ -59,8 +60,9 @@ PassRefPtr<InspectorObject> ScriptCallFrame::buildInspectorObject() const
{
RefPtr<InspectorObject> frame = InspectorObject::create();
frame->setString("functionName", m_functionName);
- frame->setString("sourceURL", m_sourceURL);
+ frame->setString("scriptName", m_scriptName);
frame->setNumber("lineNumber", m_lineNumber);
+ frame->setNumber("column", m_column);
return frame;
}
#endif
diff --git a/WebCore/inspector/ScriptCallFrame.h b/WebCore/inspector/ScriptCallFrame.h
index 2a1f257..2c025dc 100644
--- a/WebCore/inspector/ScriptCallFrame.h
+++ b/WebCore/inspector/ScriptCallFrame.h
@@ -40,11 +40,11 @@ class InspectorObject;
class ScriptCallFrame {
public:
- ScriptCallFrame(const String& functionName, const String& urlString, unsigned lineNumber);
+ ScriptCallFrame(const String& functionName, const String& scriptName, unsigned lineNumber, unsigned column = 0);
~ScriptCallFrame();
const String& functionName() const { return m_functionName; }
- const String& sourceURL() const { return m_sourceURL; }
+ const String& sourceURL() const { return m_scriptName; }
unsigned lineNumber() const { return m_lineNumber; }
bool isEqual(const ScriptCallFrame&) const;
@@ -52,8 +52,9 @@ public:
private:
String m_functionName;
- String m_sourceURL;
+ String m_scriptName;
unsigned m_lineNumber;
+ unsigned m_column;
};
} // namespace WebCore
diff --git a/WebCore/inspector/ScriptCallStack.h b/WebCore/inspector/ScriptCallStack.h
index 36ea670..4cb152f 100644
--- a/WebCore/inspector/ScriptCallStack.h
+++ b/WebCore/inspector/ScriptCallStack.h
@@ -50,7 +50,6 @@ public:
const ScriptCallFrame &at(size_t) const;
size_t size() const;
- static bool stackTrace(int, const RefPtr<InspectorArray>&);
bool isEqual(ScriptCallStack*) const;
PassRefPtr<InspectorArray> buildInspectorObject() const;
diff --git a/WebCore/inspector/TimelineRecordFactory.cpp b/WebCore/inspector/TimelineRecordFactory.cpp
index 713d6bc..7e62daf 100644
--- a/WebCore/inspector/TimelineRecordFactory.cpp
+++ b/WebCore/inspector/TimelineRecordFactory.cpp
@@ -39,6 +39,7 @@
#include "ResourceRequest.h"
#include "ResourceResponse.h"
#include "ScriptCallStack.h"
+#include "ScriptCallStackFactory.h"
namespace WebCore {
@@ -47,9 +48,9 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createGenericRecord(double st
RefPtr<InspectorObject> record = InspectorObject::create();
record->setNumber("startTime", startTime);
- RefPtr<InspectorArray> stackTrace = InspectorArray::create();
- if (ScriptCallStack::stackTrace(5, stackTrace))
- record->setArray("stackTrace", stackTrace);
+ RefPtr<ScriptCallStack> stackTrace = createScriptCallStack(5);
+ if (stackTrace && stackTrace->size())
+ record->setArray("stackTrace", stackTrace->buildInspectorObject());
return record.release();
}
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js
index 737b84f..6cf3aec 100644
--- a/WebCore/inspector/front-end/ConsoleView.js
+++ b/WebCore/inspector/front-end/ConsoleView.js
@@ -863,7 +863,7 @@ WebInspector.ConsoleMessage.prototype = {
messageTextElement.appendChild(document.createTextNode(functionName));
content.appendChild(messageTextElement);
- var urlElement = WebInspector.linkifyResourceAsNode(frame.sourceURL, "scripts", frame.lineNumber, "console-message-url");
+ var urlElement = WebInspector.linkifyResourceAsNode(frame.scriptName, "scripts", frame.lineNumber, "console-message-url");
content.appendChild(urlElement);
var treeElement = new TreeElement(content);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list