[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:51 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 7bb58a58a89c0b98ef3d12852f93c561fb624a95
Author: yurys at chromium.org <yurys at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Dec 6 11:59:32 2010 +0000

    2010-12-06  Sheriff Bot  <webkit.review.bot at gmail.com>
    
            Unreviewed, rolling out r73351.
            http://trac.webkit.org/changeset/73351
            https://bugs.webkit.org/show_bug.cgi?id=50560
    
            "The change broke plugin tests in Chromium" (Requested by
            yurys on #webkit).
    
            * bindings/js/ScriptCallStackFactory.cpp:
            (WebCore::ScriptCallStack::stackTrace):
            * bindings/js/ScriptCallStackFactory.h:
            * bindings/v8/ScriptCallStackFactory.cpp:
            (WebCore::toScriptCallFrame):
            (WebCore::toScriptCallFramesVector):
            (WebCore::createScriptCallStack):
            (WebCore::ScriptCallStack::stackTrace):
            * 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@73355 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4956c12..1297e56 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,35 @@
+2010-12-06  Sheriff Bot  <webkit.review.bot at gmail.com>
+
+        Unreviewed, rolling out r73351.
+        http://trac.webkit.org/changeset/73351
+        https://bugs.webkit.org/show_bug.cgi?id=50560
+
+        "The change broke plugin tests in Chromium" (Requested by
+        yurys on #webkit).
+
+        * bindings/js/ScriptCallStackFactory.cpp:
+        (WebCore::ScriptCallStack::stackTrace):
+        * bindings/js/ScriptCallStackFactory.h:
+        * bindings/v8/ScriptCallStackFactory.cpp:
+        (WebCore::toScriptCallFrame):
+        (WebCore::toScriptCallFramesVector):
+        (WebCore::createScriptCallStack):
+        (WebCore::ScriptCallStack::stackTrace):
+        * 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  Robert Hogan  <robert at webkit.org>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/bindings/js/ScriptCallStackFactory.cpp b/WebCore/bindings/js/ScriptCallStackFactory.cpp
index a8d8d56..9a64ffc 100644
--- a/WebCore/bindings/js/ScriptCallStackFactory.cpp
+++ b/WebCore/bindings/js/ScriptCallStackFactory.cpp
@@ -48,11 +48,6 @@ using namespace JSC;
 
 namespace WebCore {
 
-PassRefPtr<ScriptCallStack> createScriptCallStack(size_t)
-{
-    return 0;
-}
-
 PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t maxStackSize)
 {
     Vector<ScriptCallFrame> frames;
@@ -92,4 +87,9 @@ 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 67483d1..9fbfc78 100644
--- a/WebCore/bindings/js/ScriptCallStackFactory.h
+++ b/WebCore/bindings/js/ScriptCallStackFactory.h
@@ -42,7 +42,6 @@ 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 4563a28..5d4e146 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();
-    int sourceColumn = frame->GetColumn();
-    return ScriptCallFrame(functionName, sourceName, sourceLineNumber, sourceColumn);
+    return ScriptCallFrame(functionName, sourceName, sourceLineNumber);
 }
 
-static void toScriptCallFramesVector(v8::Handle<v8::StackTrace> stackTrace, Vector<ScriptCallFrame>& scriptCallFrames, size_t maxStackSize)
+static void toScriptCallFramesVector(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, Vector<ScriptCallFrame>& scriptCallFrames, size_t maxStackSize)
 {
-    ASSERT(v8::Context::InContext());
+    // TODO(yurys): remove this???
+    v8::Context::Scope contextScope(context);
     int frameCount = stackTrace->GetFrameCount();
     if (frameCount > static_cast<int>(maxStackSize))
         frameCount = maxStackSize;
@@ -70,24 +70,32 @@ static void toScriptCallFramesVector(v8::Handle<v8::StackTrace> stackTrace, Vect
         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::Handle<v8::StackTrace> stackTrace, size_t maxStackSize)
+PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, size_t maxStackSize)
 {
-    ASSERT(v8::Context::InContext());
     v8::HandleScope scope;
+    v8::Context::Scope contextScope(context);
+
     Vector<ScriptCallFrame> scriptCallFrames;
-    toScriptCallFramesVector(stackTrace, scriptCallFrames, maxStackSize);
+    toScriptCallFramesVector(context, stackTrace, scriptCallFrames, maxStackSize);
     return ScriptCallStack::create(scriptCallFrames);
 }
 
 PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize)
 {
-    if (!v8::Context::InContext())
-        return 0;
-    v8::HandleScope handleScope;
+    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(stackTrace, maxStackSize);
+    return createScriptCallStack(context, stackTrace, maxStackSize);
 }
 
 PassRefPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount)
@@ -103,4 +111,35 @@ 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 6f1bbab..66e44f5 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::Handle<v8::StackTrace>, size_t maxStackSize);
+PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context>, 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 5dc79fd..9e6e267 100644
--- a/WebCore/bindings/v8/V8ConsoleMessage.cpp
+++ b/WebCore/bindings/v8/V8ConsoleMessage.cpp
@@ -117,7 +117,8 @@ 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) {
-        callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture);
+        v8::Local<v8::Context> context = v8::Context::GetEntered();
+        callStack = createScriptCallStack(context, stackTrace, ScriptCallStack::maxCallStackSizeToCapture);
     }
 
     v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
