mirror of
https://github.com/servo/servo.git
synced 2025-09-27 15:20:09 +01:00
script: Add can_gc to WebIDL dictionary constructors (#39195)
More progress on can_gc! Testing: Internal change only, shouldn't change behavior. Fixes: #38708 --------- Signed-off-by: lumiscosity <averyrudelphe@gmail.com>
This commit is contained in:
parent
1b9dc3e672
commit
9584b9e57d
8 changed files with 26 additions and 17 deletions
|
@ -7523,7 +7523,7 @@ impl{self.generic} Clone for {self.makeClassName(self.dictionary)}{self.genericS
|
|||
assert isinstance(d.parent, IDLDictionary)
|
||||
initParent = (
|
||||
"{\n"
|
||||
f" match {self.makeModuleName(d.parent)}::{self.makeClassName(d.parent)}::new(cx, val)? {{\n"
|
||||
f" match {self.makeModuleName(d.parent)}::{self.makeClassName(d.parent)}::new(cx, val, can_gc)? {{\n"
|
||||
" ConversionResult::Success(v) => v,\n"
|
||||
" ConversionResult::Failure(error) => {\n"
|
||||
" throw_type_error(*cx, &error);\n"
|
||||
|
@ -7582,7 +7582,7 @@ impl{self.generic} Clone for {self.makeClassName(self.dictionary)}{self.genericS
|
|||
return (
|
||||
f"impl{self.generic} {selfName}{self.genericSuffix} {{\n"
|
||||
f"{CGIndenter(CGGeneric(self.makeEmpty()), indentLevel=4).define()}\n"
|
||||
" pub fn new(cx: SafeJSContext, val: HandleValue) \n"
|
||||
" pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc) \n"
|
||||
f" -> Result<ConversionResult<{actualType}>, ()> {{\n"
|
||||
f" {unsafe_if_necessary} {{\n"
|
||||
" let object = if val.get().is_null_or_undefined() {\n"
|
||||
|
@ -7606,7 +7606,7 @@ impl{self.generic} Clone for {self.makeClassName(self.dictionary)}{self.genericS
|
|||
" type Config = ();\n"
|
||||
" unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())\n"
|
||||
f" -> Result<ConversionResult<{actualType}>, ()> {{\n"
|
||||
f" {selfName}::new(SafeJSContext::from_ptr(cx), value)\n"
|
||||
f" {selfName}::new(SafeJSContext::from_ptr(cx), value, CanGc::note())\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
|
@ -7675,7 +7675,7 @@ impl{self.generic} Clone for {self.makeClassName(self.dictionary)}{self.genericS
|
|||
" rooted!(in(*cx) let mut rval = UndefinedValue());\n"
|
||||
" if get_dictionary_property(*cx, object.handle(), "
|
||||
f'"{member.identifier.name}", '
|
||||
"rval.handle_mut(), CanGc::note())? && !rval.is_undefined() {\n"
|
||||
"rval.handle_mut(), can_gc)? && !rval.is_undefined() {\n"
|
||||
f"{indent(conversion)}\n"
|
||||
" } else {\n"
|
||||
f"{indent(default)}\n"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue