Changeset 57201 in webkit


Ignore:
Timestamp:
Apr 7, 2010 3:19:30 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-07 Sheriff Bot <webkit.review.bot@gmail.com>

Unreviewed, rolling out r57196.
http://trac.webkit.org/changeset/57196
https://bugs.webkit.org/show_bug.cgi?id=37196

Multiple layout test failures on Chromium (Requested by yurys
on #webkit).

  • inspector/timeline-test.js:

2010-04-07 Sheriff Bot <webkit.review.bot@gmail.com>

Unreviewed, rolling out r57196.
http://trac.webkit.org/changeset/57196
https://bugs.webkit.org/show_bug.cgi?id=37196

Multiple layout test failures on Chromium (Requested by yurys
on #webkit).

  • bindings/js/ScriptCallStack.cpp: (WebCore::ScriptCallStack::callLocation):
  • bindings/js/ScriptCallStack.h:
  • bindings/v8/ScriptCallStack.cpp: (WebCore::ScriptCallStack::create): (WebCore::ScriptCallStack::callLocation): (WebCore::ScriptCallStack::ScriptCallStack):
  • bindings/v8/ScriptCallStack.h:
  • bindings/v8/ScriptDebugServer.cpp:
  • bindings/v8/ScriptDebugServer.h:
  • bindings/v8/V8Proxy.cpp: (WebCore::V8Proxy::createUtilityContext): (WebCore::V8Proxy::sourceLineNumber): (WebCore::V8Proxy::sourceName):
  • bindings/v8/V8Proxy.h: (WebCore::V8Proxy::utilityContext):
  • inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createGenericRecord):
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r57196 r57201  
     12010-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
    1122010-04-07  Jaime Yap  <jaimeyap@google.com>
    213
  • trunk/LayoutTests/inspector/timeline-test.js

    r57196 r57201  
    1111    callerScriptName: 1,
    1212    callerScriptLine: 1,
    13     callerFunctionName: 1,
    1413    url : 1,
    1514    usedHeapSize: 1,
  • trunk/WebCore/ChangeLog

    r57200 r57201  
     12010-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
    1292010-04-07  Simon Hausmann  <simon.hausmann@nokia.com>
    230
  • trunk/WebCore/bindings/js/ScriptCallStack.cpp

    r57196 r57201  
    102102}
    103103
    104 bool ScriptCallStack::callLocation(String*, int*, String*)
     104bool ScriptCallStack::callLocation(String*, int*)
    105105{
    106106    return false;
  • trunk/WebCore/bindings/js/ScriptCallStack.h

    r57196 r57201  
    5454        const ScriptCallFrame &at(unsigned);
    5555        unsigned size();
    56         static bool callLocation(String*, int*, String*);
     56        static bool callLocation(String*, int*);
    5757
    5858    private:
  • trunk/WebCore/bindings/v8/ScriptCallStack.cpp

    r57196 r57201  
    3333
    3434#include "ScriptController.h"
    35 #include "ScriptDebugServer.h"
    3635
    3736#include <v8.h>
    3837
    3938#include "V8Binding.h"
     39#include "V8Proxy.h"
    4040
    4141namespace WebCore {
     
    4444    String sourceName;
    4545    int sourceLineNumber;
    46     String funcName;
    47     if (!callLocation(&sourceName, &sourceLineNumber, &funcName))
     46    if (!callLocation(&sourceName, &sourceLineNumber))
    4847      return 0;
    49     return new ScriptCallStack(arguments, skipArgumentCount, sourceName, sourceLineNumber, funcName);
     48    return new ScriptCallStack(arguments, skipArgumentCount, sourceName, sourceLineNumber);
    5049}
    5150
    52 bool ScriptCallStack::callLocation(String* sourceName, int* sourceLineNumber, String* functionName)
     51bool ScriptCallStack::callLocation(String* sourceName, int* sourceLineNumber)
    5352{
    54     if (!ScriptDebugServer::topStackFrame(*sourceName, *sourceLineNumber, *functionName))
     53    if (!V8Proxy::sourceName(*sourceName) || !V8Proxy::sourceLineNumber(*sourceLineNumber))
    5554        return false;
    5655    *sourceLineNumber += 1;
     
    5857}
    5958
    60 ScriptCallStack::ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount, String sourceName, int sourceLineNumber, String functionName)
    61     : m_lastCaller(functionName, sourceName, sourceLineNumber, arguments, skipArgumentCount)
     59ScriptCallStack::ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount, String sourceName, int sourceLineNumber)
     60    : m_lastCaller(String(), sourceName, sourceLineNumber, arguments, skipArgumentCount)
    6261    , m_scriptState(ScriptState::current())
    6362{
  • trunk/WebCore/bindings/v8/ScriptCallStack.h

    r57196 r57201  
    4848        ~ScriptCallStack();
    4949
    50         static bool callLocation(String* sourceName, int* sourceLineNumber, String* functionName);
     50        static bool callLocation(String* sourceName, int* sourceLineNumber);
    5151
    5252        const ScriptCallFrame& at(unsigned) const;
     
    5858
    5959    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);
    6161   
    6262        ScriptCallFrame m_lastCaller;
  • trunk/WebCore/bindings/v8/ScriptDebugServer.cpp

    r57196 r57201  
    3434#if ENABLE(JAVASCRIPT_DEBUGGER)
    3535
    36 #include "V8Binding.h"
    37 #include <v8-debug.h>
    38 
    3936#include <wtf/StdLibExtras.h>
    4037
    4138namespace WebCore {
    42 
    43 v8::Persistent<v8::Context> ScriptDebugServer::s_utilityContext;
    4439
    4540ScriptDebugServer& ScriptDebugServer::shared()
     
    4944}
    5045
    51 // Create the utility context for holding JavaScript functions used internally
    52 // 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 source
    63     // 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 
    10646} // namespace WebCore
    10747
  • trunk/WebCore/bindings/v8/ScriptDebugServer.h

    r57196 r57201  
    4848public:
    4949    static ScriptDebugServer& shared();
    50    
    51     // Function for retrieving the source name, line number and function name for the top
    52     // JavaScript stack frame.
    53     //
    54     // It will return true if the caller information was successfully retrieved and written
    55     // into the function parameters, otherwise the function will return false. It may
    56     // fail due to a stck overflow in the underlying JavaScript implentation, handling
    57     // of such exception is up to the caller.
    58     static bool topStackFrame(String& sourceName, int& lineNumber, String& functionName);
    5950
    6051    void addListener(ScriptDebugListener*, Page*) { }
     
    9081    ScriptDebugServer() { }
    9182    ~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;
    10583};
    10684
  • trunk/WebCore/bindings/v8/V8Proxy.cpp

    r57196 r57201  
    6969#include <utility>
    7070#include <v8.h>
     71#include <v8-debug.h>
    7172#include <wtf/Assertions.h>
    7273#include <wtf/OwnArrayPtr.h>
     
    7677
    7778namespace WebCore {
     79
     80v8::Persistent<v8::Context> V8Proxy::m_utilityContext;
    7881
    7982// Static list of registered extensions
     
    753756}
    754757
     758// Create the utility context for holding JavaScript functions used internally
     759// which are not visible to JavaScript executing on the page.
     760void 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
     795bool 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
     813bool 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
    755831void V8Proxy::registerExtensionWithV8(v8::Extension* extension)
    756832{
  • trunk/WebCore/bindings/v8/V8Proxy.h

    r57196 r57201  
    297297        static void processConsoleMessages();
    298298
     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
    299309        v8::Local<v8::Context> context();
    300310        v8::Local<v8::Context> mainWorldContext();
     
    347357#endif
    348358
     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
    349369        Frame* m_frame;
    350370
    351371        // For the moment, we have one of these.  Soon we will have one per DOMWrapperWorld.
    352372        RefPtr<V8DOMWindowShell> m_windowShell;
     373       
     374        // Utility context holding JavaScript functions used internally.
     375        static v8::Persistent<v8::Context> m_utilityContext;
    353376
    354377        int m_handlerLineNumber;
  • trunk/WebCore/inspector/TimelineRecordFactory.cpp

    r57196 r57201  
    5252    String sourceName;
    5353    int sourceLineNumber;
    54     String functionName;
    55     if (ScriptCallStack::callLocation(&sourceName, &sourceLineNumber, &functionName) && sourceName != "undefined") {
     54    if (ScriptCallStack::callLocation(&sourceName, &sourceLineNumber) && sourceName != "undefined") {
    5655        record.set("callerScriptName", sourceName);
    5756        record.set("callerScriptLine", sourceLineNumber);
    58         record.set("callerFunctionName", functionName);
    5957    }
    6058    return record;
Note: See TracChangeset for help on using the changeset viewer.