Commit Graph

195 Commits

Author SHA1 Message Date
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
paulc f81a00b9e6 Return the string length in characters, not UTF-8 octets.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6144 acf43c95-373e-0410-b603-e72c3f656dc1
2016-11-04 12:15:51 +00:00
paulc 7f969238b2 Added support for parsing \xXX and \uXXXX escape sequences.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6143 acf43c95-373e-0410-b603-e72c3f656dc1
2016-11-03 14:30:34 +00:00
paulc f37f408a2f Made maximum loadable JS file size configurable.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6116 acf43c95-373e-0410-b603-e72c3f656dc1
2016-05-18 13:31:47 +00:00
oana 1e75fa2786 Make sure to also copy the name of a global function when initializing a ScriptContext.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6115 acf43c95-373e-0410-b603-e72c3f656dc1
2016-05-13 13:47:26 +00:00
paulc a42065447d Make a copy of global JS functions when initializing a Script Context.
This prevents changing JS functions across instances of the same script.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6111 acf43c95-373e-0410-b603-e72c3f656dc1
2016-05-04 10:35:55 +00:00
paulc d244a2df0d Allow assigned top-level functions to work as callbacks.
Store a JsFunction name in its embedded ExpFunction so they are always in sync.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6102 acf43c95-373e-0410-b603-e72c3f656dc1
2016-03-08 12:23:11 +00:00
andrei b978614bb5 Fixed Math.random() possible crash.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6101 acf43c95-373e-0410-b603-e72c3f656dc1
2016-03-07 12:05:52 +00:00
marian beac5b2cd1 Allow changing RegExp case insensitive and basic posix properties.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6100 acf43c95-373e-0410-b603-e72c3f656dc1
2016-03-04 14:48:48 +00:00
marian 5e18aa85f8 Added Regexp flag used to avoid regexp re-compile if not changed. Removed valid() method.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6099 acf43c95-373e-0410-b603-e72c3f656dc1
2016-03-04 10:24:01 +00:00
paulc 40860a794a Fixed the returned type of charCodeAt(), must be integer.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6098 acf43c95-373e-0410-b603-e72c3f656dc1
2016-02-25 17:12:00 +00:00
paulc efb00bbe2f Added Javascript string method charCodeAt.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6097 acf43c95-373e-0410-b603-e72c3f656dc1
2016-02-25 15:41:34 +00:00
marian 469cf9a61e Fixed bug: avoid crashing if JsRegExp constructor receives empty flags.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6096 acf43c95-373e-0410-b603-e72c3f656dc1
2016-02-25 14:28:10 +00:00
marian 28db40ad77 Added JsRegExp function used to check if the object contains a valid regexp.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6095 acf43c95-373e-0410-b603-e72c3f656dc1
2016-02-23 14:00:18 +00:00
paulc 3aeb6687d5 Fixed a GCC 6 build error: C++11 requires a space between literal and string macro.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6084 acf43c95-373e-0410-b603-e72c3f656dc1
2016-01-20 10:23:35 +00:00
paulc d2f52af2f6 Added JS Array.lastIndexOf() method.
Fixed fromIndex behavior for indexOf() and lastIndexOf().
Added optional extra parameter to allow searching a field in an array of objects.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6050 acf43c95-373e-0410-b603-e72c3f656dc1
2015-10-01 15:15:09 +00:00
paulc f632f0b034 Added JS Object.keys() static method.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6039 acf43c95-373e-0410-b603-e72c3f656dc1
2015-09-16 17:33:28 +00:00