diff options
author | Shinichi Morimoto <shnmorimoto@gmail.com> | 2020-03-30 02:32:46 +0900 |
---|---|---|
committer | Shinichi Morimoto <shnmorimoto@gmail.com> | 2020-03-30 02:32:46 +0900 |
commit | d8c1dc60e8f48f05ecd3ec01fbc91d7743734460 (patch) | |
tree | 5e07e0206ae3f311269fff2c0be61f1cff0836b7 /components | |
parent | fa8afbb1b0455493ba4859346eda6114e7a0720a (diff) | |
download | servo-d8c1dc60e8f48f05ecd3ec01fbc91d7743734460.tar.gz servo-d8c1dc60e8f48f05ecd3ec01fbc91d7743734460.zip |
fixed is_satisfied condition
Diffstat (limited to 'components')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 30c33f47077..ed0e1223e72 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -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) |