Skip to content

Commit fa4babb

Browse files
committed
Remove support for V8 extensions
1 parent 2b3e904 commit fa4babb

12 files changed

+11
-440
lines changed

README.md

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,10 @@ 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
8281
* @param bool $report_uncaught_exceptions
8382
* @param string $snapshot_blob
8483
*/
85-
public function __construct($object_name = "PHP", array $variables = [], array $extensions = [], $report_uncaught_exceptions = TRUE, $snapshot_blob = NULL)
84+
public function __construct($object_name = "PHP", array $variables = [], $report_uncaught_exceptions = TRUE, $snapshot_blob = NULL)
8685
{}
8786

8887
/**
@@ -177,30 +176,8 @@ class V8Js
177176

178177
/** Static methods **/
179178

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-
200179
/**
201180
* 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.
204181
* @param string $embed_source
205182
* @return string|false
206183
*/
@@ -353,15 +330,6 @@ This behaviour can be changed by enabling the php.ini flag `v8js.use_array_acces
353330
Snapshots
354331
=========
355332

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-
365333
First of all [custom startup snapshots](https://v8project.blogspot.de/2015/09/custom-startup-snapshots.html)
366334
is a feature provided by V8 itself, built on top of it's general heap snapshots feature. The idea is that, since
367335
it is quite common to load some JavaScript library prior to any actual work to be done, that this library code

php_v8js_macros.h

Lines changed: 0 additions & 3 deletions
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/create_snapshot_basic.phpt

Lines changed: 1 addition & 1 deletion
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(), true, $snap);
2626
$v8->executeString('var_dump(doublify(23));');
2727
?>
2828
===EOF===

tests/exception_clearing.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Test V8::executeString() : Exception clearing test
55
--FILE--
66
<?php
77

8-
$v8 = new V8Js(null, array(), array(), false);
8+
$v8 = new V8Js(null, array(), false);
99

1010
var_dump($v8->getPendingException());
1111

tests/exception_propagation_2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Foo {
1010

1111
public function __construct()
1212
{
13-
$this->v8 = new V8Js(null, array(), array(), false);
13+
$this->v8 = new V8Js(null, array(), false);
1414
$this->v8->foo = $this;
1515
$this->v8->executeString('fooobar', 'throw_0');
1616
var_dump($this->v8->getPendingException());

tests/exception_propagation_3.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Foo {
1010

1111
public function __construct()
1212
{
13-
$this->v8 = new V8Js(null, array(), array(), false);
13+
$this->v8 = new V8Js(null, array(), false);
1414
$this->v8->foo = $this;
1515
$this->v8->executeString('function foobar() { throw new SyntaxError(); }', 'throw_1');
1616
$this->v8->executeString('try { foobar(); } catch (e) { print(e + " caught in JS!\n"); }', 'trycatch1');

tests/extensions_basic.phpt

Lines changed: 0 additions & 42 deletions
This file was deleted.

tests/extensions_circular_dependency.phpt

Lines changed: 0 additions & 52 deletions
This file was deleted.

tests/extensions_error.phpt

Lines changed: 0 additions & 44 deletions
This file was deleted.

tests/unicode.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $unicode = 'äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█
1212
$snapshot = V8Js::createSnapshot("var snapshot = {unicode: '" . $unicode . "'}");
1313

1414
# start V8Js
15-
$jscript = new V8Js('php', array(), array(), true, $snapshot);
15+
$jscript = new V8Js('php', array(), true, $snapshot);
1616

1717
# insert unicode via php var
1818
$jscript->unicode = $unicode;

0 commit comments

Comments
 (0)