Commit Graph

100 Commits

Author SHA1 Message Date
Ioana Stanciu c56216f5a8 Updated copyright notices. 2023-05-23 17:01:06 +03:00
marian 3436092371 Added javascript support for callback function set when a message is enqueued by a script. Call the function after message was dispatched. 2023-03-15 16:58:21 +02:00
marian acdc469d00 Added deep copy support in Object::assignProps().
Added ExpOperVector class and JsObject support to extract stack arguments into it.
2023-03-06 13:07:02 +02:00
marian a494ca67a5 Added support for javascript Object.assign() method. Added method Object.assignProps(): copy properties using filter, may alter property names.
git-svn-id: http://voip.null.ro/svn/yate@6560 acf43c95-373e-0410-b603-e72c3f656dc1
2022-06-27 06:32:57 +00:00
oana 23327197a9 Fix documentation comments for a couple of methods.
git-svn-id: http://voip.null.ro/svn/yate@6551 acf43c95-373e-0410-b603-e72c3f656dc1
2022-03-08 12:05:27 +00:00
oana 94a2b7ce80 Add support for building and running multiple instances of the same script.
git-svn-id: http://voip.null.ro/svn/yate@6542 acf43c95-373e-0410-b603-e72c3f656dc1
2022-02-09 10:59:28 +00:00
marian 0196d2b8df Added array method used to push strings from list.
git-svn-id: http://voip.null.ro/svn/yate@6536 acf43c95-373e-0410-b603-e72c3f656dc1
2022-01-11 09:02:27 +00:00
marian 27ba8dfbec 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://voip.null.ro/svn/yate@6525 acf43c95-373e-0410-b603-e72c3f656dc1
2021-10-27 10:22:53 +00:00
paulc d15456b72d Implemented the nullish concatenation and assignment operators.
Implemented the missing logical operation plus assignment.


