From b26b8cba89324710beecbc09b99551ccf6630e32 Mon Sep 17 00:00:00 2001 From: Steven Mask Date: Thu, 2 Nov 2023 17:42:47 -0400 Subject: [PATCH] fix(initChild): setName is applied in popup context (#444) * fix(setName): for cross domain * fix(setName): condition * chore(refactor): initChild * chore(refactor): initChild --- src/parent/parent.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/parent/parent.js b/src/parent/parent.js index 8842b5ac..d3798d53 100644 --- a/src/parent/parent.js +++ b/src/parent/parent.js @@ -713,9 +713,18 @@ export function parentComponent({ return ZalgoPromise.try(() => { currentChildDomain = childDomain; childComponent = childExports; - currentProxyWin?.setName(childExports?.name); - resolveInitPromise(); - clean.register(() => childExports.close.fireAndForget().catch(noop)); + + currentProxyWin + ?.isPopup() + .then((isPopup) => { + if (childExports?.name !== "" && isPopup) { + currentProxyWin?.setName(childExports?.name); + } + }) + .finally(() => { + resolveInitPromise(); + clean.register(() => childExports.close.fireAndForget().catch(noop)); + }); }); };