Check for null focusedWindow in case of full-page plugins b=304243 r=IanN sr=jag

This commit is contained in:
neil%parkwaycc.co.uk 2005-12-02 14:33:09 +00:00
Родитель 2433929f4a
Коммит 8decabdc7b
3 изменённых файлов: 9 добавлений и 3 удалений

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

@ -279,7 +279,7 @@ function getContentAreaFrameCount()
function contentAreaFrameFocus() function contentAreaFrameFocus()
{ {
const focusedWindow = document.commandDispatcher.focusedWindow; const focusedWindow = document.commandDispatcher.focusedWindow;
if (focusedWindow.top == window.content) { if (focusedWindow && focusedWindow.top == window.content) {
gFocusedURL = focusedWindow.location.href; gFocusedURL = focusedWindow.location.href;
gFocusedDocument = focusedWindow.document; gFocusedDocument = focusedWindow.document;
} }

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

@ -86,7 +86,13 @@ function toJavaConsole()
function toOpenWindow( aWindow ) function toOpenWindow( aWindow )
{ {
aWindow.document.commandDispatcher.focusedWindow.focus(); try {
// Try to focus the previously focused window e.g. message compose body
aWindow.document.commandDispatcher.focusedWindow.focus();
} catch (e) {
// e.g. full-page plugin or non-XUL document; just raise the top window
aWindow.focus();
}
} }
function toOpenWindowByType( inType, uri ) function toOpenWindowByType( inType, uri )

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

@ -556,7 +556,7 @@
var focusedWindow = document.commandDispatcher.focusedWindow; var focusedWindow = document.commandDispatcher.focusedWindow;
var saveFocus = false; var saveFocus = false;
if (focusedWindow.top == window.content) { if (focusedWindow && focusedWindow.top == window.content) {
saveFocus = true; saveFocus = true;
} else { } else {
var contentWindow = window; var contentWindow = window;