Bug 737022 Re-enable strict warnings when parsing XUL r=jst
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Thu, 22 Mar 2012 08:36:36 +0000
changeset 93234 5c13fce74f83f7328c01f266f1e6d372d40af0fa
parent 93233 652a5c8a24b665033929ba3bb106655dbcafc8ec
child 93316 b622d692b8ecb1058c110187da9ddc517598e49c
push idunknown
push userunknown
push dateunknown
reviewersjst
bugs737022
milestone14.0a1
Bug 737022 Re-enable strict warnings when parsing XUL r=jst
dom/base/nsJSEnvironment.cpp
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -986,18 +986,16 @@ nsJSContext::JSOptionChangedCallback(con
     newDefaultJSOptions |= JSOPTION_TYPE_INFERENCE;
   else
     newDefaultJSOptions &= ~JSOPTION_TYPE_INFERENCE;
 
 #ifdef DEBUG
   // In debug builds, warnings are enabled in chrome context if
   // javascript.options.strict.debug is true
   bool strictDebug = Preferences::GetBool(js_strict_debug_option_str);
-  // Note this callback is also called from context's InitClasses thus we don't
-  // need to enable this directly from InitContext
   if (strictDebug && (newDefaultJSOptions & JSOPTION_STRICT) == 0) {
     if (chromeWindow)
       newDefaultJSOptions |= JSOPTION_STRICT;
   }
 #endif
 
   bool werror = Preferences::GetBool(js_werror_option_str);
   if (werror)
@@ -2100,16 +2098,18 @@ nsJSContext::InitContext()
   // WillInitializeContext/DidInitializeContext around this call.
   NS_ENSURE_TRUE(!mIsInitialized, NS_ERROR_ALREADY_INITIALIZED);
 
   if (!mContext)
     return NS_ERROR_OUT_OF_MEMORY;
 
   ::JS_SetErrorReporter(mContext, NS_ScriptErrorReporter);
 
+  JSOptionChangedCallback(js_options_dot_str, this);
+
   return NS_OK;
 }
 
 nsresult
 nsJSContext::CreateOuterObject(nsIScriptGlobalObject *aGlobalObject,
                                nsIScriptGlobalObject *aCurrentInner)
 {
   mGlobalObjectRef = aGlobalObject;
@@ -2822,18 +2822,16 @@ nsJSContext::InitClasses(JSObject* aGlob
   ::JS_DefineFunctions(mContext, aGlobalObj, JProfFunctions);
 #endif
 
 #ifdef MOZ_DMD
   // Attempt to initialize DMD functions
   ::JS_DefineFunctions(mContext, aGlobalObj, DMDFunctions);
 #endif
 
-  JSOptionChangedCallback(js_options_dot_str, this);
-
   return rv;
 }
 
 void
 nsJSContext::WillInitializeContext()
 {
   mIsInitialized = false;
 }