From b3b98967759016495893e506113e15c41d339c9b Mon Sep 17 00:00:00 2001 From: bridiver Date: Wed, 21 Dec 2016 22:16:03 -0700 Subject: [PATCH] add `on-tab-created` event auditors @bbondy --- atom/browser/api/atom_api_web_contents.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 287fc18ac7..b63dd97f1e 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -2030,6 +2030,20 @@ mate::Handle WebContents::FromTabID(v8::Isolate* isolate, void WebContents::OnTabCreated(const mate::Dictionary& options, base::Callback callback, content::WebContents* tab) { + node::Environment* env = node::Environment::GetCurrent(isolate()); + if (!env) { + return; + } + + auto event = v8::Local::Cast( + mate::Event::Create(isolate()).ToV8()); + + mate::EmitEvent(isolate(), + env->process_object(), + "on-tab-created", + tab, + options); + bool active = true; options.Get("active", &active);