* @param {!../../../src/service/ampdoc-impl.AmpDoc} ampdoc
(ampdoc)
| 590 | * @param {!../../../src/service/ampdoc-impl.AmpDoc} ampdoc |
| 591 | */ |
| 592 | constructor(ampdoc) { |
| 593 | /** @private {!../../../src/service/ampdoc-impl.AmpDoc} */ |
| 594 | this.ampdoc_ = ampdoc; |
| 595 | |
| 596 | /** @private {number} */ |
| 597 | this.cumulativeNonSandboxedSize_ = 0; |
| 598 | |
| 599 | /** @private {number} */ |
| 600 | this.cumulativeSandboxedSize_ = 0; |
| 601 | |
| 602 | /** @private {!Array<string>} */ |
| 603 | this.sources_ = []; |
| 604 | |
| 605 | // Query the meta tag once per document. |
| 606 | const allowedHashes = ampdoc.getMetaByName('amp-script-src'); |
| 607 | if (allowedHashes) { |
| 608 | // Allow newlines between hashes for readability/diffs |
| 609 | this.sources_ = allowedHashes.split(/\s+/).filter(Boolean); |
| 610 | } |
| 611 | |
| 612 | /** @private @const {!../../../src/service/crypto-impl.Crypto} */ |
| 613 | this.crypto_ = Services.cryptoFor(ampdoc.win); |
| 614 | } |
| 615 | |
| 616 | /** |
| 617 | * Checks if `sha384(script)` exists in `meta[name="amp-script-src"]` element |
nothing calls this directly
no test coverage detected