Commit Graph

211 Commits

Author SHA1 Message Date
oana 71206f078c Add support for building and running multiple instances of the same script.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6542 acf43c95-373e-0410-b603-e72c3f656dc1
2022-02-09 10:59:28 +00:00
marian 6cb563308f Added array method used to push strings from list.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6536 acf43c95-373e-0410-b603-e72c3f656dc1
2022-01-11 09:02:27 +00:00
marian 26ee35ea63 Fixed JSON reference resolve string comparison bug revealed by new compiler.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6528 acf43c95-373e-0410-b603-e72c3f656dc1
2021-11-25 18:02:25 +00:00
marian a95f965a0c Fixed JSON replaceReferences bug: check if object was already found when no replacements are done in it. Improved debug.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6526 acf43c95-373e-0410-b603-e72c3f656dc1
2021-10-27 12:43:59 +00:00
marian dead60e861 Added support for JSON Path (find value in object by path). Fixed JSON.stringify(): avoid crashing on circular references, replace already found objects by their path reference. Report path in Engine.dump_r for already found objects.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6525 acf43c95-373e-0410-b603-e72c3f656dc1
2021-10-27 10:22:53 +00:00
paulc 16462dbbd1 Changed priority of the JS specific operators.
Fixes problems introduced by Rev. 6511


git-svn-id: http://yate.null.ro/svn/yate/trunk@6515 acf43c95-373e-0410-b603-e72c3f656dc1
2021-08-16 10:52:48 +00:00
paulc a964723b52 Added missing precedence of the nullish operator.
Aligned operators precedence with JS.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6511 acf43c95-373e-0410-b603-e72c3f656dc1
2021-08-11 10:52:33 +00:00
paulc 11bcd6a7f8 Implemented the nullish concatenation and assignment operators.
Implemented the missing logical operation plus assignment.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6504 acf43c95-373e-0410-b603-e72c3f656dc1
2021-07-08 14:53:44 +00:00
paulc 76c0d7ed08 Add the "name" property to functions.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6480 acf43c95-373e-0410-b603-e72c3f656dc1
2021-04-16 13:03:57 +00:00
paulc 19ec4ab0eb Added Object.global() to access the script's global object.
Write numbers to JSON using their internal string representation.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6478 acf43c95-373e-0410-b603-e72c3f656dc1
2021-04-16 09:57:46 +00:00
oana fdff04abd5 Clone a JsFunction when first assigned into another variable.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6477 acf43c95-373e-0410-b603-e72c3f656dc1
2021-04-12 08:55:18 +00:00
paulc b482039d8a Made behavior of Math abs, min and max more consistent with the standard.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6471 acf43c95-373e-0410-b603-e72c3f656dc1
2021-03-29 10:34:12 +00:00
paulc 6908f576cd Added support for retrieving the call stack and the call context.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6469 acf43c95-373e-0410-b603-e72c3f656dc1
2021-03-26 12:17:41 +00:00
oana 398a02fbad Add optional name parameter to ExpWrapper constructor.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6468 acf43c95-373e-0410-b603-e72c3f656dc1
2021-03-26 12:01:58 +00:00
oana 4a1090c2d6 Fix Object.keys() evaluation on object of type Message of Engine.Hashlist: use the object list of field names when possible.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6467 acf43c95-373e-0410-b603-e72c3f656dc1
2021-03-19 14:20:48 +00:00
marian 2122b71bf1 Avoid crash in javascript array concat() called for array(s) with holes (missing indexes).
git-svn-id: http://yate.null.ro/svn/yate/trunk@6463 acf43c95-373e-0410-b603-e72c3f656dc1
2021-03-03 13:59:52 +00:00
paulc 51b6cf6bfa Fixed several issues exposed by the Microsoft compiler.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6459 acf43c95-373e-0410-b603-e72c3f656dc1
2021-02-09 14:08:19 +00:00
oana f9309ac9ed Fix issue introduced by commit 6442: make ExpNull::copy() method to have the same signature as the one from ExpWrapper in order to override it.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6455 acf43c95-373e-0410-b603-e72c3f656dc1
2020-11-20 16:02:02 +00:00
oana b971c2465a Add hashing functions for uint32, uint64 and pointer types.
Use pointer hashing function in accessing list that tracks JS objects.



git-svn-id: http://yate.null.ro/svn/yate/trunk@6448 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-30 13:56:33 +00:00
oana 153f5b35b9 Protect access to object tracking list of the script execution context.
Some objects are created outside of the context.



git-svn-id: http://yate.null.ro/svn/yate/trunk@6447 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-29 16:28:49 +00:00
oana cd07afa11d Bug fix: do not increase code line number when parsing '\n' from a string literal.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6446 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-29 14:46:07 +00:00
oana a4ba57411a Fix code line counting when parsing multi-line string.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6444 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-23 08:11:53 +00:00
oana 63eb336324 Add tracking for Javascript object creation and destruction.
Add command that reports how many objects are still alive that have been created at the reported code line.
Fix constructor for ConfigFile.



git-svn-id: http://yate.null.ro/svn/yate/trunk@6442 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-21 11:01:31 +00:00
paulc a3cfd6581e Fixed parser clamping of large negative numbers.
Added hack to parse floating point numbers but store them as integers.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6440 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-19 09:11:10 +00:00
marian eedf31e959 Added support to dump JsHashList items in print_r and toJSON.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6439 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-14 14:03:56 +00:00
marian c0db0b4817 Added print/dump_r functions used to print/dump a specific variable or script context using flags to filter what to print: props only (default), funcs only ...
git-svn-id: http://yate.null.ro/svn/yate/trunk@6437 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-14 10:38:31 +00:00
oana 670f9746b7 Add Javascript implementation for trace debug methods.
Add a setTraceId() method in Engine that sets the trace ID in current runner. This then activates internally displaying the trace ID for any Engine.debug/output.alarm call from a script.



