Commit graph

1831 commits

Author SHA1 Message Date
Gabriel Ivăncescu 8cb5d74125 jscript: Pass correct 'this' to callbacks called by builtins.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2022-11-23 17:59:47 +01:00
Gabriel Ivăncescu da842966ff jscript: Pass a jsval as the 'this' to disp_call_value.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2022-11-23 17:59:47 +01:00
Gabriel Ivăncescu 9d4e93cfde jscript: Pass a jsval as the 'this' to jsdisp_call_value.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2022-11-23 17:59:47 +01:00
Gabriel Ivăncescu 3805eef49a jscript: Initialize source and lastIndex for RegExp.prototype.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2022-11-23 17:59:47 +01:00
Gabriel Ivăncescu ae73e09a8d jscript: Use CRT allocation functions.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2022-11-21 22:10:43 +01:00
Alex Henrie 81a432c356 jscript: Remove unused function heap_strdupW. 2022-11-18 18:52:12 +01:00
Alex Henrie 844f771b13 jscript: Use standard C functions for memory allocation in jscript.c. 2022-11-18 18:52:12 +01:00
Alex Henrie 7c26da1ae9 jscript: Use standard C functions for memory allocation in dispex.c. 2022-11-18 18:52:11 +01:00
Gabriel Ivăncescu 0c875dfa5f jscript: Convert filetime to date properly using unsigned division.
Also, the result has to be signed type before converting to double, since
it can be negative then (e.g. if system clock is set before 1970).

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2022-11-08 20:09:13 +01:00
Gabriel Ivăncescu d984fb14a5 jscript: Implement VariantChangeType for VT_DISPATCH and VT_UNKNOWN.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2022-10-31 21:23:42 +01:00
Gabriel Ivăncescu 2dcc5a7026 jscript: Implement reviver argument for JSON.parse.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2022-10-17 11:27:04 +02:00
Gabriel Ivăncescu a4697901cc jscript/tests: Fix copy paste mistake in JSON test.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2022-10-17 11:27:04 +02:00
Gabriel Ivăncescu 35a6555929 jscript: Implement Function.prototype.bind's thisArg properly.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2022-10-17 11:27:04 +02:00
Gabriel Ivăncescu 605819dcd9 jscript: Refill the props at end of enumeration in html mode and retry.
If properties were added during enumeration, for example on the prototype,
they are actually visited in mshtml scripts in any mode.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2022-10-10 21:15:26 +02:00
Gabriel Ivăncescu 2a228918ef jscript: Fill the builtin props for enumeration on prototypes as well.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2022-10-10 21:15:25 +02:00
Eric Pouech 4bdf92cb7f jscript: Fix GCC 12.2 warning.
When initializing a jsstr_inline_t with a len < 3, the size passed
for the allocation is smaller then the size of the structure
(as the later is rounded up to the alignment = 4 bytes).

GCC 12.2 complains about this when dereferencing the pointer to
the structure as the size passed for allocation is smaller than the
size of the structure.

The warning is fixed by using flexible array member in
jsstr_inline_t. Given the rounding behavior in memory allocation, this
should not change the size of allocated blocks.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-19 20:10:36 +02:00
Gabriel Ivăncescu 7be0cffa06 jscript: Implement fdexNameCaseInsensitive flag handling.
Despite common sense, native doesn't seem to look for exact match first;
it simply case-insensitively compares the props and returns as soon as it
finds one. This is also reliant on implementation details in case the object
has multiple props with same case-insensitive names, e.g. an object having
`Foo` prop, with `foo` prop on its prototype, can still find `Foo` even if
you look up `foo` instead (which matches exactly on the prototype). Which
is not always reliable, sometimes it finds the prototype first.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2022-08-17 19:21:00 +02:00
Santino Mazza d93712feee jscript: Return ParseProcedureText when compile fails.
This prevents crashes when there is an invalid script
inside a tag property.

