* Execute the bootstrap * @param {!./service/ampdoc-impl.AmpDoc} ampdoc * @param {!./service/performance-impl.Performance} perf
(ampdoc, perf)
| 47 | * @param {!./service/performance-impl.Performance} perf |
| 48 | */ |
| 49 | function bootstrap(ampdoc, perf) { |
| 50 | startupChunk(self.document, function services() { |
| 51 | // Core services. |
| 52 | installRuntimeServices(self); |
| 53 | installAmpdocServices(ampdoc); |
| 54 | // We need the core services (viewer/resources) to start instrumenting |
| 55 | perf.coreServicesAvailable(); |
| 56 | maybeTrackImpression(self); |
| 57 | }); |
| 58 | startupChunk(self.document, function adoptWindow() { |
| 59 | adoptWithMultidocDeps(self); |
| 60 | }); |
| 61 | startupChunk(self.document, function builtins() { |
| 62 | // Builtins. |
| 63 | installBuiltinElements(self); |
| 64 | }); |
| 65 | startupChunk(self.document, function stub() { |
| 66 | // Pre-stub already known elements. |
| 67 | stubElementsForDoc(ampdoc); |
| 68 | whenDocumentComplete(self.document).then(() => markUnresolvedElements()); |
| 69 | }); |
| 70 | startupChunk( |
| 71 | self.document, |
| 72 | function final() { |
| 73 | if (!IS_SXG) { |
| 74 | installPullToRefreshBlocker(self); |
| 75 | } |
| 76 | installAutoLightboxExtension(ampdoc); |
| 77 | installStandaloneExtension(ampdoc); |
| 78 | maybeValidate(self); |
| 79 | makeBodyVisible(self.document); |
| 80 | preconnectToOrigin(self.document); |
| 81 | }, |
| 82 | /* makes the body visible */ true |
| 83 | ); |
| 84 | startupChunk(self.document, function finalTick() { |
| 85 | perf.tick(TickLabel_Enum.END_INSTALL_STYLES); |
| 86 | Services.resourcesForDoc(ampdoc).ampInitComplete(); |
| 87 | // TODO(erwinm): move invocation of the `flush` method when we have the |
| 88 | // new ticks in place to batch the ticks properly. |
| 89 | perf.flush(); |
| 90 | }); |
| 91 | } |
| 92 | |
| 93 | // Store the originalHash as early as possible. Trying to debug: |
| 94 | // https://github.com/ampproject/amphtml/issues/6070 |
no test coverage detected