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 4638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4649 | 4649 |
4650 // Set and check different data values. | 4650 // Set and check different data values. |
4651 v8::Handle<v8::Value> data_1 = v8::Number::New(1); | 4651 v8::Handle<v8::Value> data_1 = v8::Number::New(1); |
4652 v8::Handle<v8::Value> data_2 = v8::String::New("2"); | 4652 v8::Handle<v8::Value> data_2 = v8::String::New("2"); |
4653 context_1->SetData(data_1); | 4653 context_1->SetData(data_1); |
4654 context_2->SetData(data_2); | 4654 context_2->SetData(data_2); |
4655 CHECK(context_1->GetData()->StrictEquals(data_1)); | 4655 CHECK(context_1->GetData()->StrictEquals(data_1)); |
4656 CHECK(context_2->GetData()->StrictEquals(data_2)); | 4656 CHECK(context_2->GetData()->StrictEquals(data_2)); |
4657 | 4657 |
4658 // Simple test function which causes a break. | 4658 // Simple test function which causes a break. |
4659 char* source = "function f() { debugger; }"; | 4659 const char* source = "function f() { debugger; }"; |
4660 | 4660 |
4661 // Enter and run function in the first context. | 4661 // Enter and run function in the first context. |
4662 { | 4662 { |
4663 v8::Context::Scope context_scope(context_1); | 4663 v8::Context::Scope context_scope(context_1); |
4664 expected_context = context_1; | 4664 expected_context = context_1; |
4665 expected_context_data = data_1; | 4665 expected_context_data = data_1; |
4666 v8::Local<v8::Function> f = CompileFunction(source, "f"); | 4666 v8::Local<v8::Function> f = CompileFunction(source, "f"); |
4667 f->Call(context_1->Global(), 0, NULL); | 4667 f->Call(context_1->Global(), 0, NULL); |
4668 } | 4668 } |
4669 | 4669 |
4670 | 4670 |
4671 // Enter and run function in the second context. | 4671 // Enter and run function in the second context. |
4672 { | 4672 { |
4673 v8::Context::Scope context_scope(context_2); | 4673 v8::Context::Scope context_scope(context_2); |
4674 expected_context = context_2; | 4674 expected_context = context_2; |
4675 expected_context_data = data_2; | 4675 expected_context_data = data_2; |
4676 v8::Local<v8::Function> f = CompileFunction(source, "f"); | 4676 v8::Local<v8::Function> f = CompileFunction(source, "f"); |
4677 f->Call(context_2->Global(), 0, NULL); | 4677 f->Call(context_2->Global(), 0, NULL); |
4678 } | 4678 } |
4679 | 4679 |
4680 // Two times compile event and two times break event. | 4680 // Two times compile event and two times break event. |
4681 CHECK_GT(message_handler_hit_count, 4); | 4681 CHECK_GT(message_handler_hit_count, 4); |
4682 } | 4682 } |
OLD | NEW |