Backed out 2 changesets (bug 1563552) for failures on browser_privacypane_2.js and browser_sanitizeDialog.js CLOSED TREE

Backed out changeset c7df8a9a00a4 (bug 1563552)
Backed out changeset ce3ae99da523 (bug 1563552)
This commit is contained in:
Bogdan Tara 2019-07-24 11:51:56 +03:00
parent b05d25d7d6
commit 5e07a53115
3 changed files with 76 additions and 49 deletions

View File

@ -156,23 +156,23 @@
<vbox flex="1">
<!-- by design, no tooltip for bookmarks or history -->
<checkbox data-l10n-id="sync-engine-bookmarks"
preference="services.sync.engine.bookmarks"/>
preference="engine.bookmarks"/>
<checkbox data-l10n-id="sync-engine-history"
preference="services.sync.engine.history"/>
preference="engine.history"/>
<checkbox data-l10n-id="sync-engine-tabs"
preference="services.sync.engine.tabs"/>
preference="engine.tabs"/>
<checkbox data-l10n-id="sync-engine-logins"
preference="services.sync.engine.passwords"/>
preference="engine.passwords"/>
</vbox>
<vbox flex="1">
<checkbox data-l10n-id="sync-engine-addresses"
preference="services.sync.engine.addresses"/>
preference="engine.addresses"/>
<checkbox data-l10n-id="sync-engine-creditcards"
preference="services.sync.engine.creditcards"/>
preference="engine.creditcards"/>
<checkbox data-l10n-id="sync-engine-addons"
preference="services.sync.engine.addons"/>
preference="engine.addons"/>
<checkbox data-l10n-id="sync-engine-prefs"
preference="services.sync.engine.prefs"/>
preference="engine.prefs"/>
</vbox>
<spacer/>
</hbox>

View File

