mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 611432: assert that compartments stay the same before and after a JM activation, r=gal
This commit is contained in:
parent
b3dcdca182
commit
ed486e4069
@ -388,6 +388,22 @@ class SwitchToCompartment : public PreserveCompartment {
|
||||
}
|
||||
};
|
||||
|
||||
class AssertCompartmentUnchanged {
|
||||
protected:
|
||||
JSContext * const cx;
|
||||
JSCompartment * const oldCompartment;
|
||||
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
public:
|
||||
AssertCompartmentUnchanged(JSContext *cx JS_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: cx(cx), oldCompartment(cx->compartment) {
|
||||
JS_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
}
|
||||
|
||||
~AssertCompartmentUnchanged() {
|
||||
JS_ASSERT(cx->compartment == oldCompartment);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* jscompartment_h___ */
|
||||
|
@ -741,8 +741,12 @@ mjit::EnterMethodJIT(JSContext *cx, JSStackFrame *fp, void *code, Value *stackLi
|
||||
JS_ASSERT(cx->regs->fp == fp);
|
||||
JSFrameRegs *oldRegs = cx->regs;
|
||||
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_INFER);
|
||||
JSBool ok = JaegerTrampoline(cx, fp, code, stackLimit);
|
||||
JSBool ok;
|
||||
{
|
||||
AssertCompartmentUnchanged pcc(cx);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_INFER);
|
||||
ok = JaegerTrampoline(cx, fp, code, stackLimit);
|
||||
}
|
||||
|
||||
cx->setCurrentRegs(oldRegs);
|
||||
JS_ASSERT(fp == cx->fp());
|
||||
|
Loading…
Reference in New Issue
Block a user