| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index 5f82bd7f2e7ee184975588e4de3e6b7fcebbe325..4969784ed7f3337c085ef6bf4287e435509378e4 100644
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -17681,6 +17681,52 @@ TEST(DynamicWithSourceURLInStackTraceString) {
|
| }
|
|
|
|
|
| +TEST(EvalWithSourceURLInMessageScriptResourceNameOrSourceURL) {
|
| + LocalContext context;
|
| + v8::HandleScope scope(context->GetIsolate());
|
| +
|
| + const char *source =
|
| + "function outer() {\n"
|
| + " var scriptContents = \"function foo() { FAIL.FAIL; }\\\n"
|
| + " //# sourceURL=source_url\";\n"
|
| + " eval(scriptContents);\n"
|
| + " foo(); }\n"
|
| + "outer();\n"
|
| + "//# sourceURL=outer_url";
|
| +
|
| + v8::TryCatch try_catch;
|
| + CompileRun(source);
|
| + CHECK(try_catch.HasCaught());
|
| +
|
| + Local<v8::Message> message = try_catch.Message();
|
| + Handle<Value> sourceURL = message->GetScriptResourceNameOrSourceURL();
|
| + CHECK_EQ(*v8::String::Utf8Value(sourceURL), "source_url");
|
| +}
|
| +
|
| +
|
| +TEST(RecursionWithSourceURLInMessageScriptResourceNameOrSourceURL) {
|
| + LocalContext context;
|
| + v8::HandleScope scope(context->GetIsolate());
|
| +
|
| + const char *source =
|
| + "function outer() {\n"
|
| + " var scriptContents = \"function boo(){ boo(); }\\\n"
|
| + " //# sourceURL=source_url\";\n"
|
| + " eval(scriptContents);\n"
|
| + " boo(); }\n"
|
| + "outer();\n"
|
| + "//# sourceURL=outer_url";
|
| +
|
| + v8::TryCatch try_catch;
|
| + CompileRun(source);
|
| + CHECK(try_catch.HasCaught());
|
| +
|
| + Local<v8::Message> message = try_catch.Message();
|
| + Handle<Value> sourceURL = message->GetScriptResourceNameOrSourceURL();
|
| + CHECK_EQ(*v8::String::Utf8Value(sourceURL), "source_url");
|
| +}
|
| +
|
| +
|
| static void CreateGarbageInOldSpace() {
|
| i::Factory* factory = CcTest::i_isolate()->factory();
|
| v8::HandleScope scope(CcTest::isolate());
|
|
|