Commit 7d5c16b6 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

jscript: Throw URIError in encodeURI function.

parent 78691491
......@@ -811,8 +811,7 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
i = WideCharToMultiByte(CP_UTF8, 0, ptr, 1, NULL, 0, NULL, NULL)*3;
if(!i) {
SysFreeString(str);
FIXME("throw URIError\n");
return E_FAIL;
return throw_uri_error(ctx, ei, IDS_URI_INVALID_CHAR, NULL);
}
len += i;
......
......@@ -41,6 +41,7 @@ STRINGTABLE DISCARDABLE
IDS_NOT_BOOL "Boolean object expected"
IDS_JSCRIPT_EXPECTED "JScript object expected"
IDS_REGEXP_SYNTAX_ERROR "Syntax error in regular expression"
IDS_URI_INVALID_CHAR "URI to be encoded contains invalid characters"
IDS_INVALID_LENGTH "Array length must be a finite positive integer"
IDS_ARRAY_EXPECTED "Array object expected"
}
......@@ -37,5 +37,6 @@
#define IDS_NOT_BOOL 0x1392
#define IDS_JSCRIPT_EXPECTED 0x1396
#define IDS_REGEXP_SYNTAX_ERROR 0x1399
#define IDS_URI_INVALID_CHAR 0x13A0
#define IDS_INVALID_LENGTH 0x13A5
#define IDS_ARRAY_EXPECTED 0x13A7
......@@ -1705,6 +1705,7 @@ exception_test(function() {eval("if(")}, "SyntaxError", -2146827286);
exception_test(function() {eval("'unterminated")}, "SyntaxError", -2146827273);
exception_test(function() {eval("nonexistingfunc()")}, "TypeError", -2146823281);
exception_test(function() {RegExp(/a/, "g");}, "RegExpError", -2146823271);
exception_test(function() {encodeURI('\udcaa');}, "URIError", -2146823264);
function testThisExcept(func, number) {
exception_test(function() {func.call(new Object())}, "TypeError", number);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment