Bug 894854: env var disabling censoring of self-hosted script frames (r=till)
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Wed, 17 Jul 2013 09:58:00 +0200
changeset 151546 5e29b812885c4aa74a0685f70587c0821f4a8247
parent 151545 8190b78ed33cf145b8a3843a29469c9484d98e13
child 151547 4bbb18b109d4f43a0f4c05908edc2a1109b6eb72
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs894854
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 894854: env var disabling censoring of self-hosted script frames (r=till) It is only aenabled for debug builds. The env var is: MOZ_SHOW_ALL_JS_FRAMES
js/src/vm/Stack.cpp
js/src/vm/Stack.h
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -1215,16 +1215,24 @@ ScriptFrameIter::frameSlotValue(size_t i
     }
     MOZ_ASSUME_UNREACHABLE("Unexpected state");
 }
 
 #if defined(_MSC_VER)
 # pragma optimize("", on)
 #endif
 
+#ifdef DEBUG
+/* static */
+bool NonBuiltinScriptFrameIter::includeSelfhostedFrames() {
+    static char* env = getenv("MOZ_SHOW_ALL_JS_FRAMES");
+    return (bool)env;
+}
+#endif
+
 /*****************************************************************************/
 
 JSObject *
 AbstractFramePtr::evalPrevScopeChain(JSContext *cx) const
 {
     // Eval frames are not compiled by Ion, though their caller might be.
     AllFramesIter iter(cx);
     while (iter.isIon() || iter.abstractFramePtr() != *this)
--- a/js/src/vm/Stack.h
+++ b/js/src/vm/Stack.h
@@ -1535,19 +1535,28 @@ class ScriptFrameIter
 
     template <class Op>
     inline void ionForEachCanonicalActualArg(JSContext *cx, Op op);
 };
 
 /* A filtering of the ScriptFrameIter to only stop at non-self-hosted scripts. */
 class NonBuiltinScriptFrameIter : public ScriptFrameIter
 {
+#ifdef DEBUG
+    static bool includeSelfhostedFrames();
+#else
+    static bool includeSelfhostedFrames() {
+        return false;
+    }
+#endif
+
     void settle() {
-        while (!done() && script()->selfHosted)
-            ScriptFrameIter::operator++();
+        if (!includeSelfhostedFrames())
+            while (!done() && script()->selfHosted)
+                ScriptFrameIter::operator++();
     }
 
   public:
     NonBuiltinScriptFrameIter(JSContext *cx, ScriptFrameIter::SavedOption opt = ScriptFrameIter::STOP_AT_SAVED)
       : ScriptFrameIter(cx, opt) { settle(); }
 
     NonBuiltinScriptFrameIter(const ScriptFrameIter::Data &data)
       : ScriptFrameIter(data)