From 0e2285ea7ec9d6c7ffff142f738a8bbd0160f414 Mon Sep 17 00:00:00 2001 From: "jaggernaut%netscape.com" Date: Thu, 14 Sep 2006 06:06:44 +0000 Subject: [PATCH] Bug 127589: when switching tabs with find dialog open, update dialog's internal state so it's "attached" to the focused tab. r=Jan, sr=peterv --- suite/browser/browser.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/suite/browser/browser.js b/suite/browser/browser.js index df9077e3750..268f28a03c7 100644 --- a/suite/browser/browser.js +++ b/suite/browser/browser.js @@ -299,22 +299,25 @@ function BrowserSetForcedDetector(doReload) BrowserReloadWithFlags(nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE); } +var gFindInstData; +function getFindInstData() +{ + if (!gFindInstData) { + gFindInstData = new nsFindInstData(); + gFindInstData.browser = getBrowser(); + // defaults for rootSearchWindow and currentSearchWindow are fine here + } + return gFindInstData; +} + function BrowserFind() { - var focusedWindow = document.commandDispatcher.focusedWindow; - if (!focusedWindow || focusedWindow == window) - focusedWindow = window._content; - - findInPage(getBrowser(), window._content, focusedWindow) + findInPage(getFindInstData()); } function BrowserFindAgain(reverse) { - var focusedWindow = document.commandDispatcher.focusedWindow; - if (!focusedWindow || focusedWindow == window) - focusedWindow = window._content; - - findAgainInPage(getBrowser(), window._content, focusedWindow, reverse) + findAgainInPage(getFindInstData(), reverse); } function BrowserCanFindAgain()