jscript: Throw exception on error in JSGlobal_encodeURIComponent.

This commit is contained in:
Piotr Caban 2011-09-02 12:24:45 +02:00 committed by Alexandre Julliard
parent 65a7f47531
commit df96b7297b
2 changed files with 2 additions and 2 deletions

View File

@ -899,8 +899,7 @@ static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
size = WideCharToMultiByte(CP_UTF8, 0, ptr, 1, NULL, 0, NULL, NULL); size = WideCharToMultiByte(CP_UTF8, 0, ptr, 1, NULL, 0, NULL, NULL);
if(!size) { if(!size) {
SysFreeString(str); SysFreeString(str);
FIXME("throw Error\n"); return throw_uri_error(ctx, ei, JS_E_INVALID_URI_CHAR, NULL);
return E_FAIL;
} }
len += size*3; len += size*3;
} }

View File

@ -2053,6 +2053,7 @@ testException(function() {RegExp(/a/, "g");}, "E_REGEXP_SYNTAX_ERROR");
// URIError tests // URIError tests
testException(function() {encodeURI('\udcaa');}, "E_URI_INVALID_CHAR"); testException(function() {encodeURI('\udcaa');}, "E_URI_INVALID_CHAR");
testException(function() {encodeURIComponent('\udcaa');}, "E_URI_INVALID_CHAR");
function testThisExcept(func, e) { function testThisExcept(func, e) {
testException(function() {func.call(new Object())}, e); testException(function() {func.call(new Object())}, e);