mirror of
https://github.com/servo/servo.git
synced 2025-07-25 08:10:21 +01:00
fixed is_satisfied condition
This commit is contained in:
parent
fa8afbb1b0
commit
d8c1dc60e8
1 changed files with 14 additions and 12 deletions
|
@ -2976,22 +2976,24 @@ class CGCollectJSONAttributesMethod(CGAbstractMethod):
|
|||
ret_conditions = 'vec![' + ",".join(conditions) + "]"
|
||||
ret += fill(
|
||||
"""
|
||||
let incumbent_global = GlobalScope::incumbent().expect("no incumbent global");
|
||||
let global = incumbent_global.reflector().get_jsobject();
|
||||
let conditions = ${conditions};
|
||||
if !conditions.iter().any(|c|
|
||||
let is_satisfied = conditions.iter().any(|c|
|
||||
c.is_satisfied(
|
||||
SafeJSContext::from_ptr(cx),
|
||||
HandleObject::from_raw(obj),
|
||||
HandleObject::from_raw(obj))) {
|
||||
return false;
|
||||
}
|
||||
rooted!(in(cx) let mut temp = UndefinedValue());
|
||||
if !get_${name}(cx, obj, this, JSJitGetterCallArgs { _base: temp.handle_mut().into() }) {
|
||||
return false;
|
||||
}
|
||||
if !JS_DefineProperty(cx, result.handle().into(),
|
||||
${nameAsArray} as *const u8 as *const libc::c_char,
|
||||
temp.handle(), JSPROP_ENUMERATE as u32) {
|
||||
return false;
|
||||
global));
|
||||
if is_satisfied {
|
||||
rooted!(in(cx) let mut temp = UndefinedValue());
|
||||
if !get_${name}(cx, obj, this, JSJitGetterCallArgs { _base: temp.handle_mut().into() }) {
|
||||
return false;
|
||||
}
|
||||
if !JS_DefineProperty(cx, result.handle().into(),
|
||||
${nameAsArray} as *const u8 as *const libc::c_char,
|
||||
temp.handle(), JSPROP_ENUMERATE as u32) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
""",
|
||||
name=name, nameAsArray=str_to_const_array(name), conditions=ret_conditions)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue