Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

src: pass Isolate to all applicable api

Update the api to pass node_isolate to all supported methods.

Much thanks to Ben Noordhuis and his work in 51f6e6a.
  • Loading branch information...
commit f65e14ed1daa20a6d2aae08556b2a059f5d90599 1 parent da4d79a
@trevnorris trevnorris authored bnoordhuis committed
View
99 src/cares_wrap.cc
@@ -195,7 +195,7 @@ static void ares_sockstate_cb(void* data, ares_socket_t sock,
static Local<Array> HostentToAddresses(struct hostent* host) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<Array> addresses = Array::New();
char ip[INET6_ADDRSTRLEN];
@@ -203,7 +203,7 @@ static Local<Array> HostentToAddresses(struct hostent* host) {
uv_inet_ntop(host->h_addrtype, host->h_addr_list[i], ip, sizeof(ip));
Local<String> address = String::New(ip);
- addresses->Set(Integer::New(i), address);
+ addresses->Set(Integer::New(i, node_isolate), address);
}
return scope.Close(addresses);
@@ -211,12 +211,12 @@ static Local<Array> HostentToAddresses(struct hostent* host) {
static Local<Array> HostentToNames(struct hostent* host) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<Array> names = Array::New();
for (int i = 0; host->h_aliases[i]; ++i) {
Local<String> address = String::New(host->h_aliases[i]);
- names->Set(Integer::New(i), address);
+ names->Set(Integer::New(i, node_isolate), address);
}
return scope.Close(names);
@@ -260,7 +260,7 @@ static const char* AresErrnoString(int errorno) {
static void SetAresErrno(int errorno) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<Value> key = String::NewSymbol("_errno");
Local<Value> value = String::NewSymbol(AresErrnoString(errorno));
node::process->Set(key, value);
@@ -270,7 +270,7 @@ static void SetAresErrno(int errorno) {
class QueryWrap {
public:
QueryWrap() {
- HandleScope scope;
+ HandleScope scope(node_isolate);
object_ = Persistent<Object>::New(node_isolate, Object::New());
}
@@ -336,14 +336,14 @@ class QueryWrap {
}
void CallOnComplete(Local<Value> answer) {
- HandleScope scope;
- Local<Value> argv[2] = { Integer::New(0), answer };
+ HandleScope scope(node_isolate);
+ Local<Value> argv[2] = { Integer::New(0, node_isolate), answer };
MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv);
}
void CallOnComplete(Local<Value> answer, Local<Value> family) {
- HandleScope scope;
- Local<Value> argv[3] = { Integer::New(0), answer, family };
+ HandleScope scope(node_isolate);
+ Local<Value> argv[3] = { Integer::New(0, node_isolate), answer, family };
MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv);
}
@@ -351,8 +351,8 @@ class QueryWrap {
assert(status != ARES_SUCCESS);
SetAresErrno(status);
- HandleScope scope;
- Local<Value> argv[1] = { Integer::New(-1) };
+ HandleScope scope(node_isolate);
+ Local<Value> argv[1] = { Integer::New(-1, node_isolate) };
MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv);
}
@@ -379,7 +379,7 @@ class QueryAWrap: public QueryWrap {
protected:
void Parse(unsigned char* buf, int len) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
struct hostent* host;
@@ -411,7 +411,7 @@ class QueryAaaaWrap: public QueryWrap {
protected:
void Parse(unsigned char* buf, int len) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
struct hostent* host;
@@ -443,7 +443,7 @@ class QueryCnameWrap: public QueryWrap {
protected:
void Parse(unsigned char* buf, int len) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
struct hostent* host;
@@ -473,7 +473,7 @@ class QueryMxWrap: public QueryWrap {
protected:
void Parse(unsigned char* buf, int len) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
struct ares_mx_reply* mx_start;
int status = ares_parse_mx_reply(buf, len, &mx_start);
@@ -492,8 +492,8 @@ class QueryMxWrap: public QueryWrap {
Local<Object> mx_record = Object::New();
mx_record->Set(exchange_symbol, String::New(mx_current->host));
mx_record->Set(priority_symbol,
- Integer::New(mx_current->priority));
- mx_records->Set(Integer::New(i++), mx_record);
+ Integer::New(mx_current->priority, node_isolate));
+ mx_records->Set(Integer::New(i++, node_isolate), mx_record);
}
ares_free_data(mx_start);
@@ -550,7 +550,7 @@ class QueryTxtWrap: public QueryWrap {
struct ares_txt_reply *current = txt_out;
for (int i = 0; current; ++i, current = current->next) {
Local<String> txt = String::New(reinterpret_cast<char*>(current->txt));
- txt_records->Set(Integer::New(i), txt);
+ txt_records->Set(Integer::New(i, node_isolate), txt);
}
ares_free_data(txt_out);
@@ -574,7 +574,7 @@ class QuerySrvWrap: public QueryWrap {
protected:
void Parse(unsigned char* buf, int len) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
struct ares_srv_reply* srv_start;
int status = ares_parse_srv_reply(buf, len, &srv_start);
@@ -595,12 +595,12 @@ class QuerySrvWrap: public QueryWrap {
Local<Object> srv_record = Object::New();
srv_record->Set(name_symbol, String::New(srv_current->host));
srv_record->Set(port_symbol,
- Integer::New(srv_current->port));
+ Integer::New(srv_current->port, node_isolate));
srv_record->Set(priority_symbol,
- Integer::New(srv_current->priority));
+ Integer::New(srv_current->priority, node_isolate));
srv_record->Set(weight_symbol,
- Integer::New(srv_current->weight));
- srv_records->Set(Integer::New(i++), srv_record);
+ Integer::New(srv_current->weight, node_isolate));
+ srv_records->Set(Integer::New(i++, node_isolate), srv_record);
}
ares_free_data(srv_start);
@@ -623,7 +623,7 @@ class QueryNaptrWrap: public QueryWrap {
protected:
void Parse(unsigned char* buf, int len) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
ares_naptr_reply* naptr_start;
int status = ares_parse_naptr_reply(buf, len, &naptr_start);
@@ -656,11 +656,12 @@ class QueryNaptrWrap: public QueryWrap {
String::New(reinterpret_cast<char*>(naptr_current->regexp)));
naptr_record->Set(replacement_symbol,
String::New(naptr_current->replacement));
- naptr_record->Set(order_symbol, Integer::New(naptr_current->order));
+ naptr_record->Set(order_symbol, Integer::New(naptr_current->order,
+ node_isolate));
naptr_record->Set(preference_symbol,
- Integer::New(naptr_current->preference));
+ Integer::New(naptr_current->preference, node_isolate));
- naptr_records->Set(Integer::New(i++), naptr_record);
+ naptr_records->Set(Integer::New(i++, node_isolate), naptr_record);
}
ares_free_data(naptr_start);
@@ -697,7 +698,7 @@ class GetHostByAddrWrap: public QueryWrap {
protected:
void Parse(struct hostent* host) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
this->CallOnComplete(HostentToNames(host));
}
@@ -713,10 +714,10 @@ class GetHostByNameWrap: public QueryWrap {
protected:
void Parse(struct hostent* host) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<Array> addresses = HostentToAddresses(host);
- Local<Integer> family = Integer::New(host->h_addrtype);
+ Local<Integer> family = Integer::New(host->h_addrtype, node_isolate);
this->CallOnComplete(addresses, family);
}
@@ -725,7 +726,7 @@ class GetHostByNameWrap: public QueryWrap {
template <class Wrap>
static Handle<Value> Query(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
assert(!args.IsConstructCall());
assert(args.Length() >= 2);
@@ -737,7 +738,7 @@ static Handle<Value> Query(const Arguments& args) {
// We must cache the wrap's js object here, because cares might make the
// callback from the wrap->Send stack. This will destroy the wrap's internal
// object reference, causing wrap->GetObject() to return undefined.
- Local<Object> object = Local<Object>::New(wrap->GetObject());
+ Local<Object> object = Local<Object>::New(node_isolate, wrap->GetObject());
String::Utf8Value name(args[0]);
@@ -745,7 +746,7 @@ static Handle<Value> Query(const Arguments& args) {
if (r) {
SetAresErrno(r);
delete wrap;
- return scope.Close(v8::Null());
+ return scope.Close(v8::Null(node_isolate));
} else {
return scope.Close(object);
}
@@ -754,7 +755,7 @@ static Handle<Value> Query(const Arguments& args) {
template <class Wrap>
static Handle<Value> QueryWithFamily(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
assert(!args.IsConstructCall());
assert(args.Length() >= 3);
@@ -766,7 +767,7 @@ static Handle<Value> QueryWithFamily(const Arguments& args) {
// We must cache the wrap's js object here, because cares might make the
// callback from the wrap->Send stack. This will destroy the wrap's internal
// object reference, causing wrap->GetObject() to return undefined.
- Local<Object> object = Local<Object>::New(wrap->GetObject());
+ Local<Object> object = Local<Object>::New(node_isolate, wrap->GetObject());
String::Utf8Value name(args[0]);
int family = args[1]->Int32Value();
@@ -775,7 +776,7 @@ static Handle<Value> QueryWithFamily(const Arguments& args) {
if (r) {
SetAresErrno(r);
delete wrap;
- return scope.Close(v8::Null());
+ return scope.Close(v8::Null(node_isolate));
} else {
return scope.Close(object);
}
@@ -783,7 +784,7 @@ static Handle<Value> QueryWithFamily(const Arguments& args) {
void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
GetAddrInfoReqWrap* req_wrap = (GetAddrInfoReqWrap*) req->data;
@@ -792,7 +793,7 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
if (status) {
// Error
SetErrno(uv_last_error(uv_default_loop()));
- argv[0] = Local<Value>::New(Null());
+ argv[0] = Local<Value>::New(node_isolate, Null(node_isolate));
} else {
// Success
struct addrinfo *address;
@@ -878,25 +879,25 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
static Handle<Value> IsIP(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
String::AsciiValue ip(args[0]);
char address_buffer[sizeof(struct in6_addr)];
if (uv_inet_pton(AF_INET, *ip, &address_buffer).code == UV_OK) {
- return scope.Close(v8::Integer::New(4));
+ return scope.Close(v8::Integer::New(4, node_isolate));
}
if (uv_inet_pton(AF_INET6, *ip, &address_buffer).code == UV_OK) {
- return scope.Close(v8::Integer::New(6));
+ return scope.Close(v8::Integer::New(6, node_isolate));
}
- return scope.Close(v8::Integer::New(0));
+ return scope.Close(v8::Integer::New(0, node_isolate));
}
static Handle<Value> GetAddrInfo(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
String::Utf8Value hostname(args[0]);
@@ -931,7 +932,7 @@ static Handle<Value> GetAddrInfo(const Arguments& args) {
if (r) {
SetErrno(uv_last_error(uv_default_loop()));
delete req_wrap;
- return scope.Close(v8::Null());
+ return scope.Close(v8::Null(node_isolate));
} else {
return scope.Close(req_wrap->object_);
}
@@ -939,7 +940,7 @@ static Handle<Value> GetAddrInfo(const Arguments& args) {
static void Initialize(Handle<Object> target) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
int r;
r = ares_library_init(ARES_LIB_INIT_ALL);
@@ -976,11 +977,11 @@ static void Initialize(Handle<Object> target) {
NODE_SET_METHOD(target, "isIP", IsIP);
target->Set(String::NewSymbol("AF_INET"),
- Integer::New(AF_INET));
+ Integer::New(AF_INET, node_isolate));
target->Set(String::NewSymbol("AF_INET6"),
- Integer::New(AF_INET6));
+ Integer::New(AF_INET6, node_isolate));
target->Set(String::NewSymbol("AF_UNSPEC"),
- Integer::New(AF_UNSPEC));
+ Integer::New(AF_UNSPEC, node_isolate));
oncomplete_sym = NODE_PSYMBOL("oncomplete");
}
View
20 src/fs_event_wrap.cc
@@ -64,7 +64,7 @@ FSEventWrap::~FSEventWrap() {
void FSEventWrap::Initialize(Handle<Object> target) {
HandleWrap::Initialize(target);
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<FunctionTemplate> t = FunctionTemplate::New(New);
t->InstanceTemplate()->SetInternalFieldCount(1);
@@ -80,7 +80,7 @@ void FSEventWrap::Initialize(Handle<Object> target) {
Handle<Value> FSEventWrap::New(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
assert(args.IsConstructCall());
new FSEventWrap(args.This());
@@ -90,7 +90,7 @@ Handle<Value> FSEventWrap::New(const Arguments& args) {
Handle<Value> FSEventWrap::Start(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
UNWRAP(FSEventWrap)
@@ -111,13 +111,13 @@ Handle<Value> FSEventWrap::Start(const Arguments& args) {
SetErrno(uv_last_error(uv_default_loop()));
}
- return scope.Close(Integer::New(r));
+ return scope.Close(Integer::New(r, node_isolate));
}
void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
int events, int status) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<String> eventStr;
FSEventWrap* wrap = static_cast<FSEventWrap*>(handle->data);
@@ -137,7 +137,7 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
// unreasonable, right? Still, we should revisit this before v1.0.
if (status) {
SetErrno(uv_last_error(uv_default_loop()));
- eventStr = String::Empty();
+ eventStr = String::Empty(node_isolate);
}
else if (events & UV_RENAME) {
eventStr = String::New("rename");
@@ -151,10 +151,10 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
}
Local<Value> argv[3] = {
- Integer::New(status),
+ Integer::New(status, node_isolate),
eventStr,
filename ? static_cast<Local<Value> >(String::New(filename))
- : Local<Value>::New(v8::Null())
+ : Local<Value>::New(node_isolate, v8::Null(node_isolate))
};
if (onchange_sym.IsEmpty()) {
@@ -166,7 +166,7 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
Handle<Value> FSEventWrap::Close(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
// Unwrap manually here. The UNWRAP() macro asserts that wrap != NULL.
// That usually indicates an error but not here: double closes are possible
@@ -177,7 +177,7 @@ Handle<Value> FSEventWrap::Close(const Arguments& args) {
FSEventWrap* wrap = static_cast<FSEventWrap*>(ptr);
if (wrap == NULL || wrap->initialized_ == false) {
- return Undefined();
+ return Undefined(node_isolate);
}
wrap->initialized_ = false;
View
16 src/handle_wrap.cc
@@ -53,7 +53,7 @@ void HandleWrap::Initialize(Handle<Object> target) {
Handle<Value> HandleWrap::Ref(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
UNWRAP_NO_ABORT(HandleWrap)
@@ -62,12 +62,12 @@ Handle<Value> HandleWrap::Ref(const Arguments& args) {
wrap->flags_ &= ~kUnref;
}
- return v8::Undefined();
+ return v8::Undefined(node_isolate);
}
Handle<Value> HandleWrap::Unref(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
UNWRAP_NO_ABORT(HandleWrap)
@@ -76,19 +76,19 @@ Handle<Value> HandleWrap::Unref(const Arguments& args) {
wrap->flags_ |= kUnref;
}
- return v8::Undefined();
+ return v8::Undefined(node_isolate);
}
Handle<Value> HandleWrap::Close(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
HandleWrap *wrap = static_cast<HandleWrap*>(
args.Holder()->GetAlignedPointerFromInternalField(0));
// guard against uninitialized handle or double close
if (wrap == NULL || wrap->handle__ == NULL) {
- return Undefined();
+ return Undefined(node_isolate);
}
assert(!wrap->object_.IsEmpty());
@@ -101,7 +101,7 @@ Handle<Value> HandleWrap::Close(const Arguments& args) {
wrap->flags_ |= kCloseCallback;
}
- return Undefined();
+ return Undefined(node_isolate);
}
@@ -112,7 +112,7 @@ HandleWrap::HandleWrap(Handle<Object> object, uv_handle_t* h) {
h->data = this;
}
- HandleScope scope;
+ HandleScope scope(node_isolate);
assert(object_.IsEmpty());
assert(object->InternalFieldCount() > 0);
object_ = v8::Persistent<v8::Object>::New(node_isolate, object);
View
219 src/node.cc
@@ -186,7 +186,7 @@ static void Spin(uv_idle_t* handle, int status) {
uv_idle_stop(&tick_spinner);
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (process_tickFromSpinner.IsEmpty()) {
Local<Value> cb_v = process->Get(String::New("_tickFromSpinner"));
@@ -211,7 +211,7 @@ static void Spin(uv_idle_t* handle, int status) {
static Handle<Value> NeedTickCallback(const Arguments& args) {
need_tick_cb = true;
uv_idle_start(&tick_spinner, Spin);
- return Undefined();
+ return Undefined(node_isolate);
}
@@ -219,7 +219,7 @@ static void CheckImmediate(uv_check_t* handle, int status) {
assert(handle == &check_immediate_watcher);
assert(status == 0);
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (immediate_callback_sym.IsEmpty()) {
immediate_callback_sym = NODE_PSYMBOL("_immediateCallback");
@@ -747,7 +747,7 @@ Local<Value> ErrnoException(int errorno,
Local<Object> obj = e->ToObject();
- obj->Set(errno_symbol, Integer::New(errorno));
+ obj->Set(errno_symbol, Integer::New(errorno, node_isolate));
obj->Set(code_symbol, estring);
if (path) obj->Set(errpath_symbol, String::New(path));
if (syscall) obj->Set(syscall_symbol, String::NewSymbol(syscall));
@@ -819,7 +819,7 @@ Local<Value> UVException(int errorno,
Local<Object> obj = e->ToObject();
// TODO errno should probably go
- obj->Set(errno_symbol, Integer::New(errorno));
+ obj->Set(errno_symbol, Integer::New(errorno, node_isolate));
obj->Set(code_symbol, estring);
if (path) obj->Set(errpath_symbol, path_str);
if (syscall) obj->Set(syscall_symbol, String::NewSymbol(syscall));
@@ -880,7 +880,7 @@ Local<Value> WinapiErrnoException(int errorno,
Local<Object> obj = e->ToObject();
- obj->Set(errno_symbol, Integer::New(errorno));
+ obj->Set(errno_symbol, Integer::New(errorno, node_isolate));
if (path) obj->Set(errpath_symbol, String::New(path));
if (syscall) obj->Set(syscall_symbol, String::NewSymbol(syscall));
return e;
@@ -890,7 +890,7 @@ Local<Value> WinapiErrnoException(int errorno,
Handle<Value> FromConstructorTemplate(Persistent<FunctionTemplate> t,
const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<Value> argv[32];
unsigned argc = args.Length();
if (argc > ARRAY_SIZE(argv)) argc = ARRAY_SIZE(argv);
@@ -933,7 +933,7 @@ MakeDomainCallback(const Handle<Object> object,
assert(!domain.IsEmpty());
if (domain->Get(disposed_symbol)->IsTrue()) {
// domain has been disposed of.
- return Undefined();
+ return Undefined(node_isolate);
}
enter = Local<Function>::Cast(domain->Get(enter_symbol));
assert(!enter.IsEmpty());
@@ -941,14 +941,14 @@ MakeDomainCallback(const Handle<Object> object,
if (try_catch.HasCaught()) {
FatalException(try_catch);
- return Undefined();
+ return Undefined(node_isolate);
}
Local<Value> ret = callback->Call(object, argc, argv);
if (try_catch.HasCaught()) {
FatalException(try_catch);
- return Undefined();
+ return Undefined(node_isolate);
}
exit = Local<Function>::Cast(domain->Get(exit_symbol));
@@ -957,7 +957,7 @@ MakeDomainCallback(const Handle<Object> object,
if (try_catch.HasCaught()) {
FatalException(try_catch);
- return Undefined();
+ return Undefined(node_isolate);
}
if (tick_infobox.length == 0) {
@@ -971,7 +971,7 @@ MakeDomainCallback(const Handle<Object> object,
if (try_catch.HasCaught()) {
FatalException(try_catch);
- return Undefined();
+ return Undefined(node_isolate);
}
return ret;
@@ -983,7 +983,7 @@ MakeCallback(const Handle<Object> object,
const Handle<String> symbol,
int argc,
Handle<Value> argv[]) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<Function> callback = object->Get(symbol).As<Function>();
Local<Value> domain = object->Get(domain_symbol);
@@ -1011,7 +1011,7 @@ MakeCallback(const Handle<Object> object,
if (try_catch.HasCaught()) {
FatalException(try_catch);
- return Undefined();
+ return Undefined(node_isolate);
}
if (tick_infobox.length == 0) {
@@ -1025,7 +1025,7 @@ MakeCallback(const Handle<Object> object,
if (try_catch.HasCaught()) {
FatalException(try_catch);
- return Undefined();
+ return Undefined(node_isolate);
}
return scope.Close(ret);
@@ -1037,7 +1037,7 @@ MakeCallback(const Handle<Object> object,
const char* method,
int argc,
Handle<Value> argv[]) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Handle<Value> ret =
MakeCallback(object, String::NewSymbol(method), argc, argv);
@@ -1047,7 +1047,7 @@ MakeCallback(const Handle<Object> object,
void SetErrno(uv_err_t err) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
static Persistent<String> errno_symbol;
if (errno_symbol.IsEmpty()) {
@@ -1065,7 +1065,7 @@ void SetErrno(uv_err_t err) {
enum encoding ParseEncoding(Handle<Value> encoding_v, enum encoding _default) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (!encoding_v->IsString()) return _default;
@@ -1111,14 +1111,14 @@ enum encoding ParseEncoding(Handle<Value> encoding_v, enum encoding _default) {
}
Local<Value> Encode(const void *buf, size_t len, enum encoding encoding) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (encoding == BUFFER) {
return scope.Close(
Buffer::New(static_cast<const char*>(buf), len)->handle_);
}
- if (!len) return scope.Close(String::Empty());
+ if (!len) return scope.Close(String::Empty(node_isolate));
if (encoding == BINARY) {
const unsigned char *cbuf = static_cast<const unsigned char*>(buf);
@@ -1139,7 +1139,7 @@ Local<Value> Encode(const void *buf, size_t len, enum encoding encoding) {
// Returns -1 if the handle was not valid for decoding
ssize_t DecodeBytes(v8::Handle<v8::Value> val, enum encoding encoding) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (val->IsArray()) {
fprintf(stderr, "'raw' encoding (array of integers) has been removed. "
@@ -1170,7 +1170,7 @@ ssize_t DecodeWrite(char *buf,
size_t buflen,
v8::Handle<v8::Value> val,
enum encoding encoding) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
// XXX
// A lot of improvement can be made here. See:
@@ -1243,7 +1243,7 @@ void DisplayExceptionLine (TryCatch &try_catch) {
if (displayed_error) return;
displayed_error = true;
- HandleScope scope;
+ HandleScope scope(node_isolate);
Handle<Message> message = try_catch.Message();
@@ -1301,7 +1301,7 @@ void DisplayExceptionLine (TryCatch &try_catch) {
static void ReportException(TryCatch &try_catch, bool show_line) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (show_line) DisplayExceptionLine(try_catch);
@@ -1334,7 +1334,7 @@ static void ReportException(TryCatch &try_catch, bool show_line) {
// Executes a str within the current v8 context.
Local<Value> ExecuteString(Handle<String> source, Handle<Value> filename) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
TryCatch try_catch;
Local<v8::Script> script = v8::Script::Compile(source, filename);
@@ -1354,7 +1354,7 @@ Local<Value> ExecuteString(Handle<String> source, Handle<Value> filename) {
static Handle<Value> GetActiveRequests(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<Array> ary = Array::New();
ngx_queue_t* q = NULL;
@@ -1373,7 +1373,7 @@ static Handle<Value> GetActiveRequests(const Arguments& args) {
// Non-static, friend of HandleWrap. Could have been a HandleWrap method but
// implemented here for consistency with GetActiveRequests().
Handle<Value> GetActiveHandles(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<Array> ary = Array::New();
ngx_queue_t* q = NULL;
@@ -1395,12 +1395,12 @@ Handle<Value> GetActiveHandles(const Arguments& args) {
static Handle<Value> Abort(const Arguments& args) {
abort();
- return Undefined();
+ return Undefined(node_isolate);
}
static Handle<Value> Chdir(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (args.Length() != 1 || !args[0]->IsString()) {
return ThrowException(Exception::Error(String::New("Bad argument.")));
@@ -1414,12 +1414,12 @@ static Handle<Value> Chdir(const Arguments& args) {
return ThrowException(UVException(r.code, "uv_chdir"));
}
- return Undefined();
+ return Undefined(node_isolate);
}
static Handle<Value> Cwd(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
#ifdef _WIN32
/* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */
char buf[MAX_PATH * 4 + 1];
@@ -1440,7 +1440,7 @@ static Handle<Value> Cwd(const Arguments& args) {
static Handle<Value> Umask(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
unsigned int old;
if (args.Length() < 1 || args[0]->IsUndefined()) {
@@ -1473,7 +1473,7 @@ static Handle<Value> Umask(const Arguments& args) {
old = umask(static_cast<mode_t>(oct));
}
- return scope.Close(Uint32::New(old));
+ return scope.Close(Uint32::New(old, node_isolate));
}
@@ -1582,21 +1582,21 @@ static gid_t gid_by_name(Handle<Value> value) {
static Handle<Value> GetUid(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
int uid = getuid();
- return scope.Close(Integer::New(uid));
+ return scope.Close(Integer::New(uid, node_isolate));
}
static Handle<Value> GetGid(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
int gid = getgid();
- return scope.Close(Integer::New(gid));
+ return scope.Close(Integer::New(gid, node_isolate));
}
static Handle<Value> SetGid(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (!args[0]->IsUint32() && !args[0]->IsString()) {
return ThrowTypeError("setgid argument must be a number or a string");
@@ -1612,12 +1612,12 @@ static Handle<Value> SetGid(const Arguments& args) {
return ThrowException(ErrnoException(errno, "setgid"));
}
- return Undefined();
+ return Undefined(node_isolate);
}
static Handle<Value> SetUid(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (!args[0]->IsUint32() && !args[0]->IsString()) {
return ThrowTypeError("setuid argument must be a number or a string");
@@ -1633,12 +1633,12 @@ static Handle<Value> SetUid(const Arguments& args) {
return ThrowException(ErrnoException(errno, "setuid"));
}
- return Undefined();
+ return Undefined(node_isolate);
}
static Handle<Value> GetGroups(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
int ngroups = getgroups(0, NULL);
@@ -1660,14 +1660,14 @@ static Handle<Value> GetGroups(const Arguments& args) {
gid_t egid = getegid();
for (int i = 0; i < ngroups; i++) {
- groups_list->Set(i, Integer::New(groups[i]));
+ groups_list->Set(i, Integer::New(groups[i], node_isolate));
if (groups[i] == egid) seen_egid = true;
}
delete[] groups;
if (seen_egid == false) {
- groups_list->Set(ngroups, Integer::New(egid));
+ groups_list->Set(ngroups, Integer::New(egid, node_isolate));
}
return scope.Close(groups_list);
@@ -1675,7 +1675,7 @@ static Handle<Value> GetGroups(const Arguments& args) {
static Handle<Value> SetGroups(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (!args[0]->IsArray()) {
return ThrowTypeError("argument 1 must be an array");
@@ -1703,12 +1703,12 @@ static Handle<Value> SetGroups(const Arguments& args) {
return ThrowException(ErrnoException(errno, "setgroups"));
}
- return Undefined();
+ return Undefined(node_isolate);
}
static Handle<Value> InitGroups(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (!args[0]->IsUint32() && !args[0]->IsString()) {
return ThrowTypeError("argument 1 must be a number or a string");
@@ -1752,27 +1752,27 @@ static Handle<Value> InitGroups(const Arguments& args) {
return ThrowException(ErrnoException(errno, "initgroups"));
}
- return Undefined();
+ return Undefined(node_isolate);
}
#endif // __POSIX__
v8::Handle<v8::Value> Exit(const v8::Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
exit(args[0]->IntegerValue());
- return Undefined();
+ return Undefined(node_isolate);
}
static Handle<Value> Uptime(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
double uptime;
uv_err_t err = uv_uptime(&uptime);
if (err.code != UV_OK) {
- return Undefined();
+ return Undefined(node_isolate);
}
return scope.Close(Number::New(uptime - prog_start_time));
@@ -1780,7 +1780,7 @@ static Handle<Value> Uptime(const Arguments& args) {
v8::Handle<v8::Value> MemoryUsage(const v8::Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
size_t rss;
@@ -1804,16 +1804,18 @@ v8::Handle<v8::Value> MemoryUsage(const v8::Arguments& args) {
HeapStatistics v8_heap_stats;
node_isolate->GetHeapStatistics(&v8_heap_stats);
info->Set(heap_total_symbol,
- Integer::NewFromUnsigned(v8_heap_stats.total_heap_size()));
+ Integer::NewFromUnsigned(v8_heap_stats.total_heap_size(),
+ node_isolate));
info->Set(heap_used_symbol,
- Integer::NewFromUnsigned(v8_heap_stats.used_heap_size()));
+ Integer::NewFromUnsigned(v8_heap_stats.used_heap_size(),
+ node_isolate));
return scope.Close(info);
}
Handle<Value> Kill(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (args.Length() != 2) {
return ThrowException(Exception::Error(String::New("Bad argument.")));
@@ -1825,10 +1827,10 @@ Handle<Value> Kill(const Arguments& args) {
if (err.code != UV_OK) {
SetErrno(err);
- return scope.Close(Integer::New(-1));
+ return scope.Close(Integer::New(-1, node_isolate));
}
- return Undefined();
+ return Undefined(node_isolate);
}
// used in Hrtime() below
@@ -1840,7 +1842,7 @@ Handle<Value> Kill(const Arguments& args) {
// and nanoseconds, to avoid any integer overflow possibility.
// Pass in an Array from a previous hrtime() call to instead get a time diff.
Handle<Value> Hrtime(const v8::Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
uint64_t t = uv_hrtime();
@@ -1858,8 +1860,8 @@ Handle<Value> Hrtime(const v8::Arguments& args) {
}
Local<Array> tuple = Array::New(2);
- tuple->Set(0, Integer::NewFromUnsigned(t / NANOS_PER_SEC));
- tuple->Set(1, Integer::NewFromUnsigned(t % NANOS_PER_SEC));
+ tuple->Set(0, Integer::NewFromUnsigned(t / NANOS_PER_SEC, node_isolate));
+ tuple->Set(1, Integer::NewFromUnsigned(t % NANOS_PER_SEC, node_isolate));
return scope.Close(tuple);
}
@@ -1870,7 +1872,7 @@ typedef void (UV_DYNAMIC* extInit)(Handle<Object> exports);
// DLOpen is process.dlopen(module, filename).
// Used to load 'module.node' dynamically shared objects.
Handle<Value> DLOpen(const v8::Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
char symbol[1024], *base, *pos;
uv_lib_t lib;
int r;
@@ -1959,7 +1961,7 @@ Handle<Value> DLOpen(const v8::Arguments& args) {
// Tell coverity that 'handle' should not be freed when we return.
// coverity[leaked_storage]
- return Undefined();
+ return Undefined(node_isolate);
}
@@ -1973,7 +1975,7 @@ static void OnFatalError(const char* location, const char* message) {
}
void FatalException(TryCatch &try_catch) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (fatal_exception_symbol.IsEmpty())
fatal_exception_symbol = NODE_PSYMBOL("_fatalException");
@@ -2014,7 +2016,7 @@ Persistent<Object> binding_cache;
Persistent<Array> module_load_list;
static Handle<Value> Binding(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<String> module = args[0]->ToString();
String::Utf8Value module_v(module);
@@ -2041,7 +2043,7 @@ static Handle<Value> Binding(const Arguments& args) {
exports = Object::New();
// Internal bindings don't have a "module" object,
// only exports.
- modp->register_func(exports, Undefined());
+ modp->register_func(exports, Undefined(node_isolate));
binding_cache->Set(module, exports);
} else if (!strcmp(*module_v, "constants")) {
@@ -2065,7 +2067,7 @@ static Handle<Value> Binding(const Arguments& args) {
static Handle<Value> ProcessTitleGetter(Local<String> property,
const AccessorInfo& info) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
char buffer[512];
uv_get_process_title(buffer, sizeof(buffer));
return scope.Close(String::New(buffer));
@@ -2075,7 +2077,7 @@ static Handle<Value> ProcessTitleGetter(Local<String> property,
static void ProcessTitleSetter(Local<String> property,
Local<Value> value,
const AccessorInfo& info) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
String::Utf8Value title(value);
// TODO: protect with a lock
uv_set_process_title(*title);
@@ -2084,7 +2086,7 @@ static void ProcessTitleSetter(Local<String> property,
static Handle<Value> EnvGetter(Local<String> property,
const AccessorInfo& info) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
#ifdef __POSIX__
String::Utf8Value key(property);
const char* val = getenv(*key);
@@ -2113,7 +2115,7 @@ static Handle<Value> EnvGetter(Local<String> property,
static Handle<Value> EnvSetter(Local<String> property,
Local<Value> value,
const AccessorInfo& info) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
#ifdef __POSIX__
String::Utf8Value key(property);
String::Utf8Value val(value);
@@ -2134,11 +2136,11 @@ static Handle<Value> EnvSetter(Local<String> property,
static Handle<Integer> EnvQuery(Local<String> property,
const AccessorInfo& info) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
#ifdef __POSIX__
String::Utf8Value key(property);
if (getenv(*key)) {
- return scope.Close(Integer::New(0));
+ return scope.Close(Integer::New(0, node_isolate));
}
#else // _WIN32
String::Value key(property);
@@ -2149,9 +2151,10 @@ static Handle<Integer> EnvQuery(Local<String> property,
// Environment variables that start with '=' are hidden and read-only.
return scope.Close(Integer::New(v8::ReadOnly ||
v8::DontDelete ||
- v8::DontEnum));
+ v8::DontEnum,
+ node_isolate));
} else {
- return scope.Close(Integer::New(0));
+ return scope.Close(Integer::New(0, node_isolate));
}
}
#endif
@@ -2162,12 +2165,12 @@ static Handle<Integer> EnvQuery(Local<String> property,
static Handle<Boolean> EnvDeleter(Local<String> property,
const AccessorInfo& info) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
#ifdef __POSIX__
String::Utf8Value key(property);
- if (!getenv(*key)) return False();
+ if (!getenv(*key)) return False(node_isolate);
unsetenv(*key); // can't check return value, it's void on some platforms
- return True();
+ return True(node_isolate);
#else
String::Value key(property);
WCHAR* key_ptr = reinterpret_cast<WCHAR*>(*key);
@@ -2178,13 +2181,13 @@ static Handle<Boolean> EnvDeleter(Local<String> property,
GetLastError() != ERROR_SUCCESS;
return scope.Close(Boolean::New(rv));
}
- return True();
+ return True(node_isolate);
#endif
}
static Handle<Array> EnvEnumerator(const AccessorInfo& info) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
#ifdef __POSIX__
int size = 0;
while (environ[size]) size++;
@@ -2228,19 +2231,19 @@ static Handle<Array> EnvEnumerator(const AccessorInfo& info) {
static Handle<Object> GetFeatures() {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<Object> obj = Object::New();
obj->Set(String::NewSymbol("debug"),
#if defined(DEBUG) && DEBUG
- True()
+ True(node_isolate)
#else
- False()
+ False(node_isolate)
#endif
);
- obj->Set(String::NewSymbol("uv"), True());
- obj->Set(String::NewSymbol("ipv6"), True()); // TODO ping libuv
+ obj->Set(String::NewSymbol("uv"), True(node_isolate));
+ obj->Set(String::NewSymbol("ipv6"), True(node_isolate)); // TODO ping libuv
obj->Set(String::NewSymbol("tls_npn"), Boolean::New(use_npn));
obj->Set(String::NewSymbol("tls_sni"), Boolean::New(use_sni));
obj->Set(String::NewSymbol("tls"),
@@ -2252,15 +2255,15 @@ static Handle<Object> GetFeatures() {
static Handle<Value> DebugPortGetter(Local<String> property,
const AccessorInfo& info) {
- HandleScope scope;
- return scope.Close(Integer::NewFromUnsigned(debug_port));
+ HandleScope scope(node_isolate);
+ return scope.Close(Integer::NewFromUnsigned(debug_port, node_isolate));
}
static void DebugPortSetter(Local<String> property,
Local<Value> value,
const AccessorInfo& info) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
debug_port = value->NumberValue();
}
@@ -2279,7 +2282,7 @@ Handle<Value> NeedImmediateCallbackGetter(Local<String> property,
static void NeedImmediateCallbackSetter(Local<String> property,
Local<Value> value,
const AccessorInfo& info) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
bool bool_value = value->BooleanValue();
@@ -2299,7 +2302,7 @@ static void NeedImmediateCallbackSetter(Local<String> property,
Handle<Object> SetupProcessObject(int argc, char *argv[]) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
int i, j;
@@ -2362,10 +2365,10 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
// process.argv
Local<Array> arguments = Array::New(argc - option_end_index + 1);
- arguments->Set(Integer::New(0), String::New(argv[0]));
+ arguments->Set(Integer::New(0, node_isolate), String::New(argv[0]));
for (j = 1, i = option_end_index; i < argc; j++, i++) {
Local<String> arg = String::New(argv[i]);
- arguments->Set(Integer::New(j), arg);
+ arguments->Set(Integer::New(j, node_isolate), arg);
}
// assign it
process->Set(String::NewSymbol("argv"), arguments);
@@ -2373,7 +2376,7 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
// process.execArgv
Local<Array> execArgv = Array::New(option_end_index - 1);
for (j = 1, i = 0; j < option_end_index; j++, i++) {
- execArgv->Set(Integer::New(i), String::New(argv[j]));
+ execArgv->Set(Integer::New(i, node_isolate), String::New(argv[j]));
}
// assign it
process->Set(String::NewSymbol("execArgv"), execArgv);
@@ -2390,7 +2393,7 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
Local<Object> env = envTemplate->NewInstance();
process->Set(String::NewSymbol("env"), env);
- process->Set(String::NewSymbol("pid"), Integer::New(getpid()));
+ process->Set(String::NewSymbol("pid"), Integer::New(getpid(), node_isolate));
process->Set(String::NewSymbol("features"), GetFeatures());
process->SetAccessor(String::New("_needImmediateCallback"),
NeedImmediateCallbackGetter,
@@ -2403,17 +2406,17 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
// -p, --print
if (print_eval) {
- process->Set(String::NewSymbol("_print_eval"), True());
+ process->Set(String::NewSymbol("_print_eval"), True(node_isolate));
}
// -i, --interactive
if (force_repl) {
- process->Set(String::NewSymbol("_forceRepl"), True());
+ process->Set(String::NewSymbol("_forceRepl"), True(node_isolate));
}
// --no-deprecation
if (no_deprecation) {
- process->Set(String::NewSymbol("noDeprecation"), True());
+ process->Set(String::NewSymbol("noDeprecation"), True(node_isolate));
}
// --throw-deprecation
@@ -2423,7 +2426,7 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
// --trace-deprecation
if (trace_deprecation) {
- process->Set(String::NewSymbol("traceDeprecation"), True());
+ process->Set(String::NewSymbol("traceDeprecation"), True(node_isolate));
}
size_t size = 2*PATH_MAX;
@@ -2536,7 +2539,7 @@ void Load(Handle<Object> process_l) {
// Add a reference to the global object
Local<Object> global = v8::Context::GetCurrent()->Global();
- Local<Value> args[1] = { Local<Value>::New(process_l) };
+ Local<Value> args[1] = { Local<Value>::New(node_isolate, process_l) };
#if defined HAVE_DTRACE || defined HAVE_ETW || defined HAVE_SYSTEMTAP
InitDTrace(global);
@@ -2751,7 +2754,7 @@ static void RegisterSignalHandler(int signal, void (*handler)(int)) {
Handle<Value> DebugProcess(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (args.Length() != 1) {
return ThrowException(Exception::Error(
@@ -2767,7 +2770,7 @@ Handle<Value> DebugProcess(const Arguments& args) {
return ThrowException(ErrnoException(errno, "kill"));
}
- return Undefined();
+ return Undefined(node_isolate);
}
#endif // __POSIX__
@@ -2783,7 +2786,7 @@ DWORD WINAPI EnableDebugThreadProc(void* arg) {
}
}
- v8::Debug::DebugBreak();
+ v8::Debug::DebugBreak(node_isolate);
return 0;
}
@@ -2839,8 +2842,8 @@ static int RegisterDebugSignalHandler() {
static Handle<Value> DebugProcess(const Arguments& args) {
- HandleScope scope;
- Handle<Value> rv = Undefined();
+ HandleScope scope(node_isolate);
+ Handle<Value> rv = Undefined(node_isolate);
DWORD pid;
HANDLE process = NULL;
HANDLE thread = NULL;
@@ -2924,14 +2927,14 @@ static Handle<Value> DebugProcess(const Arguments& args) {
CloseHandle(mapping);
}
- return Undefined();
+ return Undefined(node_isolate);
}
#endif // _WIN32
static Handle<Value> DebugPause(const Arguments& args) {
v8::Debug::DebugBreak(node_isolate);
- return Undefined();
+ return Undefined(node_isolate);
}
@@ -2941,7 +2944,7 @@ static Handle<Value> DebugEnd(const Arguments& args) {
debugger_running = false;
}
- return Undefined();
+ return Undefined(node_isolate);
}
@@ -3055,11 +3058,11 @@ void AtExit(void (*cb)(void* arg), void* arg) {
void EmitExit(v8::Handle<v8::Object> process_l) {
// process.emit('exit')
- process_l->Set(String::NewSymbol("_exiting"), True());
+ process_l->Set(String::NewSymbol("_exiting"), True(node_isolate));
Local<Value> emit_v = process_l->Get(String::New("emit"));
assert(emit_v->IsFunction());
Local<Function> emit = Local<Function>::Cast(emit_v);
- Local<Value> args[] = { String::New("exit"), Integer::New(0) };
+ Local<Value> args[] = { String::New("exit"), Integer::New(0, node_isolate) };
TryCatch try_catch;
emit->Call(process_l, 2, args);
if (try_catch.HasCaught()) {
View
108 src/node_buffer.cc
@@ -92,7 +92,7 @@ static inline size_t base64_decoded_size(const char *src, size_t size) {
static size_t ByteLength (Handle<String> string, enum encoding enc) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (enc == UTF8) {
return string->Utf8Length();
@@ -110,7 +110,7 @@ static size_t ByteLength (Handle<String> string, enum encoding enc) {
Handle<Object> Buffer::New(Handle<String> string) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
// get Buffer from global scope.
Local<Object> global = v8::Context::GetCurrent()->Global();
@@ -118,7 +118,7 @@ Handle<Object> Buffer::New(Handle<String> string) {
assert(bv->IsFunction());
Local<Function> b = Local<Function>::Cast(bv);
- Local<Value> argv[1] = { Local<Value>::New(string) };
+ Local<Value> argv[1] = { Local<Value>::New(node_isolate, string) };
Local<Object> instance = b->NewInstance(1, argv);
return scope.Close(instance);
@@ -126,9 +126,9 @@ Handle<Object> Buffer::New(Handle<String> string) {
Buffer* Buffer::New(size_t length) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
- Local<Value> arg = Integer::NewFromUnsigned(length);
+ Local<Value> arg = Integer::NewFromUnsigned(length, node_isolate);
Local<Object> b = constructor_template->GetFunction()->NewInstance(1, &arg);
if (b.IsEmpty()) return NULL;
@@ -137,9 +137,9 @@ Buffer* Buffer::New(size_t length) {
Buffer* Buffer::New(const char* data, size_t length) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
- Local<Value> arg = Integer::NewFromUnsigned(0);
+ Local<Value> arg = Integer::NewFromUnsigned(0, node_isolate);
Local<Object> obj = constructor_template->GetFunction()->NewInstance(1, &arg);
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(obj);
@@ -151,9 +151,9 @@ Buffer* Buffer::New(const char* data, size_t length) {
Buffer* Buffer::New(char *data, size_t length,
free_callback callback, void *hint) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
- Local<Value> arg = Integer::NewFromUnsigned(0);
+ Local<Value> arg = Integer::NewFromUnsigned(0, node_isolate);
Local<Object> obj = constructor_template->GetFunction()->NewInstance(1, &arg);
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(obj);
@@ -168,7 +168,7 @@ Handle<Value> Buffer::New(const Arguments &args) {
return FromConstructorTemplate(constructor_template, args);
}
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (!args[0]->IsUint32()) return ThrowTypeError("Bad argument");
@@ -202,7 +202,7 @@ Buffer::~Buffer() {
// const_cast in Buffer::New requires this
void Buffer::Replace(char *data, size_t length,
free_callback callback, void *hint) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (callback_) {
callback_(data_, callback_hint_);
@@ -231,12 +231,12 @@ void Buffer::Replace(char *data, size_t length,
handle_->SetIndexedPropertiesToExternalArrayData(data_,
kExternalUnsignedByteArray,
length_);
- handle_->Set(length_symbol, Integer::NewFromUnsigned(length_));
+ handle_->Set(length_symbol, Integer::NewFromUnsigned(length_, node_isolate));
}
Handle<Value> Buffer::BinarySlice(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Buffer *parent = ObjectWrap::Unwrap<Buffer>(args.This());
SLICE_ARGS(args[0], args[1])
@@ -352,7 +352,7 @@ static void force_ascii(const char* src, char* dst, size_t len) {
Handle<Value> Buffer::AsciiSlice(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Buffer *parent = ObjectWrap::Unwrap<Buffer>(args.This());
SLICE_ARGS(args[0], args[1])
@@ -372,7 +372,7 @@ Handle<Value> Buffer::AsciiSlice(const Arguments &args) {
Handle<Value> Buffer::Utf8Slice(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Buffer *parent = ObjectWrap::Unwrap<Buffer>(args.This());
SLICE_ARGS(args[0], args[1])
char *data = parent->data_ + start;
@@ -382,7 +382,7 @@ Handle<Value> Buffer::Utf8Slice(const Arguments &args) {
Handle<Value> Buffer::Ucs2Slice(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Buffer *parent = ObjectWrap::Unwrap<Buffer>(args.This());
SLICE_ARGS(args[0], args[1])
uint16_t *data = (uint16_t*)(parent->data_ + start);
@@ -392,12 +392,12 @@ Handle<Value> Buffer::Ucs2Slice(const Arguments &args) {
Handle<Value> Buffer::HexSlice(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Buffer* parent = ObjectWrap::Unwrap<Buffer>(args.This());
SLICE_ARGS(args[0], args[1])
char* src = parent->data_ + start;
uint32_t dstlen = (end - start) * 2;
- if (dstlen == 0) return scope.Close(String::Empty());
+ if (dstlen == 0) return scope.Close(String::Empty(node_isolate));
char* dst = new char[dstlen];
for (uint32_t i = 0, k = 0; k < dstlen; i += 1, k += 2) {
static const char hex[] = "0123456789abcdef";
@@ -434,7 +434,7 @@ static const int unbase64_table[] =
Handle<Value> Buffer::Base64Slice(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Buffer *parent = ObjectWrap::Unwrap<Buffer>(args.This());
SLICE_ARGS(args[0], args[1])
@@ -503,7 +503,7 @@ Handle<Value> Buffer::Base64Slice(const Arguments &args) {
// buffer.fill(value, start, end);
Handle<Value> Buffer::Fill(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (!args[0]->IsInt32()) {
return ThrowException(Exception::Error(String::New(
@@ -518,13 +518,13 @@ Handle<Value> Buffer::Fill(const Arguments &args) {
value,
end - start);
- return Undefined();
+ return Undefined(node_isolate);
}
// var bytesCopied = buffer.copy(target, targetStart, sourceStart, sourceEnd);
Handle<Value> Buffer::Copy(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Buffer *source = ObjectWrap::Unwrap<Buffer>(args.This());
@@ -546,7 +546,7 @@ Handle<Value> Buffer::Copy(const Arguments &args) {
// Copy 0 bytes; we're done
if (source_end == source_start) {
- return scope.Close(Integer::New(0));
+ return scope.Close(Integer::New(0, node_isolate));
}
if (target_start >= target_length) {
@@ -570,13 +570,13 @@ Handle<Value> Buffer::Copy(const Arguments &args) {
(const void*)(source->data_ + source_start),
to_copy);
- return scope.Close(Integer::New(to_copy));
+ return scope.Close(Integer::New(to_copy, node_isolate));
}
// var charsWritten = buffer.utf8Write(string, offset, [maxLength]);
Handle<Value> Buffer::Utf8Write(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args.This());
if (!args[0]->IsString()) {
@@ -592,8 +592,8 @@ Handle<Value> Buffer::Utf8Write(const Arguments &args) {
if (length == 0) {
constructor_template->GetFunction()->Set(chars_written_sym,
- Integer::New(0));
- return scope.Close(Integer::New(0));
+ Integer::New(0, node_isolate));
+ return scope.Close(Integer::New(0, node_isolate));
}
if (length > 0 && offset >= buffer->length_) {
@@ -615,15 +615,16 @@ Handle<Value> Buffer::Utf8Write(const Arguments &args) {
String::NO_NULL_TERMINATION));
constructor_template->GetFunction()->Set(chars_written_sym,
- Integer::New(char_written));
+ Integer::New(char_written,
+ node_isolate));
- return scope.Close(Integer::New(written));
+ return scope.Close(Integer::New(written, node_isolate));
}
// var charsWritten = buffer.ucs2Write(string, offset, [maxLength]);
Handle<Value> Buffer::Ucs2Write(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args.This());
if (!args[0]->IsString()) {
@@ -652,9 +653,9 @@ Handle<Value> Buffer::Ucs2Write(const Arguments &args) {
String::NO_NULL_TERMINATION));
constructor_template->GetFunction()->Set(chars_written_sym,
- Integer::New(written));
+ Integer::New(written, node_isolate));
- return scope.Close(Integer::New(written * 2));
+ return scope.Close(Integer::New(written * 2, node_isolate));
}
@@ -667,7 +668,7 @@ inline unsigned hex2bin(char c) {
Handle<Value> Buffer::HexWrite(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Buffer* parent = ObjectWrap::Unwrap<Buffer>(args.This());
if (args[0]->IsString() == false) {
@@ -685,7 +686,7 @@ Handle<Value> Buffer::HexWrite(const Arguments& args) {
uint32_t end = start + size;
if (start >= parent->length_) {
- Local<Integer> val = Integer::New(0);
+ Local<Integer> val = Integer::New(0, node_isolate);
constructor_template->GetFunction()->Set(chars_written_sym, val);
return scope.Close(val);
}
@@ -696,7 +697,7 @@ Handle<Value> Buffer::HexWrite(const Arguments& args) {
}
if (size == 0) {
- Local<Integer> val = Integer::New(0);
+ Local<Integer> val = Integer::New(0, node_isolate);
constructor_template->GetFunction()->Set(chars_written_sym, val);
return scope.Close(val);
}
@@ -718,15 +719,15 @@ Handle<Value> Buffer::HexWrite(const Arguments& args) {
}
constructor_template->GetFunction()->Set(chars_written_sym,
- Integer::New(max * 2));
+ Integer::New(max * 2, node_isolate));
- return scope.Close(Integer::New(max));
+ return scope.Close(Integer::New(max, node_isolate));
}
// var charsWritten = buffer.asciiWrite(string, offset);
Handle<Value> Buffer::AsciiWrite(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args.This());
@@ -755,15 +756,15 @@ Handle<Value> Buffer::AsciiWrite(const Arguments &args) {
String::NO_NULL_TERMINATION));
constructor_template->GetFunction()->Set(chars_written_sym,
- Integer::New(written));
+ Integer::New(written, node_isolate));
- return scope.Close(Integer::New(written));
+ return scope.Close(Integer::New(written, node_isolate));
}
// var bytesWritten = buffer.base64Write(string, offset, [maxLength]);
Handle<Value> Buffer::Base64Write(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args.This());
@@ -818,14 +819,15 @@ Handle<Value> Buffer::Base64Write(const Arguments &args) {
}
constructor_template->GetFunction()->Set(chars_written_sym,
- Integer::New(dst - start));
+ Integer::New(dst - start,
+ node_isolate));
- return scope.Close(Integer::New(dst - start));
+ return scope.Close(Integer::New(dst - start, node_isolate));
}
Handle<Value> Buffer::BinaryWrite(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args.This());
@@ -850,9 +852,9 @@ Handle<Value> Buffer::BinaryWrite(const Arguments &args) {
int written = DecodeWrite(p, max_length, s, BINARY);
constructor_template->GetFunction()->Set(chars_written_sym,
- Integer::New(written));
+ Integer::New(written, node_isolate));
- return scope.Close(Integer::New(written));
+ return scope.Close(Integer::New(written, node_isolate));
}
@@ -949,7 +951,7 @@ Handle<Value> WriteFloatGeneric(const Arguments& args) {
if (ENDIANNESS != is_big_endian())
swizzle(ptr, sizeof(T));
- return Undefined();
+ return Undefined(node_isolate);
}
@@ -975,7 +977,7 @@ Handle<Value> Buffer::WriteDoubleBE(const Arguments& args) {
// var nbytes = Buffer.byteLength("string", "utf8")
Handle<Value> Buffer::ByteLength(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (!args[0]->IsString()) {
return ThrowTypeError("Argument must be a string");
@@ -984,12 +986,12 @@ Handle<Value> Buffer::ByteLength(const Arguments &args) {
Local<String> s = args[0]->ToString();
enum encoding e = ParseEncoding(args[1], UTF8);
- return scope.Close(Integer::New(node::ByteLength(s, e)));
+ return scope.Close(Integer::New(node::ByteLength(s, e), node_isolate));
}
Handle<Value> Buffer::MakeFastBuffer(const Arguments &args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
if (!Buffer::HasInstance(args[0])) {
return ThrowTypeError("First argument must be a Buffer");
@@ -1017,7 +1019,7 @@ Handle<Value> Buffer::MakeFastBuffer(const Arguments &args) {
kExternalUnsignedByteArray,
length);
- return Undefined();
+ return Undefined(node_isolate);
}
@@ -1042,7 +1044,7 @@ Handle<Value> SetFastBufferConstructor(const Arguments& args) {
assert(args[0]->IsFunction());
fast_buffer_constructor = Persistent<Function>::New(node_isolate,
args[0].As<Function>());
- return Undefined();
+ return Undefined(node_isolate);
}
@@ -1102,7 +1104,7 @@ RetainedObjectInfo* WrapperInfo(uint16_t class_id, Handle<Value> wrapper) {
void Buffer::Initialize(Handle<Object> target) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
// sanity checks
assert(unbase64('/') == 63);
View
14 src/node_counters.cc
@@ -44,37 +44,37 @@ static uint64_t counter_gc_end_time;
Handle<Value> COUNTER_NET_SERVER_CONNECTION(const Arguments& args) {
NODE_COUNT_SERVER_CONN_OPEN();
- return Undefined();
+ return Undefined(node_isolate);
}
Handle<Value> COUNTER_NET_SERVER_CONNECTION_CLOSE(const Arguments& args) {
NODE_COUNT_SERVER_CONN_CLOSE();
- return Undefined();
+ return Undefined(node_isolate);
}
Handle<Value> COUNTER_HTTP_SERVER_REQUEST(const Arguments& args) {
NODE_COUNT_HTTP_SERVER_REQUEST();
- return Undefined();
+ return Undefined(node_isolate);
}
Handle<Value> COUNTER_HTTP_SERVER_RESPONSE(const Arguments& args) {
NODE_COUNT_HTTP_SERVER_RESPONSE();
- return Undefined();
+ return Undefined(node_isolate);
}
Handle<Value> COUNTER_HTTP_CLIENT_REQUEST(const Arguments& args) {
NODE_COUNT_HTTP_CLIENT_REQUEST();
- return Undefined();
+ return Undefined(node_isolate);
}
Handle<Value> COUNTER_HTTP_CLIENT_RESPONSE(const Arguments& args) {
NODE_COUNT_HTTP_CLIENT_RESPONSE();
- return Undefined();
+ return Undefined(node_isolate);
}
@@ -106,7 +106,7 @@ static void counter_gc_done(GCType type, GCCallbackFlags flags) {
#define NODE_PROBE(name) #name, name
void InitPerfCounters(Handle<Object> target) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
static struct {
const char* name;
View
350 src/node_crypto.cc
@@ -120,7 +120,7 @@ static void crypto_lock_cb(int mode, int n, const char* file, int line) {
Handle<Value> ThrowCryptoErrorHelper(unsigned long err, bool is_type_error) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
char errmsg[128];
ERR_error_string_n(err, errmsg, sizeof(errmsg));
return is_type_error ? ThrowTypeError(errmsg) : ThrowError(errmsg);
@@ -138,7 +138,7 @@ Handle<Value> ThrowCryptoTypeError(unsigned long err) {
void SecureContext::Initialize(Handle<Object> target) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<FunctionTemplate> t = FunctionTemplate::New(SecureContext::New);
secure_context_constructor = Persistent<FunctionTemplate>::New(node_isolate,
@@ -165,7 +165,7 @@ void SecureContext::Initialize(Handle<Object> target) {
Handle<Value> SecureContext::New(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
SecureContext *p = new SecureContext();
p->Wrap(args.Holder());
return args.This();
@@ -173,7 +173,7 @@ Handle<Value> SecureContext::New(const Arguments& args) {
Handle<Value> SecureContext::Init(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
@@ -234,7 +234,7 @@ Handle<Value> SecureContext::Init(const Arguments& args) {
SSL_CTX_sess_set_new_cb(sc->ctx_, NewSessionCallback);
sc->ca_store_ = NULL;
- return True();
+ return True(node_isolate);
}
@@ -242,7 +242,7 @@ SSL_SESSION* SecureContext::GetSessionCallback(SSL* s,
unsigned char* key,
int len,
int* copy) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Connection* p = static_cast<Connection*>(SSL_get_app_data(s));
@@ -260,7 +260,7 @@ void SessionDataFree(char* data, void* hint) {
int SecureContext::NewSessionCallback(SSL* s, SSL_SESSION* sess) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Connection* p = static_cast<Connection*>(SSL_get_app_data(s));
@@ -295,7 +295,7 @@ static BIO* LoadBIO (Handle<Value> v) {
BIO *bio = BIO_new(BIO_s_mem());
if (!bio) return NULL;
- HandleScope scope;
+ HandleScope scope(node_isolate);
int r = -1;
@@ -320,7 +320,7 @@ static BIO* LoadBIO (Handle<Value> v) {
// Takes a string or buffer and loads it into an X509
// Caller responsible for X509_free-ing the returned object.
static X509* LoadX509 (Handle<Value> v) {
- HandleScope scope; // necessary?
+ HandleScope scope(node_isolate); // necessary?
BIO *bio = LoadBIO(v);
if (!bio) return NULL;
@@ -337,7 +337,7 @@ static X509* LoadX509 (Handle<Value> v) {
Handle<Value> SecureContext::SetKey(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
@@ -350,7 +350,7 @@ Handle<Value> SecureContext::SetKey(const Arguments& args) {
}
BIO *bio = LoadBIO(args[0]);
- if (!bio) return False();
+ if (!bio) return False(node_isolate);
String::Utf8Value passphrase(args[1]);
@@ -371,7 +371,7 @@ Handle<Value> SecureContext::SetKey(const Arguments& args) {
EVP_PKEY_free(key);
BIO_free_all(bio);
- return True();
+ return True(node_isolate);
}
@@ -442,7 +442,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX *ctx, BIO *in) {
Handle<Value> SecureContext::SetCert(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
@@ -452,7 +452,7 @@ Handle<Value> SecureContext::SetCert(const Arguments& args) {
}
BIO* bio = LoadBIO(args[0]);
- if (!bio) return False();
+ if (!bio) return False(node_isolate);
int rv = SSL_CTX_use_certificate_chain(sc->ctx_, bio);
@@ -467,13 +467,13 @@ Handle<Value> SecureContext::SetCert(const Arguments& args) {
return ThrowCryptoError(err);
}
- return True();
+ return True(node_isolate);
}
Handle<Value> SecureContext::AddCACert(const Arguments& args) {
bool newCAStore = false;
- HandleScope scope;
+ HandleScope scope(node_isolate);
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
@@ -487,7 +487,7 @@ Handle<Value> SecureContext::AddCACert(const Arguments& args) {
}
X509* x509 = LoadX509(args[0]);
- if (!x509) return False();
+ if (!x509) return False(node_isolate);
X509_STORE_add_cert(sc->ca_store_, x509);
SSL_CTX_add_client_CA(sc->ctx_, x509);
@@ -498,12 +498,12 @@ Handle<Value> SecureContext::AddCACert(const Arguments& args) {
SSL_CTX_set_cert_store(sc->ctx_, sc->ca_store_);
}
- return True();
+ return True(node_isolate);
}
Handle<Value> SecureContext::AddCRL(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
@@ -512,13 +512,13 @@ Handle<Value> SecureContext::AddCRL(const Arguments& args) {
}
BIO *bio = LoadBIO(args[0]);
- if (!bio) return False();
+ if (!bio) return False(node_isolate);
X509_CRL *x509 = PEM_read_bio_X509_CRL(bio, NULL, NULL, NULL);
if (x509 == NULL) {
BIO_free_all(bio);
- return False();
+ return False(node_isolate);
}
X509_STORE_add_crl(sc->ca_store_, x509);
@@ -529,13 +529,13 @@ Handle<Value> SecureContext::AddCRL(const Arguments& args) {
BIO_free_all(bio);
X509_CRL_free(x509);
- return True();
+ return True(node_isolate);
}
Handle<Value> SecureContext::AddRootCerts(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
@@ -549,14 +549,14 @@ Handle<Value> SecureContext::AddRootCerts(const Arguments& args) {
if (!BIO_write(bp, root_certs[i], strlen(root_certs[i]))) {
BIO_free_all(bp);
- return False();
+ return False(node_isolate);
}
X509 *x509 = PEM_read_bio_X509(bp, NULL, NULL, NULL);
if (x509 == NULL) {
BIO_free_all(bp);
- return False();
+ return False(node_isolate);
}
X509_STORE_add_cert(root_cert_store, x509);
@@ -569,12 +569,12 @@ Handle<Value> SecureContext::AddRootCerts(const Arguments& args) {
sc->ca_store_ = root_cert_store;
SSL_CTX_set_cert_store(sc->ctx_, sc->ca_store_);
- return True();
+ return True(node_isolate);
}
Handle<Value> SecureContext::SetCiphers(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
@@ -585,11 +585,11 @@ Handle<Value> SecureContext::SetCiphers(const Arguments& args) {
String::Utf8Value ciphers(args[0]);
SSL_CTX_set_cipher_list(sc->ctx_, *ciphers);
- return True();
+ return True(node_isolate);
}
Handle<Value> SecureContext::SetOptions(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
@@ -599,11 +599,11 @@ Handle<Value> SecureContext::SetOptions(const Arguments& args) {
SSL_CTX_set_options(sc->ctx_, args[0]->IntegerValue());
- return True();
+ return True(node_isolate);
}
Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
@@ -631,19 +631,19 @@ Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
return ThrowException(Exception::TypeError(message));
}
- return True();
+ return True(node_isolate);
}
Handle<Value> SecureContext::Close(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
sc->FreeCTXMem();
- return False();
+ return False(node_isolate);
}
//Takes .pfx or .p12 and password in string or buffer format
Handle<Value> SecureContext::LoadPKCS12(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
BIO* in = NULL;
PKCS12* p12 = NULL;
@@ -715,12 +715,12 @@ Handle<Value> SecureContext::LoadPKCS12(const Arguments& args) {
return ThrowException(Exception::Error(String::New(str)));
}
- return True();
+ return True(node_isolate);
}
size_t ClientHelloParser::Write(const uint8_t* data, size_t len) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
// Just accumulate data, everything will be pushed to BIO later
if (state_ == kPaused) return 0;
@@ -888,7 +888,7 @@ int Connection::HandleBIOError(BIO *bio, const char* func, int rv) {
static char ssl_error_buf[512];
ERR_error_string_n(rv, ssl_error_buf, sizeof(ssl_error_buf));
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<Value> e = Exception::Error(String::New(ssl_error_buf));
handle_->Set(String::New("error"), e);
@@ -929,7 +929,7 @@ int Connection::HandleSSLError(const char* func, int rv, ZeroStatus zs) {
return 0;
} else {
- HandleScope scope;
+ HandleScope scope(node_isolate);
BUF_MEM* mem;
BIO *bio;
@@ -957,7 +957,7 @@ int Connection::HandleSSLError(const char* func, int rv, ZeroStatus zs) {
void Connection::ClearError() {
#ifndef NDEBUG
- HandleScope scope;
+ HandleScope scope(node_isolate);
// We should clear the error in JS-land
assert(handle_->Get(String::New("error"))->BooleanValue() == false);
@@ -966,22 +966,22 @@ void Connection::ClearError() {
void Connection::SetShutdownFlags() {
- HandleScope scope;
+ HandleScope scope(node_isolate);
int flags = SSL_get_shutdown(ssl_);
if (flags & SSL_SENT_SHUTDOWN) {
- handle_->Set(String::New("sentShutdown"), True());
+ handle_->Set(String::New("sentShutdown"), True(node_isolate));
}
if (flags & SSL_RECEIVED_SHUTDOWN) {
- handle_->Set(String::New("receivedShutdown"), True());
+ handle_->Set(String::New("receivedShutdown"), True(node_isolate));
}
}
void Connection::Initialize(Handle<Object> target) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<FunctionTemplate> t = FunctionTemplate::New(Connection::New);
t->InstanceTemplate()->SetInternalFieldCount(1);
@@ -1105,7 +1105,8 @@ int Connection::SelectNextProtoCallback_(SSL *s,