зеркало из https://github.com/mozilla/gecko-dev.git
Bug 786095 - Initially disable Social API when in safe mode. r=felipe
This commit is contained in:
Родитель
f0b366783f
Коммит
1ced2ee56c
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче