@@ -131,10 +131,11 @@ function getNonHtmlError(finalRecord) {
131131function getPageLoadError ( navigationError , context ) {
132132 const { url, networkRecords} = context ;
133133 const mainRecordLantern = Lantern . Core . NetworkAnalyzer . findResourceForUrl (
134- networkRecords . map ( NetworkRequest . asLanternNetworkRequest ) ,
134+ // @ts -expect-error - trace engine types for InitiatorType are outdated
135+ networkRecords ,
135136 url
136137 ) ;
137- let mainRecord = mainRecordLantern ?. rawRequest ;
138+ let mainRecord = mainRecordLantern ;
138139
139140 // If the url doesn't give us a network request, it's possible we landed on a chrome-error:// page
140141 // In this case, just get the first document request.
@@ -143,6 +144,7 @@ function getPageLoadError(navigationError, context) {
143144 record . resourceType === NetworkRequest . TYPES . Document
144145 ) ;
145146 if ( documentRequests . length ) {
147+ // @ts -expect-error - mainRecord is inferred as a Lantern request from findResourceForUrl, but we assign a raw record here.
146148 mainRecord = documentRequests . reduce ( ( min , r ) => {
147149 return r . networkRequestTime < min . networkRequestTime ? r : min ;
148150 } ) ;
@@ -152,9 +154,7 @@ function getPageLoadError(navigationError, context) {
152154 // MIME Type is only set on the final redirected document request. Use this for the HTML check instead of root.
153155 let finalRecord ;
154156 if ( mainRecord ) {
155- const mainRecordLantern = NetworkRequest . asLanternNetworkRequest ( mainRecord ) ;
156- const finalRecordLantern = Lantern . Core . NetworkAnalyzer . resolveRedirects ( mainRecordLantern ) ;
157- finalRecord = finalRecordLantern ?. rawRequest || finalRecordLantern ;
157+ finalRecord = Lantern . Core . NetworkAnalyzer . resolveRedirects ( mainRecord ) ;
158158 } else {
159159 // We have no network requests to process, use the navError
160160 return navigationError ;
@@ -164,7 +164,9 @@ function getPageLoadError(navigationError, context) {
164164 context . warnings . push ( str_ ( UIStrings . warningXhtml ) ) ;
165165 }
166166
167+ // @ts -expect-error - mainRecord may be typed as a Lantern request, but functions expect a raw record.
167168 const networkError = getNetworkError ( mainRecord , context ) ;
169+ // @ts -expect-error - mainRecord may be typed as a Lantern request, but functions expect a raw record.
168170 const interstitialError = getInterstitialError ( mainRecord , networkRecords ) ;
169171 // @ts -expect-error - finalRecord may be a Lantern request, which is compatible enough
170172 // for getNonHtmlError.
0 commit comments