@@ -79,6 +79,15 @@ std::vector<std::string> ParseSchemesCLISwitch(base::CommandLine* command_line,
7979 base::SPLIT_WANT_NONEMPTY);
8080}
8181
82+ void SetHiddenValue (v8::Handle<v8::Context> context,
83+ const base::StringPiece& key,
84+ v8::Local<v8::Value> value) {
85+ v8::Isolate* isolate = context->GetIsolate ();
86+ v8::Local<v8::Private> privateKey =
87+ v8::Private::ForApi (isolate, mate::StringToV8 (isolate, key));
88+ context->Global ()->SetPrivate (context, privateKey, value);
89+ }
90+
8291} // namespace
8392
8493RendererClientBase::RendererClientBase () {
@@ -108,10 +117,13 @@ void RendererClientBase::DidCreateScriptContext(
108117 auto context_id = base::StringPrintf (
109118 " %s-%" PRId64, renderer_client_id_.c_str (), ++next_context_id_);
110119 v8::Isolate* isolate = context->GetIsolate ();
111- v8::Local<v8::String> key = mate::StringToSymbol (isolate, " contextId" );
112- v8::Local<v8::Private> private_key = v8::Private::ForApi (isolate, key);
113- v8::Local<v8::Value> value = mate::ConvertToV8 (isolate, context_id);
114- context->Global ()->SetPrivate (context, private_key, value);
120+ SetHiddenValue (context, " contextId" , mate::ConvertToV8 (isolate, context_id));
121+
122+ auto * command_line = base::CommandLine::ForCurrentProcess ();
123+ bool enableRemoteModule =
124+ !command_line->HasSwitch (switches::kDisableRemoteModule );
125+ SetHiddenValue (context, " enableRemoteModule" ,
126+ mate::ConvertToV8 (isolate, enableRemoteModule));
115127}
116128
117129void RendererClientBase::AddRenderBindings (
0 commit comments