From: Cheng Zhao Date: Thu, 5 Dec 2013 02:35:57 +0000 (+0800) Subject: Simplify V8 operations. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a61413414436e1c7c6aa5e80d8d107f4f1b3cede;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Simplify V8 operations. --- diff --git a/browser/api/atom_api_app.cc b/browser/api/atom_api_app.cc index 3bb7fd6..375087a 100644 --- a/browser/api/atom_api_app.cc +++ b/browser/api/atom_api_app.cc @@ -101,11 +101,7 @@ v8::Handle App::Focus(const v8::Arguments &args) { // static v8::Handle App::GetVersion(const v8::Arguments &args) { - v8::HandleScope scope; - - std::string version(Browser::Get()->GetVersion()); - - return v8::String::New(version.data(), version.size()); + return ToV8Value(Browser::Get()->GetVersion()); } // static @@ -123,11 +119,7 @@ v8::Handle App::SetVersion(const v8::Arguments &args) { // static v8::Handle App::GetName(const v8::Arguments &args) { - v8::HandleScope scope; - - std::string name(Browser::Get()->GetName()); - - return v8::String::New(name.data(), version.size()); + return ToV8Value(Browser::Get()->GetName()); } // static @@ -179,7 +171,10 @@ v8::Handle App::AppendArgument(const v8::Arguments &args) { // static v8::Handle App::DockBounce(const v8::Arguments& args) { - std::string type = FromV8Value(args[0]); + std::string type; + if (!FromV8Arguments(args, &type)) + return node::ThrowError("Bad argument"); + int request_id = -1; if (type == "critical") @@ -189,7 +184,7 @@ v8::Handle App::DockBounce(const v8::Arguments& args) { else return node::ThrowTypeError("Invalid bounce type"); - return v8::Integer::New(request_id); + return ToV8Value(request_id); } // static