Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Unified Diff: src/extensions/externalize-string-extension.cc

Issue 1162363005: Remove usage of to-be-deprecated APIs from v8 core (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.cc ('k') | src/extensions/gc-extension.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 =
« no previous file with comments | « src/api.cc ('k') | src/extensions/gc-extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698