Skip to content

Commit

Permalink
Merge pull request #484 from stesie/remove-deprecated-stuff
Browse files Browse the repository at this point in the history
Remove supprt for V8 extensions, uncaught exceptions & V8Js::checkString method
  • Loading branch information
stesie authored Jun 27, 2022
2 parents 712f541 + bfd2bfc commit 461230b
Show file tree
Hide file tree
Showing 17 changed files with 12 additions and 847 deletions.
38 changes: 2 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ class V8Js
* Initializes and starts V8 engine and returns new V8Js object with it's own V8 context.
* @param string $object_name
* @param array $variables
* @param array $extensions
* @param bool $report_uncaught_exceptions
* @param string $snapshot_blob
*/
public function __construct($object_name = "PHP", array $variables = [], array $extensions = [], $report_uncaught_exceptions = TRUE, $snapshot_blob = NULL)
public function __construct($object_name = "PHP", array $variables = [], $snapshot_blob = NULL)
{}

/**
Expand Down Expand Up @@ -177,30 +175,8 @@ class V8Js

/** Static methods **/

/**
* Registers persistent context independent global Javascript extension.
* NOTE! These extensions exist until PHP is shutdown and they need to be registered before V8 is initialized.
* For best performance V8 is initialized only once per process thus this call has to be done before any V8Js objects are created!
* @param string $extension_name
* @param string $code
* @param array $dependencies
* @param bool $auto_enable
* @return bool
*/
public static function registerExtension($extension_name, $code, array $dependencies, $auto_enable = FALSE)
{}

/**
* Returns extensions successfully registered with V8Js::registerExtension().
* @return array|string[]
*/
public static function getExtensions()
{}

/**
* Creates a custom V8 heap snapshot with the provided JavaScript source embedded.
* Snapshots are supported by V8 4.3.7 and higher. For older versions of V8 this
* extension doesn't provide this method.
* @param string $embed_source
* @return string|false
*/
Expand Down Expand Up @@ -353,15 +329,6 @@ This behaviour can be changed by enabling the php.ini flag `v8js.use_array_acces
Snapshots
=========

First of all snapshots are incompatible with extensions. So when you see

#
# Fatal error in ../src/snapshot/startup-serializer.cc, line 122
# Check failed: !isolate->has_installed_extensions().
#

you need to remove all extension registrations.

First of all [custom startup snapshots](https://v8project.blogspot.de/2015/09/custom-startup-snapshots.html)
is a feature provided by V8 itself, built on top of it's general heap snapshots feature. The idea is that, since
it is quite common to load some JavaScript library prior to any actual work to be done, that this library code
Expand Down Expand Up @@ -390,8 +357,7 @@ Exceptions
==========

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

PHP exceptions that occur due to calls from JavaScript code by default are
*not* re-thrown into JavaScript context but cause the JavaScript execution to
Expand Down
3 changes: 0 additions & 3 deletions php_v8js_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ ZEND_EXTERN_MODULE_GLOBALS(v8js)
*
* - whether V8 has been initialized at all
* - the V8 backend platform
* - loaded extensions
* - V8 "command line" flags
*
* In a ZTS-enabled environment access to all of these variables must happen
Expand All @@ -150,8 +149,6 @@ struct _v8js_process_globals {
std::mutex lock;
#endif

HashTable *extensions;

/* V8 command line flags */
char *v8_flags;

Expand Down
24 changes: 0 additions & 24 deletions tests/checkstring.phpt

This file was deleted.

2 changes: 1 addition & 1 deletion tests/create_snapshot_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (strlen($snap) > 0) {
var_dump("snapshot successfully created");
}

$v8 = new V8Js('PHP', array(), array(), true, $snap);
$v8 = new V8Js('PHP', array(), $snap);
$v8->executeString('var_dump(doublify(23));');
?>
===EOF===
Expand Down
90 changes: 0 additions & 90 deletions tests/exception_clearing.phpt

This file was deleted.

37 changes: 0 additions & 37 deletions tests/exception_propagation_1.phpt

This file was deleted.

112 changes: 0 additions & 112 deletions tests/exception_propagation_2.phpt

This file was deleted.

Loading

0 comments on commit 461230b

Please sign in to comment.