Changeset 140679 in webkit


Ignore:
Timestamp:
Jan 24, 2013 6:14:21 AM (11 years ago)
Author:
aandrey@chromium.org
Message:

Web Inspector: [Canvas] REGRESSION: stack traces in the replay log are gone
https://bugs.webkit.org/show_bug.cgi?id=107805

Reviewed by Pavel Feldman.

Source/WebCore:

The V8's Error.prepareStackTrace is now called from the Error.captureStackTrace
function instead of the "stack" getter function.

Test: inspector/profiler/canvas2d/canvas-stack-trace.html

  • inspector/InjectedScriptCanvasModuleSource.js:

(.):

LayoutTests:

A simple test to dump a canvas 2D trace log with function call stack traces.

  • inspector/profiler/canvas-profiler-test.js:

(initialize_CanvasWebGLProfilerTest.):
(initialize_CanvasWebGLProfilerTest.InspectorTest.dumpTraceLog):

  • inspector/profiler/canvas2d/canvas-stack-trace-expected.txt: Added.
  • inspector/profiler/canvas2d/canvas-stack-trace.html: Added.
  • platform/efl/TestExpectations:
  • platform/gtk/TestExpectations:
  • platform/mac/TestExpectations:
  • platform/qt/TestExpectations:
  • platform/win/TestExpectations:
  • platform/wincairo/TestExpectations:
