Changeset 57201 in webkit
- Timestamp:
- Apr 7, 2010 3:19:30 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r57196 r57201 1 2010-04-07 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r57196. 4 http://trac.webkit.org/changeset/57196 5 https://bugs.webkit.org/show_bug.cgi?id=37196 6 7 Multiple layout test failures on Chromium (Requested by yurys 8 on #webkit). 9 10 * inspector/timeline-test.js: 11 1 12 2010-04-07 Jaime Yap <jaimeyap@google.com> 2 13 -
trunk/LayoutTests/inspector/timeline-test.js
r57196 r57201 11 11 callerScriptName: 1, 12 12 callerScriptLine: 1, 13 callerFunctionName: 1,14 13 url : 1, 15 14 usedHeapSize: 1, -
trunk/WebCore/ChangeLog
r57200 r57201 1 2010-04-07 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r57196. 4 http://trac.webkit.org/changeset/57196 5 https://bugs.webkit.org/show_bug.cgi?id=37196 6 7 Multiple layout test failures on Chromium (Requested by yurys 8 on #webkit). 9 10 * bindings/js/ScriptCallStack.cpp: 11 (WebCore::ScriptCallStack::callLocation): 12 * bindings/js/ScriptCallStack.h: 13 * bindings/v8/ScriptCallStack.cpp: 14 (WebCore::ScriptCallStack::create): 15 (WebCore::ScriptCallStack::callLocation): 16 (WebCore::ScriptCallStack::ScriptCallStack): 17 * bindings/v8/ScriptCallStack.h: 18 * bindings/v8/ScriptDebugServer.cpp: 19 * bindings/v8/ScriptDebugServer.h: 20 * bindings/v8/V8Proxy.cpp: 21 (WebCore::V8Proxy::createUtilityContext): 22 (WebCore::V8Proxy::sourceLineNumber): 23 (WebCore::V8Proxy::sourceName): 24 * bindings/v8/V8Proxy.h: 25 (WebCore::V8Proxy::utilityContext): 26 * inspector/TimelineRecordFactory.cpp: 27 (WebCore::TimelineRecordFactory::createGenericRecord): 28 1 29 2010-04-07 Simon Hausmann <simon.hausmann@nokia.com> 2 30 -
trunk/WebCore/bindings/js/ScriptCallStack.cpp
r57196 r57201 102 102 } 103 103 104 bool ScriptCallStack::callLocation(String*, int* , String*)104 bool ScriptCallStack::callLocation(String*, int*) 105 105 { 106 106 return false; -
trunk/WebCore/bindings/js/ScriptCallStack.h
r57196 r57201 54 54 const ScriptCallFrame &at(unsigned); 55 55 unsigned size(); 56 static bool callLocation(String*, int* , String*);56 static bool callLocation(String*, int*); 57 57 58 58 private: -
trunk/WebCore/bindings/v8/ScriptCallStack.cpp
r57196 r57201 33 33 34 34 #include "ScriptController.h" 35 #include "ScriptDebugServer.h"36 35 37 36 #include <v8.h> 38 37 39 38 #include "V8Binding.h" 39 #include "V8Proxy.h" 40 40 41 41 namespace WebCore { … … 44 44 String sourceName; 45 45 int sourceLineNumber; 46 String funcName; 47 if (!callLocation(&sourceName, &sourceLineNumber, &funcName)) 46 if (!callLocation(&sourceName, &sourceLineNumber)) 48 47 return 0; 49 return new ScriptCallStack(arguments, skipArgumentCount, sourceName, sourceLineNumber , funcName);48 return new ScriptCallStack(arguments, skipArgumentCount, sourceName, sourceLineNumber); 50 49 } 51 50 52 bool ScriptCallStack::callLocation(String* sourceName, int* sourceLineNumber , String* functionName)51 bool ScriptCallStack::callLocation(String* sourceName, int* sourceLineNumber) 53 52 { 54 if (! ScriptDebugServer::topStackFrame(*sourceName, *sourceLineNumber, *functionName))53 if (!V8Proxy::sourceName(*sourceName) || !V8Proxy::sourceLineNumber(*sourceLineNumber)) 55 54 return false; 56 55 *sourceLineNumber += 1; … … 58 57 } 59 58 60 ScriptCallStack::ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount, String sourceName, int sourceLineNumber , String functionName)61 : m_lastCaller( functionName, sourceName, sourceLineNumber, arguments, skipArgumentCount)59 ScriptCallStack::ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount, String sourceName, int sourceLineNumber) 60 : m_lastCaller(String(), sourceName, sourceLineNumber, arguments, skipArgumentCount) 62 61 , m_scriptState(ScriptState::current()) 63 62 { -
trunk/WebCore/bindings/v8/ScriptCallStack.h
r57196 r57201 48 48 ~ScriptCallStack(); 49 49 50 static bool callLocation(String* sourceName, int* sourceLineNumber , String* functionName);50 static bool callLocation(String* sourceName, int* sourceLineNumber); 51 51 52 52 const ScriptCallFrame& at(unsigned) const; … … 58 58 59 59 private: 60 ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount, String sourceName, int sourceLineNumber , String funcName);60 ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount, String sourceName, int sourceLineNumber); 61 61 62 62 ScriptCallFrame m_lastCaller; -
trunk/WebCore/bindings/v8/ScriptDebugServer.cpp
r57196 r57201 34 34 #if ENABLE(JAVASCRIPT_DEBUGGER) 35 35 36 #include "V8Binding.h"37 #include <v8-debug.h>38 39 36 #include <wtf/StdLibExtras.h> 40 37 41 38 namespace WebCore { 42 43 v8::Persistent<v8::Context> ScriptDebugServer::s_utilityContext;44 39 45 40 ScriptDebugServer& ScriptDebugServer::shared() … … 49 44 } 50 45 51 // Create the utility context for holding JavaScript functions used internally52 // which are not visible to JavaScript executing on the page.53 void ScriptDebugServer::createUtilityContext()54 {55 ASSERT(s_utilityContext.IsEmpty());56 57 v8::HandleScope scope;58 v8::Handle<v8::ObjectTemplate> globalTemplate = v8::ObjectTemplate::New();59 s_utilityContext = v8::Context::New(0, globalTemplate);60 v8::Context::Scope contextScope(s_utilityContext);61 62 // Compile JavaScript function for retrieving the source line, the source63 // name and the symbol name for the top JavaScript stack frame.64 DEFINE_STATIC_LOCAL(const char*, topStackFrame,65 ("function topStackFrame(exec_state) {"66 " if (!exec_state.frameCount())"67 " return undefined;"68 " var frame = exec_state.frame(0);"69 " var func = frame.func();"70 " var scriptName;"71 " if (func.resolved() && func.script())"72 " scriptName = func.script().name();"73 " return [scriptName, frame.sourceLine(), (func.name() || func.inferredName())];"74 "}"));75 v8::Script::Compile(v8::String::New(topStackFrame))->Run();76 }77 78 bool ScriptDebugServer::topStackFrame(String& sourceName, int& lineNumber, String& functionName)79 {80 v8::HandleScope scope;81 v8::Handle<v8::Context> v8UtilityContext = utilityContext();82 if (v8UtilityContext.IsEmpty())83 return false;84 v8::Context::Scope contextScope(v8UtilityContext);85 v8::Handle<v8::Function> topStackFrame;86 topStackFrame = v8::Local<v8::Function>::Cast(v8UtilityContext->Global()->Get(v8::String::New("topStackFrame")));87 if (topStackFrame.IsEmpty())88 return false;89 v8::Handle<v8::Value> value = v8::Debug::Call(topStackFrame);90 if (value.IsEmpty())91 return false;92 if (!value->IsArray())93 return false;94 v8::Local<v8::Object> jsArray = value->ToObject();95 v8::Local<v8::Value> sourceNameValue = jsArray->Get(0);96 v8::Local<v8::Value> lineNumberValue = jsArray->Get(1);97 v8::Local<v8::Value> functionNameValue = jsArray->Get(2);98 if (sourceNameValue.IsEmpty() || lineNumberValue.IsEmpty() || functionNameValue.IsEmpty())99 return false;100 sourceName = toWebCoreString(sourceNameValue);101 lineNumber = lineNumberValue->Int32Value();102 functionName = toWebCoreString(functionNameValue);103 return true;104 }105 106 46 } // namespace WebCore 107 47 -
trunk/WebCore/bindings/v8/ScriptDebugServer.h
r57196 r57201 48 48 public: 49 49 static ScriptDebugServer& shared(); 50 51 // Function for retrieving the source name, line number and function name for the top52 // JavaScript stack frame.53 //54 // It will return true if the caller information was successfully retrieved and written55 // into the function parameters, otherwise the function will return false. It may56 // fail due to a stck overflow in the underlying JavaScript implentation, handling57 // of such exception is up to the caller.58 static bool topStackFrame(String& sourceName, int& lineNumber, String& functionName);59 50 60 51 void addListener(ScriptDebugListener*, Page*) { } … … 90 81 ScriptDebugServer() { } 91 82 ~ScriptDebugServer() { } 92 93 static void createUtilityContext();94 95 // Returns a local handle of the utility context.96 static v8::Local<v8::Context> utilityContext()97 {98 if (s_utilityContext.IsEmpty())99 createUtilityContext();100 return v8::Local<v8::Context>::New(s_utilityContext);101 }102 103 // Utility context holding JavaScript functions used internally.104 static v8::Persistent<v8::Context> s_utilityContext;105 83 }; 106 84 -
trunk/WebCore/bindings/v8/V8Proxy.cpp
r57196 r57201 69 69 #include <utility> 70 70 #include <v8.h> 71 #include <v8-debug.h> 71 72 #include <wtf/Assertions.h> 72 73 #include <wtf/OwnArrayPtr.h> … … 76 77 77 78 namespace WebCore { 79 80 v8::Persistent<v8::Context> V8Proxy::m_utilityContext; 78 81 79 82 // Static list of registered extensions … … 753 756 } 754 757 758 // Create the utility context for holding JavaScript functions used internally 759 // which are not visible to JavaScript executing on the page. 760 void V8Proxy::createUtilityContext() 761 { 762 ASSERT(m_utilityContext.IsEmpty()); 763 764 v8::HandleScope scope; 765 v8::Handle<v8::ObjectTemplate> globalTemplate = v8::ObjectTemplate::New(); 766 m_utilityContext = v8::Context::New(0, globalTemplate); 767 v8::Context::Scope contextScope(m_utilityContext); 768 769 // Compile JavaScript function for retrieving the source line of the top 770 // JavaScript stack frame. 771 DEFINE_STATIC_LOCAL(const char*, frameSourceLineSource, 772 ("function frameSourceLine(exec_state) {" 773 " if (!exec_state.frameCount())" 774 " return undefined;" 775 " return exec_state.frame(0).sourceLine();" 776 "}")); 777 v8::Script::Compile(v8::String::New(frameSourceLineSource))->Run(); 778 779 // Compile JavaScript function for retrieving the source name of the top 780 // JavaScript stack frame. 781 DEFINE_STATIC_LOCAL(const char*, frameSourceNameSource, 782 ("function frameSourceName(exec_state) {" 783 " if (!exec_state.frameCount())" 784 " return undefined;" 785 " var frame = exec_state.frame(0);" 786 " if (frame.func().resolved() && " 787 " frame.func().script() && " 788 " frame.func().script().name()) {" 789 " return frame.func().script().name();" 790 " }" 791 "}")); 792 v8::Script::Compile(v8::String::New(frameSourceNameSource))->Run(); 793 } 794 795 bool V8Proxy::sourceLineNumber(int& result) 796 { 797 v8::HandleScope scope; 798 v8::Handle<v8::Context> v8UtilityContext = V8Proxy::utilityContext(); 799 if (v8UtilityContext.IsEmpty()) 800 return false; 801 v8::Context::Scope contextScope(v8UtilityContext); 802 v8::Handle<v8::Function> frameSourceLine; 803 frameSourceLine = v8::Local<v8::Function>::Cast(v8UtilityContext->Global()->Get(v8::String::New("frameSourceLine"))); 804 if (frameSourceLine.IsEmpty()) 805 return false; 806 v8::Handle<v8::Value> value = v8::Debug::Call(frameSourceLine); 807 if (value.IsEmpty()) 808 return false; 809 result = value->Int32Value(); 810 return true; 811 } 812 813 bool V8Proxy::sourceName(String& result) 814 { 815 v8::HandleScope scope; 816 v8::Handle<v8::Context> v8UtilityContext = utilityContext(); 817 if (v8UtilityContext.IsEmpty()) 818 return false; 819 v8::Context::Scope contextScope(v8UtilityContext); 820 v8::Handle<v8::Function> frameSourceName; 821 frameSourceName = v8::Local<v8::Function>::Cast(v8UtilityContext->Global()->Get(v8::String::New("frameSourceName"))); 822 if (frameSourceName.IsEmpty()) 823 return false; 824 v8::Handle<v8::Value> value = v8::Debug::Call(frameSourceName); 825 if (value.IsEmpty()) 826 return false; 827 result = toWebCoreString(value); 828 return true; 829 } 830 755 831 void V8Proxy::registerExtensionWithV8(v8::Extension* extension) 756 832 { -
trunk/WebCore/bindings/v8/V8Proxy.h
r57196 r57201 297 297 static void processConsoleMessages(); 298 298 299 // Function for retrieving the line number and source name for the top 300 // JavaScript stack frame. 301 // 302 // It will return true if the line number was successfully retrieved and written 303 // into the |result| parameter, otherwise the function will return false. It may 304 // fail due to a stck overflow in the underlying JavaScript implentation, handling 305 // of such exception is up to the caller. 306 static bool sourceLineNumber(int& result); 307 static bool sourceName(String& result); 308 299 309 v8::Local<v8::Context> context(); 300 310 v8::Local<v8::Context> mainWorldContext(); … … 347 357 #endif 348 358 359 static void createUtilityContext(); 360 361 // Returns a local handle of the utility context. 362 static v8::Local<v8::Context> utilityContext() 363 { 364 if (m_utilityContext.IsEmpty()) 365 createUtilityContext(); 366 return v8::Local<v8::Context>::New(m_utilityContext); 367 } 368 349 369 Frame* m_frame; 350 370 351 371 // For the moment, we have one of these. Soon we will have one per DOMWrapperWorld. 352 372 RefPtr<V8DOMWindowShell> m_windowShell; 373 374 // Utility context holding JavaScript functions used internally. 375 static v8::Persistent<v8::Context> m_utilityContext; 353 376 354 377 int m_handlerLineNumber; -
trunk/WebCore/inspector/TimelineRecordFactory.cpp
r57196 r57201 52 52 String sourceName; 53 53 int sourceLineNumber; 54 String functionName; 55 if (ScriptCallStack::callLocation(&sourceName, &sourceLineNumber, &functionName) && sourceName != "undefined") { 54 if (ScriptCallStack::callLocation(&sourceName, &sourceLineNumber) && sourceName != "undefined") { 56 55 record.set("callerScriptName", sourceName); 57 56 record.set("callerScriptLine", sourceLineNumber); 58 record.set("callerFunctionName", functionName);59 57 } 60 58 return record;
Note: See TracChangeset
for help on using the changeset viewer.