* Returns data that should be saved in browser history on AMP.setState() or * AMP.pushState(). This enables features like restoring browser tabs. * @return {!Promise<?JsonObject>}
()
| 399 | * @return {!Promise<?JsonObject>} |
| 400 | */ |
| 401 | getDataForHistory_() { |
| 402 | const data = { |
| 403 | 'data': {'amp-bind': this.state_}, |
| 404 | 'title': this.localWin_.document.title, |
| 405 | }; |
| 406 | if (!this.viewer_.isEmbedded()) { |
| 407 | // CC doesn't recognize !JsonObject as a subtype of (JsonObject|null). |
| 408 | return /** @type {!Promise<?JsonObject>} */ (Promise.resolve(data)); |
| 409 | } |
| 410 | // Only pass state for history updates to trusted viewers, since they |
| 411 | // may contain user data e.g. form input. |
| 412 | return this.viewer_.isTrustedViewer().then((trusted) => { |
| 413 | return trusted ? data : null; |
| 414 | }); |
| 415 | } |
| 416 | |
| 417 | /** |
| 418 | * Removes bindings from `removedElements` and adds new bindings in |
no test coverage detected