(doc?: Document)
| 26 | * Security Policy. |
| 27 | */ |
| 28 | export function getNonce(doc?: Document): string | undefined { |
| 29 | let ownerDocument = getOwnerDocument(doc); |
| 30 | |
| 31 | let nonce = nonceCache.get(ownerDocument); |
| 32 | nonce ??= getMetaValue('csp-nonce', ownerDocument); |
| 33 | |
| 34 | if (nonce !== undefined) { |
| 35 | nonceCache.set(ownerDocument, nonce); |
| 36 | } |
| 37 | return nonce; |
| 38 | } |
no test coverage detected