Bug 932837 followup. Don't use AutoJSContext in JSStackFrame, since we use that code on workers too. r=bholley pending, but landing now to fix the CLOSED TREE.

This commit is contained in:
Boris Zbarsky 2014-01-08 01:00:57 -05:00
parent 1dddb1a066
commit ddc5cc6b61

View File

@ -386,7 +386,10 @@ JSStackFrame::GetFilename()
if (!mFilenameInitialized) {
JS::FrameDescription& desc = mStackDescription->FrameAt(mIndex);
if (desc.script()) {
AutoJSContext cx;
// This cx dance is silly, since JS_GetScriptFilename ignores
// its cx argument.
JSContext* cx = nsContentUtils::GetDefaultJSContextForThread();
JSAutoRequest ar(cx);
JSAutoCompartment ac(cx, desc.script());
const char* filename = JS_GetScriptFilename(cx, desc.script());
if (filename) {
@ -422,7 +425,8 @@ JSStackFrame::GetFunname()
if (!mFunnameInitialized) {
JS::FrameDescription& desc = mStackDescription->FrameAt(mIndex);
if (desc.fun() && desc.script()) {
AutoJSContext cx;
JSContext* cx = nsContentUtils::GetDefaultJSContextForThread();
JSAutoRequest ar(cx);
JSAutoCompartment ac(cx, desc.script());
JS::Rooted<JSFunction*> fun(cx, desc.fun());
JS::Rooted<JSString*> funid(cx, JS_GetFunctionDisplayId(fun));