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

git-svn-id: svn://10.0.0.236/trunk@185572 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
neil%parkwaycc.co.uk 2005-12-02 14:33:09 +00:00
parent 4f11d323fe
commit 478d9fff2b
3 changed files with 9 additions and 3 deletions

View File

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

View File

@ -86,7 +86,13 @@ function toJavaConsole()
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 )

View File

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