* Modify nsIPref to support security policy work.
r=neeti@netscape.com * Close security holes by tightening prefs. r=mstoltz@netscape.com git-svn-id: svn://10.0.0.236/trunk@53308 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
|
||||
typedef int (*PrefChangedFunc)(const char *, void *);
|
||||
typedef void (*PrefEnumerationFunc)(const char *, void *);
|
||||
|
||||
#define NS_PREF_CID \
|
||||
{ /* {dc26e0e0-ca94-11d1-a9a4-00805f8a7ac4} */ \
|
||||
@@ -44,6 +45,7 @@ typedef int (*PrefChangedFunc)(const char *, void *);
|
||||
[ptr] native JSContext(JSContext);
|
||||
[ptr] native JSObject(JSObject);
|
||||
native PrefChangedFunc(PrefChangedFunc);
|
||||
native PrefEnumerationFunc(PrefEnumerationFunc);
|
||||
|
||||
interface nsIFileSpec;
|
||||
|
||||
@@ -167,4 +169,17 @@ interface nsIPref : nsISupports {
|
||||
string CreateChildList(in string parent_node);
|
||||
string NextChild(in string child_list, out short index);
|
||||
|
||||
/**
|
||||
* EnumerateChildren
|
||||
*
|
||||
* Call back function "callback" with every preference string
|
||||
* having prefix "parent". Pass "data" to "callback" when calling.
|
||||
*
|
||||
* @param parent A string representation of a prefix of preferences
|
||||
* @param callback A function to call back for each matching preference
|
||||
* @param data A piece of data to pass on to the callback
|
||||
*/
|
||||
[noscript] void EnumerateChildren(in string parent,
|
||||
in PrefEnumerationFunc callback,
|
||||
in voidStar data);
|
||||
};
|
||||
|
||||
@@ -319,7 +319,8 @@ pref("security.checkuri", true);
|
||||
pref("security.checkdomprops", true);
|
||||
pref("security.checkxpconnect", true);
|
||||
|
||||
pref("security.policies", "default");
|
||||
pref("signed.applets.codebase_principal_support", false);
|
||||
|
||||
pref("security.policy.default.htmlinputelement.value", "sameOrigin");
|
||||
|
||||
pref("security.policy.default.htmlimageelement.src", "sameOrigin");
|
||||
@@ -332,10 +333,9 @@ pref("security.policy.default.location.pathname", "sameOrigin");
|
||||
pref("security.policy.default.location.port", "sameOrigin");
|
||||
pref("security.policy.default.location.protocol", "sameOrigin");
|
||||
pref("security.policy.default.location.search", "sameOrigin");
|
||||
pref("security.policy.default.location.replace", "sameOrigin");
|
||||
pref("security.policy.default.location.tostring", "sameOrigin");
|
||||
pref("security.policy.default.location.reload", "sameOrigin");
|
||||
pref("security.policy.default.location.replace", "sameOrigin");
|
||||
pref("security.policy.default.nslocation.reload", "sameOrigin");
|
||||
pref("security.policy.default.nslocation.replace", "sameOrigin");
|
||||
|
||||
pref("security.policy.default.htmldocument.anchors", "sameOrigin");
|
||||
pref("security.policy.default.htmldocument.applets", "sameOrigin");
|
||||
@@ -343,12 +343,13 @@ pref("security.policy.default.htmldocument.cookie", "sameOrigin");
|
||||
pref("security.policy.default.htmldocument.domain", "sameOrigin");
|
||||
pref("security.policy.default.htmldocument.getelementbyid", "sameOrigin");
|
||||
pref("security.policy.default.htmldocument.getelementsbyname", "sameOrigin");
|
||||
pref("security.policy.default.htmldocument.embeds", "sameOrigin");
|
||||
pref("security.policy.default.htmldocument.forms", "sameOrigin");
|
||||
pref("security.policy.default.htmldocument.lastmodified", "sameOrigin");
|
||||
pref("security.policy.default.htmldocument.links", "sameOrigin");
|
||||
pref("security.policy.default.htmldocument.referrer", "sameOrigin");
|
||||
pref("security.policy.default.htmldocument.title", "sameOrigin");
|
||||
pref("security.policy.default.htmldocument.url", "sameOrigin");
|
||||
pref("security.policy.default.nshtmldocument.embeds", "sameOrigin");
|
||||
pref("security.policy.default.nshtmldocument.lastmodified", "sameOrigin");
|
||||
|
||||
|
||||
pref("security.policy.default.navigator.preference.read", "UniversalPreferencesRead");
|
||||
pref("security.policy.default.navigator.preference.write", "UniversalPreferencesWrite");
|
||||
|
||||
@@ -994,7 +994,32 @@ NS_IMETHODIMP nsPref::NextChild(const char *child_list, PRInt16 *indx, char **li
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
struct EnumerateData {
|
||||
const char *parent;
|
||||
PrefEnumerationFunc callback;
|
||||
void *arg;
|
||||
};
|
||||
|
||||
PR_STATIC_CALLBACK(PRIntn)
|
||||
pref_enumChild(PLHashEntry *he, int i, void *arg)
|
||||
{
|
||||
EnumerateData *d = (EnumerateData *) arg;
|
||||
if (PL_strncmp((char*)he->key, d->parent, strlen(d->parent)) == 0) {
|
||||
(*d->callback)((char*)he->key, d->arg);
|
||||
}
|
||||
return HT_ENUMERATE_NEXT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPref::EnumerateChildren(const char *parent, PrefEnumerationFunc callback, void *arg)
|
||||
{
|
||||
EnumerateData ed;
|
||||
ed.parent = parent;
|
||||
ed.callback = callback;
|
||||
ed.arg = arg;
|
||||
PL_HashTableEnumerateEntries(gHashTable, pref_enumChild, &ed);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//========================================================================================
|
||||
// C++ implementations of old C routines
|
||||
|
||||
Reference in New Issue
Block a user