MCPcopy Index your code
hub / github.com/ampproject/amphtml / sameOrigin_

Method sameOrigin_

extensions/amp-script/0.1/amp-script.js:479–484  ·  view source on GitHub ↗

* Returns true iff `url` has the same origin as the AMP document. * @param {string} url * @return {boolean}

(url)

Source from the content-addressed store, hash-verified

477 * @return {boolean}
478 */
479 sameOrigin_(url) {
480 const urlService = Services.urlForDoc(this.element);
481 const docOrigin = urlService.getSourceOrigin(this.getAmpDoc().getUrl());
482 const scriptOrigin = urlService.parse(url).origin;
483 return docOrigin === scriptOrigin;
484 }
485
486 /**
487 * Returns true if mutations should be allowed based on container attributes.

Callers 1

fetchAuthorScript_Method · 0.95

Calls 4

getSourceOriginMethod · 0.80
getUrlMethod · 0.45
getAmpDocMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected