mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1174861 - Remove unnecessary Rooted from Prefable::isEnabled(). r=bholley
This commit is contained in:
parent
3c148d727c
commit
8770e02920
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user