@override
()
| 611 | |
| 612 | /** @override */ |
| 613 | getViewerOrigin() { |
| 614 | if (!this.viewerOrigin_) { |
| 615 | let origin; |
| 616 | if (!this.isEmbedded()) { |
| 617 | // Viewer is only determined for iframed documents at this time. |
| 618 | origin = ''; |
| 619 | } else if ( |
| 620 | this.win.location.ancestorOrigins && |
| 621 | this.win.location.ancestorOrigins.length > 0 |
| 622 | ) { |
| 623 | origin = this.win.location.ancestorOrigins[0]; |
| 624 | } |
| 625 | this.viewerOrigin_ = |
| 626 | origin !== undefined |
| 627 | ? Promise.resolve(origin) |
| 628 | : Services.timerFor(this.win) |
| 629 | .timeoutPromise( |
| 630 | VIEWER_ORIGIN_TIMEOUT_, |
| 631 | this.messagingReadyPromise_ |
| 632 | ) |
| 633 | .catch(() => ''); |
| 634 | } |
| 635 | return /** @type {!Promise<string>} */ (this.viewerOrigin_); |
| 636 | } |
| 637 | |
| 638 | /** |
| 639 | * @param {string} urlString |
no test coverage detected