MCPcopy Create free account
hub / github.com/ampproject/amphtml / assertTrustedViewer

Method assertTrustedViewer

src/ssr-template-helper.js:58–66  ·  view source on GitHub ↗

* Asserts that the viewer is from a trusted origin. * * @param {!Element} element * @return {!Promise}

(element)

Source from the content-addressed store, hash-verified

56 * @return {!Promise}
57 */
58 assertTrustedViewer(element) {
59 return this.viewer_.isTrustedViewer().then((trusted) => {
60 userAssert(
61 trusted,
62 'Refused to attempt SSR in untrusted viewer: ',
63 element
64 );
65 });
66 }
67
68 /**
69 * Proxies xhr and template rendering to the viewer.

Callers 2

ssrMethod · 0.95
applySsrOrCsrTemplateMethod · 0.95

Calls 3

userAssertFunction · 0.90
thenMethod · 0.45
isTrustedViewerMethod · 0.45

Tested by

no test coverage detected