Bug 805222 - Change some usages of GetFunctionId to GetFunctionDisplayId for better JS stacktrace. r=bholley,robcee

This commit is contained in:
Tom Schuster 2012-10-31 13:34:42 +01:00
Родитель eec2aef6e6
Коммит dc7288d8a6
5 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -31,7 +31,7 @@ function tabLoaded() {
function performChecks() {
// The expected stack trace object.
let stacktrace = [
{ filename: TEST_URI, lineNumber: 9, functionName: null, language: 2 },
{ filename: TEST_URI, lineNumber: 9, functionName: "window.foobar585956c", language: 2 },
{ filename: TEST_URI, lineNumber: 14, functionName: "foobar585956b", language: 2 },
{ filename: TEST_URI, lineNumber: 18, functionName: "foobar585956a", language: 2 },
{ filename: TEST_URI, lineNumber: 21, functionName: null, language: 2 }

Просмотреть файл

@ -118,7 +118,7 @@ function testConsoleGroup(aMessageObject) {
function startTraceTest() {
gLevel = "trace";
gArgs = [
{filename: TEST_URI, lineNumber: 6, functionName: null, language: 2},
{filename: TEST_URI, lineNumber: 6, functionName: "window.foobar585956c", language: 2},
{filename: TEST_URI, lineNumber: 11, functionName: "foobar585956b", language: 2},
{filename: TEST_URI, lineNumber: 15, functionName: "foobar585956a", language: 2},
{filename: TEST_URI, lineNumber: 1, functionName: "onclick", language: 2}

Просмотреть файл

@ -116,7 +116,7 @@ XPCJSStackFrame::CreateStack(JSContext* cx, XPCJSStackFrame** stack)
JSFunction* fun = desc->frames[i].fun;
if (fun) {
JSString *funid = JS_GetFunctionId(fun);
JSString *funid = JS_GetFunctionDisplayId(fun);
if (funid) {
size_t length = JS_GetStringEncodingLength(cx, funid);
if (length != size_t(-1)) {

Просмотреть файл

@ -1466,7 +1466,7 @@ XPC_WN_CallMethod(JSContext *cx, unsigned argc, jsval *vp)
#ifdef DEBUG_slimwrappers
{
JSFunction* fun = funobj->getFunctionPrivate();
JSString *funid = JS_GetFunctionId(fun);
JSString *funid = JS_GetFunctionDisplayId(fun);
JSAutoByteString bytes;
const char *funname = !funid ? "" : bytes.encode(cx, funid) ? bytes.ptr() : "<error>";
SLIM_LOG_WILL_MORPH_FOR_PROP(cx, obj, funname);
@ -1503,7 +1503,7 @@ XPC_WN_GetterSetter(JSContext *cx, unsigned argc, jsval *vp)
const char* funname = nullptr;
JSAutoByteString bytes;
if (JS_TypeOfValue(cx, JS_CALLEE(cx, vp)) == JSTYPE_FUNCTION) {
JSString *funid = JS_GetFunctionId(funobj->getFunctionPrivate());
JSString *funid = JS_GetFunctionDisplayId(funobj->getFunctionPrivate());
funname = !funid ? "" : bytes.encode(cx, funid) ? bytes.ptr() : "<error>";
}
SLIM_LOG_WILL_MORPH_FOR_PROP(cx, obj, funname);

Просмотреть файл

@ -766,7 +766,7 @@ DescribeGCThing(bool isMarked, void *p, JSGCTraceKind traceKind,
clasp->name, si->GetJSClass()->name);
} else if (clasp == &js::FunctionClass) {
JSFunction *fun = JS_GetObjectFunction(obj);
JSString *str = JS_GetFunctionId(fun);
JSString *str = JS_GetFunctionDisplayId(fun);
if (str) {
NS_ConvertUTF16toUTF8 fname(JS_GetInternedStringChars(str));
JS_snprintf(name, sizeof(name),