Commit Graph

161 Commits

Author SHA1 Message Date
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 5fdbdd2cff Minor fix: return sections of a configuration file as object instead of array.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6443 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-21 11:53:57 +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
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
paulc 166aa682f4 Added setting to track created objects per script instead of whole module.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6438 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-14 13:24:46 +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
marian 0fb78918f2 Added support to set Regexp in javascript message handler.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6427 acf43c95-373e-0410-b603-e72c3f656dc1
2020-09-22 11:29:22 +00:00
paulc 2ca7a18ac8 Made DNS resolver work with libc versions that don't define __NAMESER.
Initialize the resolver in JS DNS and return null if initialization fails.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6422 acf43c95-373e-0410-b603-e72c3f656dc1
2020-08-27 09:54:46 +00:00
marian e090326356 Added separate (global) mutex used to protect access to Channel::m_status. Removed unsafe public method used to obtain it. Added methods used to safely obtain a copy of it.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6410 acf43c95-373e-0410-b603-e72c3f656dc1
2020-05-29 14:03:35 +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
paulc 7ac83d9218 Added support for checking if a module is loaded.
Added support for configuration conditionals on module loaded.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6399 acf43c95-373e-0410-b603-e72c3f656dc1
2020-04-15 13:50:14 +00:00
marian f2343ff21f Make JsURI URI value available: properly call JsObject constructor.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6398 acf43c95-373e-0410-b603-e72c3f656dc1
2020-04-14 05:58:16 +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 18e10ce2c3 Fixed xdebug build of the javascript module.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6389 acf43c95-373e-0410-b603-e72c3f656dc1
2020-03-03 14:52:36 +00:00
marian 8ea6c82663 Made URI object and methods available in javascript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6384 acf43c95-373e-0410-b603-e72c3f656dc1
2020-02-21 14:41:19 +00:00
marian 899c7425a7 Added separate mutex to protect the scripts list and operations. Avoids locking the module if script parse is taking a long time.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6376 acf43c95-373e-0410-b603-e72c3f656dc1
2019-12-19 12:21:42 +00:00
oana d3d7ae47a8 Add support for passing arguments to setTimeout/setInterval Engine methods.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6373 acf43c95-373e-0410-b603-e72c3f656dc1
2019-11-26 11:17:24 +00:00
marian eca4039e15 Fixed some memory leaks: values extracted from stack and not freed.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6354 acf43c95-373e-0410-b603-e72c3f656dc1
2019-06-25 13:00:25 +00:00
paulc 1624922ffc Added File methods to read and write file content from Javascript.
Fixed a memory leak in some cases of File.mkdir().


