Bug 786095 - Initially disable Social API when in safe mode. r=felipe

This commit is contained in:
Jared Wein 2012-09-24 14:57:12 -07:00
Родитель f0b366783f
Коммит 1ced2ee56c
3 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -80,6 +80,10 @@ let SocialUI = {
let accesskey = gNavigatorBundle.getString("social.toggle.accesskey");
toggleCommand.setAttribute("label", label);
toggleCommand.setAttribute("accesskey", accesskey);
// Override the normal 'checked' state set by updateToggleCommand
// when in safe mode so the feature can be disabled.
if (Services.appinfo.inSafeMode)
toggleCommand.setAttribute("checked", Services.prefs.getBoolPref("social.enabled"));
SocialToolbar.init();
SocialShareButton.init();

Просмотреть файл

@ -19,7 +19,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "SocialService",
let Social = {
lastEventReceived: 0,
provider: null,
_disabledForSafeMode: false,
init: function Social_init(callback) {
this._disabledForSafeMode = Services.appinfo.inSafeMode && this.enabled;
if (this.provider) {
schedule(callback);
return;
@ -54,7 +57,8 @@ let Social = {
},
toggle: function Social_toggle() {
this.enabled = !this.enabled;
this.enabled = this._disabledForSafeMode ? true : !this.enabled;
this._disabledForSafeMode = false;
},
toggleSidebar: function SocialSidebar_toggle() {

Просмотреть файл

@ -63,7 +63,7 @@ XPCOMUtils.defineLazyGetter(SocialServiceInternal, "providers", function () {
try {
var manifest = JSON.parse(MANIFEST_PREFS.getCharPref(pref));
if (manifest && typeof(manifest) == "object") {
let provider = new SocialProvider(manifest, SocialServiceInternal.enabled);
let provider = new SocialProvider(manifest, Services.appinfo.inSafeMode ? false : SocialServiceInternal.enabled);
providers[provider.origin] = provider;
}
} catch (err) {
@ -86,7 +86,11 @@ const SocialService = {
},
set enabled(val) {
let enable = !!val;
if (enable == SocialServiceInternal.enabled)
// Allow setting to the same value when in safe mode so the
// feature can be force enabled.
if (enable == SocialServiceInternal.enabled &&
!Services.appinfo.inSafeMode)
return;
Services.prefs.setBoolPref("social.enabled", enable);