diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index 842837378fa742..4e4791865feff3 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -1036,6 +1036,16 @@ void Template::Set(v8::Local name, v8::Local value, i::Handle::cast(templ)->set_do_not_cache(true); } } + if (i::FLAG_warn_template_set && + value_obj->IsJSReceiver() && + !value_obj->IsTemplateInfo()) { + base::OS::PrintError( + "(node) v8::%sTemplate::Set() with non-primitive values is deprecated\n" + "(node) and will stop working in the next major release.\n", + templ->IsFunctionTemplateInfo() ? "Function" : "Object"); + isolate->PrintStack(stderr, i::Isolate::kPrintStackConcise); + base::DumpBacktrace(); + } // TODO(dcarney): split api to allow values of v8::Value or v8::TemplateInfo. i::ApiNatives::AddDataProperty(isolate, templ, Utils::OpenHandle(*name), value_obj, diff --git a/deps/v8/src/flag-definitions.h b/deps/v8/src/flag-definitions.h index 68088ade4de072..8450c0c0f93514 100644 --- a/deps/v8/src/flag-definitions.h +++ b/deps/v8/src/flag-definitions.h @@ -172,6 +172,9 @@ struct MaybeBoolFlag { // #define FLAG FLAG_FULL +DEFINE_BOOL(warn_template_set, true, + "warn on deprecated v8::Template::Set() use") + DEFINE_BOOL(experimental_extras, false, "enable code compiled in via v8_experimental_extra_library_files")