* Validate if is secure context. Returns null if context is secure, otherwise * return error message. * * See https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts * * @return {?string} null if current context is secure, otherwise return error * message.
()
| 16036 | * message. |
| 16037 | */ |
| 16038 | function validateSecureContext() { |
| 16039 | if (window.location.hostname.endsWith(Constants.TRUSTED_DOMAIN)) { |
| 16040 | // This is for local development. |
| 16041 | return null; |
| 16042 | } |
| 16043 | if (window.isSecureContext === undefined) { |
| 16044 | // Browser not support isSecureContext, figure out a way to validate this |
| 16045 | // for the unsupported browser. |
| 16046 | return null; |
| 16047 | } |
| 16048 | return window.isSecureContext ? |
| 16049 | null : |
| 16050 | 'Google Pay APIs should be called in secure context!'; |
| 16051 | } |
| 16052 | |
| 16053 | /** |
| 16054 | * Validate PaymentOptions. |
no outgoing calls
no test coverage detected