Commit Graph

164 Commits

Author SHA1 Message Date
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
paulc 79f5b70ca5 Added static Engine.replaceParams() that replaces object properties in a ${template} string.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6030 acf43c95-373e-0410-b603-e72c3f656dc1
2015-09-04 20:04:02 +00:00
paulc 3a638df554 Fixed the JS Array unshift() to not crash when called with no arguments.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6025 acf43c95-373e-0410-b603-e72c3f656dc1
2015-08-31 08:06:14 +00:00
paulc 307a7c09ef Added support for JS getIntValue() min/max/clamp parameters.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6023 acf43c95-373e-0410-b603-e72c3f656dc1
2015-08-27 10:56:06 +00:00
paulc 5b980e2793 Added prototypes to parsed JSON objects and arrays.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6020 acf43c95-373e-0410-b603-e72c3f656dc1
2015-08-21 13:07:19 +00:00
paulc 9bc5a3d84a Made the maximum script file size configurable at runtime and increased default to 500000.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5976 acf43c95-373e-0410-b603-e72c3f656dc1
2015-06-01 13:34:50 +00:00
paulc 91963d7659 Allow the return {inline:object}; syntax.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5975 acf43c95-373e-0410-b603-e72c3f656dc1
2015-05-19 12:29:16 +00:00
paulc d8462545d7 Resolve to undefined members of inline objects or arrays that have an undefined right hand variable.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5974 acf43c95-373e-0410-b603-e72c3f656dc1
2015-05-19 11:56:31 +00:00
paulc b7281eaade Reduce parsing time for very large scripts by limiting the simplification backtrace depth.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5972 acf43c95-373e-0410-b603-e72c3f656dc1
2015-05-15 15:17:54 +00:00
paulc d7e12fc50c Implemented JS Function apply() and call() methods.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5937 acf43c95-373e-0410-b603-e72c3f656dc1
2015-02-10 12:02:20 +00:00
paulc 77556d15c3 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://yate.null.ro/svn/yate/trunk@5898 acf43c95-373e-0410-b603-e72c3f656dc1
2014-08-05 08:27:07 +00:00
paulc 2a07a7217a Cast away type in some switch instructions to avoid compiler warnings.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5887 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-29 11:11:05 +00:00
paulc 05ebe9d1f9 Added JsObject constructor that populates prototype from a context.
Added JsRegExp contructor from existing Regexp.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5873 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-22 11:02:44 +00:00
oana 4da094e87e Fixed equal comparison for objects.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5871 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-21 12:29:38 +00:00
paulc a598cee5fc Added Javascript Array.isArray()
git-svn-id: http://yate.null.ro/svn/yate/trunk@5870 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-18 11:07:19 +00:00
paulc 9b6259ac82 Added native JSON parser and stringifier.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5869 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-14 08:06:41 +00:00
paulc 9599d6dbb7 When evaluating naked JsObject fields wrap them in an ExpWrapper.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5867 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-11 16:24:15 +00:00
paulc cb382e02a2 Fixed assignment operation changed in Rev. 5856.
Report the ExpOperation types in Engine.print_r().


git-svn-id: http://yate.null.ro/svn/yate/trunk@5857 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-25 16:04:00 +00:00
oana 3047c9b55b 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://yate.null.ro/svn/yate/trunk@5856 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-25 14:09:32 +00:00
oana 7a41ecce69 Do proper number conversion for arithmetic operations.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5854 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-24 13:36:53 +00:00
oana 1ea753395a Bug fix: do proper resolving for null object in object and array initializers.
Do not copy the singleton null object, provide a clone instead.
While doing object parameter resolving, do not alter prototypes for frozen objects.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5849 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-20 11:27:12 +00:00
paulc 7c72c1ba6a Ignore final commas in Array and Object initializers.
Handle successive commas in Array initializers by inserting undefined.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5840 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-11 10:39:34 +00:00
oana 01d170e8c4 Replaced commentary with a shorter version.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5838 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-06 15:02:56 +00:00
oana 82edff8d9e Bug fix: avoid returning arbitrary values for functions that have no return value. Return undefined instead.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5837 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-06 11:57:05 +00:00
oana e1285e0a68 Leave Javascript array data untouched if sorting fails. Slightly optimized the native sort procedure for Javascript array.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5835 acf43c95-373e-0410-b603-e72c3f656dc1
2014-05-19 15:01:29 +00:00
oana eadca3e467 Bug fix: check that we extract a valid pointer from the stack when running the compare function for Array.sort().
This avoids segmentation faults caused by a callback compare function for Array.sort() which doesn't return anything. Instead, signal a runtime error.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5833 acf43c95-373e-0410-b603-e72c3f656dc1
2014-05-16 10:40:56 +00:00
marian d5b3ce3fb7 Added parser method used to obtain a 'null' object reference.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5830 acf43c95-373e-0410-b603-e72c3f656dc1
2014-05-14 09:05:33 +00:00
oana 06536919fe Added support for Javascript RegExp constructor from string.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5825 acf43c95-373e-0410-b603-e72c3f656dc1
2014-04-18 13:37:49 +00:00
oana 0b7aacf102 Added discrimination between boolean and integer values.
Return proper results for typeof and toString() calls for boolean values.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5819 acf43c95-373e-0410-b603-e72c3f656dc1
2014-04-09 13:52:54 +00:00
paulc 410dd9a8c6 Fixed the type of the result of Array.indexOf(), must be number.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5812 acf43c95-373e-0410-b603-e72c3f656dc1
2014-04-01 13:25:17 +00:00
oana 63a85d3bf2 Fixed implementation of Array.splice() and Array.slice() functions.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5800 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-14 16:08:31 +00:00
paulc 0e603be619 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://yate.null.ro/svn/yate/trunk@5799 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-14 14:45:41 +00:00