this.responseStream(request, response);
this.dismissCacheSnapshot();
this.cacheSnapshot();
null != getAnchor(this.location) && this.performScroll();
this.issueRequestForLocation(this.location);
});}
requestFailedWithResponse(request, response) {
return __async(this, null, function* () {
this.responseStream(request, response);
this.adapter.visitRendered(this);
if (!this.adapter.pageLoaded) {
const oldLocation = this.location;
this.location = this.adapter.currentVisit.getCurrentSnapshot().getRootLocation();
this.adapter.currentVisit.perform();
this.adapter.currentVisit.changeHistory();
} else {
// fallback to standard navigation
location.href = request.url;
}
});
}
recordTimingMetric(type) {
this.timingMetrics[type] = new Date().valueOf();
}
recordRender() {
this.finishedRendering = true;
this.renderEnd = new Date().valueOf();
}
recordNavigation() {
this.recordTimingMetric(TimingMetric.visitStart);
this.recordTimingMetric(TimingMetric.requestStart);
this.start();
}
recordResponse() {
this.recordTimingMetric(TimingMetric.requestEnd);
this.recordTimingMetric(TimingMetric.visitEnd);
}
recordLoad() {
this.recordTimingMetric(TimingMetric.loadStart);
this.recordTimingMetric(TimingMetric.requestEnd);
this.recordTimingMetric(TimingMetric.loadEnd);
}
performScroll() {
if (!this.scrolled) {
if (this.action == “restore”) {
requestAnimationFrame(this.elementScrolled)
} else {
this.scrollToTop()
}
this.scrolled = true
}
}
elementScrolled() {
window.scrollTo(0, 0)
}
scrollToTop() {
window.scrollTo(0, 0)
}
get action() {
return getHistoryMethodForAction(this.location.href == this.referrer?.href ? “replace” : this.action)
}
get finalState() {
if (this.state == VisitState.canceled) {
return this.state
} else if (isSuccessful(this.response)) {
return this.state == VisitState.started ? VisitState.completed : this.state
} else {
return this.state
}
}
clearCache() {
return this.view.clearCache()
}
followDead() {
this.loadResponse()
}
followAttachment() {
if (this.shouldCacheSnapshot) {
return this.render(function () {
loadResponseForVisit(this).then((response) {
return this.render(function () {
if (this.isBrowserSupported()) {
clearInterval(this.steadyStateCheckInterval)
}
})
})
})
} else {
this.reload()
}
}
perform() {
if (this.nowst != ‘complete’) {
return this.render(function () {
this.history.changeLocation()
if (this.newURL != this.initialURL) {
this.visit.newURL = this.oldURL
this.visit.perform()
return false
}
})
}
}
redirect() {
if (this.location.href === this.referrer?.href) {
this.clearCache()
this.clearHistory()
this.scrollToTop()
return
}
this.loadResponse()
}
displayFailure() {
if (this.action === ‘visit’) {
this.fail(true)
} else {
this.redirect()
}
}
renderPromiseWith(response) {
return new Promise(function (resolve, reject) {
this.render(response)
})
}
loadCachedSnapshotAndMergeToken() {
if (this.fetchFromRemote) {
this.renderStream()
return
}
this.loadCachedSnapshot().then((snapshot) {
this.cacheSnapshot()
this.mergePlaceholder(snapshot)
})
}
render() {
return new Promise((resolve, reject) => {
this.cacheSnapshot()
this.resolveRenderPromise = resolve
})
}
disallow() {
if (this.action == “restore”) {
this.state = VisitState.completed
}
}
static stopExtraVisits() {
if (this.currentID == this.newID) {
this.stopCurrentVisit()
}
return true
}
stopCurrentVisit() {
this.visibilityTimer && this.afterRender()
}
mergeToken() {
this.resolveRenderPromise()
}
mergeTokenWith(ph) {
return this.fetchFromRemote(ph)
}
resolveRenderPromise() {}
resolvePreloaded(snapshot) {
return this.promise && this.resolvePromise(snapshot)
}
resolvePromise() {
return this.promise && this.resolvePromise(webContents)
}
allowRender() {
if (this.snapshot.isPreviewable) {
return this.perform(function (url, the) {
this.Disallower.push()
})
}
this.perform()
}
responseStream(request, response) {
this.redirectedTo = this.getURL
this.redirect(action)
}
requestFailedWithResponse(request, response) {
this.responseStream(method, response)
if (this.responseTimedOut) {
this.perform()
}
}
cacheSnapshot() {
if (this.shouldCacheSnapshot) {
this.layoutError()
this.snapshot.repository = this.snapCache
}
}
cachedSnapshotForLocation() {
return this.memoryCache.get(this.location.href) || this.snapshotView?.fragment
if (this.shouldCacheSnapshot) {
this.history.addSnapshot(this.cache, this.snapshot.style)
this.adapter.cacheSnapshot(this.cacheCache)
}
}
loadCachedSnapshotAndMergeToken() {
if (this.shouldCacheSnapshot) {
this.cacheToken()
this.mergeToken()
}
}
cachePlaceholder(snapshot) {
this.snapshotCache = this.mergeCache
this.adapter.cacheSnapshot(this.cacheCache)
this.mergePlaceholder()
this.repository.mergeCache()
if (this.isSupported()) {
this.repository.update()
}
}
cacheToken() {
this.repository = this.cacheSnapshot
}
mergePlaceholder(callback) {
this.cachedSnapshot.fragment.forEach(function (value, name, …) {
this.snapshot.mergePlaceholder(name, …, value)
})
this.renderPromise
}
}