improve JIT-control pref naming, add one for chrome JIT, add defaults to all.js

This commit is contained in:
shaver@mozilla.org 2008-08-20 08:49:00 -07:00
parent 5d3ad68bbe
commit 04b7537398
2 changed files with 13 additions and 8 deletions

View File

@ -1084,7 +1084,8 @@ static const char js_relimit_option_str[]= JS_OPTIONS_DOT_STR "relimit";
#ifdef JS_GC_ZEAL
static const char js_zeal_option_str[] = JS_OPTIONS_DOT_STR "gczeal";
#endif
static const char js_content_jit_str[] = JS_OPTIONS_DOT_STR "content_jit";
static const char js_jit_content_str[] = JS_OPTIONS_DOT_STR "jit.content";
static const char js_jit_chrome_str[] = JS_OPTIONS_DOT_STR "jit.chrome";
int PR_CALLBACK
nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
@ -1100,14 +1101,16 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
newDefaultJSOptions &= ~JSOPTION_STRICT;
nsIScriptGlobalObject *global = context->GetGlobalObject();
// XXX should we check for sysprin instead of a chrome window, to make
// XXX components be covered by the chrome pref instead of the content one?
nsCOMPtr<nsIDOMChromeWindow> chromeWindow(do_QueryInterface(global));
if (!chromeWindow) {
PRBool contentJIT = nsContentUtils::GetBoolPref(js_content_jit_str);
if (contentJIT)
newDefaultJSOptions |= JSOPTION_JIT;
else
newDefaultJSOptions &= ~JSOPTION_JIT;
}
PRBool useJIT = nsContentUtils::GetBoolPref(chromeWindow ?
js_jit_chrome_str :
js_jit_content_str);
if (useJIT)
newDefaultJSOptions |= JSOPTION_JIT;
else
newDefaultJSOptions &= ~JSOPTION_JIT;
#ifdef DEBUG
// In debug builds, warnings are always enabled in chrome context

View File

@ -498,6 +498,8 @@ pref("javascript.enabled", true);
pref("javascript.allow.mailnews", false);
pref("javascript.options.strict", false);
pref("javascript.options.relimit", false);
pref("javascript.options.jit.content", false);
pref("javascript.options.jit.chrome", false);
// advanced prefs
pref("security.enable_java", true);