jscript: Add Error_toString implementation.
This commit is contained in:
parent
f17b1f6334
commit
2d71dac412
|
@ -54,11 +54,22 @@ static HRESULT Error_message(DispatchEx *dispex, LCID lcid, WORD flags,
|
|||
}
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.11.4.4 */
|
||||
static HRESULT Error_toString(DispatchEx *dispex, LCID lcid, WORD flags,
|
||||
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
static const WCHAR str[] = {'[','o','b','j','e','c','t',' ','E','r','r','o','r',']',0};
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(retv) {
|
||||
V_VT(retv) = VT_BSTR;
|
||||
V_BSTR(retv) = SysAllocString(str);
|
||||
if(!V_BSTR(retv))
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Error_hasOwnProperty(DispatchEx *dispex, LCID lcid, WORD flags,
|
||||
|
|
|
@ -1253,6 +1253,8 @@ ok(err.valueOf === Object.prototype.valueOf, "err.valueOf !== Object.prototype.v
|
|||
ok(Error.prototype.name === "Error", "Error.prototype.name = " + Error.prototype.name);
|
||||
ok(err.name === "Error", "err.name = " + err.name);
|
||||
EvalError.prototype.message = "test";
|
||||
ok(err.toString !== Object.prototype.toString, "err.toString === Object.prototype.toString");
|
||||
ok(err.toString() === "[object Error]", "err.toString() = " + err.toString());
|
||||
err = new EvalError();
|
||||
ok(EvalError.prototype.name === "EvalError", "EvalError.prototype.name = " + EvalError.prototype.name);
|
||||
ok(err.name === "EvalError", "err.name = " + err.name);
|
||||
|
@ -1260,22 +1262,30 @@ ok(err.toString === Error.prototype.toString, "err.toString !== Error.prototype.
|
|||
ok(err.message === "", "err.message != ''");
|
||||
err.message = date;
|
||||
ok(err.message === date, "err.message != date");
|
||||
ok(err.toString() === "[object Error]", "err.toString() = " + err.toString());
|
||||
ok(err.toString !== Object.prototype.toString, "err.toString === Object.prototype.toString");
|
||||
err = new RangeError();
|
||||
ok(RangeError.prototype.name === "RangeError", "RangeError.prototype.name = " + RangeError.prototype.name);
|
||||
ok(err.name === "RangeError", "err.name = " + err.name);
|
||||
ok(err.toString() === "[object Error]", "err.toString() = " + err.toString());
|
||||
err = new ReferenceError();
|
||||
ok(ReferenceError.prototype.name === "ReferenceError", "ReferenceError.prototype.name = " + ReferenceError.prototype.name);
|
||||
ok(err.name === "ReferenceError", "err.name = " + err.name);
|
||||
ok(err.toString() === "[object Error]", "err.toString() = " + err.toString());
|
||||
err = new SyntaxError();
|
||||
ok(SyntaxError.prototype.name === "SyntaxError", "SyntaxError.prototype.name = " + SyntaxError.prototype.name);
|
||||
ok(err.name === "SyntaxError", "err.name = " + err.name);
|
||||
ok(err.toString() === "[object Error]", "err.toString() = " + err.toString());
|
||||
err = new TypeError();
|
||||
ok(TypeError.prototype.name === "TypeError", "TypeError.prototype.name = " + TypeError.prototype.name);
|
||||
ok(err.name === "TypeError", "err.name = " + err.name);
|
||||
ok(err.toString() === "[object Error]", "err.toString() = " + err.toString());
|
||||
err = new URIError();
|
||||
ok(URIError.prototype.name === "URIError", "URIError.prototype.name = " + URIError.prototype.name);
|
||||
ok(err.name === "URIError", "err.name = " + err.name);
|
||||
ok(err.toString() === "[object Error]", "err.toString() = " + err.toString());
|
||||
err = new Error("message");
|
||||
ok(err.message === "message", "err.message !== 'message'");
|
||||
ok(err.toString() === "[object Error]", "err.toString() = " + err.toString());
|
||||
|
||||
reportSuccess();
|
||||
|
|
Loading…
Reference in New Issue