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 15303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15314 "\n" | 15314 "\n" |
15315 " bar();\n" | 15315 " bar();\n" |
15316 "}\n" | 15316 "}\n" |
15317 "foo();\n" | 15317 "foo();\n" |
15318 "}\n" | 15318 "}\n" |
15319 "eval('(' + outer +')()%s');"; | 15319 "eval('(' + outer +')()%s');"; |
15320 | 15320 |
15321 i::ScopedVector<char> code(1024); | 15321 i::ScopedVector<char> code(1024); |
15322 i::SNPrintF(code, source, "//# sourceURL=eval_url"); | 15322 i::SNPrintF(code, source, "//# sourceURL=eval_url"); |
15323 CHECK(CompileRun(code.start())->IsUndefined()); | 15323 CHECK(CompileRun(code.start())->IsUndefined()); |
15324 i::SNPrintF(code, source, "//@ sourceURL=eval_url"); | |
15325 CHECK(CompileRun(code.start())->IsUndefined()); | |
15326 } | 15324 } |
15327 | 15325 |
15328 | 15326 |
15329 static int scriptIdInStack[2]; | 15327 static int scriptIdInStack[2]; |
15330 | 15328 |
15331 void AnalyzeScriptIdInStack( | 15329 void AnalyzeScriptIdInStack( |
15332 const v8::FunctionCallbackInfo<v8::Value>& args) { | 15330 const v8::FunctionCallbackInfo<v8::Value>& args) { |
15333 v8::HandleScope scope(args.GetIsolate()); | 15331 v8::HandleScope scope(args.GetIsolate()); |
15334 v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace( | 15332 v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace( |
15335 args.GetIsolate(), 10, v8::StackTrace::kScriptId); | 15333 args.GetIsolate(), 10, v8::StackTrace::kScriptId); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15397 "\n" | 15395 "\n" |
15398 " bar();\n" | 15396 " bar();\n" |
15399 "}\n" | 15397 "}\n" |
15400 "foo();\n" | 15398 "foo();\n" |
15401 "}\n" | 15399 "}\n" |
15402 "outer()\n%s"; | 15400 "outer()\n%s"; |
15403 | 15401 |
15404 i::ScopedVector<char> code(1024); | 15402 i::ScopedVector<char> code(1024); |
15405 i::SNPrintF(code, source, "//# sourceURL=source_url"); | 15403 i::SNPrintF(code, source, "//# sourceURL=source_url"); |
15406 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 1)->IsUndefined()); | 15404 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 1)->IsUndefined()); |
15407 i::SNPrintF(code, source, "//@ sourceURL=source_url"); | |
15408 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 1)->IsUndefined()); | |
15409 } | 15405 } |
15410 | 15406 |
15411 | 15407 |
15412 void AnalyzeStackOfDynamicScriptWithSourceURL( | 15408 void AnalyzeStackOfDynamicScriptWithSourceURL( |
15413 const v8::FunctionCallbackInfo<v8::Value>& args) { | 15409 const v8::FunctionCallbackInfo<v8::Value>& args) { |
15414 v8::HandleScope scope(args.GetIsolate()); | 15410 v8::HandleScope scope(args.GetIsolate()); |
15415 v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace( | 15411 v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace( |
15416 args.GetIsolate(), 10, v8::StackTrace::kDetailed); | 15412 args.GetIsolate(), 10, v8::StackTrace::kDetailed); |
15417 CHECK_EQ(4, stackTrace->GetFrameCount()); | 15413 CHECK_EQ(4, stackTrace->GetFrameCount()); |
15418 v8::Handle<v8::String> url = v8_str("source_url"); | 15414 v8::Handle<v8::String> url = v8_str("source_url"); |
(...skipping 24 matching lines...) Expand all Loading... |
15443 "\n" | 15439 "\n" |
15444 " bar();\n" | 15440 " bar();\n" |
15445 "}\n" | 15441 "}\n" |
15446 "foo();\n" | 15442 "foo();\n" |
15447 "}\n" | 15443 "}\n" |
15448 "outer()\n%s"; | 15444 "outer()\n%s"; |
15449 | 15445 |
15450 i::ScopedVector<char> code(1024); | 15446 i::ScopedVector<char> code(1024); |
15451 i::SNPrintF(code, source, "//# sourceURL=source_url"); | 15447 i::SNPrintF(code, source, "//# sourceURL=source_url"); |
15452 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); | 15448 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); |
15453 i::SNPrintF(code, source, "//@ sourceURL=source_url"); | |
15454 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); | |
15455 } | 15449 } |
15456 | 15450 |
15457 | 15451 |
15458 TEST(DynamicWithSourceURLInStackTraceString) { | 15452 TEST(DynamicWithSourceURLInStackTraceString) { |
15459 LocalContext context; | 15453 LocalContext context; |
15460 v8::HandleScope scope(context->GetIsolate()); | 15454 v8::HandleScope scope(context->GetIsolate()); |
15461 | 15455 |
15462 const char *source = | 15456 const char *source = |
15463 "function outer() {\n" | 15457 "function outer() {\n" |
15464 " function foo() {\n" | 15458 " function foo() {\n" |
(...skipping 6760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22225 env2->Global()->Set(v8_str("obj2"), object2); | 22219 env2->Global()->Set(v8_str("obj2"), object2); |
22226 ExpectString("typeof obj2.values", "function"); | 22220 ExpectString("typeof obj2.values", "function"); |
22227 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); | 22221 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); |
22228 | 22222 |
22229 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); | 22223 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); |
22230 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); | 22224 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); |
22231 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); | 22225 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); |
22232 CHECK_EQ(fn2->GetCreationContext(), *ctx2); | 22226 CHECK_EQ(fn2->GetCreationContext(), *ctx2); |
22233 } | 22227 } |
22234 } | 22228 } |
OLD | NEW |