Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ Local<Value> ErrnoException(Isolate* isolate,
e = Exception::Error(cons2);
}

Local<Object> obj = e->ToObject();
Local<Object> obj = e->ToObject(env->isolate());
obj->Set(env->errno_string(), Integer::New(env->isolate(), errorno));
obj->Set(env->code_string(), estring);

Expand Down Expand Up @@ -819,7 +819,7 @@ Local<Value> UVException(Isolate* isolate,
e = Exception::Error(cons2);
}

Local<Object> obj = e->ToObject();
Local<Object> obj = e->ToObject(env->isolate());
// TODO(piscisaureus) errno should probably go
obj->Set(env->errno_string(), Integer::New(env->isolate(), errorno));
obj->Set(env->code_string(), estring);
Expand Down Expand Up @@ -899,7 +899,7 @@ Local<Value> WinapiErrnoException(Isolate* isolate,
e = Exception::Error(message);
}

Local<Object> obj = e->ToObject();
Local<Object> obj = e->ToObject(env->isolate());
obj->Set(env->errno_string(), Integer::New(isolate, errorno));

if (path != nullptr) {
Expand Down Expand Up @@ -1350,9 +1350,9 @@ void AppendExceptionLine(Environment* env,
goto print;

err_obj->Set(env->message_string(),
String::Concat(arrow_str, msg->ToString()));
String::Concat(arrow_str, msg->ToString(env->isolate())));
err_obj->Set(env->stack_string(),
String::Concat(arrow_str, stack->ToString()));
String::Concat(arrow_str, stack->ToString(env->isolate())));
return;

print:
Expand All @@ -1376,7 +1376,7 @@ static void ReportException(Environment* env,
if (er->IsUndefined() || er->IsNull())
trace_value = Undefined(env->isolate());
else
trace_value = er->ToObject()->Get(env->stack_string());
trace_value = er->ToObject(env->isolate())->Get(env->stack_string());

node::Utf8Value trace(trace_value);

Expand Down Expand Up @@ -1988,7 +1988,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
return;
}

Local<Object> module = args[0]->ToObject(); // Cast
Local<Object> module = args[0]->ToObject(env->isolate()); // Cast
node::Utf8Value filename(args[1]); // Cast
const bool is_dlopen_error = uv_dlopen(*filename, &lib);

Expand All @@ -2002,7 +2002,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
Local<String> errmsg = OneByteString(env->isolate(), uv_dlerror(&lib));
#ifdef _WIN32
// Windows needs to add the filename into the error message
errmsg = String::Concat(errmsg, args[1]->ToString());
errmsg = String::Concat(errmsg, args[1]->ToString(env->isolate()));
#endif // _WIN32
env->isolate()->ThrowException(Exception::Error(errmsg));
return;
Expand Down Expand Up @@ -2031,7 +2031,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
modlist_addon = mp;

Local<String> exports_string = env->exports_string();
Local<Object> exports = module->Get(exports_string)->ToObject();
Local<Object> exports = module->Get(exports_string)->ToObject(env->isolate());

