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 4919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4930 v8::Handle<v8::Script> script0 = | 4930 v8::Handle<v8::Script> script0 = |
4931 v8::Script::Compile(source0, v8::String::New("test.js")); | 4931 v8::Script::Compile(source0, v8::String::New("test.js")); |
4932 v8::Handle<v8::Script> script1 = | 4932 v8::Handle<v8::Script> script1 = |
4933 v8::Script::Compile(source1, v8::String::New("test.js")); | 4933 v8::Script::Compile(source1, v8::String::New("test.js")); |
4934 v8::Handle<v8::Script> script2 = | 4934 v8::Handle<v8::Script> script2 = |
4935 v8::Script::Compile(source0); // different origin | 4935 v8::Script::Compile(source0); // different origin |
4936 CHECK_EQ(1234, script0->Run()->Int32Value()); | 4936 CHECK_EQ(1234, script0->Run()->Int32Value()); |
4937 CHECK_EQ(1234, script1->Run()->Int32Value()); | 4937 CHECK_EQ(1234, script1->Run()->Int32Value()); |
4938 CHECK_EQ(1234, script2->Run()->Int32Value()); | 4938 CHECK_EQ(1234, script2->Run()->Int32Value()); |
4939 } | 4939 } |
| 4940 |
| 4941 |
| 4942 static v8::Handle<Value> FunctionNameCallback(const v8::Arguments& args) { |
| 4943 ApiTestFuzzer::Fuzz(); |
| 4944 return v8_num(42); |
| 4945 } |
| 4946 |
| 4947 |
| 4948 THREADED_TEST(CallbackFunctionName) { |
| 4949 v8::HandleScope scope; |
| 4950 LocalContext context; |
| 4951 Local<ObjectTemplate> t = ObjectTemplate::New(); |
| 4952 t->Set(v8_str("asdf"), v8::FunctionTemplate::New(FunctionNameCallback)); |
| 4953 context->Global()->Set(v8_str("obj"), t->NewInstance()); |
| 4954 v8::Handle<v8::Value> value = CompileRun("obj.asdf.name"); |
| 4955 CHECK(value->IsString()); |
| 4956 v8::String::AsciiValue name(value); |
| 4957 CHECK_EQ("asdf", *name); |
| 4958 } |
OLD | NEW |