remove support for dom.disable_cookie_{get,set} prefs.

b=223782, r=jst,caillon, sr=alecf,darin (yes really, four reviews).
This commit is contained in:
dwitte%stanford.edu 2003-11-04 22:44:51 +00:00
parent aaf4bfcde6
commit 7b568b6327
5 changed files with 12 additions and 64 deletions

View File

@ -2205,22 +2205,8 @@ nsHTMLDocument::GetCookie(nsAString& aCookie)
aCookie.Truncate(); // clear current cookie in case service fails;
// no cookie isn't an error condition.
// If caller is not chrome and dom.disable_cookie_get is true,
// prevent getting cookies by exiting early
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
if (prefs) {
PRBool disableCookieGet = PR_FALSE;
prefs->GetBoolPref("dom.disable_cookie_get", &disableCookieGet);
if (disableCookieGet && !nsContentUtils::IsCallerChrome()) {
return NS_OK;
}
}
nsresult rv = NS_OK;
nsAutoString str;
nsCOMPtr<nsICookieService> service = do_GetService(kCookieServiceCID, &rv);
// not having a cookie service isn't an error
nsCOMPtr<nsICookieService> service = do_GetService(kCookieServiceCID);
if (service) {
// Get a URI from the document principal. We use the original
// codebase in case the codebase was changed by SetDomain
@ -2235,29 +2221,18 @@ nsHTMLDocument::GetCookie(nsAString& aCookie)
}
nsXPIDLCString cookie;
rv = service->GetCookieString(codebaseURI, mChannel, getter_Copies(cookie));
if (NS_SUCCEEDED(rv) && cookie)
CopyASCIItoUCS2(nsDependentCString(cookie), aCookie);
service->GetCookieString(codebaseURI, mChannel, getter_Copies(cookie));
CopyASCIItoUTF16(cookie, aCookie);
}
return rv;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDocument::SetCookie(const nsAString& aCookie)
{
// If caller is not chrome and dom.disable_cookie_get is true,
// prevent setting cookies by exiting early
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
if (prefs) {
PRBool disableCookieSet = PR_FALSE;
prefs->GetBoolPref("dom.disable_cookie_set", &disableCookieSet);
if (disableCookieSet && !nsContentUtils::IsCallerChrome()) {
return NS_OK;
}
}
nsresult rv = NS_OK;
nsCOMPtr<nsICookieService> service = do_GetService(kCookieServiceCID, &rv);
// not having a cookie service isn't an error
nsCOMPtr<nsICookieService> service = do_GetService(kCookieServiceCID);
if (service && mDocumentURL) {
nsCOMPtr<nsIPrompt> prompt;
nsCOMPtr<nsIDOMWindowInternal> window (do_QueryInterface(GetScriptGlobalObject()));
@ -2275,14 +2250,11 @@ nsHTMLDocument::SetCookie(const nsAString& aCookie)
return NS_OK;
}
rv = NS_ERROR_OUT_OF_MEMORY;
char* cookie = ToNewCString(aCookie);
if (cookie) {
rv = service->SetCookieString(codebaseURI, prompt, cookie, mChannel);
nsCRT::free(cookie);
}
NS_LossyConvertUTF16toASCII cookie(aCookie);
service->SetCookieString(codebaseURI, prompt, cookie.get(), mChannel);
}
return rv;
return NS_OK;
}
// static

View File

@ -454,8 +454,6 @@ pref("capability.policy.default.Clipboard.paste", "noAccess");
// Scripts & Windows prefs
pref("browser.block.target_new_window", false);
pref("dom.disable_cookie_get", false);
pref("dom.disable_cookie_set", false);
pref("dom.disable_image_src_set", false);
pref("dom.disable_window_flip", false);
pref("dom.disable_window_move_resize", false);

View File

@ -45,8 +45,6 @@ function changeDisabledState(state){
document.getElementById("allowScripts").disabled = state;
document.getElementById("allowWindowMoveResize").disabled = state;
document.getElementById("allowImageSrcChange").disabled = state;
document.getElementById("allowDocumentCookieSet").disabled = state;
document.getElementById("allowDocumentCookieGet").disabled = state;
document.getElementById("allowWindowStatusChange").disabled = state;
document.getElementById("allowWindowFlip").disabled = state;
document.getElementById("allowHideStatusBar").disabled = state;
@ -89,8 +87,6 @@ function Startup(){
var changedList = ["allowWindowMoveResizeChanged",
"allowWindowStatusChangeChanged",
"allowWindowFlipChanged",
"allowDocumentCookieSetChanged",
"allowDocumentCookieGetChanged",
"allowImageSrcChangeChanged",
"allowHideStatusBarChanged"];
@ -104,8 +100,6 @@ function Startup(){
document.getElementById("allowWindowFlip").checked = getPrefValueForCheckbox("dom.disable_window_flip");
document.getElementById("allowWindowStatusChange").checked = getPrefValueForCheckbox("dom.disable_window_status_change");
document.getElementById("allowImageSrcChange").checked = getPrefValueForCheckbox("dom.disable_image_src_set");
document.getElementById("allowDocumentCookieGet").checked = getPrefValueForCheckbox("dom.disable_cookie_get");
document.getElementById("allowDocumentCookieSet").checked = getPrefValueForCheckbox("dom.disable_cookie_set");
document.getElementById("allowHideStatusBar").checked = getPrefValueForCheckbox("dom.disable_window_open_feature.status");
//If we don't have a checkbox under groupbox pluginPreferences, we should hide it
@ -155,16 +149,6 @@ function doOnOk(){
!getCheckboxValue("allowWindowFlip"));
}
if (data.scriptData["allowDocumentCookieSetChanged"].value){
parent.hPrefWindow.setPref("bool", "dom.disable_cookie_set",
!getCheckboxValue("allowDocumentCookieSet"));
}
if (data.scriptData["allowDocumentCookieGetChanged"].value){
parent.hPrefWindow.setPref("bool", "dom.disable_cookie_get",
!getCheckboxValue("allowDocumentCookieGet"));
}
if (data.scriptData["allowImageSrcChangeChanged"].value){
parent.hPrefWindow.setPref("bool", "dom.disable_image_src_set",
!getCheckboxValue("allowImageSrcChange"));

View File

@ -52,8 +52,6 @@
"allowWindowFlip",
"allowWindowStatusChange",
"allowImageSrcChange",
"allowDocumentCookieSet",
"allowDocumentCookieGet",
"allowHideStatusBar"];
]]>
</script>
@ -75,8 +73,6 @@
<listitem type="checkbox" id="allowHideStatusBar" label="&allowHideStatusBar.label;"/>
<listitem type="checkbox" id="allowWindowStatusChange" label="&allowWindowStatusChange.label;"/>
<listitem type="checkbox" id="allowImageSrcChange" label="&allowWindowImageSrcChange.label;"/>
<listitem type="checkbox" id="allowDocumentCookieSet" label="&allowDocumentCookieSet.label;"/>
<listitem type="checkbox" id="allowDocumentCookieGet" label="&allowDocumentCookieGet.label;"/>
</listbox>
</groupbox>

View File

@ -14,8 +14,6 @@
<!ENTITY allowWindowFlip.label "Raise or lower windows">
<!ENTITY allowWindowStatusChange.label "Change status bar text">
<!ENTITY allowWindowImageSrcChange.label "Change images">
<!ENTITY allowDocumentCookieSet.label "Create or change cookies">
<!ENTITY allowDocumentCookieGet.label "Read cookies">
<!ENTITY allowHideStatusBar.label "Hide the status bar">
<!ENTITY enablePlugin.label "Enable Plug-ins for">