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

Unified Diff: test/cctest/test-api.cc

Issue 1435273002: Fix name shown by devtools for subclasses. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/profiler/heap-snapshot-generator.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index df105e927a8c06612a0ba2fcb3a237af051e6a18..37517104075dad1e9d9b4155cb3630c00212c740 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -5550,10 +5550,10 @@ TEST(TryCatchInTryFinally) {
static void check_reference_error_message(v8::Local<v8::Message> message,
v8::Local<v8::Value> data) {
const char* reference_error = "Uncaught ReferenceError: asdf is not defined";
- CHECK(message->Get()
- ->Equals(CcTest::isolate()->GetCurrentContext(),
- v8_str(reference_error))
- .FromJust());
+ Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
+ const char* reference_error2 = "Uncaught Error: asdf is not defined";
+ CHECK(message->Get()->Equals(context, v8_str(reference_error)).FromJust() ||
+ message->Get()->Equals(context, v8_str(reference_error2)).FromJust());
}
@@ -12891,11 +12891,13 @@ THREADED_TEST(ObjectGetConstructorName) {
"function Parent() {};"
"function Child() {};"
"Child.prototype = new Parent();"
+ "Child.prototype.constructor = Child;"
"var outer = { inner: function() { } };"
"var p = new Parent();"
"var c = new Child();"
"var x = new outer.inner();"
- "var proto = Child.prototype;")->Run();
+ "var proto = Child.prototype;")
+ ->Run();
Local<v8::Value> p = context->Global()->Get(v8_str("p"));
CHECK(p->IsObject() &&
@@ -12917,6 +12919,28 @@ THREADED_TEST(ObjectGetConstructorName) {
}
+THREADED_TEST(SubclassGetConstructorName) {
+ v8::Isolate* isolate = CcTest::isolate();
+ LocalContext context;
+ v8::HandleScope scope(isolate);
+ v8_compile(
+ "\"use strict\";"
+ "class Parent {}"
+ "class Child extends Parent {}"
+ "var p = new Parent();"
+ "var c = new Child();")
+ ->Run();
+
+ Local<v8::Value> p = context->Global()->Get(v8_str("p"));
+ CHECK(p->IsObject() &&
+ p->ToObject(isolate)->GetConstructorName()->Equals(v8_str("Parent")));
+
+ Local<v8::Value> c = context->Global()->Get(v8_str("c"));
+ CHECK(c->IsObject() &&
+ c->ToObject(isolate)->GetConstructorName()->Equals(v8_str("Child")));
+}
+
+
bool ApiTestFuzzer::fuzzing_ = false;
v8::base::Semaphore ApiTestFuzzer::all_tests_done_(0);
int ApiTestFuzzer::active_tests_;
« no previous file with comments | « src/profiler/heap-snapshot-generator.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698