Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return ZalgoPromise.try(() => {
const frame = getFrameByName(win, getBridgeName(getDomain()));
if (!frame) {
return;
}
if (isSameDomain(frame) && getGlobal(assertSameDomain(frame))) {
return frame;
}
return new ZalgoPromise(resolve => {
let interval;
let timeout; // eslint-disable-line prefer-const
interval = setInterval(() => { // eslint-disable-line prefer-const
if (frame && isSameDomain(frame) && getGlobal(assertSameDomain(frame))) {
clearInterval(interval);
clearTimeout(timeout);
return resolve(frame);
}
}, 100);
const renderSpinner = (win) => {
try {
win = assertSameDomain(win);
const doc = win.document;
writeElementToWindow(win, (
).render(dom({ doc })));
} catch (err) {
// pass
}
};
return ZalgoPromise['try'](function () {
if (isSameDomain(win)) {
return assertSameDomain(win);
}
});
},
getName: () => winPromise.then(win => {
if (isWindowClosed(win)) {
return;
}
if (isSameDomain(win)) {
return assertSameDomain(win).name;
}
return windowNamePromise;
}),
focus: () => winPromise.then(win => {
return awaitFrameLoad(prerenderIframe).then(function () {
var prerenderFrameWindow = prerenderIframe.contentWindow;
_this2.clean.register('destroyPrerender', function () {
destroyElement(prerenderIframe);
});
return assertSameDomain(prerenderFrameWindow);
});
},
const handleClick = (event, { fundingSource, card } : {| fundingSource : $Values, card : ?$Values |}) => {
if (supportsPopups()) {
const win = assertSameDomain(popup('', {
width: DEFAULT_POPUP_SIZE.WIDTH,
height: DEFAULT_POPUP_SIZE.HEIGHT
}));
const doc = window.document;
const spinner = (
).render(dom({ doc }));
writeElementToWindow(win, spinner);
onRenderCheckout({ win, fundingSource, card });
} else {
onRenderCheckout({ fundingSource, card });
setName: (name) => winPromise.then(win => {
if (__POST_ROBOT__.__IE_POPUP_SUPPORT__) {
linkWindow({ win, name });
}
const sameDomain = isSameDomain(win);
const frame = getFrameForWindow(win);
if (!sameDomain) {
throw new Error(`Can not set name for cross-domain window: ${ name }`);
}
assertSameDomain(win).name = name;
if (frame) {
frame.setAttribute('name', name);
}
windowNamePromise = ZalgoPromise.resolve(name);
})
};
return awaitFrameWindow(prerenderFrame).then(prerenderFrameWindow => {
return assertSameDomain(prerenderFrameWindow);
}).then(win => {
return toProxyWindow(win);
return ZalgoPromise.try(() => {
const prerenderTemplate = this.component.prerenderTemplate;
if (!prerenderTemplate) {
return;
}
let prerenderWindow = proxyPrerenderWin.getWindow();
if (!prerenderWindow || !isSameDomain(prerenderWindow) || !isBlankDomain(prerenderWindow)) {
return;
}
prerenderWindow = assertSameDomain(prerenderWindow);
const doc = prerenderWindow.document;
const el = this.renderTemplate(prerenderTemplate, { context, uid, doc });
if (!el) {
return;
}
if (el.ownerDocument !== doc) {
throw new Error(`Expected prerender template to have been created with document from child window`);
}
writeElementToWindow(prerenderWindow, el);
let { width = false, height = false, element = 'body' } = this.component.autoResize || {};
element = getElementSafe(element, doc);