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

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

Issue 879553002: [V8] Added Script::is_debugger_script flag for embedders (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « test/cctest/compiler/test-linkage.cc ('k') | test/cctest/test-compiler.cc » ('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 4580 matching lines...) Expand 10 before | Expand all | Expand 10 after
4591 CompileRun("throw error;"); 4591 CompileRun("throw error;");
4592 CHECK(message_received); 4592 CHECK(message_received);
4593 // clear out the message listener 4593 // clear out the message listener
4594 v8::V8::RemoveMessageListeners(check_message_2); 4594 v8::V8::RemoveMessageListeners(check_message_2);
4595 } 4595 }
4596 4596
4597 4597
4598 static void check_message_3(v8::Handle<v8::Message> message, 4598 static void check_message_3(v8::Handle<v8::Message> message,
4599 v8::Handle<Value> data) { 4599 v8::Handle<Value> data) {
4600 CHECK(message->IsSharedCrossOrigin()); 4600 CHECK(message->IsSharedCrossOrigin());
4601 CHECK(message->GetScriptOrigin().ResourceIsSharedCrossOrigin()->Value());
4602 CHECK(message->GetScriptOrigin().ResourceIsEmbedderDebugScript()->Value());
4601 CHECK_EQ(6.75, message->GetScriptOrigin().ResourceName()->NumberValue()); 4603 CHECK_EQ(6.75, message->GetScriptOrigin().ResourceName()->NumberValue());
4602 message_received = true; 4604 message_received = true;
4603 } 4605 }
4604 4606
4605 4607
4606 TEST(MessageHandler3) { 4608 TEST(MessageHandler3) {
4607 message_received = false; 4609 message_received = false;
4608 v8::Isolate* isolate = CcTest::isolate(); 4610 v8::Isolate* isolate = CcTest::isolate();
4609 v8::HandleScope scope(isolate); 4611 v8::HandleScope scope(isolate);
4610 CHECK(!message_received); 4612 CHECK(!message_received);
4611 v8::V8::AddMessageListener(check_message_3); 4613 v8::V8::AddMessageListener(check_message_3);
4612 LocalContext context; 4614 LocalContext context;
4613 v8::ScriptOrigin origin = 4615 v8::ScriptOrigin origin =
4614 v8::ScriptOrigin(v8_str("6.75"), 4616 v8::ScriptOrigin(v8_str("6.75"), v8::Integer::New(isolate, 1),
4615 v8::Integer::New(isolate, 1), 4617 v8::Integer::New(isolate, 2), v8::True(isolate),
4616 v8::Integer::New(isolate, 2), 4618 Handle<v8::Integer>(), v8::True(isolate));
4617 v8::True(isolate));
4618 v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"), 4619 v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"),
4619 &origin); 4620 &origin);
4620 script->Run(); 4621 script->Run();
4621 CHECK(message_received); 4622 CHECK(message_received);
4622 // clear out the message listener 4623 // clear out the message listener
4623 v8::V8::RemoveMessageListeners(check_message_3); 4624 v8::V8::RemoveMessageListeners(check_message_3);
4624 } 4625 }
4625 4626
4626 4627
4627 static void check_message_4(v8::Handle<v8::Message> message, 4628 static void check_message_4(v8::Handle<v8::Message> message,
(...skipping 14692 matching lines...) Expand 10 before | Expand all | Expand 10 after
19320 CHECK_GE(2, gc_count); 19321 CHECK_GE(2, gc_count);
19321 CHECK_EQ(1, GetGlobalObjectsCount()); 19322 CHECK_EQ(1, GetGlobalObjectsCount());
19322 19323
19323 isolate->ContextDisposedNotification(); 19324 isolate->ContextDisposedNotification();
19324 } 19325 }
19325 19326
19326 19327
19327 THREADED_TEST(ScriptOrigin) { 19328 THREADED_TEST(ScriptOrigin) {
19328 LocalContext env; 19329 LocalContext env;
19329 v8::HandleScope scope(env->GetIsolate()); 19330 v8::HandleScope scope(env->GetIsolate());
19330 v8::ScriptOrigin origin = 19331 v8::ScriptOrigin origin = v8::ScriptOrigin(
19331 v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test")); 19332 v8::String::NewFromUtf8(env->GetIsolate(), "test"),
19333 v8::Integer::New(env->GetIsolate(), 1),
19334 v8::Integer::New(env->GetIsolate(), 1), v8::True(env->GetIsolate()),
19335 v8::Handle<v8::Integer>(), v8::True(env->GetIsolate()));
19332 v8::Handle<v8::String> script = v8::String::NewFromUtf8( 19336 v8::Handle<v8::String> script = v8::String::NewFromUtf8(
19333 env->GetIsolate(), "function f() {}\n\nfunction g() {}"); 19337 env->GetIsolate(), "function f() {}\n\nfunction g() {}");
19334 v8::Script::Compile(script, &origin)->Run(); 19338 v8::Script::Compile(script, &origin)->Run();
19335 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast( 19339 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
19336 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f"))); 19340 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
19337 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( 19341 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
19338 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g"))); 19342 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
19339 19343
19340 v8::ScriptOrigin script_origin_f = f->GetScriptOrigin(); 19344 v8::ScriptOrigin script_origin_f = f->GetScriptOrigin();
19341 CHECK_EQ("test", *v8::String::Utf8Value(script_origin_f.ResourceName())); 19345 CHECK_EQ("test", *v8::String::Utf8Value(script_origin_f.ResourceName()));
19342 CHECK_EQ(0, script_origin_f.ResourceLineOffset()->Int32Value()); 19346 CHECK_EQ(1, script_origin_f.ResourceLineOffset()->Int32Value());
19347 CHECK(script_origin_f.ResourceIsSharedCrossOrigin()->Value());
19348 CHECK(script_origin_f.ResourceIsEmbedderDebugScript()->Value());
19343 19349
19344 v8::ScriptOrigin script_origin_g = g->GetScriptOrigin(); 19350 v8::ScriptOrigin script_origin_g = g->GetScriptOrigin();
19345 CHECK_EQ("test", *v8::String::Utf8Value(script_origin_g.ResourceName())); 19351 CHECK_EQ("test", *v8::String::Utf8Value(script_origin_g.ResourceName()));
19346 CHECK_EQ(0, script_origin_g.ResourceLineOffset()->Int32Value()); 19352 CHECK_EQ(1, script_origin_g.ResourceLineOffset()->Int32Value());
19353 CHECK(script_origin_g.ResourceIsSharedCrossOrigin()->Value());
19354 CHECK(script_origin_g.ResourceIsEmbedderDebugScript()->Value());
19347 } 19355 }
19348 19356
19349 19357
19350 THREADED_TEST(FunctionGetInferredName) { 19358 THREADED_TEST(FunctionGetInferredName) {
19351 LocalContext env; 19359 LocalContext env;
19352 v8::HandleScope scope(env->GetIsolate()); 19360 v8::HandleScope scope(env->GetIsolate());
19353 v8::ScriptOrigin origin = 19361 v8::ScriptOrigin origin =
19354 v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test")); 19362 v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
19355 v8::Handle<v8::String> script = v8::String::NewFromUtf8( 19363 v8::Handle<v8::String> script = v8::String::NewFromUtf8(
19356 env->GetIsolate(), 19364 env->GetIsolate(),
(...skipping 5409 matching lines...) Expand 10 before | Expand all | Expand 10 after
24766 "bar2.js"); 24774 "bar2.js");
24767 } 24775 }
24768 24776
24769 24777
24770 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { 24778 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) {
24771 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", 24779 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#",
24772 " sourceMappingURL=bar2.js\n", "foo();", NULL}; 24780 " sourceMappingURL=bar2.js\n", "foo();", NULL};
24773 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, 24781 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL,
24774 "bar2.js"); 24782 "bar2.js");
24775 } 24783 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-linkage.cc ('k') | test/cctest/test-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698