diff options
Diffstat (limited to 'components/script_plugins/webidl_must_inherit.rs')
-rw-r--r-- | components/script_plugins/webidl_must_inherit.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/components/script_plugins/webidl_must_inherit.rs b/components/script_plugins/webidl_must_inherit.rs index 61fabf0ddf8..1d5f3b4e49c 100644 --- a/components/script_plugins/webidl_must_inherit.rs +++ b/components/script_plugins/webidl_must_inherit.rs @@ -111,6 +111,23 @@ fn check_inherits(code: &str, name: &str, parent_name: &str) -> Result<(), Box<E if inherits == parent_name { return Ok(()); } + + // If there is no parent, first field must be of type Reflector. + if inherits == "" && parent_name == "Reflector" { + return Ok(()); + } + + if inherits == "" && + name == "PaintRenderingContext2D" && + parent_name == "CanvasRenderingContext2D" + { + // PaintRenderingContext2D embeds a CanvasRenderingContext2D + // instead of a Reflector as an optimization, + // but this is fine since CanvasRenderingContext2D + // also has a reflector + return Ok(()); + } + Err(boxed::Box::from(WebIdlError::ParentMismatch { name: name.to_string(), rust_parent: parent_name.to_string(), |