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

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

Issue 1527863003: [stubs] Fix TypeOfStub to properly return "undefined" for undetectable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/code-stubs-hydrogen.cc ('k') | no next file » | 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 fba07af8659806631fcf72a5ec218058fb0554b3..15cb651909b925663ede878e940e73775e298816 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -11654,6 +11654,54 @@ THREADED_TEST(CallableObject) {
}
+THREADED_TEST(Regress567998) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+
+ Local<v8::FunctionTemplate> desc =
+ v8::FunctionTemplate::New(env->GetIsolate());
+ desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable
+ desc->InstanceTemplate()->SetCallAsFunctionHandler(ReturnThis); // callable
+
+ Local<v8::Object> obj = desc->GetFunction(env.local())
+ .ToLocalChecked()
+ ->NewInstance(env.local())
+ .ToLocalChecked();
+ CHECK(
+ env->Global()->Set(env.local(), v8_str("undetectable"), obj).FromJust());
+
+ ExpectString("undetectable.toString()", "[object Object]");
+ ExpectString("typeof undetectable", "undefined");
+ ExpectString("typeof(undetectable)", "undefined");
+ ExpectBoolean("typeof undetectable == 'undefined'", true);
+ ExpectBoolean("typeof undetectable == 'object'", false);
+ ExpectBoolean("if (undetectable) { true; } else { false; }", false);
+ ExpectBoolean("!undetectable", true);
+
+ ExpectObject("true&&undetectable", obj);
+ ExpectBoolean("false&&undetectable", false);
+ ExpectBoolean("true||undetectable", true);
+ ExpectObject("false||undetectable", obj);
+
+ ExpectObject("undetectable&&true", obj);
+ ExpectObject("undetectable&&false", obj);
+ ExpectBoolean("undetectable||true", true);
+ ExpectBoolean("undetectable||false", false);
+
+ ExpectBoolean("undetectable==null", true);
+ ExpectBoolean("null==undetectable", true);
+ ExpectBoolean("undetectable==undefined", true);
+ ExpectBoolean("undefined==undetectable", true);
+ ExpectBoolean("undetectable==undetectable", true);
+
+ ExpectBoolean("undetectable===null", false);
+ ExpectBoolean("null===undetectable", false);
+ ExpectBoolean("undetectable===undefined", false);
+ ExpectBoolean("undefined===undetectable", false);
+ ExpectBoolean("undetectable===undetectable", true);
+}
+
+
static int Recurse(v8::Isolate* isolate, int depth, int iterations) {
v8::HandleScope scope(isolate);
if (depth == 0) return v8::HandleScope::NumberOfHandles(isolate);
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698