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 {
1212interface CSPTrustedTypesPolicy {
1313 createHTML : ( s : string , response : Response ) => CSPTrustedHTMLToStringable
1414}
15- let cspTrustedTypesPolicy : Promise < CSPTrustedTypesPolicy > | null = null
15+ let cspTrustedTypesPolicyPromise : Promise < CSPTrustedTypesPolicy > | null = null
1616export function setCSPTrustedTypesPolicy ( policy : CSPTrustedTypesPolicy | Promise < CSPTrustedTypesPolicy > ) : void {
17- cspTrustedTypesPolicy = Promise . resolve ( policy )
17+ cspTrustedTypesPolicyPromise = Promise . resolve ( policy )
1818}
1919
2020export default class IncludeFragmentElement extends HTMLElement {
@@ -210,8 +210,9 @@ export default class IncludeFragmentElement extends HTMLElement {
210210
211211 const responseText : string = await response . text ( )
212212 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 )
215216 }
216217
217218 // Dispatch `load` and `loadend` async to allow
You can’t perform that action at this time.
0 commit comments