@@ -23,8 +23,6 @@ use crate::config::{DisabledCspModificationKind, PatternKind};
2323#[ cfg( feature = "isolation" ) ]
2424use crate :: pattern:: isolation:: IsolationJavascriptCodegen ;
2525
26- /// The token used on the CSP tag content.
27- pub const CSP_TOKEN : & str = "__TAURI_CSP__" ;
2826/// The token used for script nonces.
2927pub const SCRIPT_NONCE_TOKEN : & str = "__TAURI_SCRIPT_NONCE__" ;
3028/// The token used for style nonces.
@@ -168,11 +166,6 @@ pub fn inject_csp(document: &NodeRef, csp: &str) {
168166 } ) ;
169167}
170168
171- /// Injects a content security policy token to the HTML.
172- pub fn inject_csp_token ( document : & NodeRef ) {
173- inject_csp ( document, CSP_TOKEN )
174- }
175-
176169fn create_csp_meta_tag ( csp : & str ) -> NodeRef {
177170 NodeRef :: new_element (
178171 QualName :: new ( None , ns ! ( html) , LocalName :: from ( "meta" ) ) ,
@@ -298,12 +291,12 @@ mod tests {
298291 ] ;
299292 for html in htmls {
300293 let document = kuchiki:: parse_html ( ) . one ( html) ;
301- super :: inject_csp_token ( & document) ;
294+ let csp = "csp-string" ;
295+ super :: inject_csp ( & document, csp) ;
302296 assert_eq ! (
303297 document. to_string( ) ,
304298 format!(
305- r#"<html><head><meta http-equiv="Content-Security-Policy" content="{}"></head><body></body></html>"# ,
306- super :: CSP_TOKEN
299+ r#"<html><head><meta http-equiv="Content-Security-Policy" content="{csp}"></head><body></body></html>"# ,
307300 )
308301 ) ;
309302 }
0 commit comments