@ -31,14 +31,30 @@ const FXA_LOGIN_UNVERIFIED = 1;
const FXA_LOGIN_FAILED = 2;
Preferences.addAll([
{ id: "services.sync.engine.addons", type: "bool" },
{ id: "services.sync.engine.bookmarks", type: "bool" },
{ id: "services.sync.engine.history", type: "bool" },
{ id: "services.sync.engine.tabs", type: "bool" },
{ id: "services.sync.engine.prefs", type: "bool" },
{ id: "services.sync.engine.passwords", type: "bool" },
{ id: "services.sync.engine.addresses", type: "bool" },
{ id: "services.sync.engine.creditcards", type: "bool" },
{ id: "engine.addons", name: "services.sync.engine.addons", type: "bool" },
{
id: "engine.bookmarks",
name: "services.sync.engine.bookmarks",
type: "bool",
},
{ id: "engine.history", name: "services.sync.engine.history", type: "bool" },
{ id: "engine.tabs", name: "services.sync.engine.tabs", type: "bool" },
{ id: "engine.prefs", name: "services.sync.engine.prefs", type: "bool" },
{
id: "engine.passwords",
name: "services.sync.engine.passwords",
type: "bool",
},
{
id: "engine.addresses",
name: "services.sync.engine.addresses",
type: "bool",
},
{
id: "engine.creditcards",
name: "services.sync.engine.creditcards",
type: "bool",
},
]);
var gSyncPane = {
@ -95,14 +111,8 @@ var gSyncPane = {
// These 2 engines are unique in that there are prefs that make the
// entire engine unavailable (which is distinct from "disabled").
let enginePrefs = [
[
"services.sync.engine.addresses.available",
"services.sync.engine.addresses",
],
[
"services.sync.engine.creditcards.available",
"services.sync.engine.creditcards",
],
["services.sync.engine.addresses.available", "engine.addresses"],
["services.sync.engine.creditcards.available", "engine.creditcards"],
];
let numHidden = 0;
for (let [availablePref, prefName] of enginePrefs) {
@ -118,12 +128,8 @@ var gSyncPane = {
// the second column. (If we only moved one, it's still unbalanced, but
// there's an odd number of engines so that can't be avoided)
if (numHidden == 2) {
let history = document.querySelector(
'[preference="services.sync.engine.history"]'
);
let addons = document.querySelector(
'[preference="services.sync.engine.addons"]'
);
let history = document.querySelector('[preference="engine.history"]');
let addons = document.querySelector('[preference="engine.addons"]');
addons.parentNode.insertBefore(history, addons);
}
},

View File

@ -344,7 +344,7 @@ const Preferences = (window.Preferences = (function() {
window.addEventListener("unload", Preferences, { once: true });
class Preference extends EventEmitter {
constructor({ id, type, inverted, disabled }) {
constructor({ id, name, type, inverted, disabled }) {
super();
this.on("change", this.onChange.bind(this));
@ -354,10 +354,17 @@ const Preferences = (window.Preferences = (function() {
this.batching = false;
this.id = id;
this._name = name || this.id;
this.type = type;
this.inverted = !!inverted;
this._disabled = !!disabled;
// if the element has been inserted without the name attribute set,
// we have nothing to do here
if (!this.name) {
throw new Error(`preference with id '${id}' doesn't have name`);
}
// In non-instant apply mode, we must try and use the last saved state
// from any previous opens of a child dialog instead of the value from
// preferences, to pick up any edits a user may have made.
@ -369,7 +376,7 @@ const Preferences = (window.Preferences = (function() {
window.opener.document.nodePrincipal.isSystemPrincipal
) {
// Try to find the preference in the parent window.
const preference = window.opener.Preferences.get(this.id);
const preference = window.opener.Preferences.get(this.name);
// Don't use the value setter here, we don't want updateElements to be
// prematurely fired.
@ -385,9 +392,9 @@ const Preferences = (window.Preferences = (function() {
}
_reportUnknownType() {
const msg = `Preference with id=${this.id} has unknown type ${
this.type
}.`;
const msg = `Preference with id=${this.id} and name=${
this.name
} has unknown type ${this.type}.`;
Services.console.logStringMessage(msg);
}
@ -523,6 +530,20 @@ const Preferences = (window.Preferences = (function() {
this.updateElements();
}
get name() {
return this._name;
}
set name(val) {
if (val == this.name) {
return val;
}
this._name = val;
return val;
}
get value() {
return this._value;
}
@ -539,7 +560,7 @@ const Preferences = (window.Preferences = (function() {
}
get locked() {
return Services.prefs.prefIsLocked(this.id);
return Services.prefs.prefIsLocked(this.name);
}
get disabled() {
@ -568,7 +589,7 @@ const Preferences = (window.Preferences = (function() {
get hasUserValue() {
return (
Services.prefs.prefHasUserValue(this.id) && this.value !== undefined
Services.prefs.prefHasUserValue(this.name) && this.value !== undefined
);
}
@ -588,28 +609,28 @@ const Preferences = (window.Preferences = (function() {
// Force a resync of value with preferences.
switch (this.type) {
case "int":
return this._branch.getIntPref(this.id);
return this._branch.getIntPref(this.name);
case "bool": {
const val = this._branch.getBoolPref(this.id);
const val = this._branch.getBoolPref(this.name);
return this.inverted ? !val : val;
}
case "wstring":
return this._branch.getComplexValue(
this.id,
this.name,
Ci.nsIPrefLocalizedString
).data;
case "string":
case "unichar":
return this._branch.getStringPref(this.id);
return this._branch.getStringPref(this.name);
case "fontname": {
const family = this._branch.getStringPref(this.id);
const family = this._branch.getStringPref(this.name);
const fontEnumerator = Cc[
"@mozilla.org/gfx/fontenumerator;1"
].createInstance(Ci.nsIFontEnumerator);
return fontEnumerator.getStandardFamilyName(family);
}
case "file": {
const f = this._branch.getComplexValue(this.id, Ci.nsIFile);
const f = this._branch.getComplexValue(this.name, Ci.nsIFile);
return f;
}
default:
@ -627,17 +648,17 @@ const Preferences = (window.Preferences = (function() {
// The special value undefined means 'reset preference to default'.
if (val === undefined) {
Services.prefs.clearUserPref(this.id);
Services.prefs.clearUserPref(this.name);
return val;
}
// Force a resync of preferences with value.
switch (this.type) {
case "int":
Services.prefs.setIntPref(this.id, val);
Services.prefs.setIntPref(this.name, val);
break;
case "bool":
Services.prefs.setBoolPref(this.id, this.inverted ? !val : val);
Services.prefs.setBoolPref(this.name, this.inverted ? !val : val);
break;
case "wstring": {
const pls = Cc["@mozilla.org/pref-localizedstring;1"].createInstance(
@ -645,7 +666,7 @@ const Preferences = (window.Preferences = (function() {
);
pls.data = val;
Services.prefs.setComplexValue(
this.id,
this.name,
Ci.nsIPrefLocalizedString,
pls
);
@ -654,7 +675,7 @@ const Preferences = (window.Preferences = (function() {
case "string":
case "unichar":
case "fontname":
Services.prefs.setStringPref(this.id, val);
Services.prefs.setStringPref(this.name, val);
break;
case "file": {
let lf;
@ -667,7 +688,7 @@ const Preferences = (window.Preferences = (function() {
} else {
lf = val.QueryInterface(Ci.nsIFile);
}
Services.prefs.setComplexValue(this.id, Ci.nsIFile, lf);
Services.prefs.setComplexValue(this.name, Ci.nsIFile, lf);
break;
}
default: