+ try {
+ var url = srGetStrBundle("chrome://calendar/locale/calendar.properties")
+ .GetStringFromName("holidayCalendarURL");
Style: try/catch defines a code block, so you need to increase your indenting here. (Anytime you use '{' indenting should change.)
Style: It's best to minimize the amount of code enclosed in a try block, since it can hide other errors. In this case, there's only one line that you expect to throw an error, so the catch should come right after it.
As mvl pointed out, the other thing that can happen here is that the localizer left holidayCalendarURL blank (but defined it) In that case, GetStringFromName won't die, and we'll create a calendar with a blank url, which is bad. So, after you get the string, you need to check to make sure it actually contains useful data.
Comment on attachment 204318
Patch v3
+ try { "chrome: //calendar/ locale/ calendar. properties" ) ame("holidayCal endarURL" );
+ var url = srGetStrBundle(
+ .GetStringFromN
Style: try/catch defines a code block, so you need to increase your indenting here. (Anytime you use '{' indenting should change.)
Style: It's best to minimize the amount of code enclosed in a try block, since it can hide other errors. In this case, there's only one line that you expect to throw an error, so the catch should come right after it.
As mvl pointed out, the other thing that can happen here is that the localizer left holidayCalendarURL blank (but defined it) In that case, GetStringFromName won't die, and we'll create a calendar with a blank url, which is bad. So, after you get the string, you need to check to make sure it actually contains useful data.