Index: src/extensions/externalize-string-extension.cc |
diff --git a/src/extensions/externalize-string-extension.cc b/src/extensions/externalize-string-extension.cc |
index e45cb67efa899dd2cf0661dc96bcbb8eb9548793..e2213b0bd4b65c2455e8d86a8b911a06eece49d4 100644 |
--- a/src/extensions/externalize-string-extension.cc |
+++ b/src/extensions/externalize-string-extension.cc |
@@ -54,28 +54,36 @@ ExternalizeStringExtension::GetNativeFunctionTemplate( |
void ExternalizeStringExtension::Externalize( |
const v8::FunctionCallbackInfo<v8::Value>& args) { |
if (args.Length() < 1 || !args[0]->IsString()) { |
- args.GetIsolate()->ThrowException(v8::String::NewFromUtf8( |
- args.GetIsolate(), |
- "First parameter to externalizeString() must be a string.")); |
+ args.GetIsolate()->ThrowException( |
+ v8::String::NewFromUtf8( |
+ args.GetIsolate(), |
+ "First parameter to externalizeString() must be a string.", |
+ NewStringType::kNormal).ToLocalChecked()); |
return; |
} |
bool force_two_byte = false; |
if (args.Length() >= 2) { |
if (args[1]->IsBoolean()) { |
- force_two_byte = args[1]->BooleanValue(); |
+ force_two_byte = |
+ args[1] |
+ ->BooleanValue(args.GetIsolate()->GetCurrentContext()) |
+ .FromJust(); |
} else { |
- args.GetIsolate()->ThrowException(v8::String::NewFromUtf8( |
- args.GetIsolate(), |
- "Second parameter to externalizeString() must be a boolean.")); |
+ args.GetIsolate()->ThrowException( |
+ v8::String::NewFromUtf8( |
+ args.GetIsolate(), |
+ "Second parameter to externalizeString() must be a boolean.", |
+ NewStringType::kNormal).ToLocalChecked()); |
return; |
} |
} |
bool result = false; |
Handle<String> string = Utils::OpenHandle(*args[0].As<v8::String>()); |
if (string->IsExternalString()) { |
- args.GetIsolate()->ThrowException(v8::String::NewFromUtf8( |
- args.GetIsolate(), |
- "externalizeString() can't externalize twice.")); |
+ args.GetIsolate()->ThrowException( |
+ v8::String::NewFromUtf8(args.GetIsolate(), |
+ "externalizeString() can't externalize twice.", |
+ NewStringType::kNormal).ToLocalChecked()); |
return; |
} |
if (string->IsOneByteRepresentation() && !force_two_byte) { |
@@ -102,8 +110,10 @@ void ExternalizeStringExtension::Externalize( |
if (!result) delete resource; |
} |
if (!result) { |
- args.GetIsolate()->ThrowException(v8::String::NewFromUtf8( |
- args.GetIsolate(), "externalizeString() failed.")); |
+ args.GetIsolate()->ThrowException( |
+ v8::String::NewFromUtf8(args.GetIsolate(), |
+ "externalizeString() failed.", |
+ NewStringType::kNormal).ToLocalChecked()); |
return; |
} |
} |
@@ -112,9 +122,11 @@ void ExternalizeStringExtension::Externalize( |
void ExternalizeStringExtension::IsOneByte( |
const v8::FunctionCallbackInfo<v8::Value>& args) { |
if (args.Length() != 1 || !args[0]->IsString()) { |
- args.GetIsolate()->ThrowException(v8::String::NewFromUtf8( |
- args.GetIsolate(), |
- "isOneByteString() requires a single string argument.")); |
+ args.GetIsolate()->ThrowException( |
+ v8::String::NewFromUtf8( |
+ args.GetIsolate(), |
+ "isOneByteString() requires a single string argument.", |
+ NewStringType::kNormal).ToLocalChecked()); |
return; |
} |
bool is_one_byte = |