Bug 1174861 - Remove unnecessary Rooted from Prefable::isEnabled(). r=bholley

This commit is contained in:
Andrew McCreight 2015-06-15 17:22:00 -04:00
parent 3c148d727c
commit 8770e02920

View File

@ -52,25 +52,23 @@ typedef bool (*PropertyEnabled)(JSContext* cx, JSObject* global);
template<typename T>
struct Prefable {
inline bool isEnabled(JSContext* cx, JSObject* obj) const {
inline bool isEnabled(JSContext* cx, JS::Handle<JSObject*> obj) const {
if (!enabled) {
return false;
}
if (!enabledFunc && !availableFunc && !checkPermissions) {
return true;
}
// Just go ahead and root obj, in case enabledFunc GCs
JS::Rooted<JSObject*> rootedObj(cx, obj);
if (enabledFunc &&
!enabledFunc(cx, js::GetGlobalForObjectCrossCompartment(rootedObj))) {
!enabledFunc(cx, js::GetGlobalForObjectCrossCompartment(obj))) {
return false;
}
if (availableFunc &&
!availableFunc(cx, js::GetGlobalForObjectCrossCompartment(rootedObj))) {
!availableFunc(cx, js::GetGlobalForObjectCrossCompartment(obj))) {
return false;
}
if (checkPermissions &&
!CheckPermissions(cx, js::GetGlobalForObjectCrossCompartment(rootedObj),
!CheckPermissions(cx, js::GetGlobalForObjectCrossCompartment(obj),
checkPermissions)) {
return false;
}