src, test: fixup after v8 update
Because of behavior change of some V8 APIs (they mostly became more strict), following modules needed to be fixed: * crypto: duplicate prototype methods are not allowed anymore * contextify: some TryCatch trickery, the binding was using it incorrectly * util: maximum call stack error is now crashing in a different place Reviewed-By: Trevor Norris <trevnorris@gmail.com> PR-URL: https://github.com/joyent/node/pull/8476
This commit is contained in:
parent
3821863109
commit
383b0c0afb
@ -26,10 +26,10 @@
|
|||||||
}],
|
}],
|
||||||
['GENERATOR == "ninja" or OS== "mac"', {
|
['GENERATOR == "ninja" or OS== "mac"', {
|
||||||
'OBJ_DIR': '<(PRODUCT_DIR)/obj',
|
'OBJ_DIR': '<(PRODUCT_DIR)/obj',
|
||||||
'V8_BASE': '<(PRODUCT_DIR)/libv8_base.<(target_arch).a',
|
'V8_BASE': '<(PRODUCT_DIR)/libv8_base.a',
|
||||||
}, {
|
}, {
|
||||||
'OBJ_DIR': '<(PRODUCT_DIR)/obj.target',
|
'OBJ_DIR': '<(PRODUCT_DIR)/obj.target',
|
||||||
'V8_BASE': '<(PRODUCT_DIR)/obj.target/deps/v8/tools/gyp/libv8_base.<(target_arch).a',
|
'V8_BASE': '<(PRODUCT_DIR)/obj.target/deps/v8/tools/gyp/libv8_base.a',
|
||||||
}],
|
}],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -2603,7 +2603,7 @@ void StopProfilerIdleNotifier(const FunctionCallbackInfo<Value>& args) {
|
|||||||
|
|
||||||
#define READONLY_PROPERTY(obj, str, var) \
|
#define READONLY_PROPERTY(obj, str, var) \
|
||||||
do { \
|
do { \
|
||||||
obj->Set(OneByteString(env->isolate(), str), var, v8::ReadOnly); \
|
obj->ForceSet(OneByteString(env->isolate(), str), var, v8::ReadOnly); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
@ -3483,7 +3483,8 @@ void Init(int* argc,
|
|||||||
|
|
||||||
// Fetch a reference to the main isolate, so we have a reference to it
|
// Fetch a reference to the main isolate, so we have a reference to it
|
||||||
// even when we need it to access it from another (debugger) thread.
|
// even when we need it to access it from another (debugger) thread.
|
||||||
node_isolate = Isolate::GetCurrent();
|
node_isolate = Isolate::New();
|
||||||
|
Isolate::Scope isolate_scope(node_isolate);
|
||||||
|
|
||||||
#ifdef __POSIX__
|
#ifdef __POSIX__
|
||||||
// Raise the open file descriptor limit.
|
// Raise the open file descriptor limit.
|
||||||
|
@ -219,7 +219,7 @@ NODE_EXTERN void RunAtExit(Environment* env);
|
|||||||
v8::Number::New(isolate, static_cast<double>(constant)); \
|
v8::Number::New(isolate, static_cast<double>(constant)); \
|
||||||
v8::PropertyAttribute constant_attributes = \
|
v8::PropertyAttribute constant_attributes = \
|
||||||
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); \
|
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); \
|
||||||
(target)->Set(constant_name, constant_value, constant_attributes); \
|
(target)->ForceSet(constant_name, constant_value, constant_attributes); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
@ -624,7 +624,7 @@ void SetupBufferJS(const FunctionCallbackInfo<Value>& args) {
|
|||||||
NODE_SET_METHOD(proto, "copy", Copy);
|
NODE_SET_METHOD(proto, "copy", Copy);
|
||||||
|
|
||||||
// for backwards compatibility
|
// for backwards compatibility
|
||||||
proto->Set(env->offset_string(),
|
proto->ForceSet(env->offset_string(),
|
||||||
Uint32::New(env->isolate(), 0),
|
Uint32::New(env->isolate(), 0),
|
||||||
v8::ReadOnly);
|
v8::ReadOnly);
|
||||||
|
|
||||||
|
@ -537,19 +537,25 @@ class ContextifyScript : public BaseObject {
|
|||||||
Environment* env = Environment::GetCurrent(args.GetIsolate());
|
Environment* env = Environment::GetCurrent(args.GetIsolate());
|
||||||
HandleScope scope(env->isolate());
|
HandleScope scope(env->isolate());
|
||||||
|
|
||||||
|
int64_t timeout;
|
||||||
|
bool display_errors;
|
||||||
|
|
||||||
// Assemble arguments
|
// Assemble arguments
|
||||||
TryCatch try_catch;
|
|
||||||
if (!args[0]->IsObject()) {
|
if (!args[0]->IsObject()) {
|
||||||
return env->ThrowTypeError(
|
return env->ThrowTypeError(
|
||||||
"contextifiedSandbox argument must be an object.");
|
"contextifiedSandbox argument must be an object.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Local<Object> sandbox = args[0].As<Object>();
|
Local<Object> sandbox = args[0].As<Object>();
|
||||||
int64_t timeout = GetTimeoutArg(args, 1);
|
{
|
||||||
bool display_errors = GetDisplayErrorsArg(args, 1);
|
TryCatch try_catch;
|
||||||
|
timeout = GetTimeoutArg(args, 1);
|
||||||
|
display_errors = GetDisplayErrorsArg(args, 1);
|
||||||
if (try_catch.HasCaught()) {
|
if (try_catch.HasCaught()) {
|
||||||
try_catch.ReThrow();
|
try_catch.ReThrow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get the context from the sandbox
|
// Get the context from the sandbox
|
||||||
ContextifyContext* contextify_context =
|
ContextifyContext* contextify_context =
|
||||||
@ -563,6 +569,8 @@ class ContextifyScript : public BaseObject {
|
|||||||
if (contextify_context->context().IsEmpty())
|
if (contextify_context->context().IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
{
|
||||||
|
TryCatch try_catch;
|
||||||
// Do the eval within the context
|
// Do the eval within the context
|
||||||
Context::Scope context_scope(contextify_context->context());
|
Context::Scope context_scope(contextify_context->context());
|
||||||
if (EvalMachine(contextify_context->env(),
|
if (EvalMachine(contextify_context->env(),
|
||||||
@ -572,6 +580,12 @@ class ContextifyScript : public BaseObject {
|
|||||||
try_catch)) {
|
try_catch)) {
|
||||||
contextify_context->CopyProperties();
|
contextify_context->CopyProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (try_catch.HasCaught()) {
|
||||||
|
try_catch.ReThrow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t GetTimeoutArg(const FunctionCallbackInfo<Value>& args,
|
static int64_t GetTimeoutArg(const FunctionCallbackInfo<Value>& args,
|
||||||
|
@ -1022,9 +1022,12 @@ void SSLWrap<Base>::AddMethods(Environment* env, Handle<FunctionTemplate> t) {
|
|||||||
|
|
||||||
#ifdef OPENSSL_NPN_NEGOTIATED
|
#ifdef OPENSSL_NPN_NEGOTIATED
|
||||||
NODE_SET_PROTOTYPE_METHOD(t, "getNegotiatedProtocol", GetNegotiatedProto);
|
NODE_SET_PROTOTYPE_METHOD(t, "getNegotiatedProtocol", GetNegotiatedProto);
|
||||||
NODE_SET_PROTOTYPE_METHOD(t, "setNPNProtocols", SetNPNProtocols);
|
|
||||||
#endif // OPENSSL_NPN_NEGOTIATED
|
#endif // OPENSSL_NPN_NEGOTIATED
|
||||||
|
|
||||||
|
#ifdef OPENSSL_NPN_NEGOTIATED
|
||||||
|
NODE_SET_PROTOTYPE_METHOD(t, "setNPNProtocols", SetNPNProtocols);
|
||||||
|
#endif
|
||||||
|
|
||||||
NODE_SET_EXTERNAL(
|
NODE_SET_EXTERNAL(
|
||||||
t->PrototypeTemplate(),
|
t->PrototypeTemplate(),
|
||||||
"_external",
|
"_external",
|
||||||
@ -2057,15 +2060,6 @@ void Connection::Initialize(Environment* env, Handle<Object> target) {
|
|||||||
|
|
||||||
SSLWrap<Connection>::AddMethods(env, t);
|
SSLWrap<Connection>::AddMethods(env, t);
|
||||||
|
|
||||||
#ifdef OPENSSL_NPN_NEGOTIATED
|
|
||||||
NODE_SET_PROTOTYPE_METHOD(t,
|
|
||||||
"getNegotiatedProtocol",
|
|
||||||
Connection::GetNegotiatedProto);
|
|
||||||
NODE_SET_PROTOTYPE_METHOD(t,
|
|
||||||
"setNPNProtocols",
|
|
||||||
Connection::SetNPNProtocols);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
|
#ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
|
||||||
NODE_SET_PROTOTYPE_METHOD(t, "getServername", Connection::GetServername);
|
NODE_SET_PROTOTYPE_METHOD(t, "getServername", Connection::GetServername);
|
||||||
|
@ -31,6 +31,8 @@ Utf8Value::Utf8Value(v8::Handle<v8::Value> value)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
v8::Local<v8::String> val_ = value->ToString();
|
v8::Local<v8::String> val_ = value->ToString();
|
||||||
|
if (val_.IsEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
// Allocate enough space to include the null terminator
|
// Allocate enough space to include the null terminator
|
||||||
size_t len = StringBytes::StorageSize(val_, UTF8) + 1;
|
size_t len = StringBytes::StorageSize(val_, UTF8) + 1;
|
||||||
|
@ -30,7 +30,7 @@ if (process.platform === 'win32') {
|
|||||||
var exec = require('child_process').exec;
|
var exec = require('child_process').exec;
|
||||||
|
|
||||||
var cmdline = 'ulimit -c 0; ' + process.execPath;
|
var cmdline = 'ulimit -c 0; ' + process.execPath;
|
||||||
cmdline += ' --max-old-space-size=4 --max-new-space-size=1';
|
cmdline += ' --max-old-space-size=4 --max-semi-space-size=1';
|
||||||
cmdline += ' -e "a = []; for (i = 0; i < 1e9; i++) { a.push({}) }"';
|
cmdline += ' -e "a = []; for (i = 0; i < 1e9; i++) { a.push({}) }"';
|
||||||
|
|
||||||
exec(cmdline, function(err, stdout, stderr) {
|
exec(cmdline, function(err, stdout, stderr) {
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// Flags: --harmony_symbols
|
|
||||||
|
|
||||||
var common = require('../common');
|
var common = require('../common');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var vm = require('vm');
|
var vm = require('vm');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user