From 9c2f12d7554552cc325ecaac74b898f5cb4cbb41 Mon Sep 17 00:00:00 2001 From: Alexei Barantsev Date: Wed, 10 Feb 2016 10:26:30 +0300 Subject: [PATCH] Firefox: Fixing closed window handling in FF45 --- javascript/firefox-driver/js/nsCommandProcessor.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/javascript/firefox-driver/js/nsCommandProcessor.js b/javascript/firefox-driver/js/nsCommandProcessor.js index cb2e7c8021b39..68be8abedf1e9 100644 --- a/javascript/firefox-driver/js/nsCommandProcessor.js +++ b/javascript/firefox-driver/js/nsCommandProcessor.js @@ -462,10 +462,16 @@ nsCommandProcessor.prototype.execute = function(jsonCommandString, return; } - var contentWindow = sessionWindow.getBrowser().contentWindow; - if (!contentWindow) { - response.sendError(new WebDriverError(bot.ErrorCode.NO_SUCH_WINDOW, + try { + var contentWindow = sessionWindow.getBrowser().contentWindow; + if (!contentWindow) { + response.sendError(new WebDriverError(bot.ErrorCode.NO_SUCH_WINDOW, 'Window not found. The browser window may have been closed.')); + return; + } + } catch (ff45) { + response.sendError(new WebDriverError(bot.ErrorCode.NO_SUCH_WINDOW, + 'Window not found. The browser window may have been closed.')); return; }