if (mp->nm_context_register_func != nullptr) {
mp->nm_context_register_func(exports, module, env->context(), mp->nm_priv);
Expand Down Expand Up @@ -2123,14 +2123,14 @@ void OnMessage(Handle<Message> message, Handle<Value> error) {
static void Binding(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);

Local<String> module = args[0]->ToString();
Local<String> module = args[0]->ToString(env->isolate());
node::Utf8Value module_v(module);

Local<Object> cache = env->binding_cache_object();
Local<Object> exports;

if (cache->Has(module)) {
exports = cache->Get(module)->ToObject();
exports = cache->Get(module)->ToObject(env->isolate());
args.GetReturnValue().Set(exports);
return;
}
Expand Down Expand Up @@ -2176,7 +2176,7 @@ static void Binding(const FunctionCallbackInfo<Value>& args) {
static void LinkedBinding(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());

Local<String> module = args[0]->ToString();
Local<String> module = args[0]->ToString(env->isolate());

Local<Object> cache = env->binding_cache_object();
Local<Value> exports_v = cache->Get(module);
Expand Down Expand Up @@ -2792,8 +2792,8 @@ static void RawDebug(const FunctionCallbackInfo<Value>& args) {
void LoadEnvironment(Environment* env) {
HandleScope handle_scope(env->isolate());

V8::SetFatalErrorHandler(node::OnFatalError);
V8::AddMessageListener(OnMessage);
env->isolate()->SetFatalErrorHandler(node::OnFatalError);
env->isolate()->AddMessageListener(OnMessage);

// Compile, execute the src/node.js file. (Which was included as static C
// string in node_natives.h. 'natve_node' is the string containing that
Expand Down Expand Up @@ -3485,7 +3485,7 @@ void EmitBeforeExit(Environment* env) {
Local<String> exit_code = FIXED_ONE_BYTE_STRING(env->isolate(), "exitCode");
Local<Value> args[] = {
FIXED_ONE_BYTE_STRING(env->isolate(), "beforeExit"),
process_object->Get(exit_code)->ToInteger()
process_object->Get(exit_code)->ToInteger(env->isolate())
};
MakeCallback(env, process_object, "emit", ARRAY_SIZE(args), args);
}
Expand Down
6 changes: 3 additions & 3 deletions src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ void Base64Slice(const FunctionCallbackInfo<Value>& args) {
void Copy(const FunctionCallbackInfo<Value> &args) {
Environment* env = Environment::GetCurrent(args);

Local<Object> target = args[0]->ToObject();
Local<Object> target = args[0]->ToObject(env->isolate());

if (!HasInstance(target))
return env->ThrowTypeError("first arg should be a Buffer");
Expand Down Expand Up @@ -421,7 +421,7 @@ void StringWrite(const FunctionCallbackInfo<Value>& args) {
if (!args[0]->IsString())
return env->ThrowTypeError("Argument must be a string");

Local<String> str = args[0]->ToString();
Local<String> str = args[0]->ToString(env->isolate());

if (encoding == HEX && str->Length() % 2 != 0)
return env->ThrowTypeError("Invalid hex string");
Expand Down Expand Up @@ -583,7 +583,7 @@ void ByteLength(const FunctionCallbackInfo<Value> &args) {
if (!args[0]->IsString())
return env->ThrowTypeError("Argument must be a string");

Local<String> s = args[0]->ToString();
Local<String> s = args[0]->ToString(env->isolate());
enum encoding e = ParseEncoding(env->isolate(), args[1], UTF8);

uint32_t size = StringBytes::Size(env->isolate(), s, e);
Expand Down
13 changes: 8 additions & 5 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,16 @@ class ContextifyContext {
HandleScope scope(env()->isolate());

Local<Context> context = PersistentToLocal(env()->isolate(), context_);
Local<Object> global = context->Global()->GetPrototype()->ToObject();
Local<Object> global =
context->Global()->GetPrototype()->ToObject(env()->isolate());
Local<Object> sandbox = PersistentToLocal(env()->isolate(), sandbox_);

Local<Function> clone_property_method;

Local<Array> names = global->GetOwnPropertyNames();
int length = names->Length();
for (int i = 0; i < length; i++) {
Local<String> key = names->Get(i)->ToString();
Local<String> key = names->Get(i)->ToString(env()->isolate());
bool has = sandbox->HasOwnProperty(key);
if (!has) {
// Could also do this like so:
Expand Down Expand Up @@ -253,7 +254,7 @@ class ContextifyContext {


static void RunInDebugContext(const FunctionCallbackInfo<Value>& args) {
Local<String> script_source(args[0]->ToString());
Local<String> script_source(args[0]->ToString(args.GetIsolate()));
if (script_source.IsEmpty())
return; // Exception pending.
Context::Scope context_scope(Debug::GetDebugContext());
Expand Down Expand Up @@ -476,7 +477,7 @@ class ContextifyScript : public BaseObject {
new ContextifyScript(env, args.This());

TryCatch try_catch;
Local<String> code = args[0]->ToString();
Local<String> code = args[0]->ToString(env->isolate());
Local<String> filename = GetFilenameArg(args, 1);
bool display_errors = GetDisplayErrorsArg(args, 1);
if (try_catch.HasCaught()) {
Expand Down Expand Up @@ -643,7 +644,9 @@ class ContextifyScript : public BaseObject {
Local<String> key = FIXED_ONE_BYTE_STRING(args.GetIsolate(), "filename");
Local<Value> value = args[i].As<Object>()->Get(key);

return value->IsUndefined() ? defaultFilename : value->ToString();
if (value->IsUndefined())
return defaultFilename;
return value->ToString(args.GetIsolate());
}


Expand Down
20 changes: 14 additions & 6 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@ void SSLWrap<Base>::VerifyError(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Local<String> reason_string = OneByteString(isolate, reason);
Local<Value> exception_value = Exception::Error(reason_string);
Local<Object> exception_object = exception_value->ToObject();
Local<Object> exception_object = exception_value->ToObject(isolate);
exception_object->Set(FIXED_ONE_BYTE_STRING(isolate, "code"),
OneByteString(isolate, code));
args.GetReturnValue().Set(exception_object);
Expand Down Expand Up @@ -2169,7 +2169,7 @@ void Connection::New(const FunctionCallbackInfo<Value>& args) {
return;
}

SecureContext* sc = Unwrap<SecureContext>(args[0]->ToObject());
SecureContext* sc = Unwrap<SecureContext>(args[0]->ToObject(env->isolate()));

bool is_server = args[1]->BooleanValue();

Expand Down Expand Up @@ -3004,7 +3004,9 @@ void Hmac::HmacDigest(const FunctionCallbackInfo<Value>& args) {

enum encoding encoding = BUFFER;
if (args.Length() >= 1) {
encoding = ParseEncoding(env->isolate(), args[0]->ToString(), BUFFER);
encoding = ParseEncoding(env->isolate(),
args[0]->ToString(env->isolate()),
BUFFER);
}

unsigned char* md_value = nullptr;
Expand Down Expand Up @@ -3119,7 +3121,9 @@ void Hash::HashDigest(const FunctionCallbackInfo<Value>& args) {

enum encoding encoding = BUFFER;
if (args.Length() >= 1) {
encoding = ParseEncoding(env->isolate(), args[0]->ToString(), BUFFER);
encoding = ParseEncoding(env->isolate(),
args[0]->ToString(env->isolate()),
BUFFER);
}

unsigned char md_value[EVP_MAX_MD_SIZE];
Expand Down Expand Up @@ -3319,7 +3323,9 @@ void Sign::SignFinal(const FunctionCallbackInfo<Value>& args) {
unsigned int len = args.Length();
enum encoding encoding = BUFFER;
if (len >= 2 && args[1]->IsString()) {
encoding = ParseEncoding(env->isolate(), args[1]->ToString(), BUFFER);
encoding = ParseEncoding(env->isolate(),
args[1]->ToString(env->isolate()),
BUFFER);
}

node::Utf8Value passphrase(args[2]);
Expand Down Expand Up @@ -3532,7 +3538,9 @@ void Verify::VerifyFinal(const FunctionCallbackInfo<Value>& args) {
// BINARY works for both buffers and binary strings.
enum encoding encoding = BINARY;
if (args.Length() >= 3) {
encoding = ParseEncoding(env->isolate(), args[2]->ToString(), BINARY);
encoding = ParseEncoding(env->isolate(),
args[2]->ToString(env->isolate()),
BINARY);
}

ssize_t hlen = StringBytes::Size(env->isolate(), args[1], encoding);
Expand Down
2 changes: 1 addition & 1 deletion src/node_dtrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ using v8::Value;
"expected object for " #obj " to contain integer member " #member); \
} \
*valp = obj->Get(OneByteString(env->isolate(), #member)) \
->ToInteger()->Value();
->ToInteger(env->isolate())->Value();

#define SLURP_OBJECT(obj, member, valp) \
if (!(obj)->IsObject()) { \
Expand Down
2 changes: 1 addition & 1 deletion src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ static void Read(const FunctionCallbackInfo<Value>& args) {
return env->ThrowError("Second argument needs to be a buffer");
}

Local<Object> buffer_obj = args[1]->ToObject();
Local<Object> buffer_obj = args[1]->ToObject(env->isolate());
char *buffer_data = Buffer::Data(buffer_obj);
size_t buffer_length = Buffer::Length(buffer_obj);

Expand Down
4 changes: 2 additions & 2 deletions src/node_http_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ class Parser : public BaseObject {
enum http_errno err = HTTP_PARSER_ERRNO(&parser->parser_);

Local<Value> e = Exception::Error(env->parse_error_string());
Local<Object> obj = e->ToObject();
Local<Object> obj = e->ToObject(env->isolate());
obj->Set(env->bytes_parsed_string(), nparsed_obj);
obj->Set(env->code_string(),
OneByteString(env->isolate(), http_errno_name(err)));
Expand Down Expand Up @@ -450,7 +450,7 @@ class Parser : public BaseObject {
enum http_errno err = HTTP_PARSER_ERRNO(&parser->parser_);

Local<Value> e = env->parse_error_string();
Local<Object> obj = e->ToObject();
Local<Object> obj = e->ToObject(env->isolate());
obj->Set(env->bytes_parsed_string(), Integer::New(env->isolate(), 0));
obj->Set(env->code_string(),
OneByteString(env->isolate(), http_errno_name(err)));
Expand Down
6 changes: 3 additions & 3 deletions src/node_zlib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class ZCtx : public AsyncWrap {
} else {
CHECK(Buffer::HasInstance(args[1]));
Local<Object> in_buf;
in_buf = args[1]->ToObject();
in_buf = args[1]->ToObject(args.GetIsolate());
in_off = args[2]->Uint32Value();
in_len = args[3]->Uint32Value();

Expand All @@ -187,7 +187,7 @@ class ZCtx : public AsyncWrap {
}

CHECK(Buffer::HasInstance(args[4]));
Local<Object> out_buf = args[4]->ToObject();
Local<Object> out_buf = args[4]->ToObject(args.GetIsolate());
out_off = args[5]->Uint32Value();
out_len = args[6]->Uint32Value();
CHECK(Buffer::IsWithinBounds(out_off, out_len, Buffer::Length(out_buf)));
Expand Down Expand Up @@ -420,7 +420,7 @@ class ZCtx : public AsyncWrap {
char* dictionary = nullptr;
size_t dictionary_len = 0;
if (args.Length() >= 5 && Buffer::HasInstance(args[4])) {
Local<Object> dictionary_ = args[4]->ToObject();
Local<Object> dictionary_ = args[4]->ToObject(args.GetIsolate());

dictionary_len = Buffer::Length(dictionary_);
dictionary = new char[dictionary_len];
Expand Down
2 changes: 1 addition & 1 deletion src/process_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class ProcessWrap : public HandleWrap {

ProcessWrap* wrap = Unwrap<ProcessWrap>(args.Holder());

Local<Object> js_options = args[0]->ToObject();
Local<Object> js_options = args[0]->ToObject(env->isolate());

uv_process_options_t options;
memset(&options, 0, sizeof(uv_process_options_t));
Expand Down
3 changes: 2 additions & 1 deletion src/smalloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ const char RetainedAllocInfo::label_[] = "smalloc";


RetainedAllocInfo::RetainedAllocInfo(Handle<Value> wrapper) {
Local<Object> obj = wrapper->ToObject();
// TODO(trevnorris): Fix to properly acquire the Isolate.
Local<Object> obj = wrapper->ToObject(Isolate::GetCurrent());
length_ = obj->GetIndexedPropertiesExternalArrayDataLength();
data_ = static_cast<char*>(obj->GetIndexedPropertiesExternalArrayData());
}
Expand Down
4 changes: 2 additions & 2 deletions src/spawn_sync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ int SyncProcessRunner::CopyJsString(Local<Value> js_value,
if (js_value->IsString())
js_string = js_value.As<String>();
else
js_string = js_value->ToString();
js_string = js_value->ToString(env()->isolate());

// Include space for null terminator byte.
size = StringBytes::StorageSize(isolate, js_string, UTF8) + 1;
Expand Down Expand Up @@ -992,7 +992,7 @@ int SyncProcessRunner::CopyJsStringArray(Local<Value> js_value,
// needed - it's okay since we cloned the original object.
for (uint32_t i = 0; i < length; i++) {
if (!js_array->Get(i)->IsString())
js_array->Set(i, js_array->Get(i)->ToString());
js_array->Set(i, js_array->Get(i)->ToString(env()->isolate()));
}

// Index has a pointer to every string element, plus one more for a final
Expand Down
4 changes: 2 additions & 2 deletions src/stream_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ void StreamWrap::Writev(const FunctionCallbackInfo<Value>& args) {
// Buffer chunk, no additional storage required

// String chunk
Handle<String> string = chunk->ToString();
Handle<String> string = chunk->ToString(env->isolate());
enum encoding encoding = ParseEncoding(env->isolate(),
chunks->Get(i * 2 + 1));
size_t chunk_size;
Expand Down Expand Up @@ -477,7 +477,7 @@ void StreamWrap::Writev(const FunctionCallbackInfo<Value>& args) {
char* str_storage = storage + offset;
size_t str_size = storage_size - offset;

Handle<String> string = chunk->ToString();
Handle<String> string = chunk->ToString(env->isolate());
enum encoding encoding = ParseEncoding(env->isolate(),
chunks->Get(i * 2 + 1));
str_size = StringBytes::Write(env->isolate(),
Expand Down
4 changes: 2 additions & 2 deletions src/string_bytes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ size_t StringBytes::StorageSize(Isolate* isolate,
return Buffer::Length(val);
}

Local<String> str = val->ToString();
Local<String> str = val->ToString(isolate);

switch (encoding) {
case BINARY:
Expand Down Expand Up @@ -461,7 +461,7 @@ size_t StringBytes::Size(Isolate* isolate,
if (GetExternalParts(isolate, val, &data, &data_size))
return data_size;

Local<String> str = val->ToString();
Local<String> str = val->ToString(isolate);

switch (encoding) {
case BINARY:
Expand Down
Loading