diff --git a/javascript/selenium-core/scripts/selenium-browserbot.js b/javascript/selenium-core/scripts/selenium-browserbot.js index b1b904bb2ea61..326b6df2bd022 100644 --- a/javascript/selenium-core/scripts/selenium-browserbot.js +++ b/javascript/selenium-core/scripts/selenium-browserbot.js @@ -2349,10 +2349,10 @@ IEBrowserBot.prototype.modifySeparateTestWindowToDetectPageLoads = function(wind var pageUnloadDetector = function() { self.pageUnloading = true; }; - if (win.addEventListener) { - win.addEventListener('beforeunload', pageUnloadDetector, true); + if (windowObject.addEventListener) { + windowObject.addEventListener('beforeunload', pageUnloadDetector, true); } else { - win.attachEvent('onbeforeunload', pageUnloadDetector); + windowObject.attachEvent('onbeforeunload', pageUnloadDetector); } BrowserBot.prototype.modifySeparateTestWindowToDetectPageLoads.call(this, windowObject); };