script: Append to existing CSP list in set_csp_list

Signed-off-by: Emmanuel Paul Elom <elomemmanuel007@gmail.com>
This commit is contained in:
Emmanuel Paul Elom 2025-05-10 15:21:09 +01:00 committed by elomscansio
parent ed469fe72f
commit 7e61cee526
8 changed files with 133 additions and 60 deletions

View file

@ -4293,7 +4293,14 @@ impl Document {
}
pub(crate) fn set_csp_list(&self, csp_list: Option<CspList>) {
self.policy_container.borrow_mut().set_csp_list(csp_list);
if let Some(new_list) = csp_list {
let mut current = self.get_csp_list();
match current {
Some(ref mut existing) => existing.append(new_list),
None => current = Some(new_list),
}
self.policy_container.borrow_mut().set_csp_list(current);
}
}
pub(crate) fn get_csp_list(&self) -> Option<CspList> {