0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-14 03:48:41 +00:00
Commit Graph

234 Commits

Author SHA1 Message Date
Taneli Leppa
54621e18f3 Added checkString() method for checking Javascript syntax. 2014-03-19 17:00:28 +02:00
Patrick Reilly
e68d7073de Merge pull request #77 from cscott/minor-fixes
A pair of minor fixes
2013-10-30 11:45:03 -07:00
C. Scott Ananian
30497766a3 Fix test cases which hard coded the object identity of returned objects. 2013-10-29 15:38:27 -04:00
C. Scott Ananian
2fe87a4cbc Protect against direct invocation of new V8Object and new V8Function.
This fixes issue #75.
2013-10-29 15:37:04 -04:00
Stefan Siegl
18b129b128 Trigger garbage collection within Isolate::Scope
Before the idle notifications to V8 were sent without a special
Isolate entered, which results in V8 using it's default isolate
(which we don't use at all).  Hence those were pretty useless
anyways (if they were called, which was unlikely).

Besides V8 seems to not trigger the weak object callbacks if
the isolate is destroyed, hence the PHP objects we add-ref'ed
before will leak.

Therefore this removes the previous idle notification logic
and forces garbage collection from the V8Js object destructor.
2013-10-27 00:41:47 +02:00
C. Scott Ananian
f6a6d1e4b5 Rework JavaScript wrapper for PHP objects.
Use the NamedPropertyHandler feature of v8 to wrap accesses to PHP properties
and methods from JavaScript.  This enables us to support property
set/delete/query.

The `in` and `delete` operators in JavaScript work like the `isset()` and
`unset()` functions in PHP.  In particular, a PHP property with a null
value will not be `in` the JavaScript object. (This holds when enumerating
all properties of an object as well.)

Because JavaScript has a single namespace for both properties and methods,
we allow the use of the `__call` method on a PHP object (even if the
PHP class does not natively define the `__call` magic function) in order
to unambiguously invoke a method.  Similarly, you can prefix a property
name with `$` to unambiguously access the property. (When enumerating all
properties, properties are `$`-prefixed in order to ensure they are not
conflated with method names.)
2013-10-25 16:47:15 -04:00
C. Scott Ananian
0adefa5048 Add a test for issue 25 (native properties) 2013-10-25 16:47:15 -04:00
C. Scott Ananian
44c329b953 Add a test of PHP magic functions. 2013-10-25 16:47:15 -04:00
C. Scott Ananian
27a140c9fb Bug fixes for JavaScript var_dump implementation (make it match PHP). 2013-10-25 14:18:56 -04:00
C. Scott Ananian
2516e76ff8 Unwrap PHP objects when passing them back from JavaScript to PHP. 2013-10-25 14:17:40 -04:00
Stefan Siegl
bd9483080d Don't re-wrap PHP objects from V8 to V8Object 2013-10-21 20:00:58 +02:00
Stefan Siegl
683ac347c7 Test export of undeclared properties in derived classes 2013-10-19 02:36:19 +02:00
Stefan Siegl
b888cfce0d Add test on protected & private properties on derived classes 2013-10-19 02:17:10 +02:00
Stefan Siegl
1f8b605585 Add test on initially initialized properties on V8Js object. 2013-10-19 02:15:37 +02:00
Stefan Siegl
645b0df999 Add test from issue #54 2013-10-18 23:57:26 +02:00
C. Scott Ananian
f85675f169 Make JavaScript function wrappers typesafe.
Use the v8::Signature parameter to FunctionTemplate::New to guarantee that
the info->Holder() is of the proper type when `php_v8js_php_callback` is
invoked.

Add test case demonstrating the segfault (which is now prevented).
2013-10-11 23:28:21 -04:00
Stefan Siegl
4f3cbd412b Make test PHP 5.3 compatible 2013-10-07 14:55:01 +02:00
C. Scott Ananian
035e6faa8b Implement property_exists()/isset()/empty() on wrapped JavaScript objects.
Fixes issue #32.
2013-10-05 11:56:42 -04:00
Stefan Siegl
f90650d630 Create temporary HandleScope to get & call methods likewise, closes #33 2013-10-03 01:15:51 +02:00
Stefan Siegl
1f4caaeead Create temporary HandleScope while reading properties 2013-10-03 01:05:03 +02:00
Stefan Siegl
662e491e1f Pass back v8 functions, don't re-wrap 2013-10-03 00:34:50 +02:00
Stefan Siegl
bc82d13658 Add isolate to key of template cache. 2013-10-02 23:38:26 +02:00
Stefan Siegl
e57e3eed1d Add tests with multiple V8Js instances 2013-09-29 23:46:19 +02:00
Stefan Siegl
286b0d8ac0 Handle non-construct call 2013-07-12 20:23:12 +02:00
Stefan Siegl
5987d5d3da Throw exception if __construct is not public 2013-07-12 20:23:12 +02:00
Stefan Siegl
35e9fd849d Add tests. 2013-07-12 20:23:12 +02:00
Stefan Siegl
a3957f3844 Add test for regression pointed out in pull request #14 2013-07-07 23:04:19 +02:00
Andrew Tch
de2479aca6 fixed tests using absolute urls 2013-05-19 17:56:54 +03:00
Simon Best
91b1a2fbd2 Added a test for CommonJS modules. 2013-05-09 23:14:02 +01:00
Simon Best
916728fa8a Added simple tests for time limit and memory limit. 2013-04-14 12:31:35 +01:00
Simon Best
7e90439cdf Make sure all tests and samples use the new exception class name V8JsScriptException. 2013-04-14 00:36:31 +01:00
Chris Johnson
68eb4c5d8b Fixed failing tests with timezone independent equivalents 2013-03-17 20:50:48 -07:00
Patrick Reilly
8fcbf0a9e7 Fixed build in 5.4+ 2012-07-06 17:21:44 -07:00
preilly
30e1d22863 Initial import 2012-04-27 16:26:15 +00:00