From 4aff5309fc5509d7af6d5274d77ae2899df7c487 Mon Sep 17 00:00:00 2001 From: "mccabe%netscape.com" Date: Tue, 7 Mar 2000 07:41:29 +0000 Subject: [PATCH] Fix to 30547 JavaScript error alert popups are now controlled by the "javascript.error.alerts" pref, initially defaulting to false. In response to to various emails and newsgroup pressure. a=jar git-svn-id: svn://10.0.0.236/trunk@62299 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 37 +++++++++++++++++-------- mozilla/modules/libpref/src/init/all.js | 1 + 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 81ca3173224..4b751b9993d 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3 -*- * * The contents of this file are subject to the Mozilla Public * License Version 1.1 (the "License"); you may not use this file @@ -1761,16 +1761,16 @@ NS_IMETHODIMP nsDocShell::ReportScriptError(const char* aErrorString, } PRBool showAlert; - if(mItemType == typeContent) { // Include a message for the beta release suggesting remedy error += - "\n" - "This error may indicate that the site has not been updated " - "for Mozilla. Please contact the site administrator, or see " - "http://developer.netscape.com/mozilla/"; - + "\n" + "If you visit this page with another browser and don't see a similar " + "error, it may indicate that the site has not yet been updated to " + "support standards implemented by the Mozilla browser such as the " + "W3C Document Object Model (DOM). Please see " + "http://developer.netsape.com/mozilla/ for more information."; showAlert = PR_TRUE; } else @@ -1784,18 +1784,33 @@ NS_IMETHODIMP nsDocShell::ReportScriptError(const char* aErrorString, #endif } + // Disable error alerts unless pref is set. + PRBool alertPref; + if (showAlert == PR_TRUE + && mPrefs != nsnull + && (NS_SUCCEEDED(mPrefs->GetBoolPref("javascript.error.alerts", + &alertPref))) + && (alertPref == PR_TRUE)) + { + showAlert = PR_TRUE; + } + else + { + showAlert = PR_FALSE; + } + if(showAlert) { // Show an alert for the error. At some point, we may have a JavaScript // console to show errors in. nsCOMPtr prompt = do_GetInterface(mTreeOwner); if(prompt) - { - prompt->Alert(error.GetUnicode()); + { + prompt->Alert(error.GetUnicode()); #ifndef DEBUG - return NS_OK; + return NS_OK; #endif - } + } } // else if not showing alert or failed to get prompt interface or diff --git a/mozilla/modules/libpref/src/init/all.js b/mozilla/modules/libpref/src/init/all.js index b4b5ba156ae..222e7eb403e 100644 --- a/mozilla/modules/libpref/src/init/all.js +++ b/mozilla/modules/libpref/src/init/all.js @@ -186,6 +186,7 @@ pref("javascript.enabled", true); pref("javascript.allow.mailnews", true); pref("javascript.allow.signing", true); pref("javascript.reflect_preferences", false); // for PE +pref("javascript.error.alerts", false); // advanced prefs pref("advanced.always_load_images", true);