fixed is_satisfied condition

This commit is contained in:
Shinichi Morimoto 2020-03-30 02:32:46 +09:00
parent fa8afbb1b0
commit d8c1dc60e8

View file

@ -2976,22 +2976,24 @@ class CGCollectJSONAttributesMethod(CGAbstractMethod):
ret_conditions = 'vec![' + ",".join(conditions) + "]" ret_conditions = 'vec![' + ",".join(conditions) + "]"
ret += fill( ret += fill(
""" """
let incumbent_global = GlobalScope::incumbent().expect("no incumbent global");
let global = incumbent_global.reflector().get_jsobject();
let conditions = ${conditions}; let conditions = ${conditions};
if !conditions.iter().any(|c| let is_satisfied = conditions.iter().any(|c|
c.is_satisfied( c.is_satisfied(
SafeJSContext::from_ptr(cx), SafeJSContext::from_ptr(cx),
HandleObject::from_raw(obj), HandleObject::from_raw(obj),
HandleObject::from_raw(obj))) { global));
return false; if is_satisfied {
} rooted!(in(cx) let mut temp = UndefinedValue());
rooted!(in(cx) let mut temp = UndefinedValue()); if !get_${name}(cx, obj, this, JSJitGetterCallArgs { _base: temp.handle_mut().into() }) {
if !get_${name}(cx, obj, this, JSJitGetterCallArgs { _base: temp.handle_mut().into() }) { return false;
return false; }
} if !JS_DefineProperty(cx, result.handle().into(),
if !JS_DefineProperty(cx, result.handle().into(), ${nameAsArray} as *const u8 as *const libc::c_char,
${nameAsArray} as *const u8 as *const libc::c_char, temp.handle(), JSPROP_ENUMERATE as u32) {
temp.handle(), JSPROP_ENUMERATE as u32) { return false;
return false; }
} }
""", """,
name=name, nameAsArray=str_to_const_array(name), conditions=ret_conditions) name=name, nameAsArray=str_to_const_array(name), conditions=ret_conditions)