46 } |
47 } |
47 |
48 |
48 JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) |
49 JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) |
49 { |
50 { |
50 JSObject* thisObj = thisValue.toThisObject(exec); |
51 JSObject* thisObj = thisValue.toThisObject(exec); |
|
52 JSValue name = thisObj->get(exec, exec->propertyNames().name); |
|
53 JSValue message = thisObj->get(exec, exec->propertyNames().message); |
51 |
54 |
52 UString s = "Error"; |
55 // Mozilla-compatible format. |
53 |
56 |
54 JSValue v = thisObj->get(exec, exec->propertyNames().name); |
57 if (!name.isUndefined()) { |
55 if (!v.isUndefined()) |
58 if (!message.isUndefined()) |
56 s = v.toString(exec); |
59 return jsMakeNontrivialString(exec, name.toString(exec), ": ", message.toString(exec)); |
57 |
60 return jsNontrivialString(exec, name.toString(exec)); |
58 v = thisObj->get(exec, exec->propertyNames().message); |
|
59 if (!v.isUndefined()) { |
|
60 // Mozilla-compatible format. |
|
61 s += ": "; |
|
62 s += v.toString(exec); |
|
63 } |
61 } |
64 |
62 if (!message.isUndefined()) |
65 return jsNontrivialString(exec, s); |
63 return jsMakeNontrivialString(exec, "Error: ", message.toString(exec)); |
|
64 return jsNontrivialString(exec, "Error"); |
66 } |
65 } |
67 |
66 |
68 } // namespace JSC |
67 } // namespace JSC |