diff --git a/WebCore/inspector/ScriptCallFrame.cpp b/WebCore/inspector/ScriptCallFrame.cpp
index 0b5204b..c4dab3c 100644
--- a/WebCore/inspector/ScriptCallFrame.cpp
+++ b/WebCore/inspector/ScriptCallFrame.cpp
@@ -36,11 +36,10 @@
 
 namespace WebCore {
 
-ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& scriptName, unsigned lineNumber, unsigned column)
+ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlString, unsigned lineNumber)
     : m_functionName(functionName)
-    , m_scriptName(scriptName)
+    , m_sourceURL(urlString)
     , m_lineNumber(lineNumber)
-    , m_column(column)
 {
 }
 
@@ -51,7 +50,7 @@ ScriptCallFrame::~ScriptCallFrame()
 bool ScriptCallFrame::isEqual(const ScriptCallFrame& o) const
 {
     return m_functionName == o.m_functionName
-        && m_scriptName == o.m_scriptName
+        && m_sourceURL == o.m_sourceURL
         && m_lineNumber == o.m_lineNumber;
 }
 
@@ -60,9 +59,8 @@ PassRefPtr<InspectorObject> ScriptCallFrame::buildInspectorObject() const
 {
     RefPtr<InspectorObject> frame = InspectorObject::create();
     frame->setString("functionName", m_functionName);
-    frame->setString("scriptName", m_scriptName);
+    frame->setString("sourceURL", m_sourceURL);
     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 2c025dc..2a1f257 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& scriptName, unsigned lineNumber, unsigned column = 0);
+    ScriptCallFrame(const String& functionName, const String& urlString, unsigned lineNumber);
     ~ScriptCallFrame();
 
     const String& functionName() const { return m_functionName; }
-    const String& sourceURL() const { return m_scriptName; }
+    const String& sourceURL() const { return m_sourceURL; }
     unsigned lineNumber() const { return m_lineNumber; }
 
     bool isEqual(const ScriptCallFrame&) const;
@@ -52,9 +52,8 @@ public:
 
 private:
     String m_functionName;
-    String m_scriptName;
+    String m_sourceURL;
     unsigned m_lineNumber;
-    unsigned m_column;
 };
 
 } // namespace WebCore
diff --git a/WebCore/inspector/ScriptCallStack.h b/WebCore/inspector/ScriptCallStack.h
index 4cb152f..36ea670 100644
--- a/WebCore/inspector/ScriptCallStack.h
+++ b/WebCore/inspector/ScriptCallStack.h
@@ -50,6 +50,7 @@ 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 7e62daf..713d6bc 100644
--- a/WebCore/inspector/TimelineRecordFactory.cpp
+++ b/WebCore/inspector/TimelineRecordFactory.cpp
@@ -39,7 +39,6 @@
 #include "ResourceRequest.h"
 #include "ResourceResponse.h"
 #include "ScriptCallStack.h"
-#include "ScriptCallStackFactory.h"
 
 namespace WebCore {
 
@@ -48,9 +47,9 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createGenericRecord(double st
     RefPtr<InspectorObject> record = InspectorObject::create();
     record->setNumber("startTime", startTime);
 
-    RefPtr<ScriptCallStack> stackTrace = createScriptCallStack(5);
-    if (stackTrace && stackTrace->size())
-        record->setArray("stackTrace", stackTrace->buildInspectorObject());
+    RefPtr<InspectorArray> stackTrace = InspectorArray::create();
+    if (ScriptCallStack::stackTrace(5, stackTrace))
+        record->setArray("stackTrace", stackTrace);
     return record.release();
 }
 
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js
index 6cf3aec..737b84f 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.scriptName, "scripts", frame.lineNumber, "console-message-url");
+            var urlElement = WebInspector.linkifyResourceAsNode(frame.sourceURL, "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