* Preinstalls built-ins and legacy elements in the emebedded ampdoc. * @param {!./ampdoc-impl.AmpDoc} ampdoc * @param {!Array<{extensionId: string, extensionVersion: string}>} extensions * @restricted
(ampdoc, extensions)
| 454 | * @restricted |
| 455 | */ |
| 456 | preinstallEmbed(ampdoc, extensions) { |
| 457 | const topWin = this.win; |
| 458 | const childWin = ampdoc.win; |
| 459 | |
| 460 | // Install built-ins and legacy elements. |
| 461 | copyBuiltinElementsToChildWindow(topWin, childWin); |
| 462 | stubLegacyElements(childWin); |
| 463 | |
| 464 | // Stub extensions. |
| 465 | extensions.forEach(({extensionId, extensionVersion}) => { |
| 466 | // Declare the extension version on ampdoc so it doesn't request the |
| 467 | // extension again. |
| 468 | ampdoc.declareExtension(extensionId, extensionVersion); |
| 469 | |
| 470 | // This will extend automatic upgrade of custom elements from top |
| 471 | // window to the child window. |
| 472 | if (!LEGACY_ELEMENTS.includes(extensionId)) { |
| 473 | stubElementIfNotKnown(childWin, extensionId); |
| 474 | } |
| 475 | }); |
| 476 | } |
| 477 | |
| 478 | /** |
| 479 | * Installs all ampdoc factories previously registered with |
no test coverage detected