Skip to content

Commit ebadb68

Browse files
jeisingerCommit bot
authored andcommitted
Remove usage of to-be-deprecated APIs from samples
BUG=v8:4134 R=vogelheim@chromium.org LOG=n Review URL: https://codereview.chromium.org/1219133004 Cr-Commit-Position: refs/heads/master@{#29452}
1 parent 0ecd9e1 commit ebadb68

4 files changed

Lines changed: 207 additions & 156 deletions

File tree

samples/hello-world.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ int main(int argc, char* argv[]) {
4747
Context::Scope context_scope(context);
4848

4949
// Create a string containing the JavaScript source code.
50-
Local<String> source = String::NewFromUtf8(isolate, "'Hello' + ', World!'");
50+
Local<String> source =
51+
String::NewFromUtf8(isolate, "'Hello' + ', World!'",
52+
NewStringType::kNormal).ToLocalChecked();
5153

5254
// Compile the source code.
53-
Local<Script> script = Script::Compile(source);
55+
Local<Script> script = Script::Compile(context, source).ToLocalChecked();
5456

5557
// Run the script to get the result.
56-
Local<Value> result = script->Run();
58+
Local<Value> result = script->Run(context).ToLocalChecked();
5759

5860
// Convert the result to an UTF8 string and print it.
5961
String::Utf8Value utf8(result);

0 commit comments

Comments
 (0)