Skip to content
Open
Changes from 1 commit
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
10 changes: 8 additions & 2 deletions client/src/RequestBehavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ export class IFrameRequestBehavior extends RequestBehavior {
}

public async request(endpoint: string, command: KeyguardCommand, args: any[]): Promise<any> {
if (this._iframe && this._iframe.src !== `${endpoint}${IFrameRequestBehavior.IFRAME_PATH_SUFFIX}`) {
throw new Error('Keyguard iframe is already opened with another endpoint');
if (this._iframe
&& this._iframe.src
&& this._iframe.src !== `${endpoint}${IFrameRequestBehavior.IFRAME_PATH_SUFFIX}`
) {
const openedSrc = this._iframe.src;
const expectedSrc = `${endpoint}${IFrameRequestBehavior.IFRAME_PATH_SUFFIX}`;
Comment thread
sisou marked this conversation as resolved.
Outdated
throw new Error('Keyguard iframe is already opened with another endpoint' +
`(opened: ${openedSrc}, expected: ${expectedSrc}`);
Comment thread
sisou marked this conversation as resolved.
Outdated
}

const origin = RequestBehavior.getAllowedOrigin(endpoint);
Expand Down