MCPcopy
hub / github.com/ampproject/amphtml / doesOriginDomainMatchIframeSrc

Function doesOriginDomainMatchIframeSrc

3p/recaptcha.js:189–208  ·  view source on GitHub ↗
(win, data)

Source from the content-addressed store, hash-verified

187 * @return {!Promise}
188 */
189export 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

Callers 2

test-recaptcha.jsFile · 0.90
actionTypeHandlerFunction · 0.85

Calls 4

parseUrlDeprecatedFunction · 0.90
isProxyOriginFunction · 0.90
compareCurlsDomainFunction · 0.85
thenMethod · 0.45

Tested by

no test coverage detected