Bug 365467 Focus contollers initial window and element can get out of sync r+sr=jst

Reordering tests to see if that can make the change stick

--HG--
rename : browser/base/content/test/browser_autodiscovery.js => browser/base/content/test/browser_discovery.js
rename : browser/base/content/test/autodiscovery.html => browser/base/content/test/discovery.html
This commit is contained in:
Neil Rashbrook 2008-10-10 10:36:41 +01:00
Родитель 211a0c9692
Коммит c9cedd0533
4 изменённых файлов: 14 добавлений и 22 удалений

Просмотреть файл

@ -55,10 +55,11 @@ _BROWSER_FILES = browser_bug321000.js \
browser_bug405137.js \
browser_bug409481.js \
browser_bug413915.js \
browser_autodiscovery.js \
browser_bug420160.js \
browser_bug427559.js \
browser_bug441778.js \
autodiscovery.html \
browser_discovery.js \
discovery.html \
moz.png \
browser_getshortcutoruri.js \
browser_page_style_menu.js \
@ -72,13 +73,6 @@ _BROWSER_FILES += browser_customize.js \
$(NULL)
endif
# disable tests on linux for now..
ifneq ($(OS_ARCH),Linux)
_BROWSER_FILES += \
browser_bug427559.js \
$(NULL)
endif
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)

Просмотреть файл

@ -20,7 +20,7 @@ function test() {
waitForExplicitFinish();
var activeWin = Application.activeWindow;
gTestPage = activeWin.open(url("chrome://mochikit/content/browser/browser/base/content/test/autodiscovery.html"));
gTestPage = activeWin.open(url("chrome://mochikit/content/browser/browser/base/content/test/discovery.html"));
gTestPage.focus();
setTimeout(iconDiscovery, 1000);
}

Просмотреть файл

@ -2293,19 +2293,17 @@ static void CheckForFocus(nsPIDOMWindow* aOurWindow,
if (!aFocusController)
return;
nsCOMPtr<nsIDOMWindowInternal> ourWin = do_QueryInterface(aOurWindow);
nsCOMPtr<nsIDOMWindowInternal> focusedWindow;
aFocusController->GetFocusedWindow(getter_AddRefs(focusedWindow));
if (!focusedWindow) {
// This should never really happen, but if it does, assume
// we can focus ourself to keep the window from being keydead.
focusedWindow = ourWin;
// This happens if the window has not been shown yet. We don't need to
// focus anything now because showing the window will set the focus.
return;
}
// Walk up the document chain, starting with focusedWindow's document.
// We stop walking when we find a document that has a null DOMWindow
// (meaning that the DOMWindow has a new document now) or find ourWin
// (meaning that the DOMWindow has a new document now) or find aOurWindow
// as the document's window. We also stop if we hit aDocument, since
// that means there is a child document which loaded before us that's
// already been given focus.
@ -2328,7 +2326,7 @@ static void CheckForFocus(nsPIDOMWindow* aOurWindow,
while (curDoc) {
nsPIDOMWindow *curWin = curDoc->GetWindow();
if (!curWin || curWin == ourWin)
if (!curWin || curWin == aOurWindow)
break;
curDoc = curDoc->GetParentDocument();
@ -2337,20 +2335,20 @@ static void CheckForFocus(nsPIDOMWindow* aOurWindow,
}
if (!curDoc) {
// We reached the top of the document chain, and did not encounter ourWin
// or a windowless document. So, focus should be unaffected by this
// document load.
// We reached the top of the document chain, and did not encounter
// aOurWindow or a windowless document. So, focus should be unaffected
// by this document load.
return;
}
PRBool active;
aFocusController->GetActive(&active);
if (active)
ourWin->Focus();
aOurWindow->Focus();
// We need to ensure that the focus controller is updated, since it may be
// suppressed when this function is called.
aFocusController->SetFocusedWindow(ourWin);
aFocusController->SetFocusedWindow(aOurWindow);
}
NS_IMETHODIMP