File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ interface CSPTrustedHTMLToStringable {
12
12
interface CSPTrustedTypesPolicy {
13
13
createHTML : ( s : string , response : Response ) => CSPTrustedHTMLToStringable
14
14
}
15
- let cspTrustedTypesPolicy : Promise < CSPTrustedTypesPolicy > | null = null
15
+ let cspTrustedTypesPolicyPromise : Promise < CSPTrustedTypesPolicy > | null = null
16
16
export function setCSPTrustedTypesPolicy ( policy : CSPTrustedTypesPolicy | Promise < CSPTrustedTypesPolicy > ) : void {
17
- cspTrustedTypesPolicy = Promise . resolve ( policy )
17
+ cspTrustedTypesPolicyPromise = Promise . resolve ( policy )
18
18
}
19
19
20
20
export default class IncludeFragmentElement extends HTMLElement {
@@ -210,8 +210,9 @@ export default class IncludeFragmentElement extends HTMLElement {
210
210
211
211
const responseText : string = await response . text ( )
212
212
let data : string | CSPTrustedHTMLToStringable = responseText
213
- if ( cspTrustedTypesPolicy ) {
214
- data = await cspTrustedTypesPolicy . then ( policy => policy . createHTML ( responseText , response ) )
213
+ if ( cspTrustedTypesPolicyPromise ) {
214
+ const cspTrustedTypesPolicy = await cspTrustedTypesPolicyPromise
215
+ data = cspTrustedTypesPolicy . createHTML ( responseText , response )
215
216
}
216
217
217
218
// Dispatch `load` and `loadend` async to allow
You can’t perform that action at this time.
0 commit comments