| 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 16776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16787 "\n" | 16787 "\n" |
| 16788 " bar();\n" | 16788 " bar();\n" |
| 16789 "}\n" | 16789 "}\n" |
| 16790 "foo();\n" | 16790 "foo();\n" |
| 16791 "}\n" | 16791 "}\n" |
| 16792 "eval('(' + outer +')()%s');"; | 16792 "eval('(' + outer +')()%s');"; |
| 16793 | 16793 |
| 16794 i::ScopedVector<char> code(1024); | 16794 i::ScopedVector<char> code(1024); |
| 16795 i::SNPrintF(code, source, "//# sourceURL=eval_url"); | 16795 i::SNPrintF(code, source, "//# sourceURL=eval_url"); |
| 16796 CHECK(CompileRun(code.start())->IsUndefined()); | 16796 CHECK(CompileRun(code.start())->IsUndefined()); |
| 16797 i::SNPrintF(code, source, "//@ sourceURL=eval_url"); | |
| 16798 CHECK(CompileRun(code.start())->IsUndefined()); | |
| 16799 } | 16797 } |
| 16800 | 16798 |
| 16801 | 16799 |
| 16802 static int scriptIdInStack[2]; | 16800 static int scriptIdInStack[2]; |
| 16803 | 16801 |
| 16804 void AnalyzeScriptIdInStack( | 16802 void AnalyzeScriptIdInStack( |
| 16805 const v8::FunctionCallbackInfo<v8::Value>& args) { | 16803 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 16806 v8::HandleScope scope(args.GetIsolate()); | 16804 v8::HandleScope scope(args.GetIsolate()); |
| 16807 v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace( | 16805 v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace( |
| 16808 args.GetIsolate(), 10, v8::StackTrace::kScriptId); | 16806 args.GetIsolate(), 10, v8::StackTrace::kScriptId); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16869 "\n" | 16867 "\n" |
| 16870 " bar();\n" | 16868 " bar();\n" |
| 16871 "}\n" | 16869 "}\n" |
| 16872 "foo();\n" | 16870 "foo();\n" |
| 16873 "}\n" | 16871 "}\n" |
| 16874 "outer()\n%s"; | 16872 "outer()\n%s"; |
| 16875 | 16873 |
| 16876 i::ScopedVector<char> code(1024); | 16874 i::ScopedVector<char> code(1024); |
| 16877 i::SNPrintF(code, source, "//# sourceURL=source_url"); | 16875 i::SNPrintF(code, source, "//# sourceURL=source_url"); |
| 16878 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 1)->IsUndefined()); | 16876 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 1)->IsUndefined()); |
| 16879 i::SNPrintF(code, source, "//@ sourceURL=source_url"); | |
| 16880 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 1)->IsUndefined()); | |
| 16881 } | 16877 } |
| 16882 | 16878 |
| 16883 | 16879 |
| 16884 void AnalyzeStackOfDynamicScriptWithSourceURL( | 16880 void AnalyzeStackOfDynamicScriptWithSourceURL( |
| 16885 const v8::FunctionCallbackInfo<v8::Value>& args) { | 16881 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 16886 v8::HandleScope scope(args.GetIsolate()); | 16882 v8::HandleScope scope(args.GetIsolate()); |
| 16887 v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace( | 16883 v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace( |
| 16888 args.GetIsolate(), 10, v8::StackTrace::kDetailed); | 16884 args.GetIsolate(), 10, v8::StackTrace::kDetailed); |
| 16889 CHECK_EQ(4, stackTrace->GetFrameCount()); | 16885 CHECK_EQ(4, stackTrace->GetFrameCount()); |
| 16890 v8::Local<v8::String> url = v8_str("source_url"); | 16886 v8::Local<v8::String> url = v8_str("source_url"); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 16915 "\n" | 16911 "\n" |
| 16916 " bar();\n" | 16912 " bar();\n" |
| 16917 "}\n" | 16913 "}\n" |
| 16918 "foo();\n" | 16914 "foo();\n" |
| 16919 "}\n" | 16915 "}\n" |
| 16920 "outer()\n%s"; | 16916 "outer()\n%s"; |
| 16921 | 16917 |
| 16922 i::ScopedVector<char> code(1024); | 16918 i::ScopedVector<char> code(1024); |
| 16923 i::SNPrintF(code, source, "//# sourceURL=source_url"); | 16919 i::SNPrintF(code, source, "//# sourceURL=source_url"); |
| 16924 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); | 16920 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); |
| 16925 i::SNPrintF(code, source, "//@ sourceURL=source_url"); | |
| 16926 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); | |
| 16927 } | 16921 } |
| 16928 | 16922 |
| 16929 | 16923 |
| 16930 TEST(DynamicWithSourceURLInStackTraceString) { | 16924 TEST(DynamicWithSourceURLInStackTraceString) { |
| 16931 LocalContext context; | 16925 LocalContext context; |
| 16932 v8::HandleScope scope(context->GetIsolate()); | 16926 v8::HandleScope scope(context->GetIsolate()); |
| 16933 | 16927 |
| 16934 const char *source = | 16928 const char *source = |
| 16935 "function outer() {\n" | 16929 "function outer() {\n" |
| 16936 " function foo() {\n" | 16930 " function foo() {\n" |
| (...skipping 6891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23828 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust()); | 23822 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust()); |
| 23829 ExpectString("typeof obj2.values", "function"); | 23823 ExpectString("typeof obj2.values", "function"); |
| 23830 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); | 23824 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); |
| 23831 | 23825 |
| 23832 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); | 23826 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); |
| 23833 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); | 23827 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); |
| 23834 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); | 23828 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); |
| 23835 CHECK_EQ(fn2->GetCreationContext(), *ctx2); | 23829 CHECK_EQ(fn2->GetCreationContext(), *ctx2); |
| 23836 } | 23830 } |
| 23837 } | 23831 } |
| OLD | NEW |