Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

[RUN-5718] Views can only be attached to in-app windows #999

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/browser/api/browser_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -87,7 +90,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);
Expand Down