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

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

Issue 1406293011: Re-ship @@toStringTag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added API tests to answer my security question 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/flag-definitions.h ('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 646f868968737b06a0a70eb0ca969ca6bed41ab8..f47c997f518462433d693c9ec5904ae3e702022d 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -22038,11 +22038,21 @@ TEST(AccessCheckedToStringTag) {
ExpectString("result", "[object hello]");
ExpectString("object[Symbol.toStringTag]", "hello");
+ // ToString through the API should succeed too.
+ String::Utf8Value result_allowed(
+ object->ObjectProtoToString(env.local()).ToLocalChecked());
+ CHECK_EQ(0, strcmp(*result_allowed, "[object hello]"));
+
// If access check fails, the value of @@toStringTag is ignored
allowed_access = false;
CompileRun("var result = Object.prototype.toString.call(object)");
ExpectString("result", "[object Object]");
ExpectTrue("object[Symbol.toStringTag] === undefined");
+
+ // ToString through the API should also fail.
+ String::Utf8Value result_denied(
+ object->ObjectProtoToString(env.local()).ToLocalChecked());
+ CHECK_EQ(0, strcmp(*result_denied, "[object Object]"));
}
« no previous file with comments | « src/flag-definitions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698