From 9394feaf01218112f5600bbca80e14015ee35399 Mon Sep 17 00:00:00 2001 From: Pierre Baize Date: Wed, 16 Oct 2019 14:32:12 -0400 Subject: [PATCH 1/2] throw on out of app target --- src/browser/api/browser_view.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/browser/api/browser_view.ts b/src/browser/api/browser_view.ts index 472034e47..651a9bb3e 100644 --- a/src/browser/api/browser_view.ts +++ b/src/browser/api/browser_view.ts @@ -87,7 +87,9 @@ export function show(ofView: OfView) { export async function attach(ofView: OfView, toIdentity: Identity) { const {view, target: previousTarget} = ofView; - + if (toIdentity.uuid !== ofView.uuid) { + throw new Error('A view may only be attached to a window in the same application'); + } if (view && ! view.isDestroyed()) { const ofWin = getWindowByUuidName(toIdentity.uuid, toIdentity.name); const oldWin = getWindowByUuidName(previousTarget.uuid, previousTarget.name); From fdab52d539e16a91e493d3d8b9a3b40398a2c01c Mon Sep 17 00:00:00 2001 From: Pierre Baize Date: Wed, 16 Oct 2019 14:43:37 -0400 Subject: [PATCH 2/2] throw on create too --- src/browser/api/browser_view.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/browser/api/browser_view.ts b/src/browser/api/browser_view.ts index 651a9bb3e..a9fd20ee4 100644 --- a/src/browser/api/browser_view.ts +++ b/src/browser/api/browser_view.ts @@ -29,6 +29,9 @@ export async function create(options: BrowserViewOpts) { throw new Error('Must supply target identity'); } const targetIdentity = options.target; + if (targetIdentity.uuid !== uuid) { + throw new Error('A view may only be attached to a window in the same application'); + } const targetWin = getWindowByUuidName(targetIdentity.uuid, targetIdentity.name); if (!targetWin) { throw new Error('Target Window could not be found');