mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Switch compartments when walking stacks (bug 608800, r=mrbkap).
This commit is contained in:
parent
c0e2873909
commit
2e92e6a345
@ -61,6 +61,7 @@
|
|||||||
#include "jsscope.h"
|
#include "jsscope.h"
|
||||||
#include "jsscript.h"
|
#include "jsscript.h"
|
||||||
#include "jsstaticcheck.h"
|
#include "jsstaticcheck.h"
|
||||||
|
#include "jswrapper.h"
|
||||||
|
|
||||||
#include "jscntxtinlines.h"
|
#include "jscntxtinlines.h"
|
||||||
#include "jsinterpinlines.h"
|
#include "jsinterpinlines.h"
|
||||||
@ -545,9 +546,14 @@ ValueToShortSource(JSContext *cx, jsval v)
|
|||||||
JSString *str;
|
JSString *str;
|
||||||
|
|
||||||
/* Avoid toSource bloat and fallibility for object types. */
|
/* Avoid toSource bloat and fallibility for object types. */
|
||||||
if (JSVAL_IS_PRIMITIVE(v)) {
|
if (JSVAL_IS_PRIMITIVE(v))
|
||||||
str = js_ValueToSource(cx, Valueify(v));
|
return js_ValueToSource(cx, Valueify(v));
|
||||||
} else if (VALUE_IS_FUNCTION(cx, v)) {
|
|
||||||
|
AutoCompartment ac(cx, JSVAL_TO_OBJECT(v));
|
||||||
|
if (!ac.enter())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (VALUE_IS_FUNCTION(cx, v)) {
|
||||||
/*
|
/*
|
||||||
* XXX Avoid function decompilation bloat for now.
|
* XXX Avoid function decompilation bloat for now.
|
||||||
*/
|
*/
|
||||||
@ -570,6 +576,11 @@ ValueToShortSource(JSContext *cx, jsval v)
|
|||||||
JSVAL_TO_OBJECT(v)->getClass()->name);
|
JSVAL_TO_OBJECT(v)->getClass()->name);
|
||||||
str = JS_NewStringCopyZ(cx, buf);
|
str = JS_NewStringCopyZ(cx, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ac.leave();
|
||||||
|
|
||||||
|
if (!str || !cx->compartment->wrap(cx, &str))
|
||||||
|
return NULL;
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user