Closed Bug 265381 Opened 20 years ago Closed 20 years ago

Changing default value of homepage raises an exception

Categories

(SeaMonkey :: General, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: bugzilla, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; cs-CZ; rv:1.7.3) Gecko/20040910
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; cs-CZ; rv:1.7.3) Gecko/20040910

Mozilla homepage is stored in the pref "browser.startup.homepage".
Administrators often want to set default value of the browser homepage e.g. to
the institution page. But there is no simple way ho to do this, because changing
"browser.startup.homepage" default value raises an exception.

I have tried to change default value of "browser.startup.homepage" directly in
the defaults/pref/browser-prefs.js or by adding new file all-page.js with the
new "browser.startup.homepage" value, but it doesn't work;
"browser.startup.homepage" is read as nsIPrefLocalizedString and Mozilla raises
exception when reading nsIPrefLocalizedString set not to the chrome:// URL but
to the string (I am not sure if this is bug or feature - probably depends on the
bug #109902 ).

Exception is raised in the navigator.js

function getHomePage()
{
  var URIs = [];
  try {
*    URIs[0] = pref.getComplexValue("browser.startup.homepage",
                                  
Components.interfaces.nsIPrefLocalizedString).data;
    .....
.  } catch(e) {
.  }

  return URIs;
}

* this line raises exception:

Error: uncaught exception: [Exception... "Component returned failure code:
0x80004005 (NS_ERROR_FAILURE) [nsIPrefBranch.getComplexValue]"  nsresult:
"0x80004005 (NS_ERROR_FAILURE)" location: "JS frame ::
chrome://navigator/content/navigator.js :: getHomePage :: line 366" data: no]

Question: Is really correct behaviour, that you cannot change
nsIPrefLocalizedString pref from
"chrome://navigator-region/locale/region.properties" to something like
"http://www.page.cz/"? If it this so, maybe we can after failed
nsIPrefLocalizedString reading add simple rescue like:

pref.getCharPref("browser.startup.homepage");


Any sugestion? I think there is important for admins to have simple possibility
howto change default homepage e.g. only by copying simple all-page.js in the
mozilla/defaults/pref folder.

Reproducible: Always
Steps to Reproduce:
xref: In the bug #109932 , there is also problem with the
"browser.startup.homepage", but a little bit different
Why not change the value in the properties file?  The whole point of using a
localized string is that only the properties file needs to be edited to change it...
Well Boris, it is possible for 1,2,3...10 computers. Really I was asked in our
Czech forum by some amins from companies with about 100-500 coputers how to do
it. Yes, there is possible to create script and update "region.properties" in
the jar file. But it seems unsuitable for them (we have large tutorial for
admins http://www.czilla.cz/devel/uprava-instalatoru/ but they are not
satisfied). Assuming that changing home page is one of the most frequent
adjustments.

Mozilla (FF, TB...) have some disadvantages in the automatic settings (e.g.
there is no group policy, no *.adm file for Mozilla), so I think every help  for
admins is very useful. Try to consult this with some admins, and see yourself
how much it is neccessary.
How about adding your own all-override.js which sets browser.startup.homepage to
file://///server/share/homepage.properties or resource:///homepage.properties ?
Interesting workaround. I will consult it with other people. Thanks. 
OK, closing.

Neil, this is the best solution we can achieve now. But in the future IMHO there
is *neccessary* to implement some Group policy (I am consulting this now with
some admins) if we want put Mozilla (Firefox...) in the large companies.

Thanks.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.