git-svn-id: http://yate.null.ro/svn/yate/trunk@6336 acf43c95-373e-0410-b603-e72c3f656dc1
2018-12-11 16:57:32 +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
marian 243909bd44 Added saveFile() and loadFile() to javascript XML.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6311 acf43c95-373e-0410-b603-e72c3f656dc1
2018-04-12 12:44:38 +00:00
marian fd04da7b91 Fixed bug: avoid infinite loop when stringifying an array with holes (index is missing). Put null for missing indexes.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6308 acf43c95-373e-0410-b603-e72c3f656dc1
2018-04-11 12:00:37 +00:00
marian 086a25e1f6 Added replaceParams() function to JSON.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6307 acf43c95-373e-0410-b603-e72c3f656dc1
2018-04-10 12:16:20 +00:00
marian 4a3740daf9 XML element replaceParams() is now available in javascript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6306 acf43c95-373e-0410-b603-e72c3f656dc1
2018-04-10 11:08:25 +00:00
marian 8b17aa8edb Engine::init() is now available in javascript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6300 acf43c95-373e-0410-b603-e72c3f656dc1
2018-03-12 14:10:45 +00:00
oana 65bc140298 Add method to clear parameter(s) to JS Message API.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6298 acf43c95-373e-0410-b603-e72c3f656dc1
2018-02-12 14:42:45 +00:00
oana e6a765dc35 Allow using JS Message object for Engine.replaceParams() implementation.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6297 acf43c95-373e-0410-b603-e72c3f656dc1
2018-02-12 12:07:25 +00:00
oana be0ce880da Add DNS.dscp() method to validate given DSCP values from Javascript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6281 acf43c95-373e-0410-b603-e72c3f656dc1
2017-11-17 15:57:31 +00:00
paulc 78c93b5462 Added support for recursively dispatching a handled message.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6275 acf43c95-373e-0410-b603-e72c3f656dc1
2017-11-01 16:37:48 +00:00
oana ffd790e56b Add count() method to Javascript implementation of HashList.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6269 acf43c95-373e-0410-b603-e72c3f656dc1
2017-09-29 14:52:33 +00:00
marian 19b8dc9fe4 Fixed bug: avoid dumping ExpFunction when JSON stringifying an object.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6267 acf43c95-373e-0410-b603-e72c3f656dc1
2017-09-19 13:56:24 +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
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 c4c9e994f0 Renamed DebugGoOn to DebugCrit so it better matches its purpose.
Swapped order of DebugCall and DebugNote so DebugCall is less visible.
Changed default debug level to DebugNote.
Modified a few inadequate uses of DebugCrit.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6250 acf43c95-373e-0410-b603-e72c3f656dc1
2017-08-01 13:08:23 +00:00
andrei 255bd0161a Added support for Semaphore in JS.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6248 acf43c95-373e-0410-b603-e72c3f656dc1
2017-08-01 06:20:58 +00:00
paulc 9e5c186299 Added support for setting "debug level N+" or "debug level N-"
git-svn-id: http://yate.null.ro/svn/yate/trunk@6226 acf43c95-373e-0410-b603-e72c3f656dc1
2017-06-05 12:33:38 +00:00
oana 9e8a1602c1 Added Message.copyParams() method to Javascript support.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6219 acf43c95-373e-0410-b603-e72c3f656dc1
2017-05-22 12:37:22 +00:00
oana 828911a1d7 Do not attempt to build an JS XML object from another object when the expected parameter should be a string.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6215 acf43c95-373e-0410-b603-e72c3f656dc1
2017-05-08 09:04:33 +00:00
oana 23b9e4a09c Build JS Message objects with properly set prototypes.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6214 acf43c95-373e-0410-b603-e72c3f656dc1
2017-05-08 09:03:05 +00:00
andrei 42d5ab7c01 Fixed deadlock while destroying JsEngineWorker.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6212 acf43c95-373e-0410-b603-e72c3f656dc1
2017-05-03 08:39:48 +00:00
andrei f44fef8bfc Added option to get the age of a message.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6211 acf43c95-373e-0410-b603-e72c3f656dc1
2017-04-27 12:30:45 +00:00
paulc d836aca12b Added JS Engine method to retrieve exiting state from a script.
Moved engine.halt handler that unloads global JS scripts to priority 120.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6210 acf43c95-373e-0410-b603-e72c3f656dc1
2017-04-27 10:31:07 +00:00
oana f180ed599d Extend JS Message constructor to copy parameters from a given object.
Fix function that was copying properties to message to not copy objects, null or undefined.



git-svn-id: http://yate.null.ro/svn/yate/trunk@6209 acf43c95-373e-0410-b603-e72c3f656dc1
2017-04-26 15:53:15 +00:00
andrei 511a5d36ca Fixed deadlock at JS script instance destruction.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6208 acf43c95-373e-0410-b603-e72c3f656dc1
2017-04-26 10:40:04 +00:00
paulc 54e9ebf2e5 Added support for using JS method msgTime(newTime) to alter creation time of a message.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6207 acf43c95-373e-0410-b603-e72c3f656dc1
2017-04-21 14:06:16 +00:00
paulc 0ce48000ee Keep the JS global object locked while cleaning up its attributes.
This fixes a race condition crash in scripts destruction.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6174 acf43c95-373e-0410-b603-e72c3f656dc1
2017-01-24 18:53:16 +00:00
paulc 887e0cd860 Fixed a JS deadlock caused by uninstalling a message handler from itself (even indirectly).
This required exposing some internal methods of MessageHandler.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6173 acf43c95-373e-0410-b603-e72c3f656dc1
2017-01-23 19:53:55 +00:00
paulc c088d3ef2e Added methods getParam and setParam to Javascript Message object.
These allow manipulating parameters whose name clashes with a method.


git-svn-id: http://yate.null.ro/svn/yate/trunk@6170 acf43c95-373e-0410-b603-e72c3f656dc1
2017-01-20 15:16:19 +00:00
paulc cfccac463c Added Engine methods for retrieving uptime from Javascript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6169 acf43c95-373e-0410-b603-e72c3f656dc1
2017-01-20 13:28:58 +00:00