git-svn-id: http://yate.null.ro/svn/yate/trunk@6403 acf43c95-373e-0410-b603-e72c3f656dc1
2020-04-22 12:05:53 +00:00
oana 6965bec52f Add Engine methods for retrieving current line of source code being executed, current source file name and the concatenation of both.
Add Message.trace() method for tracking of message handling in JS code.



git-svn-id: http://yate.null.ro/svn/yate/trunk@6397 acf43c95-373e-0410-b603-e72c3f656dc1
2020-04-01 11:47:55 +00:00
paulc 94a3b70b42 Added support for retrieving the timezone at any time, not just now.
Fixed the Javascript Date getTimezoneOffset() result.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6396 acf43c95-373e-0410-b603-e72c3f656dc1
2020-04-01 07:38:14 +00:00
marian d5fa7c939c Handle RegExp when given in string split delimiter.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6383 acf43c95-373e-0410-b603-e72c3f656dc1
2020-02-21 14:15:15 +00:00
marian 1edde8b332 Fixed parameter name in documentation.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6374 acf43c95-373e-0410-b603-e72c3f656dc1
2019-12-11 06:44:18 +00:00
paulc 3577c50b78 Added the Array-like "arguments" variable to called functions.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6372 acf43c95-373e-0410-b603-e72c3f656dc1
2019-11-25 15:16:46 +00:00
oana 36678b54d8 Add setters/getters for JSObject fields from various data types.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6366 acf43c95-373e-0410-b603-e72c3f656dc1
2019-11-11 14:33:26 +00:00
marian 1a9603fba7 Handle string description in JsDate constructor. Add string representation when stringifying a JsDate. Added toJSON() method to JsDate.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6365 acf43c95-373e-0410-b603-e72c3f656dc1
2019-11-08 11:24:35 +00:00
paulc b339c4b655 Properly return undefined on finding garbage after JSON.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6346 acf43c95-373e-0410-b603-e72c3f656dc1
2019-02-28 19:17:38 +00:00
oana ff8d653feb Moved methods to the JS library that stringify objects to JSON format.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6317 acf43c95-373e-0410-b603-e72c3f656dc1
2018-06-15 13:39:48 +00:00
paulc 3a00fba2a8 Added JS Array method includes().
git-svn-id: http://yate.null.ro/svn/yate/trunk@6315 acf43c95-373e-0410-b603-e72c3f656dc1
2018-05-10 12:55:45 +00:00
paulc b96e06d214 Added String method includes().
git-svn-id: http://yate.null.ro/svn/yate/trunk@6314 acf43c95-373e-0410-b603-e72c3f656dc1
2018-05-04 18:37:44 +00:00
marian 0461cfbdcb Added utility to ScriptContext used to add string fields from a NamedList.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6309 acf43c95-373e-0410-b603-e72c3f656dc1
2018-04-12 12:35:32 +00:00
marian 983e05f546 Added hashCode function for javascript strings. Return String::hash().
git-svn-id: http://yate.null.ro/svn/yate/trunk@6284 acf43c95-373e-0410-b603-e72c3f656dc1
2017-12-08 16:12:59 +00:00
oana e3bf50ad2b Use String method which trims whitespaces for the implementation of JS String method trim().
git-svn-id: http://yate.null.ro/svn/yate/trunk@6279 acf43c95-373e-0410-b603-e72c3f656dc1
2017-11-14 14:31:52 +00:00
paulc 7497ff0d05 Don't attempt to DNS resolve empty, null or undefined names.
Added helper functions to check if an operator is missing or empty.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6266 acf43c95-373e-0410-b603-e72c3f656dc1
2017-09-18 13:03:30 +00:00
oana 6f58478394 Added support for a native implementation of a Javascript HashList.
When generating iterator for JsObjects avoid checking that were not setting duplicates in the iterator. JsObject does not allow setting duplicates.



git-svn-id: http://yate.null.ro/svn/yate/trunk@6264 acf43c95-373e-0410-b603-e72c3f656dc1
2017-09-18 12:14:44 +00:00
paulc 27de15bc48 Fixed compile time bugs and warnings exposed by Visual Studio.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6256 acf43c95-373e-0410-b603-e72c3f656dc1
2017-09-07 15:29:32 +00:00
andrei d557427582 BugFix. Clear JsContext parameters before destructor is reached.
Clear ScriptRun stack and async tasks, before destroying the script context.
Fixed JsSemaphore prototype.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6252 acf43c95-373e-0410-b603-e72c3f656dc1
2017-08-02 13:48:40 +00:00
paulc 34ae3b8537 Fixed behavior of Date constructor with missing parameters or with two digits year.
Added the Date.UTC static method.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6229 acf43c95-373e-0410-b603-e72c3f656dc1
2017-06-07 14:17:15 +00:00
oana d8f8bdd5d6 Build RegExp object with properly set prototypes.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6213 acf43c95-373e-0410-b603-e72c3f656dc1
2017-05-08 08:59:46 +00:00
paulc 4364b81adc Don't check changes in files that didn't had a valid timestamp.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6204 acf43c95-373e-0410-b603-e72c3f656dc1
2017-04-14 09:13:41 +00:00
paulc 736fb2bb2f Clean up stack during for and while loops to prevent building up useless values.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6202 acf43c95-373e-0410-b603-e72c3f656dc1
2017-04-06 00:07:37 +00:00
paulc 0e0ca89ee1 Speed up the filling of large field names lists mainly used in iteration over object properties.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6201 acf43c95-373e-0410-b603-e72c3f656dc1
2017-04-05 23:12:07 +00:00