Changeset 73355 in webkit
- Timestamp:
- Dec 6, 2010 3:59:32 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r73352 r73355 1 2010-12-06 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r73351. 4 http://trac.webkit.org/changeset/73351 5 https://bugs.webkit.org/show_bug.cgi?id=50560 6 7 "The change broke plugin tests in Chromium" (Requested by 8 yurys on #webkit). 9 10 * bindings/js/ScriptCallStackFactory.cpp: 11 (WebCore::ScriptCallStack::stackTrace): 12 * bindings/js/ScriptCallStackFactory.h: 13 * bindings/v8/ScriptCallStackFactory.cpp: 14 (WebCore::toScriptCallFrame): 15 (WebCore::toScriptCallFramesVector): 16 (WebCore::createScriptCallStack): 17 (WebCore::ScriptCallStack::stackTrace): 18 * bindings/v8/ScriptCallStackFactory.h: 19 * bindings/v8/V8ConsoleMessage.cpp: 20 (WebCore::V8ConsoleMessage::handler): 21 * inspector/ScriptCallFrame.cpp: 22 (WebCore::ScriptCallFrame::ScriptCallFrame): 23 (WebCore::ScriptCallFrame::isEqual): 24 (WebCore::ScriptCallFrame::buildInspectorObject): 25 * inspector/ScriptCallFrame.h: 26 (WebCore::ScriptCallFrame::sourceURL): 27 * inspector/ScriptCallStack.h: 28 * inspector/TimelineRecordFactory.cpp: 29 (WebCore::TimelineRecordFactory::createGenericRecord): 30 * inspector/front-end/ConsoleView.js: 31 (WebInspector.ConsoleMessage.prototype._populateStackTraceTreeElement): 32 1 33 2010-12-06 Robert Hogan <robert@webkit.org> 2 34 -
trunk/WebCore/bindings/js/ScriptCallStackFactory.cpp
r73351 r73355 49 49 namespace WebCore { 50 50 51 PassRefPtr<ScriptCallStack> createScriptCallStack(size_t)52 {53 return 0;54 }55 56 51 PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t maxStackSize) 57 52 { … … 93 88 } 94 89 90 bool ScriptCallStack::stackTrace(int, const RefPtr<InspectorArray>&) 91 { 92 return false; 93 } 94 95 95 } // namespace WebCore -
trunk/WebCore/bindings/js/ScriptCallStackFactory.h
r73351 r73355 43 43 class ScriptCallStack; 44 44 45 PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize);46 45 PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState*, size_t maxStackSize); 47 46 PassRefPtr<ScriptArguments> createScriptArguments(JSC::ExecState*, unsigned skipArgumentCount); -
trunk/WebCore/bindings/v8/ScriptCallStackFactory.cpp
r73351 r73355 57 57 58 58 int sourceLineNumber = frame->GetLineNumber(); 59 int sourceColumn = frame->GetColumn(); 60 return ScriptCallFrame(functionName, sourceName, sourceLineNumber, sourceColumn); 59 return ScriptCallFrame(functionName, sourceName, sourceLineNumber); 61 60 } 62 61 63 static void toScriptCallFramesVector(v8:: Handle<v8::StackTrace> stackTrace, Vector<ScriptCallFrame>& scriptCallFrames, size_t maxStackSize)62 static void toScriptCallFramesVector(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, Vector<ScriptCallFrame>& scriptCallFrames, size_t maxStackSize) 64 63 { 65 ASSERT(v8::Context::InContext()); 64 // TODO(yurys): remove this??? 65 v8::Context::Scope contextScope(context); 66 66 int frameCount = stackTrace->GetFrameCount(); 67 67 if (frameCount > static_cast<int>(maxStackSize)) … … 71 71 scriptCallFrames.append(toScriptCallFrame(stackFrame)); 72 72 } 73 74 if (!frameCount) { 75 // Successfully grabbed stack trace, but there are no frames. It may happen in case of a syntax error for example. 76 // Fallback to setting lineNumber to 0, and source and function name to "undefined". 77 scriptCallFrames.append(ScriptCallFrame("undefined", "undefined", 0)); 78 } 73 79 } 74 80 75 PassRefPtr<ScriptCallStack> createScriptCallStack(v8:: Handle<v8::StackTrace> stackTrace, size_t maxStackSize)81 PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, size_t maxStackSize) 76 82 { 77 ASSERT(v8::Context::InContext());78 83 v8::HandleScope scope; 84 v8::Context::Scope contextScope(context); 85 79 86 Vector<ScriptCallFrame> scriptCallFrames; 80 toScriptCallFramesVector( stackTrace, scriptCallFrames, maxStackSize);87 toScriptCallFramesVector(context, stackTrace, scriptCallFrames, maxStackSize); 81 88 return ScriptCallStack::create(scriptCallFrames); 82 89 } … … 84 91 PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize) 85 92 { 86 if (!v8::Context::InContext()) 87 return 0; 88 v8::HandleScope handleScope; 93 v8::HandleScope scope; 94 v8::Local<v8::Context> context = v8::Context::GetCurrent(); 95 // TODO(yurys): remove? 96 v8::Context::Scope contextScope(context); 89 97 v8::Handle<v8::StackTrace> stackTrace(v8::StackTrace::CurrentStackTrace(maxStackSize, stackTraceOptions)); 90 return createScriptCallStack( stackTrace, maxStackSize);98 return createScriptCallStack(context, stackTrace, maxStackSize); 91 99 } 92 100 … … 104 112 } 105 113 114 bool ScriptCallStack::stackTrace(int frameLimit, const RefPtr<InspectorArray>& stackTrace) 115 { 116 #if ENABLE(INSPECTOR) 117 if (!v8::Context::InContext()) 118 return false; 119 v8::Handle<v8::Context> context = v8::Context::GetCurrent(); 120 if (context.IsEmpty()) 121 return false; 122 v8::HandleScope scope; 123 v8::Context::Scope contextScope(context); 124 v8::Handle<v8::StackTrace> trace(v8::StackTrace::CurrentStackTrace(frameLimit)); 125 int frameCount = trace->GetFrameCount(); 126 if (trace.IsEmpty() || !frameCount) 127 return false; 128 for (int i = 0; i < frameCount; ++i) { 129 v8::Handle<v8::StackFrame> frame = trace->GetFrame(i); 130 RefPtr<InspectorObject> frameObject = InspectorObject::create(); 131 v8::Local<v8::String> scriptName = frame->GetScriptName(); 132 frameObject->setString("scriptName", scriptName.IsEmpty() ? "" : toWebCoreString(scriptName)); 133 v8::Local<v8::String> functionName = frame->GetFunctionName(); 134 frameObject->setString("functionName", functionName.IsEmpty() ? "" : toWebCoreString(functionName)); 135 frameObject->setNumber("lineNumber", frame->GetLineNumber()); 136 frameObject->setNumber("column", frame->GetColumn()); 137 stackTrace->pushObject(frameObject); 138 } 139 return true; 140 #else 141 return false; 142 #endif 143 } 144 106 145 } // namespace WebCore -
trunk/WebCore/bindings/v8/ScriptCallStackFactory.h
r73351 r73355 47 47 | v8::StackTrace::kFunctionName); 48 48 49 PassRefPtr<ScriptCallStack> createScriptCallStack(v8:: Handle<v8::StackTrace>, size_t maxStackSize);49 PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context>, v8::Handle<v8::StackTrace>, size_t maxStackSize); 50 50 PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize); 51 51 PassRefPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount); -
trunk/WebCore/bindings/v8/V8ConsoleMessage.cpp
r73351 r73355 118 118 // Currently stack trace is only collected when inspector is open. 119 119 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) { 120 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture); 120 v8::Local<v8::Context> context = v8::Context::GetEntered(); 121 callStack = createScriptCallStack(context, stackTrace, ScriptCallStack::maxCallStackSizeToCapture); 121 122 } 122 123 -
trunk/WebCore/inspector/ScriptCallFrame.cpp
r73351 r73355 37 37 namespace WebCore { 38 38 39 ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& scriptName, unsigned lineNumber, unsigned column)39 ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& urlString, unsigned lineNumber) 40 40 : m_functionName(functionName) 41 , m_s criptName(scriptName)41 , m_sourceURL(urlString) 42 42 , m_lineNumber(lineNumber) 43 , m_column(column)44 43 { 45 44 } … … 52 51 { 53 52 return m_functionName == o.m_functionName 54 && m_s criptName == o.m_scriptName53 && m_sourceURL == o.m_sourceURL 55 54 && m_lineNumber == o.m_lineNumber; 56 55 } … … 61 60 RefPtr<InspectorObject> frame = InspectorObject::create(); 62 61 frame->setString("functionName", m_functionName); 63 frame->setString("s criptName", m_scriptName);62 frame->setString("sourceURL", m_sourceURL); 64 63 frame->setNumber("lineNumber", m_lineNumber); 65 frame->setNumber("column", m_column);66 64 return frame; 67 65 } -
trunk/WebCore/inspector/ScriptCallFrame.h
r73351 r73355 41 41 class ScriptCallFrame { 42 42 public: 43 ScriptCallFrame(const String& functionName, const String& scriptName, unsigned lineNumber, unsigned column = 0);43 ScriptCallFrame(const String& functionName, const String& urlString, unsigned lineNumber); 44 44 ~ScriptCallFrame(); 45 45 46 46 const String& functionName() const { return m_functionName; } 47 const String& sourceURL() const { return m_s criptName; }47 const String& sourceURL() const { return m_sourceURL; } 48 48 unsigned lineNumber() const { return m_lineNumber; } 49 49 … … 53 53 private: 54 54 String m_functionName; 55 String m_s criptName;55 String m_sourceURL; 56 56 unsigned m_lineNumber; 57 unsigned m_column;58 57 }; 59 58 -
trunk/WebCore/inspector/ScriptCallStack.h
r73351 r73355 51 51 const ScriptCallFrame &at(size_t) const; 52 52 size_t size() const; 53 static bool stackTrace(int, const RefPtr<InspectorArray>&); 53 54 54 55 bool isEqual(ScriptCallStack*) const; -
trunk/WebCore/inspector/TimelineRecordFactory.cpp
r73351 r73355 40 40 #include "ResourceResponse.h" 41 41 #include "ScriptCallStack.h" 42 #include "ScriptCallStackFactory.h"43 42 44 43 namespace WebCore { … … 49 48 record->setNumber("startTime", startTime); 50 49 51 RefPtr< ScriptCallStack> stackTrace = createScriptCallStack(5);52 if ( stackTrace && stackTrace->size())53 record->setArray("stackTrace", stackTrace ->buildInspectorObject());50 RefPtr<InspectorArray> stackTrace = InspectorArray::create(); 51 if (ScriptCallStack::stackTrace(5, stackTrace)) 52 record->setArray("stackTrace", stackTrace); 54 53 return record.release(); 55 54 } -
trunk/WebCore/inspector/front-end/ConsoleView.js
r73351 r73355 864 864 content.appendChild(messageTextElement); 865 865 866 var urlElement = WebInspector.linkifyResourceAsNode(frame.s criptName, "scripts", frame.lineNumber, "console-message-url");866 var urlElement = WebInspector.linkifyResourceAsNode(frame.sourceURL, "scripts", frame.lineNumber, "console-message-url"); 867 867 content.appendChild(urlElement); 868 868
Note: See TracChangeset
for help on using the changeset viewer.