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

Method findAndSetMetadata_

3p/ampcontext.js:405–424  ·  view source on GitHub ↗

* Checks to see if there is a window variable assigned with the * sentinel value, sets it, and returns true if so. * @private

()

Source from the content-addressed store, hash-verified

403 * @private
404 */
405 findAndSetMetadata_() {
406 // If the context data is set on window, that means we don't need
407 // to check the name attribute as it has been bypassed.
408 // TODO(alanorozco): why the heck could AMP_CONTEXT_DATA be two different
409 // types? FIX THIS.
410 if (isObject(this.win_.sf_) && this.win_.sf_.cfg) {
411 this.setupMetadata_(/** @type {string}*/ (this.win_.sf_.cfg));
412 } else if (this.win_.AMP_CONTEXT_DATA) {
413 if (typeof this.win_.AMP_CONTEXT_DATA == 'string') {
414 this.sentinel = this.win_.AMP_CONTEXT_DATA;
415 // If AMP_CONTEXT_DATA is an Object, Assume that it is the Context Object
416 // and not inside the attributes._context which is the structure
417 // parsed from "name" on other instances.
418 } else if (isObject(this.win_.AMP_CONTEXT_DATA)) {
419 this.setupMetadataFromContext_(this.win_.AMP_CONTEXT_DATA);
420 }
421 } else {
422 this.setupMetadata_(this.win_.name);
423 }
424 }
425
426 /**
427 * Send 3p error to parent iframe

Callers 1

constructorMethod · 0.95

Calls 3

setupMetadata_Method · 0.95
isObjectFunction · 0.90

Tested by

no test coverage detected