mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 630471 - Enter compartment when creating XPC stack frame, before JS_PCToLineNumber (r=gal)
This commit is contained in:
parent
7b5ff04357
commit
8d967375c9
@ -160,31 +160,35 @@ XPCJSStackFrame::CreateStack(JSContext* cx, JSStackFrame* fp,
|
||||
jsbytecode* pc = JS_GetFramePC(cx, fp);
|
||||
if(script && pc)
|
||||
{
|
||||
const char* filename = JS_GetScriptFilename(cx, script);
|
||||
if(filename)
|
||||
{
|
||||
self->mFilename = (char*)
|
||||
nsMemory::Clone(filename,
|
||||
sizeof(char)*(strlen(filename)+1));
|
||||
}
|
||||
|
||||
self->mLineno = (PRInt32) JS_PCToLineNumber(cx, script, pc);
|
||||
|
||||
|
||||
JSFunction* fun = JS_GetFrameFunction(cx, fp);
|
||||
if(fun)
|
||||
{
|
||||
JSString *funid = JS_GetFunctionId(fun);
|
||||
if(funid)
|
||||
JSAutoEnterCompartment ac;
|
||||
if(ac.enter(cx, script))
|
||||
{
|
||||
const char* filename = JS_GetScriptFilename(cx, script);
|
||||
if(filename)
|
||||
{
|
||||
size_t length = JS_GetStringEncodingLength(cx, funid);
|
||||
if(length != size_t(-1))
|
||||
self->mFilename = (char*)
|
||||
nsMemory::Clone(filename,
|
||||
sizeof(char)*(strlen(filename)+1));
|
||||
}
|
||||
|
||||
self->mLineno = (PRInt32) JS_PCToLineNumber(cx, script, pc);
|
||||
|
||||
|
||||
JSFunction* fun = JS_GetFrameFunction(cx, fp);
|
||||
if(fun)
|
||||
{
|
||||
JSString *funid = JS_GetFunctionId(fun);
|
||||
if(funid)
|
||||
{
|
||||
self->mFunname = static_cast<char *>(nsMemory::Alloc(length + 1));
|
||||
if(self->mFunname)
|
||||
size_t length = JS_GetStringEncodingLength(cx, funid);
|
||||
if(length != size_t(-1))
|
||||
{
|
||||
JS_EncodeStringToBuffer(funid, self->mFunname, length);
|
||||
self->mFunname[length] = '\0';
|
||||
self->mFunname = static_cast<char *>(nsMemory::Alloc(length + 1));
|
||||
if(self->mFunname)
|
||||
{
|
||||
JS_EncodeStringToBuffer(funid, self->mFunname, length);
|
||||
self->mFunname[length] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user