(window, parentLocation)
| 203 | * @visibleForTesting |
| 204 | */ |
| 205 | export function validateParentOrigin(window, parentLocation) { |
| 206 | const ancestors = window.location.ancestorOrigins; |
| 207 | // Currently only webkit and blink based browsers support |
| 208 | // ancestorOrigins. In that case we proceed but mark the origin |
| 209 | // as non-validated. |
| 210 | if (!ancestors || !ancestors.length) { |
| 211 | return; |
| 212 | } |
| 213 | userAssert( |
| 214 | ancestors[0] == parentLocation.origin, |
| 215 | 'Parent origin mismatch: %s, %s', |
| 216 | ancestors[0], |
| 217 | parentLocation.origin |
| 218 | ); |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * Check that this iframe intended this particular ad type to run. |
no test coverage detected