FIXME: Revert 749b9c06 from the V8 repo

It is supposed to be temporary, until the Node.js upgrade.
This commit is contained in:
Aleksei Kuzmin 2017-11-14 15:57:57 +03:00
Родитель b401485c7d
Коммит 10df2daf36
1 изменённых файлов: 73 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,73 @@
6e157c8eb4633da4b66aa3488c1f00b87f560505
diff --git a/include/v8.h b/include/v8.h
index eec2256aea..cb16b21d2a 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -6348,6 +6348,8 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
* Callback to check if code generation from strings is allowed. See
* Context::AllowCodeGenerationFromStrings.
*/
+typedef bool (*DeprecatedAllowCodeGenerationFromStringsCallback)(
+ Local<Context> context);
typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> context,
Local<String> source);
@@ -7627,6 +7629,9 @@ class V8_EXPORT Isolate {
*/
void SetAllowCodeGenerationFromStringsCallback(
AllowCodeGenerationFromStringsCallback callback);
+ V8_DEPRECATED("Use callback with source parameter.",
+ void SetAllowCodeGenerationFromStringsCallback(
+ DeprecatedAllowCodeGenerationFromStringsCallback callback));
/**
* Embedder over{ride|load} injection points for wasm APIs. The expectation
@@ -7787,6 +7792,15 @@ class V8_EXPORT V8 {
"Use isolate version",
void SetFatalErrorHandler(FatalErrorCallback that));
+ /**
+ * Set the callback to invoke to check if code generation from
+ * strings should be allowed.
+ */
+ V8_INLINE static V8_DEPRECATED(
+ "Use isolate version",
+ void SetAllowCodeGenerationFromStringsCallback(
+ DeprecatedAllowCodeGenerationFromStringsCallback that));
+
/**
* Check if V8 is dead and therefore unusable. This is the case after
* fatal errors such as out-of-memory situations.
@@ -10266,6 +10280,14 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
#endif
}
+void V8::SetAllowCodeGenerationFromStringsCallback(
+ DeprecatedAllowCodeGenerationFromStringsCallback callback) {
+ Isolate* isolate = Isolate::GetCurrent();
+ isolate->SetAllowCodeGenerationFromStringsCallback(
+ reinterpret_cast<AllowCodeGenerationFromStringsCallback>(callback));
+}
+
+
bool V8::IsDead() {
Isolate* isolate = Isolate::GetCurrent();
return isolate->IsDead();
diff --git a/src/api.cc b/src/api.cc
index d676a7426c..644ac55a69 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -9023,6 +9023,13 @@ void Isolate::SetAllowCodeGenerationFromStringsCallback(
isolate->set_allow_code_gen_callback(callback);
}
+void Isolate::SetAllowCodeGenerationFromStringsCallback(
+ DeprecatedAllowCodeGenerationFromStringsCallback callback) {
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
+ isolate->set_allow_code_gen_callback(
+ reinterpret_cast<AllowCodeGenerationFromStringsCallback>(callback));
+}
+
#define CALLBACK_SETTER(ExternalName, Type, InternalName) \
void Isolate::Set##ExternalName(Type callback) { \
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); \