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

@ -142,6 +142,18 @@ WebContents.prototype._sendInternalToAll = function (channel, ...args) {
return this._send(internal, sendToAll, channel, args)
}
WebContents.prototype._sendToFrameInternal = function (frameId, channel, ...args) {
if (typeof channel !== 'string') {
throw new Error('Missing required channel argument')
} else if (typeof frameId !== 'number') {
throw new Error('Missing required frameId argument')
}
const internal = true
const sendToAll = false
return this._sendToFrame(internal, sendToAll, frameId, channel, args)
}
// Following methods are mapped to webFrame.
const webFrameMethods = [