mirror of
https://github.com/servo/servo.git
synced 2025-06-20 15:18:58 +01:00
Add a testing API.
This will allow us to verify the entire detection pipeline in real nightly builds, which will give us confidence that real heap corruption will be detected and reported properly. MozReview-Commit-ID: 43Fp2HT8RYy
This commit is contained in:
parent
039fe176b9
commit
abd408433f
2 changed files with 17 additions and 0 deletions
|
@ -1508,6 +1508,17 @@ impl Stylist {
|
|||
pub fn shutdown() {
|
||||
UA_CASCADE_DATA_CACHE.lock().unwrap().clear()
|
||||
}
|
||||
|
||||
/// Temporary testing method. See bug 1403397.
|
||||
pub fn corrupt_rule_hash_and_crash(&self, index: usize) {
|
||||
let mut origin_iter = self.cascade_data.iter_origins();
|
||||
let d = origin_iter.next().unwrap().0;
|
||||
let mut it = d.element_map.local_name_hash.iter();
|
||||
let nth = index % it.len();
|
||||
let entry = it.nth(nth).unwrap();
|
||||
let ptr = entry.0 as *const _ as *const usize as *mut usize;
|
||||
unsafe { *ptr = 0; }
|
||||
}
|
||||
}
|
||||
|
||||
/// This struct holds data which users of Stylist may want to extract
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue