diff --git a/js/src/vm/Stack.cpp b/js/src/vm/Stack.cpp index 7633ad47796..4a36d503441 100644 --- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -1220,6 +1220,14 @@ ScriptFrameIter::frameSlotValue(size_t index) const # pragma optimize("", on) #endif +#ifdef DEBUG +/* static */ +bool NonBuiltinScriptFrameIter::includeSelfhostedFrames() { + static char* env = getenv("MOZ_SHOW_ALL_JS_FRAMES"); + return (bool)env; +} +#endif + /*****************************************************************************/ JSObject * diff --git a/js/src/vm/Stack.h b/js/src/vm/Stack.h index 20a62ed7e57..0d30d0f02f0 100644 --- a/js/src/vm/Stack.h +++ b/js/src/vm/Stack.h @@ -1540,9 +1540,18 @@ class ScriptFrameIter /* 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: