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
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
27a140c9fb
Bug fixes for JavaScript var_dump implementation (make it match PHP).
2013-10-25 14:18:56 -04:00
C. Scott Ananian
c725a80674
Handle NULL in global.var_dump().
2013-10-25 14:18:56 -04:00
C. Scott Ananian
0e1c6ef5e9
Clean up allocation/deallocation of php_v8js_ctx.
...
Use the constructor and destructor functions (don't just cross our fingers
and hope that zeroing out memory will work).
2013-10-25 14:18:50 -04:00
C. Scott Ananian
49632054a4
Cleanup: remove some warnings when compiled with -Wunused
2013-10-25 14:17:40 -04:00
C. Scott Ananian
abadda147c
Don't rethrow outer exception if report_uncaught is false.
...
This would cause the exception to stick around and the next time JavaScript
is executed, this exception would be (anomalously) thrown.
2013-10-25 14:17:40 -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
Patrick Reilly
6de3e901fa
Merge pull request #60 from stesie/fix-v8object-rewrap
...
Don't re-wrap PHP objects from V8 to V8Object
2013-10-22 10:51:56 -07:00
Stefan Siegl
bd9483080d
Don't re-wrap PHP objects from V8 to V8Object
2013-10-21 20:00:58 +02:00
Patrick Reilly
0051c77700
Merge pull request #58 from stesie/fix-tsrm
...
TSRM/ZTS fixes.
2013-10-21 03:21:41 -07:00
Stefan Siegl
61eee4cbd6
TSRM/ZTS fixes.
2013-10-19 23:04:35 +00:00
Patrick Reilly
f31c44e524
Merge pull request #57 from stesie/call-object_properties_init
...
More fixes on handling of derived V8Js objects and property export
2013-10-18 23:37:43 -07:00
Stefan Siegl
8eb5721c35
Copy default_properties to new object (PHP 5.3)
2013-10-19 02:52:19 +02:00
Stefan Siegl
683ac347c7
Test export of undeclared properties in derived classes
2013-10-19 02:36:19 +02:00
Stefan Siegl
c77cdf4b6f
Export initially initialized public properties to V8
...
Before a property was exported to V8 if it was assigned a value
during normal code execution. However if the value was assigned
(hard coded) on class level it wasn't exported.
2013-10-19 02:36:19 +02:00
Stefan Siegl
257233be51
Make php_v8js_write_property export only public properties
...
Before a property would have been exported, even if a derived
class declared it either private or protected.
2013-10-19 02:22:13 +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
Patrick Reilly
40d9e3e4f2
Merge pull request #55 from stesie/call-object_properties_init
...
Call object_properties_init on newly created V8Js object.
2013-10-18 04:44:10 -07:00
Stefan Siegl
d6a4a3c960
Call object_properties_init on newly created V8Js object.
2013-10-17 23:32:16 +02:00
Anatol Belski
c0290d4a17
fix version macros name
2013-10-15 17:42:02 +02:00
Patrick Reilly
17381525f1
Merge pull request #53 from stesie/v8-debug
...
Add V8 debugging support
2013-10-13 12:28:58 -07:00
Stefan Siegl
3f049d3b91
Unlock isolate on JS->PHP transition.
2013-10-13 11:36:57 +02:00
Stefan Siegl
d69f2be50a
Add v8 debug support
2013-10-13 11:36:57 +02:00
Patrick Reilly
ab35dcc96b
Merge pull request #52 from cscott/travis
...
Support g++-4.6 and travis CI server.
2013-10-13 00:26:31 -07:00
Patrick Reilly
b021bbefab
Merge pull request #51 from cscott/typesafe-func
...
Make JavaScript function wrappers typesafe.
2013-10-13 00:26:08 -07:00
C. Scott Ananian
d75fc4a142
Hookup Travis continous integration test server.
2013-10-12 01:19:14 -04:00
C. Scott Ananian
d416d9b59b
Support g++-4.6 in configuration script.
...
gcc 4.6 doesn't have the -std=c++11 option, it uses the not-yet-finalized
-std=c++0x option. Use whichever is found to be appropriate at configure
time.
2013-10-12 01:19:14 -04: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
Patrick Reilly
0319b74250
Merge pull request #50 from stesie/fix-test-for-php53
...
Make test PHP 5.3 compatible
2013-10-07 09:05:42 -07:00
Stefan Siegl
4f3cbd412b
Make test PHP 5.3 compatible
2013-10-07 14:55:01 +02:00
Patrick Reilly
8862498a10
Merge pull request #48 from cscott/has_prop
...
Implement property_exists()/isset()/empty() on wrapped JavaScript object
2013-10-05 12:10:17 -07:00
Patrick Reilly
0855065e5a
Merge pull request #49 from stesie/ci-badge
...
Build status badge for README
2013-10-05 12:08:29 -07:00
Stefan Siegl
6ab41f21a1
Add CI badge and link to Jenkins job list
2013-10-05 20:11:35 +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
Patrick Reilly
ba3fe2e27a
Merge pull request #46 from cscott/more-build-tweaks
...
Ensure all v8 libraries are copied in README; sanity check in config.m4.
2013-10-03 15:09:15 -07:00
Patrick Reilly
09f5fd2ede
Merge pull request #47 from stesie/fix-copy-trait-inline
...
Fix CopyablePersistentTraits for v8 3.21.15 .. 3.21.18.x
2013-10-03 15:08:42 -07:00
Stefan Siegl
988691d2dc
Fix CopyablePersistentTraits for v8 3.21.15 .. 3.21.18.x
2013-10-04 00:05:11 +02:00
C. Scott Ananian
91393faca3
Ensure all v8 libraries are copied in README; sanity check in config.m4.
...
The latest versions of v8 build libicu as well. If this isn't copied to
the lib directory, then the v8 version check fails (with a link error).
Ensure that this is caught at configuration time.
2013-10-03 17:59:27 -04:00
Patrick Reilly
19f30f5b1c
Merge pull request #44 from cscott/g++-update
...
Add a bit of documentation about g++ 4.8.
2013-10-03 14:11:30 -07:00
C. Scott Ananian
8904288b33
Add a bit of documentation about g++ 4.8.
2013-10-03 17:08:37 -04:00
Patrick Reilly
d0f5fafbd9
Merge pull request #43 from stesie/wip-ftbfs-v8-3.22
...
Adopt V8 API changes (up to 3.22.6)
2013-10-03 10:58:58 -07:00
Stefan Siegl
12e5e01920
Remove Locker from timer thread
2013-10-03 16:57:18 +02:00
Stefan Siegl
386465570d
Use v8's CopyablePersistentTraits for v8 >= 3.22.0
2013-10-03 16:27:41 +02:00
Stefan Siegl
619231913c
Adapt to new v8::Persistent API, support V8 >= 3.21.12
2013-10-03 16:27:04 +02:00
Patrick Reilly
1c4d9817dc
Merge pull request #39 from stesie/fix-property-read
...
Create temporary HandleScopes when reading properties
2013-10-02 16:32:27 -07:00