| OLD | NEW | 
|---|
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 4998 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5009 | 5009 | 
| 5010   v8::Local<v8::String> data_obj_source = v8::String::New( | 5010   v8::Local<v8::String> data_obj_source = v8::String::New( | 
| 5011     "({ a: 'abc',\n" | 5011     "({ a: 'abc',\n" | 
| 5012     "  b: 123,\n" | 5012     "  b: 123,\n" | 
| 5013     "  toString: function() { return this.a + ' ' + this.b; }\n" | 5013     "  toString: function() { return this.a + ' ' + this.b; }\n" | 
| 5014     "})\n"); | 5014     "})\n"); | 
| 5015   v8::Local<v8::Value> data_obj = v8::Script::Compile(data_obj_source)->Run(); | 5015   v8::Local<v8::Value> data_obj = v8::Script::Compile(data_obj_source)->Run(); | 
| 5016   v8::ScriptOrigin origin2 = v8::ScriptOrigin(v8::String::New("new name")); | 5016   v8::ScriptOrigin origin2 = v8::ScriptOrigin(v8::String::New("new name")); | 
| 5017   v8::Handle<v8::Script> script2 = v8::Script::Compile(script, &origin2); | 5017   v8::Handle<v8::Script> script2 = v8::Script::Compile(script, &origin2); | 
| 5018   script2->Run(); | 5018   script2->Run(); | 
| 5019   script2->SetData(data_obj); | 5019   script2->SetData(data_obj->ToString()); | 
| 5020   f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); | 5020   f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); | 
| 5021   f->Call(env->Global(), 0, NULL); | 5021   f->Call(env->Global(), 0, NULL); | 
| 5022   CHECK_EQ(3, break_point_hit_count); | 5022   CHECK_EQ(3, break_point_hit_count); | 
| 5023   CHECK_EQ("new name", last_script_name_hit); | 5023   CHECK_EQ("new name", last_script_name_hit); | 
| 5024   CHECK_EQ("abc 123", last_script_data_hit); | 5024   CHECK_EQ("abc 123", last_script_data_hit); | 
| 5025 } | 5025 } | 
| 5026 | 5026 | 
| 5027 | 5027 | 
| 5028 static v8::Persistent<v8::Context> expected_context; | 5028 static v8::Persistent<v8::Context> expected_context; | 
| 5029 static v8::Handle<v8::Value> expected_context_data; | 5029 static v8::Handle<v8::Value> expected_context_data; | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5062       v8::Handle<v8::ObjectTemplate>(); | 5062       v8::Handle<v8::ObjectTemplate>(); | 
| 5063   v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>(); | 5063   v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>(); | 
| 5064   context_1 = v8::Context::New(NULL, global_template, global_object); | 5064   context_1 = v8::Context::New(NULL, global_template, global_object); | 
| 5065   context_2 = v8::Context::New(NULL, global_template, global_object); | 5065   context_2 = v8::Context::New(NULL, global_template, global_object); | 
| 5066 | 5066 | 
| 5067   // Default data value is undefined. | 5067   // Default data value is undefined. | 
| 5068   CHECK(context_1->GetData()->IsUndefined()); | 5068   CHECK(context_1->GetData()->IsUndefined()); | 
| 5069   CHECK(context_2->GetData()->IsUndefined()); | 5069   CHECK(context_2->GetData()->IsUndefined()); | 
| 5070 | 5070 | 
| 5071   // Set and check different data values. | 5071   // Set and check different data values. | 
| 5072   v8::Handle<v8::Value> data_1 = v8::Number::New(1); | 5072   v8::Handle<v8::String> data_1 = v8::String::New("1"); | 
| 5073   v8::Handle<v8::Value> data_2 = v8::String::New("2"); | 5073   v8::Handle<v8::String> data_2 = v8::String::New("2"); | 
| 5074   context_1->SetData(data_1); | 5074   context_1->SetData(data_1); | 
| 5075   context_2->SetData(data_2); | 5075   context_2->SetData(data_2); | 
| 5076   CHECK(context_1->GetData()->StrictEquals(data_1)); | 5076   CHECK(context_1->GetData()->StrictEquals(data_1)); | 
| 5077   CHECK(context_2->GetData()->StrictEquals(data_2)); | 5077   CHECK(context_2->GetData()->StrictEquals(data_2)); | 
| 5078 | 5078 | 
| 5079   // Simple test function which causes a break. | 5079   // Simple test function which causes a break. | 
| 5080   const char* source = "function f() { debugger; }"; | 5080   const char* source = "function f() { debugger; }"; | 
| 5081 | 5081 | 
| 5082   // Enter and run function in the first context. | 5082   // Enter and run function in the first context. | 
| 5083   { | 5083   { | 
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5226   v8::Persistent<v8::Context> context_1; | 5226   v8::Persistent<v8::Context> context_1; | 
| 5227   v8::Handle<v8::ObjectTemplate> global_template = | 5227   v8::Handle<v8::ObjectTemplate> global_template = | 
| 5228       v8::Handle<v8::ObjectTemplate>(); | 5228       v8::Handle<v8::ObjectTemplate>(); | 
| 5229   v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>(); | 5229   v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>(); | 
| 5230   context_1 = v8::Context::New(NULL, global_template, global_object); | 5230   context_1 = v8::Context::New(NULL, global_template, global_object); | 
| 5231 | 5231 | 
| 5232   // Default data value is undefined. | 5232   // Default data value is undefined. | 
| 5233   CHECK(context_1->GetData()->IsUndefined()); | 5233   CHECK(context_1->GetData()->IsUndefined()); | 
| 5234 | 5234 | 
| 5235   // Set and check a data value. | 5235   // Set and check a data value. | 
| 5236   v8::Handle<v8::Value> data_1 = v8::Number::New(1); | 5236   v8::Handle<v8::String> data_1 = v8::String::New("1"); | 
| 5237   context_1->SetData(data_1); | 5237   context_1->SetData(data_1); | 
| 5238   CHECK(context_1->GetData()->StrictEquals(data_1)); | 5238   CHECK(context_1->GetData()->StrictEquals(data_1)); | 
| 5239 | 5239 | 
| 5240   // Simple test function with eval that causes a break. | 5240   // Simple test function with eval that causes a break. | 
| 5241   const char* source = "function f() { eval('debugger;'); }"; | 5241   const char* source = "function f() { eval('debugger;'); }"; | 
| 5242 | 5242 | 
| 5243   // Enter and run function in the context. | 5243   // Enter and run function in the context. | 
| 5244   { | 5244   { | 
| 5245     v8::Context::Scope context_scope(context_1); | 5245     v8::Context::Scope context_scope(context_1); | 
| 5246     expected_context = context_1; | 5246     expected_context = context_1; | 
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5746 | 5746 | 
| 5747   break_point_hit_count = 0; | 5747   break_point_hit_count = 0; | 
| 5748   foo->Call(env->Global(), 0, NULL); | 5748   foo->Call(env->Global(), 0, NULL); | 
| 5749   CHECK_EQ(1, break_point_hit_count); | 5749   CHECK_EQ(1, break_point_hit_count); | 
| 5750 | 5750 | 
| 5751   v8::Debug::SetDebugEventListener(NULL); | 5751   v8::Debug::SetDebugEventListener(NULL); | 
| 5752   debugee_context = v8::Handle<v8::Context>(); | 5752   debugee_context = v8::Handle<v8::Context>(); | 
| 5753   debugger_context = v8::Handle<v8::Context>(); | 5753   debugger_context = v8::Handle<v8::Context>(); | 
| 5754   CheckDebuggerUnloaded(); | 5754   CheckDebuggerUnloaded(); | 
| 5755 } | 5755 } | 
| OLD | NEW | 
|---|