Because ParseProcedureText calls release_bytecode without
checking if compile_script failed, "code" is not set, and
this leads to a crash when release_bytecode tries to access it.

Signed-off-by: Santino Mazza <mazzasantino1206@gmail.com>
2022-07-20 22:33:44 +02:00
Jacek Caban 6010e6b8cb jscript: Correctly handle deleted entries in iterate_map.
Based on patch by Gabriel Ivăncescu.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2022-06-07 19:37:11 +02:00
Gabriel Ivăncescu bae77953ed jscript: Use LIST_FOR_EACH_ENTRY_SAFE to clear Map and Set objects.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2022-06-07 19:37:11 +02:00
Jacek Caban 34aeef628f jscript/tests: Add test for releasing script context objects.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2022-06-07 19:37:11 +02:00
Gabriel Ivăncescu 738e306bf7 jscript: Don't allow construction on builtin methods.
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-06-03 21:55:17 +02:00
Gabriel Ivăncescu 79e51d6bc5 jscript: Release all globals when the script is uninitialized.
Most of these globals were leaking before as they were never freed at all.

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-06-03 21:55:17 +02:00
Gabriel Ivăncescu c35e5274ed jscript: Forward actual error in to_primitive if it's not just missing prop.
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-06-03 21:55:17 +02:00
Gabriel Ivăncescu 469219dcf7 jscript: Don't execute any functions if script state does not allow it.
Instead of only interpreted functions. Property retrievals or setters are
allowed though, as long as they are not accessors.

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-06-03 21:55:17 +02:00
Gabriel Ivăncescu c8d7d504eb jscript: Setup builtin function when the dispid is retrieved.
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-06-03 21:55:17 +02:00
Gabriel Ivăncescu 079b14b2e9 jscript: Don't allow starting script using state from uninitialized.
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-06-03 21:55:17 +02:00
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 5007c4d72f jscript: Handle detached scope objects 'this' in all calls.
Not just for interpreted functions.

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 36d96b0fa0 jscript: Implement Array.prototype.lastIndexOf.
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-03 20:25:25 +02:00
Gabriel Ivăncescu f0dd9748da jscript: Implement Array.prototype.some.
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-03 20:25:11 +02:00
Gabriel Ivăncescu eb80db6f8a jscript: Implement Array.prototype.every.
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-03 20:24:58 +02:00
Gabriel Ivăncescu c603fb490a jscript: Implement Array.prototype.filter.
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-03 20:24:44 +02:00
Gabriel Ivăncescu a8057c2e14 jscript: Implement Array.prototype.toLocaleString.
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-03 20:24:31 +02:00
Gabriel Ivăncescu 41782ec12e jscript: Return proper error in Number.toLocaleString with invalid 'this' in ES5 mode.
Note that, for example, Number.toFixed still returns JS_E_NUMBER_EXPECTED
even in ES5 mode (this is already tested).

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-03 20:24:18 +02:00
Gabriel Ivăncescu 8aefdf48f9 jscript: Implement Number.prototype.toLocaleString.
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-03 20:24:06 +02:00
Gabriel Ivăncescu e254680ed1 jscript: Initialize hres in String constructor.
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-15 20:55:55 +02:00
Gabriel Ivăncescu 121851955e jscript: Use proper error description for invalid Set 'this'.
Map and Set share the same error code, but the description given is different,
so we need to throw it manually.

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:30 +02:00
Gabriel Ivăncescu 58479eefea jscript: Implement Set on top of Map.
Because a Set is just a Map where key == value.

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 15053a1d17 jscript: Compare numbers in a Map bitwise for equality.
Native treats -0 and 0 differently, so it must be doing a bitwise
comparison. This might not order the numbers correctly, but that's not
important, since we don't need them sorted other than for quick lookup
(and any arbitrary sorting is fine, as long as it's consistent).

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 251eda6f56 jscript: Support passing 'this' context to the Map callback when iterating.
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 399f8b6f06 jscript: Pass the Map object to the callback when iterating.
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 477026a55b jscript: Set a map entry using a helper function.
So it can be re-used by Set objects.

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 ce644eedae jscript: Iterate through the map in a helper function.
So it can be re-used by Set objects.

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 27ce397307 jscript: Move Set below Map.
So it can be implemented on top of Map.

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 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 2bdce91e8f jscript: Defer lookup to the actual locals for function statements.
Functions declared as function statements have an associated local_ref and
can be changed from within themselves by using their name (by literally
changing the local variable), while function expressions can not.

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-13 20:19:47 +02:00
Gabriel Ivăncescu 4fd955ae07 jscript: Treat NULL disps as actual null values in html mode.
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-12 22:13:05 +02:00
Gabriel Ivăncescu 3349dc5eea jscript: Accept DISPATCH_PROPERTYPUTREF for jsdisps.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45493
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-12 21:39:42 +02:00
Gabriel Ivăncescu fa09e3f36c jscript: Throw proper error when invoking non-method builtin.
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-11 21:15:13 +02:00
Gabriel Ivăncescu 45d8af4cf3 jscript: Make idx props enumerable.
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-11 21:15:10 +02:00
Gabriel Ivăncescu 67fef476c7 jscript: Handle PROP_IDX in jsdisp_get_own_property.
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-11 21:15:05 +02:00
Gabriel Ivăncescu f858318384 jscript: Handle non-JS objects in Object.getPrototypeOf.
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-25 17:55:01 +01:00
Gabriel Ivăncescu ed55216558 jscript: Throw proper error in Object methods with non-objects args.
According to the ES6 spec, they don't throw anymore (compared to ES5),
but native IE seems to not follow it here and throws anyway.

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-25 17:54:49 +01:00
Gabriel Ivăncescu 9785781fbc jscript: Implement Object.prototype.__defineSetter__.
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-25 17:54:44 +01:00
Gabriel Ivăncescu 8eac0fc60a jscript: Implement Object.prototype.__defineGetter__.
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-25 17:54:36 +01: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 429325b689 jscript: Don't allow changing prototype on non-extensible objects.
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-21 22:33:30 +01:00
Gabriel Ivăncescu 7858f87ae5 jscript: Throw error when attempting to set circular __proto__ chains.
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-21 22:33:27 +01:00
Gabriel Ivăncescu 364e093ab7 jscript: Make Object.prototype.__proto__ an actual accessor.
We have to define it after the constructors are initiated.

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-21 22:33:24 +01:00
Gabriel Ivăncescu 94349fdd9a jscript: Allow overriding builtin methods by setting the prop.
Methods can be overriden by simple assignment, not just via defineProperty,
unlike accessors.

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-21 22:33:22 +01:00
Gabriel Ivăncescu 324b82d9ec jscript: Return JS_E_INVALID_PROPERTY in jsdisp_call_name if property is not found.
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-21 22:33:19 +01:00
Gabriel Ivăncescu 47b02e8c1e jscript: Return the correct string for Object.toString(undefined) in ES5+ modes.
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:51 +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 22ce4d7ec9 jscript: Return the correct string for Object.toString(null) in ES5+ modes.
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:45 +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 030a686010 jscript/tests: Enable compilation with long types.
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-03-01 22:41:15 +01:00
Eric Pouech e8e0917a9c jscript: Enable compilation with long types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-11 11:21:29 +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
Alexandre Julliard f0cd33c69e include: Add support for defining Win32 types as 'long' where possible.
Add -DWINE_NO_LONG_TYPES to modules that still have compilation
warnings with long types.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-27 20:38:22 +01:00
Alexandre Julliard f4af3134de makefiles: Specify the bison prefix directly in the source files.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-21 13:15:12 +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
Gabriel Ivăncescu adad455049 jscript: Get rid of the value_prop from jsdisp props.
The mapping between DISPID and index into props has to be adjusted since
the value_prop (props[0]) is now gone.

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:25 +01:00
Gabriel Ivăncescu 8b3afbe402 jscript: Access the PROTREF with proper index instead of get_prop.
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-24 18:48:42 +01:00
Gabriel Ivăncescu 5842ec60e2 jscript: Use ~0 to mark invalid bucket.
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-24 18:48:40 +01:00
Gabriel Ivăncescu 464134c20f jscript: Use to_primitive when getting the default value.
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-24 18:48:37 +01:00
Gabriel Ivăncescu c1861dc7d0 jscript: Support deletion for accessor, builtin and idx props.
IDX props are not configurable, thus they cannot be deleted, so it makes
no sense to special-case them anyway.

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-24 18:48:35 +01:00
Gabriel Ivăncescu 3f135a0611 jscript: Throw when defining a PROTREF prop on a non-extensible object.
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-24 18:48:32 +01:00
Gabriel Ivăncescu 738894a47c jscript: Fixup PROTREF props when looking them up.
Convert them to PROP_DELETE if the referenced prop in the prototype chain
doesn't exist anymore.

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-24 18:48:29 +01:00
Gabriel Ivăncescu 58722dfe35 jscript: Treat prototype refs as non-existent when deleting.
Delete only affects own properties.

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-24 18:48:26 +01:00
Gabriel Ivăncescu 46367d1ecc jscript: Implement Object.prototype.__proto__ property.
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-03 21:10:09 +01:00
Gabriel Ivăncescu 87ac636cbb jscript: Implement Object.prototype.isPrototypeOf 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-03 21:10:07 +01:00
Gabriel Ivăncescu 4e5c4758ff jscript: Fix some refcount leaks.
In particular, most leak when jsdisp->ctx is not the current ctx.

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-01 20:52:24 +01:00
Gabriel Ivăncescu 749c5d55e5 jscript: Return the failure code if the value invoke failed.
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-09-20 22:48:33 +02:00
Alexandre Julliard 088a787a2c makefiles: Make -mno-cygwin the default.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:48 +02:00
Gabriel Ivăncescu 59bb402bf1 jscript: Fix refcounting the object prototype fallback.
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-09-07 23:19:21 +02:00
Paul Gofman c6a75d4936 jscript: Also add function name to its detached scope in ES5 mode.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-09 22:39:45 +02:00
Paul Gofman 6b22f2bd60 jscript: Avoid use after free in JSON_parse().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-06 19:58:02 +02:00
Paul Gofman a439f7202a jscript: Fix use after free in Object_defineProperty().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-05 20:43:27 +02:00
Gabriel Ivăncescu 678789c72f jscript: Fix GetIDsOfNames for more than one name.
Names after the first one are supposed to retrieve DISPIDs for parameters,
but it doesn't seem to be implemented on Windows.

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-08-04 21:48:28 +02:00
Paul Gofman cfeb815ff4 jscript: Store the head of statement list instead of the list structure.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-30 18:58:13 +02:00
Paul Gofman 5c75646865 jscript: Implement 'let' declaration in 'for' statement.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-21 23:13:58 +02:00
Paul Gofman deeadb4fa6 jscript: Factor out compiler statement push and pop functions.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-21 23:13:58 +02:00
Paul Gofman 6bd291605c jscript: Initialize variable flags in new_variable_declaration().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-21 23:13:58 +02:00
Paul Gofman cf751a6dd3 jscript: Don't list LexicalDeclaration in Statement.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-21 23:13:58 +02:00
Paul Gofman e73cf60a74 jscript: Support nested scopes for functions defined inside.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-18 16:49:44 +02:00
Paul Gofman 308c8468b4 jscript: Support block scope variables.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-18 16:49:41 +02:00
Paul Gofman a35901137e jscript: Enumerate with and block scopes.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-18 16:49:39 +02:00
Paul Gofman 2a368c45ae jscript: Factor local_ref_scopes_t structure out of function_code_t.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-18 16:49:37 +02:00