[d8] Remove deprecated calls from d8-readline
authorbinji <binji@chromium.org>
Tue, 21 Jul 2015 03:28:39 +0000 (20:28 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 21 Jul 2015 03:28:43 +0000 (03:28 +0000)
R=jochen@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/1242973002

Cr-Commit-Position: refs/heads/master@{#29767}

src/d8-readline.cc

index eca6553..e57b756 100644 (file)
@@ -85,7 +85,8 @@ Local<String> ReadLineEditor::Prompt(const char* prompt) {
   result = readline(prompt);
   if (result == NULL) return Local<String>();
   AddHistory(result);
-  return String::NewFromUtf8(isolate_, result);
+  return String::NewFromUtf8(isolate_, result, NewStringType::kNormal)
+      .ToLocalChecked();
 }
 
 
@@ -123,21 +124,23 @@ char* ReadLineEditor::CompletionGenerator(const char* text, int state) {
   HandleScope scope(isolate);
   Local<Array> completions;
   if (state == 0) {
-    Local<String> full_text = String::NewFromUtf8(isolate,
-                                                  rl_line_buffer,
-                                                  String::kNormalString,
-                                                  rl_point);
-    completions = Shell::GetCompletions(isolate,
-                                        String::NewFromUtf8(isolate, text),
-                                        full_text);
+    Local<String> full_text =
+        String::NewFromUtf8(isolate, rl_line_buffer, NewStringType::kNormal,
+                            rl_point)
+            .ToLocalChecked();
+    completions = Shell::GetCompletions(
+        isolate, String::NewFromUtf8(isolate, text, NewStringType::kNormal)
+                     .ToLocalChecked(),
+        full_text);
     current_completions.Reset(isolate, completions);
     current_index = 0;
   } else {
     completions = Local<Array>::New(isolate, current_completions);
   }
   if (current_index < completions->Length()) {
+    Local<Context> context(isolate->GetCurrentContext());
     Local<Integer> index = Integer::New(isolate, current_index);
-    Local<Value> str_obj = completions->Get(index);
+    Local<Value> str_obj = completions->Get(context, index).ToLocalChecked();
     current_index++;
     String::Utf8Value str(str_obj);
     return strdup(*str);