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

Side by Side Diff: test/cctest/test-api.cc

Issue 582093002: Revert "filter cross context eval" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/v8natives.js ('k') | test/mjsunit/cross-realm-filtering.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 22842 matching lines...) Expand 10 before | Expand all | Expand 10 after
22853 Local<Value> script_name = script->GetUnboundScript()->GetScriptName(); 22853 Local<Value> script_name = script->GetUnboundScript()->GetScriptName();
22854 CHECK(!script_name.IsEmpty()); 22854 CHECK(!script_name.IsEmpty());
22855 CHECK(script_name->IsString()); 22855 CHECK(script_name->IsString());
22856 String::Utf8Value utf8_name(script_name); 22856 String::Utf8Value utf8_name(script_name);
22857 CHECK_EQ(url, *utf8_name); 22857 CHECK_EQ(url, *utf8_name);
22858 int line_number = script->GetUnboundScript()->GetLineNumber(0); 22858 int line_number = script->GetUnboundScript()->GetLineNumber(0);
22859 CHECK_EQ(13, line_number); 22859 CHECK_EQ(13, line_number);
22860 } 22860 }
22861 22861
22862 22862
22863 Local<v8::Context> call_eval_context;
22864 Local<v8::Function> call_eval_bound_function;
22865 static void CallEval(const v8::FunctionCallbackInfo<v8::Value>& args) {
22866 v8::Context::Scope scope(call_eval_context);
22867 args.GetReturnValue().Set(
22868 call_eval_bound_function->Call(call_eval_context->Global(), 0, NULL));
22869 }
22870
22871
22872 TEST(CrossActivationEval) {
22873 LocalContext env;
22874 v8::Isolate* isolate = env->GetIsolate();
22875 v8::HandleScope scope(isolate);
22876 {
22877 call_eval_context = v8::Context::New(isolate);
22878 v8::Context::Scope scope(call_eval_context);
22879 call_eval_bound_function =
22880 Local<Function>::Cast(CompileRun("eval.bind(this, '1')"));
22881 }
22882 env->Global()->Set(v8_str("CallEval"),
22883 v8::FunctionTemplate::New(isolate, CallEval)->GetFunction());
22884 Local<Value> result = CompileRun("CallEval();");
22885 CHECK_EQ(result, v8::Integer::New(isolate, 1));
22886 }
22887
22888
22889 void SourceURLHelper(const char* source, const char* expected_source_url, 22863 void SourceURLHelper(const char* source, const char* expected_source_url,
22890 const char* expected_source_mapping_url) { 22864 const char* expected_source_mapping_url) {
22891 Local<Script> script = v8_compile(source); 22865 Local<Script> script = v8_compile(source);
22892 if (expected_source_url != NULL) { 22866 if (expected_source_url != NULL) {
22893 v8::String::Utf8Value url(script->GetUnboundScript()->GetSourceURL()); 22867 v8::String::Utf8Value url(script->GetUnboundScript()->GetSourceURL());
22894 CHECK_EQ(expected_source_url, *url); 22868 CHECK_EQ(expected_source_url, *url);
22895 } else { 22869 } else {
22896 CHECK(script->GetUnboundScript()->GetSourceURL()->IsUndefined()); 22870 CHECK(script->GetUnboundScript()->GetSourceURL()->IsUndefined());
22897 } 22871 }
22898 if (expected_source_mapping_url != NULL) { 22872 if (expected_source_mapping_url != NULL) {
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
23345 // TestSourceStream::GetMoreData won't block, so it's OK to just run the 23319 // TestSourceStream::GetMoreData won't block, so it's OK to just run the
23346 // task here in the main thread. 23320 // task here in the main thread.
23347 task->Run(); 23321 task->Run();
23348 delete task; 23322 delete task;
23349 23323
23350 const v8::ScriptCompiler::CachedData* cached_data = source.GetCachedData(); 23324 const v8::ScriptCompiler::CachedData* cached_data = source.GetCachedData();
23351 CHECK(cached_data != NULL); 23325 CHECK(cached_data != NULL);
23352 CHECK(cached_data->data != NULL); 23326 CHECK(cached_data->data != NULL);
23353 CHECK_GT(cached_data->length, 0); 23327 CHECK_GT(cached_data->length, 0);
23354 } 23328 }
OLDNEW
« no previous file with comments | « src/v8natives.js ('k') | test/mjsunit/cross-realm-filtering.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698