Diff
Modified: trunk/LayoutTests/ChangeLog (140678 => 140679)
--- trunk/LayoutTests/ChangeLog 2013-01-24 13:42:53 UTC (rev 140678)
+++ trunk/LayoutTests/ChangeLog 2013-01-24 14:14:21 UTC (rev 140679)
@@ -1,3 +1,24 @@
+2013-01-24 Andrey Adaikin <[email protected]>
+
+ 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.
+
+ 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:
+
2013-01-23 Alexis Menard <[email protected]>
Unreviewed cleanup of comments and a commented test.
Modified: trunk/LayoutTests/inspector/profiler/canvas-profiler-test.js (140678 => 140679)
--- trunk/LayoutTests/inspector/profiler/canvas-profiler-test.js 2013-01-24 13:42:53 UTC (rev 140678)
+++ trunk/LayoutTests/inspector/profiler/canvas-profiler-test.js 2013-01-24 14:14:21 UTC (rev 140679)
@@ -38,8 +38,48 @@
}
};
+InspectorTest.dumpTraceLogCall = function(call, indent)
+{
+ indent = indent || "";
+ function formatSourceURL(url)
+ {
+ return url ? "\"" + url.replace(/^.*\/([^\/]+)\/?$/, "$1") + "\"" : "null";
+ }
+ var args = (call.arguments || []).map(function(arg) {
+ return arg.description;
+ });
+ var properties = [
+ "{Call}",
+ call.functionName ? "functionName:\"" + call.functionName + "\"" : "",
+ call.arguments ? "arguments:[" + args.join(",") + "]" : "",
+ call.result ? "result:" + call.result.description : "",
+ call.property ? "property:\"" + call.property + "\"" : "",
+ call.value ? "value:" + call.value.description : "",
+ call.isDrawingCall ? "isDrawingCall:true" : "",
+ "sourceURL:" + formatSourceURL(call.sourceURL),
+ "lineNumber:" + call.lineNumber,
+ "columnNumber:" + call.columnNumber
+ ];
+ InspectorTest.addResult(indent + properties.filter(Boolean).join(" "));
};
+InspectorTest.dumpTraceLog = function(traceLog, indent)
+{
+ indent = indent || "";
+ var calls = traceLog.calls;
+ var properties = [
+ "{TraceLog}",
+ "alive:" + !!traceLog.alive,
+ "startOffset:" + (traceLog.startOffset || 0),
+ "#calls:" + traceLog.totalAvailableCalls
+ ];
+ InspectorTest.addResult(indent + properties.filter(Boolean).join(" "));
+ for (var i = 0, n = calls.length; i < n; ++i)
+ InspectorTest.dumpTraceLogCall(calls[i], indent + " ");
+};
+
+};
+
function createWebGLContext(opt_canvas)
{
if (window.testRunner)
Added: trunk/LayoutTests/inspector/profiler/canvas2d/canvas-stack-trace-expected.txt (0 => 140679)
--- trunk/LayoutTests/inspector/profiler/canvas2d/canvas-stack-trace-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/profiler/canvas2d/canvas-stack-trace-expected.txt 2013-01-24 14:14:21 UTC (rev 140679)
@@ -0,0 +1,10 @@
+Tests stack traces in the Canvas TraceLog results.
+
+Bug 107805
+
+{TraceLog} alive:true startOffset:0 #calls:4
+ {Call} functionName:"beginPath" arguments:[] sourceURL:"canvas-stack-trace.html" lineNumber:19 columnNumber:13
+ {Call} functionName:"rect" arguments:[0,0,100,100] sourceURL:"canvas-stack-trace.html" lineNumber:20 columnNumber:13
+ {Call} property:"fillStyle" value:red sourceURL:"canvas-stack-trace.html" lineNumber:21 columnNumber:23
+ {Call} functionName:"fill" arguments:[] isDrawingCall:true sourceURL:"canvas-stack-trace.html" lineNumber:22 columnNumber:13
+
Added: trunk/LayoutTests/inspector/profiler/canvas2d/canvas-stack-trace.html (0 => 140679)
--- trunk/LayoutTests/inspector/profiler/canvas2d/canvas-stack-trace.html (rev 0)
+++ trunk/LayoutTests/inspector/profiler/canvas2d/canvas-stack-trace.html 2013-01-24 14:14:21 UTC (rev 140679)
@@ -0,0 +1,65 @@
+<html>
+<head>
+ <script src=""
+ <script src=""
+<script>
+
+var canvas;
+var context;
+
+function createCanvasContext()
+{
+ canvas = document.getElementById("canvas");
+ context = canvas.getContext("2d");
+ console.assert(context, "Failed to create a canvas context");
+}
+
+function doSomeCanvasCalls()
+{
+ context.beginPath();
+ context.rect(0, 0, 100, 100);
+ context.fillStyle = 'red';
+ context.fill();
+}
+
+function test()
+{
+ var traceLogId;
+ InspectorTest.enableCanvasAgent(step1);
+ function step1()
+ {
+ InspectorTest.evaluateInConsole("createCanvasContext()", step2);
+ }
+ function step2()
+ {
+ CanvasAgent.startCapturing(didStartCapturing);
+ }
+ function didStartCapturing(error, id)
+ {
+ InspectorTest.assertTrue(!error && !!id, "Unexpected error: " + error);
+ traceLogId = id;
+ InspectorTest.evaluateInConsole("doSomeCanvasCalls()", didSomeCanvasCalls);
+ }
+ function didSomeCanvasCalls()
+ {
+ CanvasAgent.getTraceLog(traceLogId, 0, undefined, didReceiveTraceLog);
+ }
+ function didReceiveTraceLog(error, traceLog)
+ {
+ InspectorTest.assertTrue(!error && !!traceLog, "Unexpected error: " + error);
+ InspectorTest.addResult("");
+ InspectorTest.dumpTraceLog(traceLog);
+ InspectorTest.completeTest();
+ }
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+<p>
+Tests stack traces in the Canvas TraceLog results.
+</p>
+<a href="" 107805</a>
+<canvas id="canvas"></canvas>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/efl/TestExpectations (140678 => 140679)
--- trunk/LayoutTests/platform/efl/TestExpectations 2013-01-24 13:42:53 UTC (rev 140678)
+++ trunk/LayoutTests/platform/efl/TestExpectations 2013-01-24 14:14:21 UTC (rev 140679)
@@ -1574,6 +1574,7 @@
# New inspector/profiler/memory-instrumentation-canvas.html fails on JSC platforms
webkit.org/b/99001 inspector/profiler/memory-instrumentation-canvas.html
webkit.org/b/73936 inspector/profiler/canvas2d/canvas-has-uninstrumented-canvases.html
+webkit.org/b/73936 inspector/profiler/canvas2d/canvas-stack-trace.html
# EFL port does not support Emacs commands.
Bug(EFL) editing/pasteboard/emacs-cntl-y-001.html [ Missing ]
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (140678 => 140679)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2013-01-24 13:42:53 UTC (rev 140678)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2013-01-24 14:14:21 UTC (rev 140679)
@@ -981,6 +981,7 @@
webkit.org/b/99001 inspector/profiler/memory-instrumentation-canvas.html [ Failure ]
webkit.org/b/50485 inspector-protocol/take-heap-snapshot.html [ Skip ]
webkit.org/b/73936 inspector/profiler/canvas2d/canvas-has-uninstrumented-canvases.html [ Failure ]
+webkit.org/b/73936 inspector/profiler/canvas2d/canvas-stack-trace.html [ Failure ]
webkit.org/b/37613 webkit.org/b/20011 printing [ Skip ]
webkit.org/b/37613 editing/execCommand/print.html [ Skip ]
Modified: trunk/LayoutTests/platform/mac/TestExpectations (140678 => 140679)
--- trunk/LayoutTests/platform/mac/TestExpectations 2013-01-24 13:42:53 UTC (rev 140678)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2013-01-24 14:14:21 UTC (rev 140679)
@@ -268,6 +268,7 @@
# New inspector/profiler/memory-instrumentation-canvas.html fails on JSC platforms
webkit.org/b/99001 inspector/profiler/memory-instrumentation-canvas.html
webkit.org/b/73936 inspector/profiler/canvas2d/canvas-has-uninstrumented-canvases.html
+webkit.org/b/73936 inspector/profiler/canvas2d/canvas-stack-trace.html
# Skipping newly added tests while I'm finding out what is wrong.
# https://bugs.webkit.org/show_bug.cgi?id=59706
Modified: trunk/LayoutTests/platform/qt/TestExpectations (140678 => 140679)
--- trunk/LayoutTests/platform/qt/TestExpectations 2013-01-24 13:42:53 UTC (rev 140678)
+++ trunk/LayoutTests/platform/qt/TestExpectations 2013-01-24 14:14:21 UTC (rev 140679)
@@ -2440,6 +2440,7 @@
# New inspector/profiler/memory-instrumentation-canvas.html fails on JSC platforms
webkit.org/b/99001 inspector/profiler/memory-instrumentation-canvas.html
webkit.org/b/73936 inspector/profiler/canvas2d/canvas-has-uninstrumented-canvases.html
+webkit.org/b/73936 inspector/profiler/canvas2d/canvas-stack-trace.html
# [Qt] Unidentified pixel failures
webkit.org/b/99306 animations/additive-transform-animations.html [ ImageOnlyFailure ]
Modified: trunk/LayoutTests/platform/win/TestExpectations (140678 => 140679)
--- trunk/LayoutTests/platform/win/TestExpectations 2013-01-24 13:42:53 UTC (rev 140678)
+++ trunk/LayoutTests/platform/win/TestExpectations 2013-01-24 14:14:21 UTC (rev 140679)
@@ -1297,6 +1297,7 @@
# New inspector/profiler/memory-instrumentation-canvas.html fails on JSC platforms
webkit.org/b/99001 inspector/profiler/memory-instrumentation-canvas.html
webkit.org/b/73936 inspector/profiler/canvas2d/canvas-has-uninstrumented-canvases.html
+webkit.org/b/73936 inspector/profiler/canvas2d/canvas-stack-trace.html
# https://bugs.webkit.org/show_bug.cgi?id=40300
inspector/debugger/live-edit.html
Modified: trunk/LayoutTests/platform/wincairo/TestExpectations (140678 => 140679)
--- trunk/LayoutTests/platform/wincairo/TestExpectations 2013-01-24 13:42:53 UTC (rev 140678)
+++ trunk/LayoutTests/platform/wincairo/TestExpectations 2013-01-24 14:14:21 UTC (rev 140679)
@@ -1823,6 +1823,7 @@
# New inspector/profiler/memory-instrumentation-canvas.html fails on JSC platforms
webkit.org/b/99001 inspector/profiler/memory-instrumentation-canvas.html
webkit.org/b/73936 inspector/profiler/canvas2d/canvas-has-uninstrumented-canvases.html
+webkit.org/b/73936 inspector/profiler/canvas2d/canvas-stack-trace.html
# https://bugs.webkit.org/show_bug.cgi?id=40300
inspector/debugger/live-edit.html
Modified: trunk/Source/WebCore/ChangeLog (140678 => 140679)
--- trunk/Source/WebCore/ChangeLog 2013-01-24 13:42:53 UTC (rev 140678)
+++ trunk/Source/WebCore/ChangeLog 2013-01-24 14:14:21 UTC (rev 140679)
@@ -1,3 +1,18 @@
+2013-01-24 Andrey Adaikin <[email protected]>
+
+ 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.
+
+ 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:
+ (.):
+
2013-01-23 Andrey Adaikin <[email protected]>
Web Inspector: [Canvas] UI: add a selector to capture a single canvas frame vs consecutive frames
Modified: trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js (140678 => 140679)
--- trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js 2013-01-24 13:42:53 UTC (rev 140678)
+++ trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js 2013-01-24 14:14:21 UTC (rev 140679)
@@ -192,7 +192,7 @@
StackTrace.prototype = {
/**
* @param {number} index
- * @return {{sourceURL: string, lineNumber: number, columnNumber: number}}
+ * @return {{sourceURL: string, lineNumber: number, columnNumber: number}|undefined}
*/
callFrame: function(index)
{
@@ -222,52 +222,47 @@
function StackTraceV8(stackTraceLimit, topMostFunctionToIgnore)
{
StackTrace.call(this);
+
+ var oldPrepareStackTrace = Error.prepareStackTrace;
var oldStackTraceLimit = Error.stackTraceLimit;
if (typeof stackTraceLimit === "number")
Error.stackTraceLimit = stackTraceLimit;
- this._error = /** @type {{stack: Array}} */ ({});
- Error.captureStackTrace(this._error, topMostFunctionToIgnore || arguments.callee);
+ /**
+ * @param {Object} error
+ * @param {Array.<CallSite>} structuredStackTrace
+ * @return {Array.<{sourceURL: string, lineNumber: number, columnNumber: number}>}
+ */
+ Error.prepareStackTrace = function(error, structuredStackTrace)
+ {
+ return structuredStackTrace.map(function(callSite) {
+ return {
+ sourceURL: callSite.getFileName(),
+ lineNumber: callSite.getLineNumber(),
+ columnNumber: callSite.getColumnNumber()
+ };
+ });
+ }
+ var holder = /** @type {{stack: Array.<{sourceURL: string, lineNumber: number, columnNumber: number}>}} */ ({});
+ Error.captureStackTrace(holder, topMostFunctionToIgnore || arguments.callee);
+ this._stackTrace = holder.stack;
+
Error.stackTraceLimit = oldStackTraceLimit;
+ Error.prepareStackTrace = oldPrepareStackTrace;
}
StackTraceV8.prototype = {
/**
* @override
* @param {number} index
- * @return {{sourceURL: string, lineNumber: number, columnNumber: number}}
+ * @return {{sourceURL: string, lineNumber: number, columnNumber: number}|undefined}
*/
callFrame: function(index)
{
- if (!this._stackTrace)
- this._prepareStackTrace();
return this._stackTrace[index];
},
- _prepareStackTrace: function()
- {
- var oldPrepareStackTrace = Error.prepareStackTrace;
- /**
- * @param {Object} error
- * @param {Array.<CallSite>} structuredStackTrace
- * @return {Array.<{sourceURL: string, lineNumber: number, columnNumber: number}>}
- */
- Error.prepareStackTrace = function(error, structuredStackTrace)
- {
- return structuredStackTrace.map(function(callSite) {
- return {
- sourceURL: callSite.getFileName(),
- lineNumber: callSite.getLineNumber(),
- columnNumber: callSite.getColumnNumber()
- };
- });
- }
- this._stackTrace = this._error.stack;
- Error.prepareStackTrace = oldPrepareStackTrace;
- delete this._error; // No longer needed, free memory.
- },
-
__proto__: StackTrace.prototype
}