Piotr Caban : jscript: Throw exception on error in JSGlobal_encodeURIComponent.

Alexandre Julliard julliard at winehq.org
Fri Sep 2 13:13:38 CDT 2011


Module: wine
Branch: master
Commit: df96b7297b3963d94c7cda3975182a67baa2d2e4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=df96b7297b3963d94c7cda3975182a67baa2d2e4

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Fri Sep  2 12:24:45 2011 +0200

jscript: Throw exception on error in JSGlobal_encodeURIComponent.

---

 dlls/jscript/global.c     |    3 +--
 dlls/jscript/tests/api.js |    1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/global.c b/dlls/jscript/global.c
index edc8350..6ff88ee 100644
--- a/dlls/jscript/global.c
+++ b/dlls/jscript/global.c
@@ -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);
             if(!size) {
                 SysFreeString(str);
-                FIXME("throw Error\n");
-                return E_FAIL;
+                return throw_uri_error(ctx, ei, JS_E_INVALID_URI_CHAR, NULL);
             }
             len += size*3;
         }
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index 09c3360..2416ea0 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -2053,6 +2053,7 @@ testException(function() {RegExp(/a/, "g");}, "E_REGEXP_SYNTAX_ERROR");
 
 // URIError tests
 testException(function() {encodeURI('\udcaa');}, "E_URI_INVALID_CHAR");
+testException(function() {encodeURIComponent('\udcaa');}, "E_URI_INVALID_CHAR");
 
 function testThisExcept(func, e) {
     testException(function() {func.call(new Object())}, e);




More information about the wine-cvs mailing list