Piotr Caban : jscript: Throw URIError in encodeURI function.
Alexandre Julliard
julliard at winehq.org
Mon Nov 9 15:14:15 CST 2009
Module: wine
Branch: master
Commit: 7d5c16b64e5134617c03c610cf1bb94f5b19d1f8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7d5c16b64e5134617c03c610cf1bb94f5b19d1f8
Author: Piotr Caban <piotr.caban at gmail.com>
Date: Sun Nov 8 11:36:28 2009 +0100
jscript: Throw URIError in encodeURI function.
---
dlls/jscript/global.c | 3 +--
dlls/jscript/jscript_En.rc | 1 +
dlls/jscript/resource.h | 1 +
dlls/jscript/tests/api.js | 1 +
4 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/jscript/global.c b/dlls/jscript/global.c
index 18bff55..8f6080d 100644
--- a/dlls/jscript/global.c
+++ b/dlls/jscript/global.c
@@ -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;
diff --git a/dlls/jscript/jscript_En.rc b/dlls/jscript/jscript_En.rc
index 14be9bd..bd3c09d 100644
--- a/dlls/jscript/jscript_En.rc
+++ b/dlls/jscript/jscript_En.rc
@@ -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"
}
diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h
index 17c0df0..b88621f 100644
--- a/dlls/jscript/resource.h
+++ b/dlls/jscript/resource.h
@@ -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
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index ed795cf..1fb2f6d 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -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);
More information about the wine-cvs
mailing list