Bug 625199 - Actually that NULL check was necessary in js_GetPropertyHelperInline (having a non-null pc does not mean currentScript is non-null because currentScript returns null when cx->fp is in another compartment (r=bustage) CLOSED TREE
authorLuke Wagner <luke@mozilla.com>
Thu, 23 Aug 2012 18:42:29 -0700
changeset 105303 a2834312d80d216f5586ec84dd94338ddc97b736
parent 105302 9c2c1987abc41cacfda266117d7cd8bfced5d03f
child 105304 20a3b0eeb776ba57f2219fc49470c5716f07b849
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersbustage
bugs625199
milestone17.0a1
Bug 625199 - Actually that NULL check was necessary in js_GetPropertyHelperInline (having a non-null pc does not mean currentScript is non-null because currentScript returns null when cx->fp is in another compartment (r=bustage) CLOSED TREE
js/src/jsobj.cpp
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -4557,21 +4557,24 @@ js_GetPropertyHelperInline(JSContext *cx
             if (op == JSOP_GETXPROP) {
                 /* Undefined property during a name lookup, report an error. */
                 JSAutoByteString printable;
                 if (js_ValueToPrintable(cx, IdToValue(id), &printable))
                     js_ReportIsNotDefined(cx, printable.ptr());
                 return false;
             }
 
-            if (!cx->hasStrictOption() ||
-                cx->stack.currentScript()->warnedAboutUndefinedProp ||
-                (op != JSOP_GETPROP && op != JSOP_GETELEM)) {
-                return JS_TRUE;
-            }
+            /* Don't warn if not strict or for random getprop operations. */
+            if (!cx->hasStrictOption() || (op != JSOP_GETPROP && op != JSOP_GETELEM))
+                return true;
+
+            /* Don't warn repeatedly for the same script. */
+            JSScript *script = cx->stack.currentScript();
+            if (!script || script->warnedAboutUndefinedProp)
+                return true;
 
             /*
              * XXX do not warn about missing __iterator__ as the function
              * may be called from JS_GetMethodById. See bug 355145.
              */
             if (JSID_IS_ATOM(id, cx->runtime->atomState.iteratorIntrinsicAtom))
                 return JS_TRUE;