Fixing bug 74816. Adding a pref check to window.dump() that lets us control the output from dump() with a pref in release builds, the default for release builds is disable output, and in debug builds the output is always enabled. The boolean pref that controls this is 'browser.dom.window.dump.enabled'. r=pollmann@netscape.com, sr=ben@netscape.com, a=drivers@mozilla.org (blizzard@mozilla.org)

This commit is contained in:
jst%netscape.com 2001-06-22 10:54:23 +00:00
parent bf31f50b3f
commit 935e3d3c27

View File

@ -1528,6 +1528,28 @@ NS_IMETHODIMP GlobalWindowImpl::GetLength(PRUint32* aLength)
NS_IMETHODIMP GlobalWindowImpl::Dump(const nsAReadableString& aStr)
{
#ifndef NS_DEBUG
{
// In optimized builds we check a pref that controls if we should
// enable output from dump() or not, in debug builds it's always
// enabled.
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
if (!prefs)
return NS_OK;
PRBool enable_dump = PR_FALSE;
// if pref doesn't exist, disable dump output.
nsresult rv = prefs->GetBoolPref("browser.dom.window.dump.enabled",
&enable_dump);
if (NS_FAILED(rv) || !enable_dump) {
return NS_OK;
}
}
#endif
char *cstr = ToNewUTF8String(aStr);
#ifdef XP_MAC