diff --git a/package.json b/package.json index 2e4af688e..a50b7c0cf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "testcafe-hammerhead", "description": "A powerful web-proxy used as a core for the TestCafe testing framework (https://github.com/DevExpress/testcafe).", - "version": "9.3.10", + "version": "9.3.11", "homepage": "https://github.com/DevExpress/testcafe-hammerhead", "bugs": { "url": "https://github.com/DevExpress/testcafe-hammerhead/issues" diff --git a/src/client/sandbox/event/message.js b/src/client/sandbox/event/message.js index aa5915ebd..5fc06b5bc 100644 --- a/src/client/sandbox/event/message.js +++ b/src/client/sandbox/event/message.js @@ -200,12 +200,21 @@ export default class MessageSandbox extends SandboxBase { var sendFunc = force => { // NOTE: In IE, this function is called on the timeout despite the fact that the timer has been cleared // in the unload event handler, so we check whether the function is in the queue - if (canSendDirectly() && (force || this._removeInternalMsgFromQueue(sendFunc))) { - targetWindow[this.RECEIVE_MSG_FN]({ - // NOTE: Cloning a message to prevent this modification. - data: parseJSON(stringifyJSON(message)), - source: this.window - }); + if (force || this._removeInternalMsgFromQueue(sendFunc)) { + // NOTE: The 'sendFunc' function may be called on timeout, so we must call 'canSendDirectly' again, + // because the iframe could become cross-domain in the meantime. Unfortunately, Chrome hangs when + // trying to call the 'isCrossDomainWindows' function, so we have to wrap it in 'try/catch'. + try { + targetWindow[this.RECEIVE_MSG_FN]({ + // NOTE: Cloning a message to prevent this modification. + data: parseJSON(stringifyJSON(message)), + source: this.window + }); + } + /*eslint-disable no-empty */ + catch (e) { + } + /*eslint-enable no-empty */ } };