Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
});
let error;
try {
await clickButton(FUNDING.PAYPAL);
} catch (err) {
error = err;
}
if (!error) {
throw new Error(`Expected button click to trigger an error`);
}
await ZalgoPromise.delay(1000);
gqlMock.done();
firebaseScripts.done();
await mockWebSocketServer.done();
if (!closeMessageSent) {
throw new Error(`Expected close message to be sent`);
}
});
});
window.xprops.onClick = mockAsyncProp(expect('onClick', (data, actions) => {
return ZalgoPromise.delay(50).then(() => actions.reject());
}));
return win.isClosed().then(function (closed) {
if (closed) {
return _this18.userClose();
}
return ZalgoPromise.delay(200).then(function () {
return win.isClosed();
}).then(function (secondClosed) {
if (secondClosed) {
return _this18.userClose();
}
});
});
};
return win.isClosed().then(closed => {
if (closed) {
return this.userClose();
}
return ZalgoPromise.delay(200)
.then(() => win.isClosed())
.then(secondClosed => {
if (secondClosed) {
return this.userClose();
}
});
});
}
}).then(valid => {
if (valid) {
if (usePopupAppSwitch() && win) {
win.location = getNativePopupUrl();
}
} else {
if (usePopupAppSwitch()) {
close();
} else {
return ZalgoPromise.delay(500).then(() => {
if (didAppSwitch(win)) {
return connectNative().close();
}
}).then(() => {
return close();
});
}
}
}, err => {
close();
socketPromise = ZalgoPromise.try(() => {
if (retryDelay) {
retryPromise = ZalgoPromise.delay(retryDelay);
return retryPromise;
}
}).then(() => {
retryPromise = null;
return win.isClosed().then(closed => {
if (closed) {
return this.close();
}
return ZalgoPromise.delay(200)
.then(() => win.isClosed())
.then(secondClosed => {
if (secondClosed) {
return this.close();
}
});
});
}
watchForClose(proxyWin : ProxyWindow) : ZalgoPromise {
let cancelled = false;
this.clean.register(() => {
cancelled = true;
});
return ZalgoPromise.delay(2000).then(() => {
return proxyWin.isClosed();
}).then(isClosed => {
if (isClosed) {
this.component.log(`detect_close_child`);
return this.close();
} else if (!cancelled) {
return this.watchForClose(proxyWin);
}
});
}
const onBlurHandler = () => {
setOpaque(false);
return ZalgoPromise.delay(FADE_TIME).then(() => {
setVisible(false);
return ZalgoPromise.all([ onBlur(), hide() ]);
});
};