зеркало из https://github.com/mozilla/gecko-dev.git
Bug 770737 - Make JSContext::global() return Handle<GlobalObject*> (r=billm)
--HG-- extra : rebase_source : af8f4c7461cc07d4ebc34ddff0a801432fa27ddd
This commit is contained in:
Родитель
93e4660716
Коммит
5fd54c99e4
|
@ -1097,6 +1097,9 @@ struct JSContext : js::ContextFriendFields
|
|||
/* Current execution stack. */
|
||||
js::ContextStack stack;
|
||||
|
||||
/* Current global. */
|
||||
inline js::Handle<js::GlobalObject*> global() const;
|
||||
|
||||
/* ContextStack convenience functions */
|
||||
inline bool hasfp() const { return stack.hasfp(); }
|
||||
inline js::StackFrame* fp() const { return stack.fp(); }
|
||||
|
|
|
@ -229,7 +229,7 @@ class CompartmentChecker
|
|||
{
|
||||
if (cx->compartment) {
|
||||
GlobalObject *global = GetGlobalForScopeChain(cx);
|
||||
JS_ASSERT(cx->compartment->maybeGlobal() == global);
|
||||
JS_ASSERT(cx->global() == global);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ struct JSCompartment
|
|||
JSPrincipals *principals;
|
||||
|
||||
private:
|
||||
friend struct JSContext;
|
||||
js::GlobalObject *global_;
|
||||
public:
|
||||
// Nb: global_ might be NULL, if (a) it's the atoms compartment, or (b) the
|
||||
|
@ -438,6 +439,12 @@ JSContext::setCompartment(JSCompartment *compartment)
|
|||
this->inferenceEnabled = compartment ? compartment->types.inferenceEnabled : false;
|
||||
}
|
||||
|
||||
inline js::Handle<js::GlobalObject*>
|
||||
JSContext::global() const
|
||||
{
|
||||
return js::Handle<js::GlobalObject*>::fromMarkedLocation(&compartment->global_);
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
||||
class PreserveCompartment {
|
||||
|
|
Загрузка…
Ссылка в новой задаче