git-svn-id: http://voip.null.ro/svn/yate@6504 acf43c95-373e-0410-b603-e72c3f656dc1
2021-07-08 14:53:44 +00:00
oana f0b7849ee1 Clone a JsFunction when first assigned into another variable.
git-svn-id: http://voip.null.ro/svn/yate@6477 acf43c95-373e-0410-b603-e72c3f656dc1
2021-04-12 08:55:18 +00:00
paulc 8cbdd26b7f Added support for retrieving the call stack and the call context.
git-svn-id: http://voip.null.ro/svn/yate@6469 acf43c95-373e-0410-b603-e72c3f656dc1
2021-03-26 12:17:41 +00:00
oana 3208dc161f Add optional name parameter to ExpWrapper constructor.
git-svn-id: http://voip.null.ro/svn/yate@6468 acf43c95-373e-0410-b603-e72c3f656dc1
2021-03-26 12:01:58 +00:00
oana 83ef49437f 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://voip.null.ro/svn/yate@6442 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-21 11:01:31 +00:00
marian f4e68d8527 Added support to dump JsHashList items in print_r and toJSON.
git-svn-id: http://voip.null.ro/svn/yate@6439 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-14 14:03:56 +00:00
marian a51728652e 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://voip.null.ro/svn/yate@6437 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-14 10:38:31 +00:00
oana 8209f5614c 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://voip.null.ro/svn/yate@6403 acf43c95-373e-0410-b603-e72c3f656dc1
2020-04-22 12:05:53 +00:00
oana 700b3b1036 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://voip.null.ro/svn/yate@6397 acf43c95-373e-0410-b603-e72c3f656dc1
2020-04-01 11:47:55 +00:00
marian 85759c91d4 Fixed parameter name in documentation.
git-svn-id: http://voip.null.ro/svn/yate@6374 acf43c95-373e-0410-b603-e72c3f656dc1
2019-12-11 06:44:18 +00:00
oana c168c341a5 Add setters/getters for JSObject fields from various data types.
git-svn-id: http://voip.null.ro/svn/yate@6366 acf43c95-373e-0410-b603-e72c3f656dc1
2019-11-11 14:33:26 +00:00
oana 1a8b055ed2 Moved methods to the JS library that stringify objects to JSON format.
git-svn-id: http://voip.null.ro/svn/yate@6317 acf43c95-373e-0410-b603-e72c3f656dc1
2018-06-15 13:39:48 +00:00
marian 2c241d279f Added utility to ScriptContext used to add string fields from a NamedList.
git-svn-id: http://voip.null.ro/svn/yate@6309 acf43c95-373e-0410-b603-e72c3f656dc1
2018-04-12 12:35:32 +00:00
paulc 018a1a65a5 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://voip.null.ro/svn/yate@6266 acf43c95-373e-0410-b603-e72c3f656dc1
2017-09-18 13:03:30 +00:00
oana 8267d6863a 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://voip.null.ro/svn/yate@6264 acf43c95-373e-0410-b603-e72c3f656dc1
2017-09-18 12:14:44 +00:00
oana 456ea16287 Build RegExp object with properly set prototypes.
git-svn-id: http://voip.null.ro/svn/yate@6213 acf43c95-373e-0410-b603-e72c3f656dc1
2017-05-08 08:59:46 +00:00
paulc ceeb2a87a6 Made maximum loadable JS file size configurable.
git-svn-id: http://voip.null.ro/svn/yate@6116 acf43c95-373e-0410-b603-e72c3f656dc1
2016-05-18 13:31:47 +00:00
oana 6061e9049e Make sure to also copy the name of a global function when initializing a ScriptContext.
git-svn-id: http://voip.null.ro/svn/yate@6115 acf43c95-373e-0410-b603-e72c3f656dc1
2016-05-13 13:47:26 +00:00
paulc 0091b832c3 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://voip.null.ro/svn/yate@6102 acf43c95-373e-0410-b603-e72c3f656dc1
2016-03-08 12:23:11 +00:00
marian 2c5493b6ee Allow changing RegExp case insensitive and basic posix properties.
git-svn-id: http://voip.null.ro/svn/yate@6100 acf43c95-373e-0410-b603-e72c3f656dc1
2016-03-04 14:48:48 +00:00
paulc 093e51fc39 Added support for JS getIntValue() min/max/clamp parameters.
git-svn-id: http://voip.null.ro/svn/yate@6023 acf43c95-373e-0410-b603-e72c3f656dc1
2015-08-27 10:56:06 +00:00
paulc 9bb6e439e1 Added prototypes to parsed JSON objects and arrays.
git-svn-id: http://voip.null.ro/svn/yate@6020 acf43c95-373e-0410-b603-e72c3f656dc1
2015-08-21 13:07:19 +00:00
paulc 25b11ff5b1 Made the maximum script file size configurable at runtime and increased default to 500000.
git-svn-id: http://voip.null.ro/svn/yate@5976 acf43c95-373e-0410-b603-e72c3f656dc1
2015-06-01 13:34:50 +00:00
paulc 068cd4cf31 Fixed script line counting when an identifier is last item on a line.
Fixed line numbers of function calls to match the function identifier.
Fixed line numbers for parts of expressions spanning multiple lines.


git-svn-id: http://voip.null.ro/svn/yate@5898 acf43c95-373e-0410-b603-e72c3f656dc1
2014-08-05 08:27:07 +00:00
paulc 4391b6f37c Added JsObject constructor that populates prototype from a context.
Added JsRegExp contructor from existing Regexp.


git-svn-id: http://voip.null.ro/svn/yate@5873 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-22 11:02:44 +00:00
paulc 86cecbd5dc Added Javascript Array.isArray()
git-svn-id: http://voip.null.ro/svn/yate@5870 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-18 11:07:19 +00:00
paulc d92a383e0f Added native JSON parser and stringifier.
git-svn-id: http://voip.null.ro/svn/yate@5869 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-14 08:06:41 +00:00
paulc d7d4f7a20d Fixed assignment operation changed in Rev. 5856.
Report the ExpOperation types in Engine.print_r().


