Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
469b5972
Commit
469b5972
authored
Jul 20, 2009
by
Piotr Caban
Committed by
Alexandre Julliard
Jul 21, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Add error throwing functions.
parent
2d71dac4
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
136 additions
and
7 deletions
+136
-7
Makefile.in
dlls/jscript/Makefile.in
+4
-2
date.c
dlls/jscript/date.c
+2
-4
error.c
dlls/jscript/error.c
+60
-0
jscript.h
dlls/jscript/jscript.h
+11
-0
jscript_En.rc
dlls/jscript/jscript_En.rc
+26
-0
jscript_main.c
dlls/jscript/jscript_main.c
+1
-1
resource.h
dlls/jscript/resource.h
+21
-0
api.js
dlls/jscript/tests/api.js
+11
-0
No files found.
dlls/jscript/Makefile.in
View file @
469b5972
...
...
@@ -3,9 +3,11 @@ TOPOBJDIR = ../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
MODULE
=
jscript.dll
IMPORTS
=
oleaut32 advapi32 kernel32
IMPORTS
=
oleaut32
user32
advapi32 kernel32
RC_SRCS
=
rsrc.rc
RC_SRCS
=
\
jscript_En.rc
\
rsrc.rc
C_SRCS
=
\
array.c
\
...
...
dlls/jscript/date.c
View file @
469b5972
...
...
@@ -590,10 +590,8 @@ static HRESULT Date_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA
TRACE
(
"
\n
"
);
if
(
!
is_class
(
dispex
,
JSCLASS_DATE
))
{
FIXME
(
"throw TypeError
\n
"
);
return
E_FAIL
;
}
if
(
!
is_class
(
dispex
,
JSCLASS_DATE
))
return
throw_type_error
(
dispex
->
ctx
,
ei
,
IDS_NOT_DATE
,
NULL
);
date
=
(
DateInstance
*
)
dispex
;
time
=
local_time
(
date
->
time
,
date
);
...
...
dlls/jscript/error.c
View file @
469b5972
...
...
@@ -330,3 +330,63 @@ HRESULT init_error_constr(script_ctx_t *ctx)
return
S_OK
;
}
static
HRESULT
throw_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
UINT
id
,
const
WCHAR
*
str
,
DispatchEx
*
constr
)
{
WCHAR
buf
[
1024
],
*
pos
=
NULL
;
DispatchEx
*
err
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
LoadStringW
(
jscript_hinstance
,
id
,
buf
,
sizeof
(
buf
)
/
sizeof
(
WCHAR
));
if
(
str
)
pos
=
strchrW
(
buf
,
'|'
);
if
(
pos
)
{
int
len
=
strlenW
(
str
);
memmove
(
pos
+
len
,
pos
+
1
,
strlenW
(
pos
+
1
)
*
sizeof
(
WCHAR
));
memcpy
(
pos
,
str
,
len
*
sizeof
(
WCHAR
));
}
hres
=
create_error
(
ctx
,
constr
,
buf
,
&
err
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
ei
)
return
id
;
V_VT
(
&
ei
->
var
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
ei
->
var
)
=
(
IDispatch
*
)
_IDispatchEx_
(
err
);
return
0x800A0000
+
id
;
}
HRESULT
throw_eval_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
UINT
id
,
const
WCHAR
*
str
)
{
return
throw_error
(
ctx
,
ei
,
id
,
str
,
ctx
->
eval_error_constr
);
}
HRESULT
throw_range_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
UINT
id
,
const
WCHAR
*
str
)
{
return
throw_error
(
ctx
,
ei
,
id
,
str
,
ctx
->
range_error_constr
);
}
HRESULT
throw_reference_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
UINT
id
,
const
WCHAR
*
str
)
{
return
throw_error
(
ctx
,
ei
,
id
,
str
,
ctx
->
reference_error_constr
);
}
HRESULT
throw_syntax_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
UINT
id
,
const
WCHAR
*
str
)
{
return
throw_error
(
ctx
,
ei
,
id
,
str
,
ctx
->
syntax_error_constr
);
}
HRESULT
throw_type_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
UINT
id
,
const
WCHAR
*
str
)
{
return
throw_error
(
ctx
,
ei
,
id
,
str
,
ctx
->
type_error_constr
);
}
HRESULT
throw_uri_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
UINT
id
,
const
WCHAR
*
str
)
{
return
throw_error
(
ctx
,
ei
,
id
,
str
,
ctx
->
uri_error_constr
);
}
dlls/jscript/jscript.h
View file @
469b5972
...
...
@@ -28,6 +28,8 @@
#include "dispex.h"
#include "activscp.h"
#include "resource.h"
#include "wine/unicode.h"
#include "wine/list.h"
...
...
@@ -58,6 +60,8 @@ jsheap_t *jsheap_mark(jsheap_t*);
typedef
struct
DispatchEx
DispatchEx
;
extern
HINSTANCE
jscript_hinstance
;
#define PROPF_ARGMASK 0x00ff
#define PROPF_METHOD 0x0100
#define PROPF_ENUM 0x0200
...
...
@@ -139,6 +143,13 @@ HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const builtin_inf
DispatchEx
*
,
DispatchEx
**
);
HRESULT
Function_value
(
DispatchEx
*
,
LCID
,
WORD
,
DISPPARAMS
*
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
HRESULT
throw_eval_error
(
script_ctx_t
*
,
jsexcept_t
*
,
UINT
,
const
WCHAR
*
);
HRESULT
throw_range_error
(
script_ctx_t
*
,
jsexcept_t
*
,
UINT
,
const
WCHAR
*
);
HRESULT
throw_reference_error
(
script_ctx_t
*
,
jsexcept_t
*
,
UINT
,
const
WCHAR
*
);
HRESULT
throw_syntax_error
(
script_ctx_t
*
,
jsexcept_t
*
,
UINT
,
const
WCHAR
*
);
HRESULT
throw_type_error
(
script_ctx_t
*
,
jsexcept_t
*
,
UINT
,
const
WCHAR
*
);
HRESULT
throw_uri_error
(
script_ctx_t
*
,
jsexcept_t
*
,
UINT
,
const
WCHAR
*
);
HRESULT
create_object
(
script_ctx_t
*
,
DispatchEx
*
,
DispatchEx
**
);
HRESULT
create_math
(
script_ctx_t
*
,
DispatchEx
**
);
...
...
dlls/jscript/jscript_En.rc
0 → 100644
View file @
469b5972
/*
* Copyright 2009 Piotr Caban
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "resource.h"
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_NOT_DATE "'[object]' is not a date object"
}
dlls/jscript/jscript_main.c
View file @
469b5972
...
...
@@ -40,7 +40,7 @@ static const CLSID CLSID_JScriptEncode =
DEFINE_GUID
(
GUID_NULL
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
static
HINSTANCE
jscript_hinstance
;
HINSTANCE
jscript_hinstance
;
static
HRESULT
WINAPI
ClassFactory_QueryInterface
(
IClassFactory
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
...
...
dlls/jscript/resource.h
0 → 100644
View file @
469b5972
/*
* Copyright 2009 Piotr Caban
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <windef.h>
#define IDS_NOT_DATE 0x138E
dlls/jscript/tests/api.js
View file @
469b5972
...
...
@@ -1288,4 +1288,15 @@ err = new Error("message");
ok
(
err
.
message
===
"message"
,
"err.message !== 'message'"
);
ok
(
err
.
toString
()
===
"[object Error]"
,
"err.toString() = "
+
err
.
toString
());
function
exception_test
(
func
,
type
)
{
ret
=
""
;
try
{
func
();
}
catch
(
e
)
{
ret
=
e
.
name
;
}
ok
(
ret
===
type
,
"Exception test, ret = "
+
ret
+
", expected "
+
type
+
". Executed function: "
+
func
.
toString
());
}
exception_test
(
function
()
{
arr
.
toString
=
Date
.
prototype
.
toString
;
arr
.
toString
();},
"TypeError"
);
reportSuccess
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment