diff options
author | Martin Kosek <mkosek@redhat.com> | 2011-02-17 17:51:03 +0100 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-02-17 12:12:23 -0500 |
commit | dbc268d96419b2f56b82f518496f3597c4afbc07 (patch) | |
tree | 5cda919c910e3b896a1b1e334b3b833773998d91 | |
parent | 50318b60eebbed1dc1a488991dff7f86bfaca58f (diff) | |
download | freeipa-dbc268d96419b2f56b82f518496f3597c4afbc07.tar.gz freeipa-dbc268d96419b2f56b82f518496f3597c4afbc07.tar.xz freeipa-dbc268d96419b2f56b82f518496f3597c4afbc07.zip |
Browser configuration support for Firefox 4
Support of navigator.preferences that is used to access browser
configuration was dropped in Firefox 4. This disables automatic
configuration of user preferences in this browser that is needed
to use Kerberos single sign-on.
This patch detectes a lack of this interface and tries to
configure the browser using new Services module introduced in
Gecko 2 (used in Firefox 4, SeaMonkey 2.1).
https://fedorahosted.org/freeipa/ticket/975
-rw-r--r-- | install/share/preferences.html.template | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/install/share/preferences.html.template b/install/share/preferences.html.template index 2d3684dcd..ef657e96c 100644 --- a/install/share/preferences.html.template +++ b/install/share/preferences.html.template @@ -9,24 +9,44 @@ </form> <script type="text/javascript"> -function setPreferences() { - try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite"); + function setPreferences() { + if (typeof navigator.preference == 'undefined') { + // From Firefox 4 and SeaMonkey 2.1, navigator.preference intefrace is dropped + // Use new Gecko2 Services.jsm JavaScript code module instead. + var privilege = 'UniversalXPConnect'; + netscape.security.PrivilegeManager.enablePrivilege(privilege); + Components.utils.import("resource://gre/modules/Services.jsm"); + var prefFuncChar = function(par, val) {Services.prefs.setCharPref(par, val)}; + var prefFuncBool = function(par, val) {Services.prefs.setBoolPref(par, val)}; + } else { + var privilege = 'UniversalPreferencesWrite'; + netscape.security.PrivilegeManager.enablePrivilege(privilege); + var prefFuncChar = function(par, val) {navigator.preference(par, val)}; + var prefFuncBool = prefFuncChar; // same function for bool and char + } + + try { + try { - navigator.preference("network.negotiate-auth.using-native-gsslib", true) - navigator.preference("network.negotiate-auth.delegation-uris", ".$DOMAIN") - navigator.preference("network.negotiate-auth.trusted-uris", ".$DOMAIN") - navigator.preference("network.negotiate-auth.allow-proxies", true) + prefFuncBool('network.negotiate-auth.using-native-gsslib', true); + prefFuncChar('network.negotiate-auth.delegation-uris', '.$DOMAIN'); + prefFuncChar('network.negotiate-auth.trusted-uris', '.$DOMAIN'); + prefFuncBool('network.negotiate-auth.allow-proxies', true); } catch (e) { - alert("Unable to store preferences: " + e) + alert("Unable to store preferences: " + e); + return; } - netscape.security.PrivilegeManager.disablePrivilege("UniversalPreferencesWrite"); - alert("Successfully configured Firefox for single sign on.") + + netscape.security.PrivilegeManager.disablePrivilege(privilege); + + alert("Successfully configured Firefox for single sign-on."); } catch (e) { - alert("Unable to apply recommended settings.\n\nClick on the Certificate Authority link and select trust for all, then reload this page and try again.\n\nThe error returned was: " + e); + alert("Unable to apply recommended settings.\n\n" + + "Click on the Certificate Authority link and select trust for all, " + + "then reload this page and try again.\n\nThe error returned was: " + e); return; + } } -} </script> </body> |