Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Side by Side Diff: test/cctest/test-api.cc

Issue 296043004: Fix UnboundScript::GetScriptName and GetLineNumber. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22595 matching lines...) Expand 10 before | Expand all | Expand 10 after
22606 v8::internal::FLAG_stack_size = 150; 22606 v8::internal::FLAG_stack_size = 150;
22607 LocalContext current; 22607 LocalContext current;
22608 v8::Isolate* isolate = current->GetIsolate(); 22608 v8::Isolate* isolate = current->GetIsolate();
22609 v8::HandleScope scope(isolate); 22609 v8::HandleScope scope(isolate);
22610 V8::SetCaptureStackTraceForUncaughtExceptions( 22610 V8::SetCaptureStackTraceForUncaughtExceptions(
22611 true, 10, v8::StackTrace::kDetailed); 22611 true, 10, v8::StackTrace::kDetailed);
22612 v8::TryCatch try_catch; 22612 v8::TryCatch try_catch;
22613 CompileRun("(function f(x) { f(x+1); })(0)"); 22613 CompileRun("(function f(x) { f(x+1); })(0)");
22614 CHECK(try_catch.HasCaught()); 22614 CHECK(try_catch.HasCaught());
22615 } 22615 }
22616
22617
22618 TEST(ScriptNameAndLineNumber) {
22619 LocalContext env;
22620 v8::Isolate* isolate = env->GetIsolate();
22621 v8::HandleScope scope(isolate);
22622 const char* url = "http://www.foo.com/foo.js";
22623 v8::ScriptOrigin origin(v8_str(url), v8::Integer::New(isolate, 13));
22624 v8::ScriptCompiler::Source script_source(v8_str("var foo;"), origin);
22625 Local<Script> script = v8::ScriptCompiler::Compile(
22626 isolate, &script_source);
22627 Local<Value> script_name = script->GetUnboundScript()->GetScriptName();
22628 CHECK(!script_name.IsEmpty());
22629 CHECK(script_name->IsString());
22630 String::Utf8Value utf8_name(script_name);
22631 CHECK_EQ(url, *utf8_name);
22632 int line_number = script->GetUnboundScript()->GetLineNumber(0);
22633 CHECK_EQ(13, line_number);
22634 }
OLDNEW
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698