Commit b256c9c1 authored by ricow@chromium.org's avatar ricow@chromium.org

Reinitialize the arguments object in d8 when renewing the evaluation context (fixes issue 1477).

Review URL: http://codereview.chromium.org/7189007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8312 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a5ef18b9
......@@ -613,19 +613,6 @@ void Shell::Initialize() {
utility_context_->SetSecurityToken(Undefined());
Context::Scope utility_scope(utility_context_);
i::JSArguments js_args = i::FLAG_js_arguments;
i::Handle<i::FixedArray> arguments_array =
FACTORY->NewFixedArray(js_args.argc());
for (int j = 0; j < js_args.argc(); j++) {
i::Handle<i::String> arg =
FACTORY->NewStringFromUtf8(i::CStrVector(js_args[j]));
arguments_array->set(j, *arg);
}
i::Handle<i::JSArray> arguments_jsarray =
FACTORY->NewJSArrayWithElements(arguments_array);
global_template->Set(String::New("arguments"),
Utils::ToLocal(arguments_jsarray));
#ifdef ENABLE_DEBUGGER_SUPPORT
// Install the debugger object in the utility scope
i::Debug* debug = i::Isolate::Current()->debug();
......@@ -650,6 +637,20 @@ void Shell::RenewEvaluationContext() {
evaluation_context_ = Context::New(NULL, global_template);
evaluation_context_->SetSecurityToken(Undefined());
Context::Scope utility_scope(utility_context_);
i::JSArguments js_args = i::FLAG_js_arguments;
i::Handle<i::FixedArray> arguments_array =
FACTORY->NewFixedArray(js_args.argc());
for (int j = 0; j < js_args.argc(); j++) {
i::Handle<i::String> arg =
FACTORY->NewStringFromUtf8(i::CStrVector(js_args[j]));
arguments_array->set(j, *arg);
}
i::Handle<i::JSArray> arguments_jsarray =
FACTORY->NewJSArrayWithElements(arguments_array);
evaluation_context_->Global()->Set(String::New("arguments"),
Utils::ToLocal(arguments_jsarray));
#ifdef ENABLE_DEBUGGER_SUPPORT
i::Debug* debug = i::Isolate::Current()->debug();
debug->Load();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment