File tree Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change 1- import { CSPTrustedHTMLToStringable , CSPTrustedTypesPolicy } from './trusted-types'
2-
31const privateData = new WeakMap ( )
42
53function isWildcard ( accept : string | null ) {
64 return accept && ! ! accept . split ( ',' ) . find ( x => x . match ( / ^ \s * \* \/ \* / ) )
75}
86
7+ // We don't want to add `@types/trusted-types` as a dependency, so we use this stand-in.
8+
9+ interface CSPTrustedHTMLToStringable {
10+ toString : ( ) => string
11+ }
12+ interface CSPTrustedTypesPolicy {
13+ createHTML : ( s : string , response : Response ) => CSPTrustedHTMLToStringable
14+ }
915let cspTrustedTypesPolicy : Promise < CSPTrustedTypesPolicy > | null = null
1016export function setCSPTrusedTypesPolicy ( policy : CSPTrustedTypesPolicy | Promise < CSPTrustedTypesPolicy > ) : void {
1117 cspTrustedTypesPolicy = Promise . resolve ( policy )
@@ -202,7 +208,7 @@ export default class IncludeFragmentElement extends HTMLElement {
202208 throw new Error ( `Failed to load resource: expected ${ this . accept || 'text/html' } but was ${ ct } ` )
203209 }
204210
205- let responseText : string = await response . text ( )
211+ const responseText : string = await response . text ( )
206212 let data : string | CSPTrustedHTMLToStringable = responseText
207213 if ( cspTrustedTypesPolicy ) {
208214 data = await cspTrustedTypesPolicy . then ( policy => policy . createHTML ( responseText , response ) )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments