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

Unified Diff: samples/shell.cc

Issue 99254: Add the "arguments" global to the shell sample. The "arguments"... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 8 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 | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/shell.cc
===================================================================
--- samples/shell.cc (revision 1828)
+++ samples/shell.cc (working copy)
@@ -61,6 +61,13 @@
global->Set(v8::String::New("quit"), v8::FunctionTemplate::New(Quit));
// Bind the 'version' function
global->Set(v8::String::New("version"), v8::FunctionTemplate::New(Version));
+ // Create a utility context to allow us to create an array
+ v8::Handle<v8::Context> utility_context_ = v8::Context::New(NULL, global);
+ utility_context_->SetSecurityToken(v8::Undefined());
+ v8::Context::Scope utility_scope(utility_context_);
+ // Bind the global 'arguments' variable to the "--" arguments from the command
+ // line.
+ global->Set(v8::String::New("arguments"), v8::V8::GetJSArguments());
// Create a new execution environment containing the built-in
// functions
v8::Handle<v8::Context> context = v8::Context::New(NULL, global);
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698