style: Assert we don't try to do dumb stuff. draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 08 Feb 2018 12:21:27 +0100
changeset 752873 58fc3d8a3889eb2c7e063212cdce3044e3fe0e1d
parent 752872 37611524b428b2c599ee0088686d3ed4e7825940
child 752874 cde49484057f26d5365257bd027e3606a8014e3d
push id98405
push userbmo:emilio@crisal.io
push dateFri, 09 Feb 2018 01:50:06 +0000
milestone60.0a1
style: Assert we don't try to do dumb stuff. MozReview-Commit-ID: 6DpkiwUdccD
servo/components/style/stylesheet_set.rs
--- a/servo/components/style/stylesheet_set.rs
+++ b/servo/components/style/stylesheet_set.rs
@@ -362,16 +362,19 @@ where
         // Inserting stylesheets somewhere but at the end changes the validity
         // of the cascade data, but not the invalidation data.
         self.set_data_validity_at_least(OriginValidity::CascadeInvalid);
         self.entries.insert(index, StylesheetSetEntry::new(sheet));
     }
 
     fn set_data_validity_at_least(&mut self, validity: OriginValidity) {
         use std::cmp;
+
+        debug_assert_ne!(validity, OriginValidity::Valid);
+
         self.dirty = true;
         self.data_validity = cmp::max(validity, self.data_validity);
     }
 
     fn prepend(&mut self, sheet: S) {
         debug_assert!(!self.contains(&sheet));
         // Inserting stylesheets somewhere but at the end changes the validity
         // of the cascade data, but not the invalidation data.