0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-10 04:58:41 +00:00
Commit Graph

77 Commits

Author SHA1 Message Date
Stefan Siegl
48765bcc97 Merge pull request #102 from stesie/dispose-isolate
Dispose isolate on V8Js object destruction
2014-09-16 16:02:35 +02:00
Stefan Siegl
361dd4185c Fix some memory leaks. 2014-08-11 15:09:02 +02:00
Stefan Siegl
0334ba64fa TSRM/ZTS fixes 2014-08-11 14:25:39 +02:00
Stefan Siegl
133ad4a7b5 Merge remote-tracking branch 'rosmo/dispose-isolate' 2014-08-10 22:13:47 +02:00
Stefan Siegl
3947d8690c zend_fetch_class_by_name is not available in PHP 5.3 2014-08-10 17:59:15 +02:00
Stefan Siegl
50b36d2cf5 Don't explicitly indicate constructor, let V8 figure out
The GetConstructor function was removed from v8::Object which
would require some work to find out.  But V8 can do it
internally, so just leave it to V8 :)
2014-08-10 13:58:08 +02:00
Stefan Siegl
9ead20823f GetConstructor method was removed, use GetConstructorName and instanciate on our own 2014-08-10 13:36:54 +02:00
Stefan Siegl
e25e5264f6 Make compatible with V8 3.28.23, fixes #99 2014-08-10 11:57:20 +02:00
Taneli Leppa
a8ddf9daef Also perform isolate exit on fatal error abort. 2014-07-01 10:49:29 +03:00
Stefan Siegl
1fc79f8223 Don't restore original error handler when exiting inner frame, refs #94 2014-05-23 00:35:51 +02:00
Taneli Leppa
cbda704d7e Only pass fatal errors to the V8JS error handler, others go to PHP's error handler. 2014-05-22 11:17:38 +03:00
Stefan Siegl
659c0fb601 Code folding marks and comments 2014-04-13 22:59:35 +02:00
Stefan Siegl
6f31840daf Handle fatal errors even if executeString is used recursively 2014-04-13 22:52:38 +02:00
Stefan Siegl
35d8b815f8 Store error message and re-throw with original type & message 2014-04-13 21:46:31 +02:00
Stefan Siegl
dfd8a1f386 Use V8JSG instead of global variable. 2014-04-12 09:22:58 +02:00
Stefan Siegl
a49fa8ce02 Unwind V8 execution context on fatal error, refs #87
This is yet a first hack to prove applicability.  Currently
unwind environment is held in a global variable, i.e. solution
is neither thread safe nor reentrant yet.
2014-04-12 00:02:43 +02:00
Stefan Siegl
48feb0bf35 Don't unset non-public properties, just hide them.
Before non-public properties were not reset also, trying to
unset them just caused a fatal php error, effectively crashing
the whole script.
2014-04-11 20:42:55 +02:00
Stefan Siegl
c866e67313 Call INIT_ZVAL on stack-allocated zval 2014-04-11 20:15:51 +02:00
Stefan Siegl
b188f9882f Initialize fci.no_separation correctly 2014-04-11 20:13:08 +02:00
Stefan Siegl
8f200b3905 Call __set if JS accesses private/protected property 2014-04-07 00:53:46 +02:00
Stefan Siegl
53cac1c524 Don't allow JS to overwrite protected/private properties 2014-04-06 23:53:08 +02:00
Stefan Siegl
170b1ff94c Handle property visibility and __get, refs #79
Protected and private properties should not be available
to JS context.  Instead call __get function, if the
property is not accessible.
2014-04-06 20:04:48 +02:00
Stefan Siegl
ddbef50ea6 Merge remote-tracking branch 'rosmo/master' 2014-03-22 18:44:13 +01:00
Stefan Siegl
bc86ce9e44 Clear persistent cells with weak references correctly, refs #88 2014-03-22 17:41:00 +01:00
Stefan Siegl
4c64bc4ad9 Make compatible with V8 3.24.10, fixes #83 2014-03-22 00:07:53 +01:00
Taneli Leppa
3b6390b7f8 Fix passing of null bytes from V8 to PHP (github issue #80). 2014-03-21 10:59:18 +02:00
Taneli Leppa
da53c90f88 Added new "v8js.use_date" ini setting to convert PHP DateTime objects to Javascript Date objects
when set as V8JS object properties.
2014-03-20 16:06:18 +02:00
Taneli Leppa
9ddac3f124 Passing integers that didn't fit in 32-bit integers from PHP to Javascript
did not work properly, now uses float to pass larger numbers.
2014-03-20 12:00:45 +02:00
Stefan Siegl
8858bf5f27 Make compatible with V8 3.23.2 (and below) 2013-12-21 20:54:55 +01:00
Stefan Siegl
1e773dd4a8 Make compatible with V8 3.23.8 (and below) 2013-12-21 20:54:55 +01:00
Stefan Siegl
e20e5098c7 Make compatible with V8 3.23.11 (and below) 2013-12-21 19:56:28 +01:00
Stefan Siegl
69290b5779 Fix build against libv8 3.24.5 2013-12-21 01:18:08 +01:00
C. Scott Ananian
7c5817c931 Remove unnecessary TSRMLS_FETCH from php_v8js_weak_object_callback. 2013-10-29 15:38:18 -04:00
Patrick Reilly
6eeafc0f83 Merge pull request #74 from cscott/dtor-simple
Simplify php_v8js_weak_object_callback.
2013-10-27 10:32:14 -07:00
C. Scott Ananian
892c654c8c Simplify php_v8js_weak_object_callback.
This also fixes a leak in the `object_dom` testcase, where the DOM extension
returns an object with refcnt 1 but object_store refcnt 2, causing
READY_TO_DESTROY to return false.  Don't try to be fancy, just use the
standard PHP destructor.
2013-10-27 12:39:02 -04:00
C. Scott Ananian
1976e35b9a Fix leak in v8 named property setter; clean up v8 named property getter.
zend_update_property does not own the value after the call; we need to
do the deref ourself.  Tweaks to the getter based on a better understanding
of the zend_read_property API.
2013-10-27 12:36:54 -04:00
C. Scott Ananian
879d1d54a2 Fix memory leak in zend_read_property; also pass correct scope object. 2013-10-27 02:49:24 -04:00
C. Scott Ananian
1c3a919ae8 Don't leak if PHP constructor is called from JavaScript.
Register the weak reference callback to deref and do memory limit
accounting for wrapped PHP objects created from within JavaScript.
2013-10-27 02:49:23 -04:00
C. Scott Ananian
39cc821f91 Store tsrm_ls in php_v8js_ctx.
This avoids the need to ever do a (slow) TSRMLS_FETCH().
2013-10-26 02:07:12 -04:00
C. Scott Ananian
011e517cfe Fix ZTS errors in v8js_convert.cc. 2013-10-26 02:07:00 -04:00
C. Scott Ananian
303f3f52b5 Refactor template cache into php_v8js_ctx.
Reduce map lookups by adding internal object field pointing to function
template.  Use hidden field to allow easy unwrapping of PHP objects.
2013-10-25 17:40:51 -04:00
C. Scott Ananian
c341511b36 PHP 5.3 compatibility fixes. 2013-10-25 17:40:51 -04: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
52d8946b89 Add isolate parameter to V8JS_* macros.
This avoids unnecessary calls to Isolate::GetCurrent() in the implementation.
By standardizing on the V8JS_SYM and V8JS_STR macros we also standardize on
UTF-8 encoding for v8 strings.
2013-10-25 16:46:07 -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
61eee4cbd6 TSRM/ZTS fixes. 2013-10-19 23:04:35 +00:00
Stefan Siegl
3f049d3b91 Unlock isolate on JS->PHP transition. 2013-10-13 11:36:57 +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
988691d2dc Fix CopyablePersistentTraits for v8 3.21.15 .. 3.21.18.x 2013-10-04 00:05:11 +02:00