mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 4a4e0c618649 (bug 1056170) for XPC Test Failures
This commit is contained in:
parent
59f71f5766
commit
2e1b498181
@ -788,11 +788,6 @@ Preferences::GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Preferences::GetDirty(bool *_retval) {
|
||||
*_retval = gDirty;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Preferences::NotifyServiceObservers(const char *aTopic)
|
||||
|
@ -120,19 +120,16 @@ interface nsIPrefService : nsISupports
|
||||
*/
|
||||
nsIPrefBranch getDefaultBranch(in string aPrefRoot);
|
||||
|
||||
/**
|
||||
* The preference service is 'dirty' if there are changes to user preferences
|
||||
* that have not been written to disk
|
||||
*/
|
||||
readonly attribute boolean dirty;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_PREFSERVICE_CID \
|
||||
{ /* {410c269f-3f7a-4396-88ce-781071733182} */ \
|
||||
0x410c269f, 0x3f7a, 0x4396, \
|
||||
{ 0x88, 0xce, 0x78, 0x10, 0x71, 0x73, 0x31, 0x82 } \
|
||||
{ /* {1cd91b88-1dd2-11b2-92e1-ed22ed298000} */ \
|
||||
0x91ca2441, \
|
||||
0x050f, \
|
||||
0x4f7c, \
|
||||
{ 0x9d, 0xf8, 0x75, 0xb4, 0x0e, 0xa4, 0x01, 0x56 } \
|
||||
}
|
||||
|
||||
#define NS_PREFSERVICE_CONTRACTID "@mozilla.org/preferences-service;1"
|
||||
|
@ -312,7 +312,7 @@ pref_SetPref(const dom::PrefSetting& aPref)
|
||||
if (userValue.type() == dom::MaybePrefValue::TPrefValue) {
|
||||
rv = SetPrefValue(prefName, userValue.get_PrefValue(), USER_VALUE);
|
||||
} else {
|
||||
rv = PREF_ClearUserPref(prefName);
|
||||
rv = PREF_ClearUserPref(prefName);
|
||||
}
|
||||
|
||||
// NB: we should never try to clear a default value, that doesn't
|
||||
@ -725,6 +725,7 @@ static void pref_SetValue(PrefValue* existingValue, uint16_t *existingFlags,
|
||||
else {
|
||||
*existingValue = newValue;
|
||||
}
|
||||
gDirty = true;
|
||||
}
|
||||
|
||||
PrefHashEntry* pref_HashTableLookup(const void *key)
|
||||
@ -784,8 +785,6 @@ nsresult pref_HashPref(const char *key, PrefValue value, PrefType type, uint32_t
|
||||
if (!PREF_HAS_USER_VALUE(pref))
|
||||
valueChanged = true;
|
||||
}
|
||||
// What if we change the default to be the same as the user value?
|
||||
// Should we clear the user value?
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -800,10 +799,8 @@ nsresult pref_HashPref(const char *key, PrefValue value, PrefType type, uint32_t
|
||||
{
|
||||
/* XXX should we free a user-set string value if there is one? */
|
||||
pref->flags &= ~PREF_USERSET;
|
||||
if (!PREF_IS_LOCKED(pref)) {
|
||||
gDirty = true;
|
||||
if (!PREF_IS_LOCKED(pref))
|
||||
valueChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!PREF_HAS_USER_VALUE(pref) ||
|
||||
@ -812,17 +809,20 @@ nsresult pref_HashPref(const char *key, PrefValue value, PrefType type, uint32_t
|
||||
{
|
||||
pref_SetValue(&pref->userPref, &pref->flags, value, type);
|
||||
pref->flags |= PREF_USERSET;
|
||||
if (!PREF_IS_LOCKED(pref)) {
|
||||
gDirty = true;
|
||||
if (!PREF_IS_LOCKED(pref))
|
||||
valueChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (valueChanged) {
|
||||
return pref_DoCallback(key);
|
||||
gDirty = true;
|
||||
|
||||
nsresult rv2 = pref_DoCallback(key);
|
||||
if (NS_FAILED(rv2))
|
||||
rv = rv2;
|
||||
}
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
size_t
|
||||
|
@ -32,7 +32,7 @@ var provider = {
|
||||
persistent.value = true;
|
||||
if (prop == NS_APP_USER_PROFILE_50_DIR)
|
||||
return dirSvc.get("CurProcD", Ci.nsIFile);
|
||||
throw Components.Exception("Tried to get test directory '" + prop + "'", Cr.NS_ERROR_FAILURE);
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
},
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsIDirectoryServiceProvider) ||
|
||||
|
@ -1,75 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* Tests for handling of the preferences 'dirty' flag (bug 985998) */
|
||||
|
||||
const PREF_INVALID = 0;
|
||||
const PREF_BOOL = 128;
|
||||
const PREF_INT = 64;
|
||||
const PREF_STRING = 32;
|
||||
|
||||
function run_test() {
|
||||
|
||||
var ps = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefService);
|
||||
|
||||
let defaultBranch = ps.getDefaultBranch("");
|
||||
let userBranch = ps.getBranch("");
|
||||
|
||||
let prefFile = do_get_profile();
|
||||
prefFile.append("prefs.js");
|
||||
|
||||
//**************************************************************************//
|
||||
// prefs are not dirty after a write
|
||||
ps.savePrefFile(prefFile);
|
||||
do_check_false(ps.dirty);
|
||||
|
||||
// set a new a user value, we should become dirty
|
||||
userBranch.setBoolPref("DirtyTest.new.bool", true);
|
||||
do_check_true(ps.dirty);
|
||||
ps.savePrefFile(prefFile);
|
||||
// Overwrite a pref with the same value => not dirty
|
||||
userBranch.setBoolPref("DirtyTest.new.bool", true);
|
||||
do_check_false(ps.dirty);
|
||||
|
||||
// Repeat for the other two types
|
||||
userBranch.setIntPref("DirtyTest.new.int", 1);
|
||||
do_check_true(ps.dirty);
|
||||
ps.savePrefFile(prefFile);
|
||||
// Overwrite a pref with the same value => not dirty
|
||||
userBranch.setIntPref("DirtyTest.new.int", 1);
|
||||
do_check_false(ps.dirty);
|
||||
|
||||
userBranch.setCharPref("DirtyTest.new.char", "oop");
|
||||
do_check_true(ps.dirty);
|
||||
ps.savePrefFile(prefFile);
|
||||
// Overwrite a pref with the same value => not dirty
|
||||
userBranch.setCharPref("DirtyTest.new.char", "oop");
|
||||
do_check_false(ps.dirty);
|
||||
|
||||
// change *type* of a user value -> dirty
|
||||
userBranch.setBoolPref("DirtyTest.new.char", false);
|
||||
do_check_true(ps.dirty);
|
||||
ps.savePrefFile(prefFile);
|
||||
|
||||
// Set a default pref => not dirty (defaults don't go into prefs.js)
|
||||
defaultBranch.setBoolPref("DirtyTest.existing.bool", true);
|
||||
do_check_false(ps.dirty);
|
||||
// Fail to change type of a pref with default value -> not dirty
|
||||
do_check_throws(function() {
|
||||
userBranch.setCharPref("DirtyTest.existing.bool", "boo"); }, Cr.NS_ERROR_UNEXPECTED);
|
||||
do_check_false(ps.dirty);
|
||||
|
||||
// Set user value same as default, not dirty
|
||||
userBranch.setBoolPref("DirtyTest.existing.bool", true);
|
||||
do_check_false(ps.dirty);
|
||||
// User value different from default, dirty
|
||||
userBranch.setBoolPref("DirtyTest.existing.bool", false);
|
||||
do_check_true(ps.dirty);
|
||||
ps.savePrefFile(prefFile);
|
||||
// Back to default value, dirty again
|
||||
userBranch.setBoolPref("DirtyTest.existing.bool", true);
|
||||
do_check_true(ps.dirty);
|
||||
ps.savePrefFile(prefFile);
|
||||
}
|
@ -11,6 +11,5 @@ support-files =
|
||||
[test_bug577950.js]
|
||||
[test_bug790374.js]
|
||||
[test_changeType.js]
|
||||
[test_dirtyPrefs.js]
|
||||
[test_extprefs.js]
|
||||
[test_libPrefs.js]
|
||||
|
Loading…
Reference in New Issue
Block a user