Skip to content

Commit

Permalink
Update to v9.3.11, fix chrome hang (#864)
Browse files Browse the repository at this point in the history
* Fix chrome hang

* Update to v9.3.11
  • Loading branch information
churkin authored and VasilyStrelyaev committed Oct 17, 2016
1 parent de2c759 commit 776ddb0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
21 changes: 15 additions & 6 deletions src/client/sandbox/event/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}
};

Expand Down

0 comments on commit 776ddb0

Please sign in to comment.