| OLD | NEW | 
|---|
| 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 16022 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 16033                      "  error = true;" | 16033                      "  error = true;" | 
| 16034                      "  throw new Error();" | 16034                      "  throw new Error();" | 
| 16035                      "});" | 16035                      "});" | 
| 16036                      "function f() {};" | 16036                      "function f() {};" | 
| 16037                      "f.displayName = { 'foo': 6, toString: function() {" | 16037                      "f.displayName = { 'foo': 6, toString: function() {" | 
| 16038                      "  error = true;" | 16038                      "  error = true;" | 
| 16039                      "  return 'wrong_display_name';" | 16039                      "  return 'wrong_display_name';" | 
| 16040                      "}};" | 16040                      "}};" | 
| 16041                      "var g = function() {" | 16041                      "var g = function() {" | 
| 16042                      "  arguments.callee.displayName = 'set_in_runtime';" | 16042                      "  arguments.callee.displayName = 'set_in_runtime';" | 
| 16043                      "}; g();" | 16043                      "}; g();"; | 
| 16044                      ; |  | 
| 16045   v8::ScriptOrigin origin = | 16044   v8::ScriptOrigin origin = | 
| 16046       v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test")); | 16045       v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test")); | 
| 16047   v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), code), &origin) | 16046   v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), code), &origin) | 
| 16048       ->Run(); | 16047       ->Run(); | 
| 16049   v8::Local<v8::Value> error = | 16048   v8::Local<v8::Value> error = | 
| 16050       env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "error")); | 16049       env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "error")); | 
| 16051   v8::Local<v8::Function> a = v8::Local<v8::Function>::Cast( | 16050   v8::Local<v8::Function> a = v8::Local<v8::Function>::Cast( | 
| 16052       env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "a"))); | 16051       env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "a"))); | 
| 16053   v8::Local<v8::Function> b = v8::Local<v8::Function>::Cast( | 16052   v8::Local<v8::Function> b = v8::Local<v8::Function>::Cast( | 
| 16054       env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "b"))); | 16053       env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "b"))); | 
| (...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 17850   CHECK(!context->IsCodeGenerationFromStringsAllowed()); | 17849   CHECK(!context->IsCodeGenerationFromStringsAllowed()); | 
| 17851   CheckCodeGenerationDisallowed(); | 17850   CheckCodeGenerationDisallowed(); | 
| 17852 } | 17851 } | 
| 17853 | 17852 | 
| 17854 | 17853 | 
| 17855 TEST(SetErrorMessageForCodeGenFromStrings) { | 17854 TEST(SetErrorMessageForCodeGenFromStrings) { | 
| 17856   LocalContext context; | 17855   LocalContext context; | 
| 17857   v8::HandleScope scope(context->GetIsolate()); | 17856   v8::HandleScope scope(context->GetIsolate()); | 
| 17858   TryCatch try_catch(context->GetIsolate()); | 17857   TryCatch try_catch(context->GetIsolate()); | 
| 17859 | 17858 | 
| 17860   Handle<String> message = v8_str("Message") ; | 17859   Handle<String> message = v8_str("Message"); | 
| 17861   Handle<String> expected_message = v8_str("Uncaught EvalError: Message"); | 17860   Handle<String> expected_message = v8_str("Uncaught EvalError: Message"); | 
| 17862   V8::SetAllowCodeGenerationFromStringsCallback(&CodeGenerationDisallowed); | 17861   V8::SetAllowCodeGenerationFromStringsCallback(&CodeGenerationDisallowed); | 
| 17863   context->AllowCodeGenerationFromStrings(false); | 17862   context->AllowCodeGenerationFromStrings(false); | 
| 17864   context->SetErrorMessageForCodeGenerationFromStrings(message); | 17863   context->SetErrorMessageForCodeGenerationFromStrings(message); | 
| 17865   Handle<Value> result = CompileRun("eval('42')"); | 17864   Handle<Value> result = CompileRun("eval('42')"); | 
| 17866   CHECK(result.IsEmpty()); | 17865   CHECK(result.IsEmpty()); | 
| 17867   CHECK(try_catch.HasCaught()); | 17866   CHECK(try_catch.HasCaught()); | 
| 17868   Handle<String> actual_message = try_catch.Message()->Get(); | 17867   Handle<String> actual_message = try_catch.Message()->Get(); | 
| 17869   CHECK(expected_message->Equals(actual_message)); | 17868   CHECK(expected_message->Equals(actual_message)); | 
| 17870 } | 17869 } | 
| (...skipping 3986 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 21857   timeout_thread.Join(); | 21856   timeout_thread.Join(); | 
| 21858 } | 21857 } | 
| 21859 | 21858 | 
| 21860 | 21859 | 
| 21861 TEST(EstimatedContextSize) { | 21860 TEST(EstimatedContextSize) { | 
| 21862   v8::Isolate* isolate = CcTest::isolate(); | 21861   v8::Isolate* isolate = CcTest::isolate(); | 
| 21863   v8::HandleScope scope(isolate); | 21862   v8::HandleScope scope(isolate); | 
| 21864   LocalContext env; | 21863   LocalContext env; | 
| 21865   CHECK(50000 < env->EstimatedSize()); | 21864   CHECK(50000 < env->EstimatedSize()); | 
| 21866 } | 21865 } | 
| OLD | NEW | 
|---|