git-svn-id: http://voip.null.ro/svn/yate@5857 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-25 16:04:00 +00:00
oana c07e3cc6f3 Fix loss of boolean type information through assignment due to changes in commit 5854.
Do proper cloning on ExpOperation when resolving fields and do proper detection for number conversion on boolean values.



git-svn-id: http://voip.null.ro/svn/yate@5856 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-25 14:09:32 +00:00
oana 48c3ed7154 Do proper number conversion for arithmetic operations.
git-svn-id: http://voip.null.ro/svn/yate@5854 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-24 13:36:53 +00:00
marian 45b6321104 Added parser method used to obtain a 'null' object reference.
git-svn-id: http://voip.null.ro/svn/yate@5830 acf43c95-373e-0410-b603-e72c3f656dc1
2014-05-14 09:05:33 +00:00
oana 5704c84662 Added support for Javascript RegExp constructor from string.
git-svn-id: http://voip.null.ro/svn/yate@5825 acf43c95-373e-0410-b603-e72c3f656dc1
2014-04-18 13:37:49 +00:00
oana 82d4ffb659 Added discrimination between boolean and integer values.
Return proper results for typeof and toString() calls for boolean values.



git-svn-id: http://voip.null.ro/svn/yate@5819 acf43c95-373e-0410-b603-e72c3f656dc1
2014-04-09 13:52:54 +00:00
paulc f869586d43 Added and extra include path (defaulting to config dir) for JS scripts.
Engine runtime parameters can be used in javascript.conf for script paths.


git-svn-id: http://voip.null.ro/svn/yate@5799 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-14 14:45:41 +00:00
oana 785ea24117 Bug fix: properly set prototype property on JS Array objects.
Added JsObject::setPrototype() in order to set an objects prototype from given context.
Added new JsArray constructor which set its own prototype. Replaced use of constructor which returned Array prototype with this contructor.



git-svn-id: http://voip.null.ro/svn/yate@5796 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-13 13:10:56 +00:00
paulc 42f71895c5 Added proper constructor for JS Array object.
git-svn-id: http://voip.null.ro/svn/yate@5789 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-26 12:25:53 +00:00
paulc d56cecb40e Added copyright notices to sources and scripts missing them.
Updated copyright notices for 2014.
Fixed end of lines in many files.


git-svn-id: http://voip.null.ro/svn/yate@5755 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-05 11:42:17 +00:00
oana c1dcd17eea Bug fix: report parser error when parsing expressions like 'a.' (parsing of field operator without subsequent field name).
Also do not parse fields that do not start with a letter or characters '_'/'$'.



git-svn-id: http://voip.null.ro/svn/yate@5655 acf43c95-373e-0410-b603-e72c3f656dc1
2013-09-17 14:34:43 +00:00
paulc 81c120bcb7 Fixed some of the cases related to script change detection.
git-svn-id: http://voip.null.ro/svn/yate@5634 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-30 12:53:24 +00:00
paulc cad5b5eb13 Properly dump 64 bit JS values for debugging and tracing.
Made possible to dump the linked code for debugging purpose.
Exposed accessors for more properties.


git-svn-id: http://voip.null.ro/svn/yate@5633 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-30 10:58:23 +00:00
paulc 0b869b4437 Check the timestamps of all files included in Javascript.
On initialization reload scripts if any included file has changed.
Reload routing script only if it has changed.


git-svn-id: http://voip.null.ro/svn/yate@5631 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-28 13:19:42 +00:00
paulc 751937b0ec More fixes related to 32 and 64 bit types usage in JS.
git-svn-id: http://voip.null.ro/svn/yate@5613 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-07 10:18:23 +00:00