* Load HTML content into the tab AND store it for replay after context recreation * (e.g. viewport --scale). Unlike page.setContent() alone, this rehydrates * TabSession.loadedHtml so the next saveState()/restoreState() round-trip preserves * the content.
(html: string, opts: { waitUntil?: SetContentWaitUntil } = {})
| 187 | * the content. |
| 188 | */ |
| 189 | async setTabContent(html: string, opts: { waitUntil?: SetContentWaitUntil } = {}): Promise<void> { |
| 190 | const waitUntil = opts.waitUntil ?? 'domcontentloaded'; |
| 191 | // Call setContent FIRST — only record the replay metadata after a successful load. |
| 192 | // If setContent throws (timeout, crash), we must not leave phantom HTML that a |
| 193 | // later viewport --scale would replay. |
| 194 | await this.page.setContent(html, { waitUntil, timeout: 15000 }); |
| 195 | this.loadedHtml = html; |
| 196 | this.loadedHtmlWaitUntil = waitUntil; |
| 197 | } |
| 198 | |
| 199 | /** Get stored HTML + waitUntil for state replay. Returns null if no load-html happened. */ |
| 200 | getLoadedHtml(): { html: string; waitUntil?: SetContentWaitUntil } | null { |
no outgoing calls
no test coverage detected