(win, data)
| 187 | * @return {!Promise} |
| 188 | */ |
| 189 | export function doesOriginDomainMatchIframeSrc(win, data) { |
| 190 | if (!data.origin) { |
| 191 | return Promise.reject(new Error('Could not retreive the origin domain')); |
| 192 | } |
| 193 | |
| 194 | // Using the deprecated parseUrl here, as we don't have access |
| 195 | // to the URL service in a 3p frame. |
| 196 | const originLocation = parseUrlDeprecated(data.origin); |
| 197 | |
| 198 | if (isProxyOrigin(data.origin)) { |
| 199 | const curlsSubdomain = originLocation.hostname.split('.')[0]; |
| 200 | return compareCurlsDomain(win, curlsSubdomain, data.origin); |
| 201 | } |
| 202 | |
| 203 | return ampToolboxCacheUrl |
| 204 | .createCurlsSubdomain(data.origin) |
| 205 | .then((curlsSubdomain) => { |
| 206 | return compareCurlsDomain(win, curlsSubdomain, data.origin); |
| 207 | }); |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * Function to compare curls domains with the passed subdomain |
no test coverage detected