зеркало из https://github.com/mozilla/gecko-dev.git
Bug 609141 - Compartments mismatch in jsdScript::GetFunctionSource. r=sayrer
This commit is contained in:
Родитель
3526db0dbf
Коммит
792ba90b5e
|
@ -60,6 +60,9 @@
|
|||
#include "nsIScriptContext.h"
|
||||
#include "nsIJSContextStack.h"
|
||||
|
||||
/* XXX private JS headers. */
|
||||
#include "jscompartment.h"
|
||||
|
||||
/*
|
||||
* defining CAUTIOUS_SCRIPTHOOK makes jsds disable GC while calling out to the
|
||||
* script hook. This was a hack to avoid some js engine problems that should
|
||||
|
@ -1319,10 +1322,14 @@ jsdScript::GetFunctionSource(nsAString & aFunctionSource)
|
|||
JSAutoRequest ar(cx);
|
||||
|
||||
JSString *jsstr;
|
||||
if (fun)
|
||||
if (fun) {
|
||||
JSAutoEnterCompartment ac;
|
||||
if (!ac.enter(cx, JS_GetFunctionObject(fun)))
|
||||
return NS_ERROR_FAILURE;
|
||||
jsstr = JS_DecompileFunction (cx, fun, 4);
|
||||
else {
|
||||
} else {
|
||||
JSScript *script = JSD_GetJSScript (mCx, mScript);
|
||||
js::SwitchToCompartment sc(cx, script->compartment);
|
||||
jsstr = JS_DecompileScript (cx, script, "ppscript", 4);
|
||||
}
|
||||
if (!jsstr)
|
||||
|
|
|
@ -4726,7 +4726,10 @@ JS_DecompileScript(JSContext *cx, JSScript *script, const char *name, uintN inde
|
|||
JSString *str;
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, script);
|
||||
#ifdef DEBUG
|
||||
if (cx->compartment != script->compartment)
|
||||
CompartmentChecker::fail(cx->compartment, script->compartment);
|
||||
#endif
|
||||
jp = js_NewPrinter(cx, name, NULL,
|
||||
indent & ~JS_DONT_PRETTY_PRINT,
|
||||
!(indent & JS_DONT_PRETTY_PRINT),
|
||||
|
|
Загрузка…
Ссылка в новой задаче