https://bugs.webkit.org/show_bug.cgi?id=40118
Patch by Anthony Scian <ascian@rim.com> on 2012-07-04
Reviewed by Yong Li.
Source/JavaScriptCore:
Added member functions to expose function name, urlString, and line #.
Refactored toString to make use of these member functions to reduce
duplicated code for future maintenance.
Manually tested refactoring of toString by tracing thrown exceptions.
* interpreter/Interpreter.h:
(JSC::StackFrame::toString):
(JSC::StackFrame::friendlySourceURL):
(JSC::StackFrame::friendlyFunctionName):
(JSC::StackFrame::friendlyLineNumber):
Source/WebCore:
Implemented stub for createScriptCallStack to call into
Interpreter and extract the current stack frames, iterate
through the frames and create the return result required.
No new tests, manually tested thrown exception and inspector
tracebacks.
* bindings/js/ScriptCallStackFactory.cpp:
(WebCore::createScriptCallStack):
LayoutTests:
Updated test results now that createScriptCallStack is functional.
* http/tests/inspector/console-resource-errors-expected.txt:
* http/tests/inspector/console-xhr-logging-async-expected.txt:
* http/tests/inspector/console-xhr-logging-expected.txt:
* http/tests/inspector/network/script-as-text-loading-expected.txt:
* inspector/timeline/timeline-animation-frame-expected.txt:
* inspector/timeline/timeline-layout-expected.txt:
* inspector/timeline/timeline-mark-timeline-expected.txt:
* inspector/timeline/timeline-network-resource-expected.txt:
* inspector/timeline/timeline-paint-expected.txt:
* inspector/timeline/timeline-parse-html-expected.txt:
* inspector/timeline/timeline-time-stamp-expected.txt:
* inspector/timeline/timeline-timer-expected.txt:
* platform/chromium/http/tests/inspector/console-xhr-logging-async-expected.txt:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121871
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-07-04 Anthony Scian <ascian@rim.com>
+
+ Web Inspector [JSC]: Implement ScriptCallStack::stackTrace
+ https://bugs.webkit.org/show_bug.cgi?id=40118
+
+ Reviewed by Yong Li.
+
+ Updated test results now that createScriptCallStack is functional.
+
+ * http/tests/inspector/console-resource-errors-expected.txt:
+ * http/tests/inspector/console-xhr-logging-async-expected.txt:
+ * http/tests/inspector/console-xhr-logging-expected.txt:
+ * http/tests/inspector/network/script-as-text-loading-expected.txt:
+ * inspector/timeline/timeline-animation-frame-expected.txt:
+ * inspector/timeline/timeline-layout-expected.txt:
+ * inspector/timeline/timeline-mark-timeline-expected.txt:
+ * inspector/timeline/timeline-network-resource-expected.txt:
+ * inspector/timeline/timeline-paint-expected.txt:
+ * inspector/timeline/timeline-parse-html-expected.txt:
+ * inspector/timeline/timeline-time-stamp-expected.txt:
+ * inspector/timeline/timeline-timer-expected.txt:
+ * platform/chromium/http/tests/inspector/console-xhr-logging-async-expected.txt:
+
2012-07-04 Zan Dobersek <zandobersek@gmail.com>
Unreviewed GTK gardening, skip another two http tests that
GET http://127.0.0.1:8000/inspector/missing.css 404 (Not Found) console-resource-errors-iframe.html:3 console-message console-error-level
GET http://127.0.0.1:8000/inspector/non-existent-iframe.html 404 (Not Found) non-existent-iframe.html:1 console-message console-error-level
GET http://127.0.0.1:8000/inspector/non-existent-script.js 404 (Not Found) console-resource-errors-iframe.html:4 console-message console-error-level
-GET http://127.0.0.1:8000/inspector/non-existent-xhr 404 (Not Found) non-existent-xhr:1 console-message console-error-level
+GET http://127.0.0.1:8000/inspector/non-existent-xhr 404 (Not Found) [native code]:1send [native code]:1loadXHR console-resource-errors.html:18performActions console-resource-errors.html:10eval codeeval [native code]:1_evaluateOn_evaluateAndWrapevaluate(anonymous function) [native code]:1 console-message console-error-level
Tests that XMLHttpRequest Logging works when Enabled and doesn't show logs when Disabled for asynchronous XHRs.
Bug 79229
-XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-exists.html". network-test.js:39
+XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-exists.html". [native code]:1
Done. console-xhr-logging-async.html:14
Tests that XMLHttpRequest Logging works when Enabled and doesn't show logs when Disabled.
sending a GET request to resources/xhr-exists.html console-xhr-logging.html:10
-XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-exists.html".
+XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-exists.html". [native code]:1
sending a GET request to resources/xhr-does-not-exist.html console-xhr-logging.html:10
-GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found) resources/xhr-does-not-exist.html:1
-XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html".
+GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found) [native code]:1
+XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html". [native code]:1
sending a POST request to resources/post-target.cgi console-xhr-logging.html:10
-XHR finished loading: "http://127.0.0.1:8000/inspector/resources/post-target.cgi".
+XHR finished loading: "http://127.0.0.1:8000/inspector/resources/post-target.cgi". [native code]:1
sending a GET request to http://localhost:8000/inspector/resources/xhr-exists.html console-xhr-logging.html:10
XMLHttpRequest cannot load http://localhost:8000/inspector/resources/xhr-exists.html. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin.
sending a GET request to resources/xhr-exists.html console-xhr-logging.html:10
sending a GET request to resources/xhr-does-not-exist.html console-xhr-logging.html:10
-GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found) resources/xhr-does-not-exist.html:1
+GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found) [native code]:1
sending a POST request to resources/post-target.cgi console-xhr-logging.html:10
sending a GET request to http://localhost:8000/inspector/resources/xhr-exists.html console-xhr-logging.html:10
XMLHttpRequest cannot load http://localhost:8000/inspector/resources/xhr-exists.html. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin.
Tests console message when script is loaded with incorrect text/html mime type.
Bug 69972
-Resource interpreted as Script but transferred with MIME type text/plain: "http://127.0.0.1:8000/inspector/network/resources/script-as-text.php".
+Resource interpreted as Script but transferred with MIME type text/plain: "http://127.0.0.1:8000/inspector/network/resources/script-as-text.php". [native code]:1
RequestAnimationFrame Properties:
{
startTime : <number>
+ stackTrace : <object>
data : {
id : <number>
}
CancelAnimationFrame Properties:
{
startTime : <number>
+ stackTrace : <object>
data : {
id : <number>
}
Layout Properties:
{
startTime : <number>
+ stackTrace : <object>
data : {
}
children : <object>
TimeStamp Properties:
{
startTime : <number>
+ stackTrace : <object>
data : {
message : "MARK TIMELINE"
}
ResourceSendRequest Properties:
{
startTime : <number>
+ stackTrace : <object>
data : {
requestId : <string>
url : <string>
Paint Properties:
{
startTime : <number>
+ stackTrace : <object>
data : {
x : 0
y : 0
ParseHTML Properties:
{
startTime : <number>
+ stackTrace : <object>
data : {
length : 9
startLine : 0
ParseHTML Properties:
{
startTime : <number>
+ stackTrace : <object>
data : {
length : 1
startLine : 0
TimeStamp Properties:
{
startTime : <number>
+ stackTrace : <object>
data : {
message : "TIME STAMP"
}
TimerInstall Properties:
{
startTime : <number>
+ stackTrace : <object>
data : {
timerId : <number>
timeout : 10
TimerInstall Properties:
{
startTime : <number>
+ stackTrace : <object>
data : {
timerId : <number>
timeout : 20
TimerRemove Properties:
{
startTime : <number>
+ stackTrace : <object>
data : {
timerId : <number>
}
--- /dev/null
+CONSOLE MESSAGE: line 14: Done.
+CONSOLE MESSAGE: line 14: Done.
+Tests that XMLHttpRequest Logging works when Enabled and doesn't show logs when Disabled for asynchronous XHRs.
+
+Bug 79229
+XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-exists.html". network-test.js:39
+Done. console-xhr-logging-async.html:14
+
+2012-07-04 Anthony Scian <ascian@rim.com>
+
+ Web Inspector [JSC]: Implement ScriptCallStack::stackTrace
+ https://bugs.webkit.org/show_bug.cgi?id=40118
+
+ Reviewed by Yong Li.
+
+ Added member functions to expose function name, urlString, and line #.
+ Refactored toString to make use of these member functions to reduce
+ duplicated code for future maintenance.
+
+ Manually tested refactoring of toString by tracing thrown exceptions.
+
+ * interpreter/Interpreter.h:
+ (JSC::StackFrame::toString):
+ (JSC::StackFrame::friendlySourceURL):
+ (JSC::StackFrame::friendlyFunctionName):
+ (JSC::StackFrame::friendlyLineNumber):
+
2012-07-04 Andy Wingo <wingo@igalia.com>
[GTK] Enable parallel GC
/*
* Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "RegisterFile.h"
#include <wtf/HashMap.h>
+#include <wtf/text/StringBuilder.h>
namespace JSC {
UString sourceURL;
UString toString(CallFrame* callFrame) const
{
- bool hasSourceURLInfo = !sourceURL.isNull() && !sourceURL.isEmpty();
- bool hasLineInfo = line > -1;
+ StringBuilder traceBuild;
+ String functionName = friendlyFunctionName(callFrame);
+ String sourceURL = friendlySourceURL();
+ traceBuild.append(functionName);
+ if (!sourceURL.isEmpty()) {
+ if (!functionName.isEmpty())
+ traceBuild.append('@');
+ traceBuild.append(sourceURL);
+ if (line > -1) {
+ traceBuild.append(':');
+ traceBuild.append(String::number(line));
+ }
+ }
+ return traceBuild.toString().impl();
+ }
+ String friendlySourceURL() const
+ {
String traceLine;
- JSObject* stackFrameCallee = callee.get();
switch (codeType) {
case StackFrameEvalCode:
- if (hasSourceURLInfo) {
- traceLine = hasLineInfo ? String::format("eval code@%s:%d", sourceURL.ascii().data(), line)
- : String::format("eval code@%s", sourceURL.ascii().data());
- } else
- traceLine = String::format("eval code");
+ case StackFrameFunctionCode:
+ case StackFrameGlobalCode:
+ if (!sourceURL.isEmpty())
+ traceLine = sourceURL.impl();
break;
- case StackFrameNativeCode: {
- if (callee) {
- UString functionName = getCalculatedDisplayName(callFrame, stackFrameCallee);
- traceLine = String::format("%s@[native code]", functionName.ascii().data());
- } else
- traceLine = "[native code]";
+ case StackFrameNativeCode:
+ traceLine = "[native code]";
break;
}
- case StackFrameFunctionCode: {
- UString functionName = getCalculatedDisplayName(callFrame, stackFrameCallee);
- if (hasSourceURLInfo) {
- traceLine = hasLineInfo ? String::format("%s@%s:%d", functionName.ascii().data(), sourceURL.ascii().data(), line)
- : String::format("%s@%s", functionName.ascii().data(), sourceURL.ascii().data());
- } else
- traceLine = String::format("%s\n", functionName.ascii().data());
+ return traceLine.isNull() ? emptyString() : traceLine;
+ }
+ String friendlyFunctionName(CallFrame* callFrame) const
+ {
+ String traceLine;
+ JSObject* stackFrameCallee = callee.get();
+
+ switch (codeType) {
+ case StackFrameEvalCode:
+ traceLine = "eval code";
+ break;
+ case StackFrameNativeCode:
+ if (callee)
+ traceLine = getCalculatedDisplayName(callFrame, stackFrameCallee).impl();
+ break;
+ case StackFrameFunctionCode:
+ traceLine = getCalculatedDisplayName(callFrame, stackFrameCallee).impl();
break;
- }
case StackFrameGlobalCode:
- if (hasSourceURLInfo) {
- traceLine = hasLineInfo ? String::format("global code@%s:%d", sourceURL.ascii().data(), line)
- : String::format("global code@%s", sourceURL.ascii().data());
- } else
- traceLine = String::format("global code");
-
+ traceLine = "global code";
+ break;
}
- return traceLine.impl();
+ return traceLine.isNull() ? emptyString() : traceLine;
+ }
+ unsigned friendlyLineNumber() const
+ {
+ return line > -1 ? line : 0;
}
};
+2012-07-04 Anthony Scian <ascian@rim.com>
+
+ Web Inspector [JSC]: Implement ScriptCallStack::stackTrace
+ https://bugs.webkit.org/show_bug.cgi?id=40118
+
+ Reviewed by Yong Li.
+
+ Implemented stub for createScriptCallStack to call into
+ Interpreter and extract the current stack frames, iterate
+ through the frames and create the return result required.
+
+ No new tests, manually tested thrown exception and inspector
+ tracebacks.
+
+ * bindings/js/ScriptCallStackFactory.cpp:
+ (WebCore::createScriptCallStack):
+
2012-07-04 Dana Jansens <danakj@chromium.org>
[chromium] Respect memory needed for RenderSurfaces when reserving contents textures
/*
* Copyright (c) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
#include "InspectorInstrumentation.h"
#include "JSDOMBinding.h"
+#include "JSMainThreadExecState.h"
#include "ScriptArguments.h"
#include "ScriptCallFrame.h"
#include "ScriptCallStack.h"
class ScriptExecutionContext;
-PassRefPtr<ScriptCallStack> createScriptCallStack(size_t, bool)
+PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize, bool emptyIsAllowed)
{
- return 0;
+ Vector<ScriptCallFrame> frames;
+ if (JSC::ExecState* exec = JSMainThreadExecState::currentState()) {
+ Vector<StackFrame> stackTrace;
+ Interpreter::getStackTrace(&exec->globalData(), stackTrace);
+ for (Vector<StackFrame>::const_iterator iter = stackTrace.begin(); iter < stackTrace.end(); iter++) {
+ frames.append(ScriptCallFrame(iter->friendlyFunctionName(exec), iter->friendlySourceURL(), iter->friendlyLineNumber()));
+ if (frames.size() >= maxStackSize)
+ break;
+ }
+ }
+ if (frames.isEmpty() && !emptyIsAllowed) {
+ // No frames found. It may happen in the case where
+ // a bound function is called from native code for example.
+ // Fallback to setting lineNumber to 0, and source and function name to "undefined".
+ frames.append(ScriptCallFrame("undefined", "undefined", 0));
+ }
+ return ScriptCallStack::create(frames);
}
PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t maxStackSize)