[INFER] Fix merge botch, only warn once for each script accessing undefined properties in contexts with the strict option set, bug 662393.

This commit is contained in:
Brian Hackett 2011-06-06 17:12:49 -07:00
parent 702ed9a730
commit dab2052347
3 changed files with 6 additions and 1 deletions

View File

@ -946,7 +946,7 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
js_profiling_chrome_str :
js_profiling_content_str);
PRBool useMethodJITAlways = Preferences::GetBool(js_methodjit_always_str);
PRBool useTypeInference = !chromeWindow && nsContentUtils::GetBoolPref(js_typeinfer_str);
PRBool useTypeInference = !chromeWindow && Preferences::GetBool(js_typeinfer_str);
nsCOMPtr<nsIXULRuntime> xr = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
if (xr) {
PRBool safeMode = PR_FALSE;

View File

@ -5788,6 +5788,7 @@ js_GetPropertyHelperWithShapeInline(JSContext *cx, JSObject *obj, JSObject *rece
flags = JSREPORT_ERROR;
} else {
if (!cx->hasStrictOption() ||
cx->stack.currentScript()->warnedAboutUndefinedProp ||
(op != JSOP_GETPROP && op != JSOP_GETELEM) ||
js_CurrentPCIsInImacro(cx)) {
return JS_TRUE;
@ -5811,6 +5812,7 @@ js_GetPropertyHelperWithShapeInline(JSContext *cx, JSObject *obj, JSObject *rece
}
flags = JSREPORT_WARNING | JSREPORT_STRICT;
cx->stack.currentScript()->warnedAboutUndefinedProp = true;
}
/* Ok, bad undefined property reference: whine about it. */

View File

@ -460,6 +460,9 @@ struct JSScript {
bool warnedAboutTwoArgumentEval:1; /* have warned about use of
obsolete eval(s, o) in
this script */
bool warnedAboutUndefinedProp:1; /* have warned about uses of
undefined properties in this
script */
bool hasSingletons:1; /* script has singleton objects */
bool isActiveEval:1; /* script came from eval(), and is still active */
bool isCachedEval:1; /* script came from eval(), and is in eval cache */