From 276b64070780d8fc758bfea206222240abc623af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Sat, 31 Oct 2009 01:50:57 +0100 Subject: [PATCH] Bug 525190 - Refactor the way pageInfo.js handles arguments. r=db48x --- browser/base/content/pageinfo/pageInfo.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) 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;