Skip to content

Commit 461230b

Browse files
authored
Merge pull request #484 from stesie/remove-deprecated-stuff
Remove supprt for V8 extensions, uncaught exceptions & V8Js::checkString method
2 parents 712f541 + bfd2bfc commit 461230b

17 files changed

+12
-847
lines changed

README.md

+2-36
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,9 @@ class V8Js
7878
* Initializes and starts V8 engine and returns new V8Js object with it's own V8 context.
7979
* @param string $object_name
8080
* @param array $variables
81-
* @param array $extensions
82-
* @param bool $report_uncaught_exceptions
8381
* @param string $snapshot_blob
8482
*/
85-
public function __construct($object_name = "PHP", array $variables = [], array $extensions = [], $report_uncaught_exceptions = TRUE, $snapshot_blob = NULL)
83+
public function __construct($object_name = "PHP", array $variables = [], $snapshot_blob = NULL)
8684
{}
8785

8886
/**
@@ -177,30 +175,8 @@ class V8Js
177175

178176
/** Static methods **/
179177

180-
/**
181-
* Registers persistent context independent global Javascript extension.
182-
* NOTE! These extensions exist until PHP is shutdown and they need to be registered before V8 is initialized.
183-
* For best performance V8 is initialized only once per process thus this call has to be done before any V8Js objects are created!
184-
* @param string $extension_name
185-
* @param string $code
186-
* @param array $dependencies
187-
* @param bool $auto_enable
188-
* @return bool
189-
*/
190-
public static function registerExtension($extension_name, $code, array $dependencies, $auto_enable = FALSE)
191-
{}
192-
193-
/**
194-
* Returns extensions successfully registered with V8Js::registerExtension().
195-
* @return array|string[]
196-
*/
197-
public static function getExtensions()
198-
{}
199-
200178
/**
201179
* Creates a custom V8 heap snapshot with the provided JavaScript source embedded.
202-
* Snapshots are supported by V8 4.3.7 and higher. For older versions of V8 this
203-
* extension doesn't provide this method.
204180
* @param string $embed_source
205181
* @return string|false
206182
*/
@@ -353,15 +329,6 @@ This behaviour can be changed by enabling the php.ini flag `v8js.use_array_acces
353329
Snapshots
354330
=========
355331

356-
First of all snapshots are incompatible with extensions. So when you see
357-
358-
#
359-
# Fatal error in ../src/snapshot/startup-serializer.cc, line 122
360-
# Check failed: !isolate->has_installed_extensions().
361-
#
362-
363-
you need to remove all extension registrations.
364-
365332
First of all [custom startup snapshots](https://v8project.blogspot.de/2015/09/custom-startup-snapshots.html)
366333
is a feature provided by V8 itself, built on top of it's general heap snapshots feature. The idea is that, since
367334
it is quite common to load some JavaScript library prior to any actual work to be done, that this library code
@@ -390,8 +357,7 @@ Exceptions
390357
==========
391358

392359
If the JavaScript code throws (without catching), causes errors or doesn't
393-
compile, `V8JsScriptException` exceptions are thrown unless the `V8Js` object
394-
is constructed with `report_uncaught_exceptions` set `FALSE`.
360+
compile, `V8JsScriptException` exceptions are thrown.
395361

396362
PHP exceptions that occur due to calls from JavaScript code by default are
397363
*not* re-thrown into JavaScript context but cause the JavaScript execution to

php_v8js_macros.h

-3
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ ZEND_EXTERN_MODULE_GLOBALS(v8js)
138138
*
139139
* - whether V8 has been initialized at all
140140
* - the V8 backend platform
141-
* - loaded extensions
142141
* - V8 "command line" flags
143142
*
144143
* In a ZTS-enabled environment access to all of these variables must happen
@@ -150,8 +149,6 @@ struct _v8js_process_globals {
150149
std::mutex lock;
151150
#endif
152151

153-
HashTable *extensions;
154-
155152
/* V8 command line flags */
156153
char *v8_flags;
157154

tests/checkstring.phpt

-24
This file was deleted.

tests/create_snapshot_basic.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if (strlen($snap) > 0) {
2222
var_dump("snapshot successfully created");
2323
}
2424

25-
$v8 = new V8Js('PHP', array(), array(), true, $snap);
25+
$v8 = new V8Js('PHP', array(), $snap);
2626
$v8->executeString('var_dump(doublify(23));');
2727
?>
2828
===EOF===

tests/exception_clearing.phpt

-90
This file was deleted.

tests/exception_propagation_1.phpt

-37
This file was deleted.

tests/exception_propagation_2.phpt

-112
This file was deleted.

0 commit comments

Comments
 (0)