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

Unified Diff: test/cctest/test-access-checks.cc

Issue 2162443002: Add API to create a "remote" instance of a given FunctionTemplate (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/counters.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-access-checks.cc
diff --git a/test/cctest/test-access-checks.cc b/test/cctest/test-access-checks.cc
index 937e875d7ed7b8426e9da03407914430d10a6cf5..59c17b89eb057decaac2bbcc23374f6d08d9a932 100644
--- a/test/cctest/test-access-checks.cc
+++ b/test/cctest/test-access-checks.cc
@@ -181,6 +181,10 @@ void CheckCrossContextAccess(v8::Isolate* isolate,
"[\"7\",\"cross_context_int\"]");
}
+void Ctor(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ CHECK(info.IsConstructCall());
+}
+
} // namespace
TEST(AccessCheckWithInterceptor) {
@@ -276,3 +280,26 @@ TEST(NewRemoteContext) {
CheckCanRunScriptInContext(isolate, context5);
}
}
+
+TEST(NewRemoteInstance) {
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::FunctionTemplate> tmpl =
+ v8::FunctionTemplate::New(isolate, Ctor);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ instance->SetAccessCheckCallbackAndHandler(
+ AccessCheck,
+ v8::NamedPropertyHandlerConfiguration(
+ NamedGetter, NamedSetter, NamedQuery, NamedDeleter, NamedEnumerator),
+ v8::IndexedPropertyHandlerConfiguration(IndexedGetter, IndexedSetter,
+ IndexedQuery, IndexedDeleter,
+ IndexedEnumerator));
+ tmpl->SetNativeDataProperty(
+ v8_str("all_can_read"), Return42, nullptr, v8::Local<v8::Value>(),
+ v8::None, v8::Local<v8::AccessorSignature>(), v8::ALL_CAN_READ);
+
+ v8::Local<v8::Object> obj = tmpl->NewRemoteInstance().ToLocalChecked();
+
+ v8::Local<v8::Context> context = v8::Context::New(isolate);
+ CheckCrossContextAccess(isolate, context, obj);
+}
« no previous file with comments | « src/counters.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698