@override
(newUrl)
| 864 | |
| 865 | /** @override */ |
| 866 | replaceUrl(newUrl) { |
| 867 | if ( |
| 868 | !newUrl || |
| 869 | !this.ampdoc.isSingleDoc() || |
| 870 | !this.win.history.replaceState |
| 871 | ) { |
| 872 | return; |
| 873 | } |
| 874 | |
| 875 | try { |
| 876 | // The origin and source origin must match. |
| 877 | const url = parseUrlDeprecated(this.win.location.href); |
| 878 | const replaceUrl = parseUrlDeprecated( |
| 879 | removeFragment(newUrl) + this.win.location.hash |
| 880 | ); |
| 881 | if ( |
| 882 | url.origin == replaceUrl.origin && |
| 883 | getSourceOrigin(url) == getSourceOrigin(replaceUrl) |
| 884 | ) { |
| 885 | this.win.history.replaceState({}, '', replaceUrl.href); |
| 886 | this.win.location['originalHref'] = url.href; |
| 887 | dev().fine(TAG_, 'replace url:' + replaceUrl.href); |
| 888 | } |
| 889 | } catch (e) { |
| 890 | dev().error(TAG_, 'replaceUrl failed', e); |
| 891 | } |
| 892 | } |
| 893 | |
| 894 | /** |
| 895 | * Defense in-depth against viewer communication issues: Will make the |
no test coverage detected