chore: make rpc-server reply to sender frame instead of the main frame (#15973)

* chore: make rpc-server reply to frame

* fix: check IsRenderFrameLive
This commit is contained in:
Cheng Zhao 2018-12-10 09:37:42 +09:00 committed by GitHub
parent eb8fcf833c
commit db2fda1b6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 10 deletions

View file

@ -5,6 +5,7 @@
#include "atom/browser/api/event_emitter.h"
#include "atom/browser/api/event.h"
#include "content/public/browser/render_frame_host.h"
#include "native_mate/arguments.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
@ -56,6 +57,8 @@ v8::Local<v8::Object> CreateJSEvent(v8::Isolate* isolate,
event = CreateEventObject(isolate);
}
mate::Dictionary(isolate, event).Set("sender", object);
if (sender)
mate::Dictionary(isolate, event).Set("frameId", sender->GetRoutingID());
return event;
}