diff --git a/browser/base/content/pageinfo/pageInfo.js b/browser/base/content/pageinfo/pageInfo.js index 65a7e39eca08..742c18f352e4 100644 --- a/browser/base/content/pageinfo/pageInfo.js +++ b/browser/base/content/pageinfo/pageInfo.js @@ -279,9 +279,12 @@ function onLoadPageInfo() gStrings.mediaLink = gBundle.getString("mediaLink"); gStrings.mediaInput = gBundle.getString("mediaInput"); - if ("arguments" in window && window.arguments.length >= 1 && - window.arguments[0] && window.arguments[0].doc) { - gDocument = window.arguments[0].doc; + var args = "arguments" in window && + window.arguments.length >= 1 && + window.arguments[0]; + + if (args && args.doc) { + gDocument = args.doc; gWindow = gDocument.defaultView; } else { @@ -297,18 +300,13 @@ function onLoadPageInfo() imageTree.view = gImageView; // set gImageElement if present - if ("arguments" in window && window.arguments.length >= 1 && - window.arguments[0].imageElement) - gImageElement = window.arguments[0].imageElement; + gImageElement = args && args.imageElement; // build the content loadPageInfo(); /* Select the requested tab, if the name is specified */ - var initialTab = "generalTab"; - if ("arguments" in window && window.arguments.length >= 1 && - window.arguments[0] && window.arguments[0].initialTab) - initialTab = window.arguments[0].initialTab; + var initialTab = (args && args.initialTab) || "generalTab"; var radioGroup = document.getElementById("viewGroup"); initialTab = document.getElementById(initialTab) || document.getElementById("generalTab"); radioGroup.selectedItem = initialTab;