Commit Graph

165 Commits

Author SHA1 Message Date
Gabriel Ivăncescu 2e9d086b04 jscript: Pass undefined 'this' instead of null in ES5 mode.
Based on the spec (ECMA-262 5.1 Edition 11.2.3.7), whereas the ES3 spec
says it gets replaced with null.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-16 22:10:15 +02:00
Gabriel Ivăncescu c464c1bd47 jscript: Handle NULL return pointers in all constructors.
Instead of crashing.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-14 23:45:29 +02:00
Gabriel Ivăncescu f6dc431af5 jscript: Store NULL disps as a different type of jsval_null.
This makes sure that object instances are always non-NULL and gets rid of
all such checks.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-24 23:22:06 +01:00
Gabriel Ivăncescu 598709f872 jscript: Pass jsval "this" to function calls instead of a dispatch.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-18 22:17:48 +01:00
Gabriel Ivăncescu 8fa923ca2c jscript: Pass null jsval to builtin functions instead of the global host.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-18 22:17:41 +01:00
Gabriel Ivăncescu 7a1c6453bc jscript: Pass a jsval "this" to builtin functions.
And get rid of vdisp_t since it's no longer needed.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-17 21:06:11 +01:00
Eric Pouech 679bbdf89d jscript: Use correct integral type.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-01 18:23:19 +01:00
Gabriel Ivăncescu ce1b3f5f1d jscript: Replace the value_prop in builtin_info with a call method.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-25 21:20:29 +01:00
Jacek Caban 380ae426a4 jscript: Throw error when trying to add a property to non-extensible objects in jsdisp_propput_idx.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-02 21:13:27 +02:00
Jeff Smith 4d68572aa6 jscript: Use wide-char string literals.
Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-03 20:18:39 +01:00
Michael Stefaniuc 59b9747644 jscript: Use wide-char string literals.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-24 16:53:52 +01:00
Michael Stefaniuc a8a03eb35f jscript: Use wide-char string literals in struct initialization.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-05 20:46:19 +01:00
Hans Leidekker d39e3d8762 jscript: Fix allocation size in BindFunction_call.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-03 21:50:56 +01:00
Jacek Caban edd4316492 jscript: Support null this in Function.prototype.bind.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-21 21:51:40 +02:00
Gabriel Ivăncescu 7ad740cd29 jscript: Get rid of the variable_obj parameter to exec_source.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-17 20:27:13 +01:00
Gabriel Ivăncescu f6201b4b11 jscript: Lookup the named item and keep a ref to it from the associated bytecode.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-09 22:16:30 +01:00
Gabriel Ivăncescu acb076c820 jscript: Lookup host global object on demand instead of storing it in script context.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-06 17:54:31 +01:00
Jacek Caban 8b836797e2 jscript: Directly return error code instead of using throw_type_error where possible.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-02 16:25:12 +01:00
Jacek Caban ba500a6a9e jscript: Store source context and starting line in bytecode_t.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-30 15:58:36 +01:00
Gabriel Ivăncescu 94bd9ab8a9 jscript: Store the necessary function and variable info in the TypeInfo.
The TypeInfo is built when it is retrieved and frozen at that moment, even
if the script changes after that and more identifiers are added to it,
or existing ones deleted.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-12 23:17:05 +01:00
Jacek Caban 11a9b373e7 jscript: Implement Function.prototype.bind.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-14 17:41:01 +02:00
Jacek Caban 462ab9b42b jscript: Move function name to NativeFunction.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-14 17:41:01 +02:00
Jacek Caban cc22ee7f2e jscript: Introduce InterpretedFunction struct.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-14 17:41:01 +02:00
Jacek Caban 2204c06909 jscript: Move value_proc to BuiltinFunction struct.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-14 17:41:01 +02:00
Jacek Caban 5c5397d1ef jscript: Move function call implementation into vtbl.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-14 17:41:01 +02:00
Jacek Caban 4960f9e338 jscript: Move function destructor implementation into vtbl.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-14 17:41:01 +02:00
Jacek Caban bad132acae jscript: Introduce function vtbl and use it for toString implementation.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-14 17:41:01 +02:00
Alexandre Julliard 29ea8b42db jscript: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-06 11:15:24 +02:00
Michael Stefaniuc ef64f27632 jscript: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-10 18:58:59 +02:00
Jacek Caban 599769f857 jscript: Use jsdisp_define_property to set prototype constructors.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-14 16:26:07 +02:00
Jacek Caban 3767d63a1c jscript: Use jsdisp_define_property to set function prototypes.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-14 16:26:05 +02:00
Jacek Caban 20007e586a jscript: Use jsdisp_define_data_property for arguments object properties.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-14 16:26:03 +02:00
Jacek Caban 4555828c57 jscript: Use jsdisp_define_property instead of jsdisp_propput_const.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-11 17:26:51 +02:00
Jacek Caban 7f01473a38 jscript: Make Function instance object properties non-writable.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-11 00:39:49 +02:00
Jacek Caban 6b86fd795c jscript: Use new PROPF_WRITABLE flag instead of PROPF_CONST.
This is closer to how ES5 defines them.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-03 16:20:40 +02:00
Jacek Caban 197db9cac9 jscript: Use new PROPF_CONFIGURABLE flag instead of PROPF_DONTDELETE.
This is closer to how ES5 defines them.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-03 16:20:36 +02:00
Michael Stefaniuc 55f6e3c350 jscript: Use the existing helpers to get from a jsdisp_t to an Instance.
Signed-off-by: Michael Stefaniuc <mstefani@redhat.de>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-09-23 20:48:11 +09:00
Sebastian Lackner 69437afed1 jscript: Change prototype of jsstr_alloc_buf and fix some error handling issues.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-09-08 10:05:46 +09:00
Jacek Caban 403fb41cd1 jscript: Create scope in setup_scope.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-05 10:32:23 -05:00
Jacek Caban 713051d027 jscript: Store local functions in locals map.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-04 09:09:12 -05:00
Jacek Caban 2f63a1e009 jscript: Delay arguments object until it's accessed and properly detach it after function exits.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-03 11:13:50 -05:00
Jacek Caban 5a7327d21d jscript: Setup arguments object by interpreter and store all arguments inside the object on call exit.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-03 11:13:50 -05:00
Jacek Caban 9daafa87bc jscript: Access arguments directly from stack in arguments object if possible.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-03 11:13:50 -05:00
Jacek Caban 5e4d3826ec jscript: Store function arguments on JS stack and transfer them to variable object only when needed.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-07-29 11:59:27 +09:00
Jacek Caban be37b894a4 jscript: Use IDispatch* as iface_to_jsdisp argument type.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-07-20 23:04:53 +09:00
Jacek Caban db6b86cbbd jscript: Allow Function.apply() to be called on non-jscript objects.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-06-17 00:09:18 +09:00
Jacek Caban 889f2657dd jscript: Use already running interpreter for Function.call() execution.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-03-30 11:54:42 +09:00
Jacek Caban 813609b843 jscript: Use already running interpreter for Function.apply() execution.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-03-30 11:54:40 +09:00
Jacek Caban fa726bed4d jscript: Use already running interpreter for execution new expressions.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-03-30 11:54:37 +09:00
Jacek Caban 66632091bf jscript: Use already running interpreter for execution of member source function.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-03-30 11:54:33 +09:00