From d8c1dc60e8f48f05ecd3ec01fbc91d7743734460 Mon Sep 17 00:00:00 2001 From: Shinichi Morimoto Date: Mon, 30 Mar 2020 02:32:46 +0900 Subject: [PATCH] fixed is_satisfied condition --- .../dom/bindings/codegen/CodegenRust.py | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 30c33f470779..ed0e1223e720 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -2976,22 +2976,24 @@ def definition_body(self): 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)