diff options
author | Josh Matthews <josh@joshmatthews.net> | 2025-03-16 09:46:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-16 13:46:14 +0000 |
commit | d35da38a2fd6f093967e74f704612391b4988e69 (patch) | |
tree | 96c8705a5a597be25ac74b58043e57b3e06992f4 /components/script/security_manager.rs | |
parent | 3ecd1c069978f6ceb20e4ee6af599fbef425e9da (diff) | |
download | servo-d35da38a2fd6f093967e74f704612391b4988e69.tar.gz servo-d35da38a2fd6f093967e74f704612391b4988e69.zip |
Cleanups for future script crate split (#35987)
* script: Avoid direct impl blocks on generated dicts and unions.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Remove references to codegen-specific import module.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Fix tidy.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/script/security_manager.rs')
-rw-r--r-- | components/script/security_manager.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/components/script/security_manager.rs b/components/script/security_manager.rs index 391a54f30dd..223fd5e005a 100644 --- a/components/script/security_manager.rs +++ b/components/script/security_manager.rs @@ -49,6 +49,7 @@ pub(crate) struct SecurityPolicyViolationReport { line_number: u32, column_number: u32, original_policy: String, + #[serde(serialize_with = "serialize_disposition")] disposition: SecurityPolicyViolationEventDisposition, } @@ -170,11 +171,12 @@ impl Convert<SecurityPolicyViolationEventInit> for SecurityPolicyViolationReport } } -impl Serialize for SecurityPolicyViolationEventDisposition { - fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { - match self { - Self::Report => serializer.serialize_str("report"), - Self::Enforce => serializer.serialize_str("enforce"), - } +fn serialize_disposition<S: serde::Serializer>( + val: &SecurityPolicyViolationEventDisposition, + serializer: S, +) -> Result<S::Ok, S::Error> { + match val { + SecurityPolicyViolationEventDisposition::Report => serializer.serialize_str("report"), + SecurityPolicyViolationEventDisposition::Enforce => serializer.serialize_str("enforce"), } } |