Location:
trunk
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140673 r140679  
     12013-01-24  Andrey Adaikin  <aandrey@chromium.org>
     2
     3        Web Inspector: [Canvas] REGRESSION: stack traces in the replay log are gone
     4        https://bugs.webkit.org/show_bug.cgi?id=107805
     5
     6        Reviewed by Pavel Feldman.
     7
     8        A simple test to dump a canvas 2D trace log with function call stack traces.
     9
     10        * inspector/profiler/canvas-profiler-test.js:
     11        (initialize_CanvasWebGLProfilerTest.):
     12        (initialize_CanvasWebGLProfilerTest.InspectorTest.dumpTraceLog):
     13        * inspector/profiler/canvas2d/canvas-stack-trace-expected.txt: Added.
     14        * inspector/profiler/canvas2d/canvas-stack-trace.html: Added.
     15        * platform/efl/TestExpectations:
     16        * platform/gtk/TestExpectations:
     17        * platform/mac/TestExpectations:
     18        * platform/qt/TestExpectations:
     19        * platform/win/TestExpectations:
     20        * platform/wincairo/TestExpectations:
     21
    1222013-01-23  Alexis Menard  <alexis@webkit.org>
    223
  • trunk/LayoutTests/inspector/profiler/canvas-profiler-test.js

    r138497 r140679  
    3939};
    4040
     41InspectorTest.dumpTraceLogCall = function(call, indent)
     42{
     43    indent = indent || "";
     44    function formatSourceURL(url)
     45    {
     46        return url ? "\"" + url.replace(/^.*\/([^\/]+)\/?$/, "$1") + "\"" : "null";
     47    }
     48    var args = (call.arguments || []).map(function(arg) {
     49        return arg.description;
     50    });
     51    var properties = [
     52        "{Call}",
     53        call.functionName ? "functionName:\"" + call.functionName + "\"" : "",
     54        call.arguments ? "arguments:[" + args.join(",") + "]" : "",
     55        call.result ? "result:" + call.result.description : "",
     56        call.property ? "property:\"" + call.property + "\"" : "",
     57        call.value ? "value:" + call.value.description : "",
     58        call.isDrawingCall ? "isDrawingCall:true" : "",
     59        "sourceURL:" + formatSourceURL(call.sourceURL),
     60        "lineNumber:" + call.lineNumber,
     61        "columnNumber:" + call.columnNumber
     62    ];
     63    InspectorTest.addResult(indent + properties.filter(Boolean).join("  "));
     64};
     65
     66InspectorTest.dumpTraceLog = function(traceLog, indent)
     67{
     68    indent = indent || "";
     69    var calls = traceLog.calls;
     70    var properties = [
     71        "{TraceLog}",
     72        "alive:" + !!traceLog.alive,
     73        "startOffset:" + (traceLog.startOffset || 0),
     74        "#calls:" + traceLog.totalAvailableCalls
     75    ];
     76    InspectorTest.addResult(indent + properties.filter(Boolean).join("  "));
     77    for (var i = 0, n = calls.length; i < n; ++i)
     78        InspectorTest.dumpTraceLogCall(calls[i], indent + "  ");
     79};
     80
    4181};
    4282
  • trunk/LayoutTests/platform/efl/TestExpectations

    r140670 r140679  
    15751575webkit.org/b/99001 inspector/profiler/memory-instrumentation-canvas.html
    15761576webkit.org/b/73936 inspector/profiler/canvas2d/canvas-has-uninstrumented-canvases.html
     1577webkit.org/b/73936 inspector/profiler/canvas2d/canvas-stack-trace.html
    15771578
    15781579# EFL port does not support Emacs commands.
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r140670 r140679  
    982982webkit.org/b/50485 inspector-protocol/take-heap-snapshot.html [ Skip ]
    983983webkit.org/b/73936 inspector/profiler/canvas2d/canvas-has-uninstrumented-canvases.html [ Failure ]
     984webkit.org/b/73936 inspector/profiler/canvas2d/canvas-stack-trace.html [ Failure ]
    984985
    985986webkit.org/b/37613 webkit.org/b/20011 printing [ Skip ]
  • trunk/LayoutTests/platform/mac/TestExpectations

    r140670 r140679  
    269269webkit.org/b/99001 inspector/profiler/memory-instrumentation-canvas.html
    270270webkit.org/b/73936 inspector/profiler/canvas2d/canvas-has-uninstrumented-canvases.html
     271webkit.org/b/73936 inspector/profiler/canvas2d/canvas-stack-trace.html
    271272
    272273# Skipping newly added tests while I'm finding out what is wrong.
  • trunk/LayoutTests/platform/qt/TestExpectations

    r140670 r140679  
    24412441webkit.org/b/99001 inspector/profiler/memory-instrumentation-canvas.html
    24422442webkit.org/b/73936 inspector/profiler/canvas2d/canvas-has-uninstrumented-canvases.html
     2443webkit.org/b/73936 inspector/profiler/canvas2d/canvas-stack-trace.html
    24432444
    24442445# [Qt] Unidentified pixel failures
  • trunk/LayoutTests/platform/win/TestExpectations

    r140657 r140679  
    12981298webkit.org/b/99001 inspector/profiler/memory-instrumentation-canvas.html
    12991299webkit.org/b/73936 inspector/profiler/canvas2d/canvas-has-uninstrumented-canvases.html
     1300webkit.org/b/73936 inspector/profiler/canvas2d/canvas-stack-trace.html
    13001301
    13011302# https://bugs.webkit.org/show_bug.cgi?id=40300
  • trunk/LayoutTests/platform/wincairo/TestExpectations

    r140657 r140679  
    18241824webkit.org/b/99001 inspector/profiler/memory-instrumentation-canvas.html
    18251825webkit.org/b/73936 inspector/profiler/canvas2d/canvas-has-uninstrumented-canvases.html
     1826webkit.org/b/73936 inspector/profiler/canvas2d/canvas-stack-trace.html
    18261827
    18271828# https://bugs.webkit.org/show_bug.cgi?id=40300
  • trunk/Source/WebCore/ChangeLog

    r140678 r140679  
     12013-01-24  Andrey Adaikin  <aandrey@chromium.org>
     2
     3        Web Inspector: [Canvas] REGRESSION: stack traces in the replay log are gone
     4        https://bugs.webkit.org/show_bug.cgi?id=107805
     5
     6        Reviewed by Pavel Feldman.
     7
     8        The V8's Error.prepareStackTrace is now called from the Error.captureStackTrace
     9        function instead of the "stack" getter function.
     10
     11        Test: inspector/profiler/canvas2d/canvas-stack-trace.html
     12
     13        * inspector/InjectedScriptCanvasModuleSource.js:
     14        (.):
     15
    1162013-01-23  Andrey Adaikin  <aandrey@chromium.org>
    217
  • trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js

    r140678 r140679  
    193193    /**
    194194     * @param {number} index
    195      * @return {{sourceURL: string, lineNumber: number, columnNumber: number}}
     195     * @return {{sourceURL: string, lineNumber: number, columnNumber: number}|undefined}
    196196     */
    197197    callFrame: function(index)
     
    223223{
    224224    StackTrace.call(this);
     225
     226    var oldPrepareStackTrace = Error.prepareStackTrace;
    225227    var oldStackTraceLimit = Error.stackTraceLimit;
    226228    if (typeof stackTraceLimit === "number")
    227229        Error.stackTraceLimit = stackTraceLimit;
    228230
    229     this._error = /** @type {{stack: Array}} */ ({});
    230     Error.captureStackTrace(this._error, topMostFunctionToIgnore || arguments.callee);
     231    /**
     232     * @param {Object} error
     233     * @param {Array.<CallSite>} structuredStackTrace
     234     * @return {Array.<{sourceURL: string, lineNumber: number, columnNumber: number}>}
     235     */
     236    Error.prepareStackTrace = function(error, structuredStackTrace)
     237    {
     238        return structuredStackTrace.map(function(callSite) {
     239            return {
     240                sourceURL: callSite.getFileName(),
     241                lineNumber: callSite.getLineNumber(),
     242                columnNumber: callSite.getColumnNumber()
     243            };
     244        });
     245    }
     246
     247    var holder = /** @type {{stack: Array.<{sourceURL: string, lineNumber: number, columnNumber: number}>}} */ ({});
     248    Error.captureStackTrace(holder, topMostFunctionToIgnore || arguments.callee);
     249    this._stackTrace = holder.stack;
    231250
    232251    Error.stackTraceLimit = oldStackTraceLimit;
     252    Error.prepareStackTrace = oldPrepareStackTrace;
    233253}
    234254
     
    237257     * @override
    238258     * @param {number} index
    239      * @return {{sourceURL: string, lineNumber: number, columnNumber: number}}
     259     * @return {{sourceURL: string, lineNumber: number, columnNumber: number}|undefined}
    240260     */
    241261    callFrame: function(index)
    242262    {
    243         if (!this._stackTrace)
    244             this._prepareStackTrace();
    245263        return this._stackTrace[index];
    246     },
    247 
    248     _prepareStackTrace: function()
    249     {
    250         var oldPrepareStackTrace = Error.prepareStackTrace;
    251         /**
    252          * @param {Object} error
    253          * @param {Array.<CallSite>} structuredStackTrace
    254          * @return {Array.<{sourceURL: string, lineNumber: number, columnNumber: number}>}
    255          */
    256         Error.prepareStackTrace = function(error, structuredStackTrace)
    257         {
    258             return structuredStackTrace.map(function(callSite) {
    259                 return {
    260                     sourceURL: callSite.getFileName(),
    261                     lineNumber: callSite.getLineNumber(),
    262                     columnNumber: callSite.getColumnNumber()
    263                 };
    264             });
    265         }
    266         this._stackTrace = this._error.stack;
    267         Error.prepareStackTrace = oldPrepareStackTrace;
    268         delete this._error; // No longer needed, free memory.
    269264    },
    270265
Note: See TracChangeset for help on using the changeset viewer.