From 8b0d3a256794f0fda3d630830687f69ccc268859 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 3 Feb 2017 13:58:07 -0800 Subject: [PATCH] Emit attach params as well in event --- docs/api/web-contents.md | 5 ++++- lib/browser/guest-view-manager.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 4e4f6171b715..192e12e4012e 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -511,8 +511,11 @@ Returns: * `webPreferences` Object - The web preferences that will be used by the guest page. This object can be modified to adjust the preferences for the guest page. +* `params` Object - The other `` parameters such as the `src` URL. + This object can be modified to adjust the parameters of the guest page. -Calling `event.preventDefault()` will destroy the guest page. +Emitted when a ``'s web contents is being attached to this web +contents. Calling `event.preventDefault()` will destroy the guest page. ### Instance Methods diff --git a/lib/browser/guest-view-manager.js b/lib/browser/guest-view-manager.js index 5a47a52747cd..6b8b6144708a 100644 --- a/lib/browser/guest-view-manager.js +++ b/lib/browser/guest-view-manager.js @@ -206,7 +206,7 @@ const attachGuest = function (event, elementInstanceId, guestInstanceId, params) webPreferences.preloadURL = params.preload } - event.sender.emit('will-attach-webview', event, guest, webPreferences) + event.sender.emit('will-attach-webview', event, guest, webPreferences, params) if (event.defaultPrevented) { if (guest.viewInstanceId == null) guest.viewInstanceId = params.instanceId destroyGuest(embedder, guestInstanceId)