From 1f39ef72674d988cbd3aba37e7652c15e1b2249f Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Sat, 26 Oct 2024 11:03:03 -0700 Subject: [PATCH 1/8] various edge-case loading optimizations: - if too many range requests for same URL are being made, try skipping/failing right away to reduce load - assume main browser context is used not just for service workers, always enable - check false positive 'net-aborted' error that may actually be ok for media, as well as documents - improve logging - possible fix for issues in #706 - interrupt any pending requests (that may be loading via browser context) after page timeout, log dropped requests --- package.json | 2 +- src/crawler.ts | 6 ++++-- src/util/browser.ts | 31 +++++++-------------------- src/util/recorder.ts | 51 +++++++++++++++++++++++++++++++++----------- yarn.lock | 18 ++++++++-------- 5 files changed, 61 insertions(+), 47 deletions(-) diff --git a/package.json b/package.json index 5d0c0f08..93b4c568 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "p-queue": "^7.3.4", "pixelmatch": "^5.3.0", "pngjs": "^7.0.0", - "puppeteer-core": "^23.5.1", + "puppeteer-core": "^23.6.0", "sax": "^1.3.0", "sharp": "^0.32.6", "tsc": "^2.0.4", diff --git a/src/crawler.ts b/src/crawler.ts index d9bce83d..ae5ebb36 100644 --- a/src/crawler.ts +++ b/src/crawler.ts @@ -175,6 +175,7 @@ export class Crawler { finalExit = false; uploadAndDeleteLocal = false; done = false; + postCrawling = false; textInPages = false; @@ -1536,12 +1537,13 @@ self.__bx_behaviors.selectMainBehavior(); } async postCrawl() { + this.postCrawling = true; + logger.info("Crawling done"); + if (this.params.combineWARC && !this.params.dryRun) { await this.combineWARC(); } - logger.info("Crawling done"); - if ( (this.params.generateCDX || this.params.generateWACZ) && !this.params.dryRun diff --git a/src/util/browser.ts b/src/util/browser.ts index df4a2293..a8f07cf7 100644 --- a/src/util/browser.ts +++ b/src/util/browser.ts @@ -6,7 +6,7 @@ import { Readable } from "node:stream"; import os from "os"; import path from "path"; -import { LogContext, logger } from "./logger.js"; +import { formatErr, LogContext, logger } from "./logger.js"; import { initStorage } from "./storage.js"; import { DISPLAY, type ServiceWorkerOpt } from "./constants.js"; @@ -126,7 +126,7 @@ export class Browser { ? undefined : (target) => this.targetFilter(target), }; - await this._init(launchOpts, ondisconnect, recording); + await this._init(launchOpts, ondisconnect); } targetFilter(target: Target) { @@ -392,7 +392,7 @@ export class Browser { launchOpts: PuppeteerLaunchOptions, // eslint-disable-next-line @typescript-eslint/ban-types ondisconnect: Function | null = null, - recording: boolean, + //_recording: boolean, ) { this.browser = await puppeteer.launch(launchOpts); @@ -400,9 +400,7 @@ export class Browser { this.firstCDP = await target.createCDPSession(); - if (recording) { - await this.serviceWorkerFetch(); - } + await this.browserContextFetch(); if (ondisconnect) { this.browser.on("disconnected", (err) => ondisconnect(err)); @@ -479,31 +477,18 @@ export class Browser { return { page, cdp }; } - async serviceWorkerFetch() { + async browserContextFetch() { if (!this.firstCDP) { return; } this.firstCDP.on("Fetch.requestPaused", async (params) => { - const { frameId, requestId, networkId, request } = params; + const { frameId, requestId, request } = params; if (!this.firstCDP) { throw new Error("CDP missing"); } - if (networkId) { - try { - await this.firstCDP.send("Fetch.continueResponse", { requestId }); - } catch (e) { - logger.warn( - "continueResponse failed", - { url: request.url }, - "recorder", - ); - } - return; - } - let foundRecorder = null; for (const recorder of this.recorders) { @@ -527,9 +512,9 @@ export class Browser { try { await this.firstCDP.send("Fetch.continueResponse", { requestId }); } catch (e) { - logger.warn( + logger.debug( "continueResponse failed", - { url: request.url }, + { url: request.url, ...formatErr(e), from: "serviceWorker" }, "recorder", ); } diff --git a/src/util/recorder.ts b/src/util/recorder.ts index 3eabdf7b..db35101d 100644 --- a/src/util/recorder.ts +++ b/src/util/recorder.ts @@ -122,6 +122,7 @@ export class Recorder { pendingRequests!: Map; skipIds!: Set; pageInfo!: PageInfoRecord; + skipRangeUrls!: Map; swTargetId?: string | null; swFrameIds = new Set(); @@ -407,6 +408,8 @@ export class Recorder { logNetwork("Network.loadingFailed", { requestId, url, + errorText, + type, ...this.logDetails, }); @@ -426,15 +429,13 @@ export class Recorder { case "net::ERR_ABORTED": // check if this is a false positive -- a valid download that's already been fetched // the abort is just for page, but download will succeed - if (type === "Document" && reqresp.isValidBinary()) { + if ( + type === "Document" || + (type === "Media" && reqresp.isValidBinary()) + ) { this.removeReqResp(requestId); return this.serializeToWARC(reqresp); - } else if ( - url && - reqresp.requestHeaders && - reqresp.requestHeaders["x-browsertrix-fetch"] - ) { - delete reqresp.requestHeaders["x-browsertrix-fetch"]; + } else if (url && reqresp.requestHeaders && type === "Media") { logger.warn( "Attempt direct fetch of failed request", { url, ...this.logDetails }, @@ -453,7 +454,7 @@ export class Recorder { default: logger.warn( "Request failed", - { url, errorText, ...this.logDetails }, + { url, errorText, type, status: reqresp.status, ...this.logDetails }, "recorder", ); } @@ -520,8 +521,7 @@ export class Recorder { if ( responseStatusCode && !responseErrorReason && - !this.shouldSkip(headers, url, method, resourceType) && - !(isSWorker && networkId) + !this.shouldSkip(headers, url, method, resourceType) ) { continued = await this.handleFetchResponse(params, cdp, isSWorker); } @@ -616,6 +616,16 @@ export class Recorder { "recorder", ); this.removeReqResp(networkId); + const count = this.skipRangeUrls.get(url) || 0; + if (count > 2) { + // just fail additional range requests to save bandwidth, as these are not being recorded + await cdp.send("Fetch.failRequest", { + requestId, + errorReason: "BlockedByResponse", + }); + return true; + } + this.skipRangeUrls.set(url, count + 1); return false; } } @@ -794,6 +804,7 @@ export class Recorder { } this.pendingRequests = new Map(); this.skipIds = new Set(); + this.skipRangeUrls = new Map(); this.skipping = false; this.pageInfo = { pageid, @@ -861,8 +872,13 @@ export class Recorder { let numPending = this.pendingRequests.size; - while (numPending && !this.crawler.interrupted) { - const pending = []; + let pending = []; + while ( + numPending && + !this.crawler.interrupted && + !this.crawler.postCrawling + ) { + pending = []; for (const [requestId, reqresp] of this.pendingRequests.entries()) { const url = reqresp.url || ""; const entry: { @@ -892,6 +908,17 @@ export class Recorder { await sleep(5.0); numPending = this.pendingRequests.size; } + + if (this.pendingRequests.size) { + logger.warn( + "Dropping timed out requests", + { numPending, pending, ...this.logDetails }, + "recorder", + ); + for (const requestId of this.pendingRequests.keys()) { + this.removeReqResp(requestId); + } + } } async onClosePage() { diff --git a/yarn.lock b/yarn.lock index a2fb5d75..8b0b963e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2075,10 +2075,10 @@ detect-newline@^3.0.0: resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== -devtools-protocol@0.0.1342118: - version "0.0.1342118" - resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1342118.tgz#ea136fc1701572c0830233dcb414dc857e582e0a" - integrity sha512-75fMas7PkYNDTmDyb6PRJCH7ILmHLp+BhrZGeMsa4bCh40DTxgCz2NRy5UDzII4C5KuD0oBMZ9vXKhEl6UD/3w== +devtools-protocol@0.0.1354347: + version "0.0.1354347" + resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1354347.tgz#5cb509610b8f61fc69a31e5c810d5bed002d85ea" + integrity sha512-BlmkSqV0V84E2WnEnoPnwyix57rQxAM5SKJjf4TbYOCGLAWtz8CDH8RIaGOjPgPCXo2Mce3kxSY497OySidY3Q== diff-sequences@^29.6.3: version "29.6.3" @@ -4375,15 +4375,15 @@ punycode@^2.1.0: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== -puppeteer-core@^23.5.1: - version "23.5.1" - resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-23.5.1.tgz#fac4268820c35d3172e783a1f1a39773b2c0f7c6" - integrity sha512-We6xKCSZaZ23+GAYckeNfeDeJIVuhxOBsh/gZkbULu/XLFJ3umSiiQ8Ey927h3g/XrCCr8CnSZ5fvP5v2vB5Yw== +puppeteer-core@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-23.6.0.tgz#a3e1e09c05f47fb8ca2bc9d4ca200d18e3704303" + integrity sha512-se1bhgUpR9C529SgHGr/eyT92mYyQPAhA2S9pGtGrVG2xob9qE6Pbp7TlqiSPlnnY1lINqhn6/67EwkdzOmKqQ== dependencies: "@puppeteer/browsers" "2.4.0" chromium-bidi "0.8.0" debug "^4.3.7" - devtools-protocol "0.0.1342118" + devtools-protocol "0.0.1354347" typed-query-selector "^2.12.0" ws "^8.18.0" From e084e1356fc77463a85adb19d097194424d09195 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Mon, 28 Oct 2024 23:22:53 -0700 Subject: [PATCH 2/8] fixes from code review --- src/util/browser.ts | 1 - src/util/recorder.ts | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/util/browser.ts b/src/util/browser.ts index a8f07cf7..a0a85b59 100644 --- a/src/util/browser.ts +++ b/src/util/browser.ts @@ -392,7 +392,6 @@ export class Browser { launchOpts: PuppeteerLaunchOptions, // eslint-disable-next-line @typescript-eslint/ban-types ondisconnect: Function | null = null, - //_recording: boolean, ) { this.browser = await puppeteer.launch(launchOpts); diff --git a/src/util/recorder.ts b/src/util/recorder.ts index db35101d..355d5f96 100644 --- a/src/util/recorder.ts +++ b/src/util/recorder.ts @@ -430,8 +430,8 @@ export class Recorder { // check if this is a false positive -- a valid download that's already been fetched // the abort is just for page, but download will succeed if ( - type === "Document" || - (type === "Media" && reqresp.isValidBinary()) + (type === "Document" || type === "Media") && + reqresp.isValidBinary() ) { this.removeReqResp(requestId); return this.serializeToWARC(reqresp); @@ -1422,7 +1422,7 @@ class AsyncFetcher { reqresp.payload = Buffer.concat(buffers, currSize); externalBuffer.buffers = [reqresp.payload]; } else if (fh) { - logger.warn( + logger.debug( "Large payload written to WARC, but not returned to browser (would require rereading into memory)", { url, actualSize: reqresp.readSize, maxSize: this.maxFetchSize }, "recorder", From c663864734a9f941cdad3b3c89f33f41ddb0f597 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Tue, 29 Oct 2024 20:29:08 -0700 Subject: [PATCH 3/8] fix streaming logic that excluded full range requests from being streamed by only checking 200, not 206 (ack!) status code new logic: - if content length > 25MB (text rewrite limit), always stream, won't do any rewriting (should be fairly rare) - if content length > 5MB, always stream, unless essential resource (eg. html/js/css) which requires in-memory fetch for possible rewriting - if content length is unknown, stream if non-error code <300, as error codes likely aren't very large. --- src/util/recorder.ts | 48 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/src/util/recorder.ts b/src/util/recorder.ts index 355d5f96..02b6a07a 100644 --- a/src/util/recorder.ts +++ b/src/util/recorder.ts @@ -666,13 +666,13 @@ export class Recorder { let streamingConsume = false; - // if contentLength is large or unknown, do streaming, unless its an essential resource - // in which case, need to do a full fetch either way - // don't count non-200 responses which may not have content-length if ( - (contentLen < 0 || contentLen > MAX_BROWSER_DEFAULT_FETCH_SIZE) && - responseStatusCode === 200 && - !this.isEssentialResource(reqresp.resourceType, mimeType) + this.shouldStream( + contentLen, + responseStatusCode || 0, + reqresp.resourceType || "", + mimeType, + ) ) { const opts: ResponseStreamAsyncFetchOptions = { reqresp, @@ -1046,7 +1046,7 @@ export class Recorder { } } - isEssentialResource(resourceType: string | undefined, contentType: string) { + isEssentialResource(resourceType: string, contentType: string) { if (resourceType === "script" || resourceType === "stylesheet") { return true; } @@ -1058,6 +1058,40 @@ export class Recorder { return false; } + shouldStream( + contentLength: number, + responseStatusCode: number, + resourceType: string, + mimeType: string, + ) { + // if contentLength is too large even for rewriting, always stream, will not do rewriting + // even if text + if (contentLength > MAX_TEXT_REWRITE_SIZE) { + return true; + } + + // if contentLength larger but is essential resource, do stream + // otherwise full fetch for rewriting + if ( + contentLength > MAX_BROWSER_DEFAULT_FETCH_SIZE && + !this.isEssentialResource(resourceType, mimeType) + ) { + return true; + } + + // if contentLength is unknown, also stream if its an essential resource and not 3xx / 4xx / 5xx + // status code, as these codes may have no content-length, and are likely small + if ( + contentLength < 0 && + !this.isEssentialResource(resourceType, mimeType) && + responseStatusCode < 300 + ) { + return true; + } + + return false; + } + protected getMimeType( headers?: Protocol.Fetch.HeaderEntry[] | { name: string; value: string }[], ) { From 2fa5df81498c769c8e987ae1993ecf2ca3063f58 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Wed, 30 Oct 2024 23:47:40 -0700 Subject: [PATCH 4/8] additional cleanup: - add fetchContinued to avoid double-handling requestPaused if intercepted both in browser context and page context - rename isServiceWorker -> isBrowserContext, write record in fetch response if no page context - don't write 'no payload' requests in browser context, as they may be redirects reusing same requestId, and 204 will get skipped anyway - don't auto-attempt aborted media, already handled via behavior fetch --- src/util/browser.ts | 8 +++-- src/util/recorder.ts | 74 ++++++++++++++++++++++++++------------------ src/util/reqresp.ts | 6 ++++ 3 files changed, 55 insertions(+), 33 deletions(-) diff --git a/src/util/browser.ts b/src/util/browser.ts index a0a85b59..7d81f057 100644 --- a/src/util/browser.ts +++ b/src/util/browser.ts @@ -484,6 +484,8 @@ export class Browser { this.firstCDP.on("Fetch.requestPaused", async (params) => { const { frameId, requestId, request } = params; + const { url } = request; + if (!this.firstCDP) { throw new Error("CDP missing"); } @@ -491,7 +493,7 @@ export class Browser { let foundRecorder = null; for (const recorder of this.recorders) { - if (recorder.swUrls.has(request.url)) { + if (recorder.swUrls.has(url)) { recorder.swFrameIds.add(frameId); } @@ -504,7 +506,7 @@ export class Browser { if (!foundRecorder) { logger.warn( "Skipping URL from unknown frame", - { url: request.url, frameId }, + { url, frameId }, "recorder", ); @@ -513,7 +515,7 @@ export class Browser { } catch (e) { logger.debug( "continueResponse failed", - { url: request.url, ...formatErr(e), from: "serviceWorker" }, + { url, ...formatErr(e), from: "serviceWorker" }, "recorder", ); } diff --git a/src/util/recorder.ts b/src/util/recorder.ts index 02b6a07a..69ab1003 100644 --- a/src/util/recorder.ts +++ b/src/util/recorder.ts @@ -435,20 +435,23 @@ export class Recorder { ) { this.removeReqResp(requestId); return this.serializeToWARC(reqresp); - } else if (url && reqresp.requestHeaders && type === "Media") { - logger.warn( - "Attempt direct fetch of failed request", - { url, ...this.logDetails }, - "recorder", - ); - const fetcher = new AsyncFetcher({ - reqresp, - recorder: this, - networkId: requestId, - }); - void this.fetcherQ.add(() => fetcher.load()); - return; } + // disable for now, driven by fetch from behaviors likely + // else if (url && reqresp.requestHeaders && type === "Media") { + // this.removeReqResp(requestId); + // logger.warn( + // "Attempt direct fetch of failed request", + // { url, ...this.logDetails }, + // "recorder", + // ); + // const fetcher = new AsyncFetcher({ + // reqresp, + // recorder: this, + // networkId: requestId, + // }); + // void this.fetcherQ.add(() => fetcher.load()); + // return; + // } break; default: @@ -496,7 +499,7 @@ export class Recorder { async handleRequestPaused( params: Protocol.Fetch.RequestPausedEvent, cdp: CDPSession, - isSWorker = false, + isBrowserContext = false, ) { const { requestId, @@ -523,7 +526,11 @@ export class Recorder { !responseErrorReason && !this.shouldSkip(headers, url, method, resourceType) ) { - continued = await this.handleFetchResponse(params, cdp, isSWorker); + continued = await this.handleFetchResponse( + params, + cdp, + isBrowserContext, + ); } } catch (e) { logger.error( @@ -549,7 +556,7 @@ export class Recorder { async handleFetchResponse( params: Protocol.Fetch.RequestPausedEvent, cdp: CDPSession, - isSWorker: boolean, + isBrowserContext: boolean, ) { const { request } = params; const { url } = request; @@ -610,11 +617,11 @@ export class Recorder { return false; } else { - logger.debug( - "Skip 206 Response", - { range, contentLen, url, ...this.logDetails }, - "recorder", - ); + // logger.debug( + // "Skip 206 Response", + // { range, contentLen, url, ...this.logDetails }, + // "recorder", + // ); this.removeReqResp(networkId); const count = this.skipRangeUrls.get(url) || 0; if (count > 2) { @@ -631,10 +638,23 @@ export class Recorder { } const reqresp = this.pendingReqResp(networkId); + if (!reqresp) { return false; } + // indicate that this is intercepted in the page context + if (!isBrowserContext) { + reqresp.inPageContext = true; + } + + // Already being handled by a different handler + if (reqresp.fetchContinued) { + return false; + } + + reqresp.fetchContinued = true; + if ( url === this.pageUrl && (!this.pageInfo.ts || @@ -653,12 +673,6 @@ export class Recorder { if (this.noResponseForStatus(responseStatusCode)) { reqresp.payload = new Uint8Array(); - - if (isSWorker) { - this.removeReqResp(networkId); - await this.serializeToWARC(reqresp); - } - return false; } @@ -734,9 +748,9 @@ export class Recorder { const rewritten = await this.rewriteResponse(reqresp, mimeType); - // if in service worker, serialize here - // as won't be getting a loadingFinished message - if (isSWorker && reqresp.payload) { + // if in browser context, and not also intercepted in page context + // serialize here, as won't be getting a loadingFinished message for it + if (isBrowserContext && !reqresp.inPageContext && reqresp.payload) { this.removeReqResp(networkId); await this.serializeToWARC(reqresp); } diff --git a/src/util/reqresp.ts b/src/util/reqresp.ts index 1b3b2d58..5548cb5b 100644 --- a/src/util/reqresp.ts +++ b/src/util/reqresp.ts @@ -49,6 +49,12 @@ export class RequestResponseInfo { payload?: Uint8Array; isRemoveRange = false; + // fetchContinued - avoid duplicate fetch response handling + fetchContinued = false; + + // is handled in page context + inPageContext = false; + // misc fromServiceWorker = false; fromCache = false; From 5ea30d3ab86bd539d726072b0b9bf8bb9fb456e1 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Thu, 31 Oct 2024 09:31:01 -0700 Subject: [PATCH 5/8] further cleanup: - interrupt pending requests when page is finished, so pageinfo record is written after - add pageFinished flag to recorder, remove unused 'skipping' flag - renable attempt refetch, should be using dedup --- src/util/recorder.ts | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/src/util/recorder.ts b/src/util/recorder.ts index 69ab1003..72eb7432 100644 --- a/src/util/recorder.ts +++ b/src/util/recorder.ts @@ -131,7 +131,8 @@ export class Recorder { // TODO: Fix this the next time the file is edited. // eslint-disable-next-line @typescript-eslint/no-explicit-any logDetails: Record = {}; - skipping = false; + + pageFinished = false; gzip = true; @@ -170,6 +171,7 @@ export class Recorder { frameIdToExecId: Map; }) { this.frameIdToExecId = frameIdToExecId; + this.pageFinished = false; // Fetch cdp.on("Fetch.requestPaused", (params) => { @@ -435,23 +437,21 @@ export class Recorder { ) { this.removeReqResp(requestId); return this.serializeToWARC(reqresp); + } else if (url && reqresp.requestHeaders && type === "Media") { + this.removeReqResp(requestId); + logger.warn( + "Attempt direct fetch of failed request", + { url, ...this.logDetails }, + "recorder", + ); + const fetcher = new AsyncFetcher({ + reqresp, + recorder: this, + networkId: requestId, + }); + void this.fetcherQ.add(() => fetcher.load()); + return; } - // disable for now, driven by fetch from behaviors likely - // else if (url && reqresp.requestHeaders && type === "Media") { - // this.removeReqResp(requestId); - // logger.warn( - // "Attempt direct fetch of failed request", - // { url, ...this.logDetails }, - // "recorder", - // ); - // const fetcher = new AsyncFetcher({ - // reqresp, - // recorder: this, - // networkId: requestId, - // }); - // void this.fetcherQ.add(() => fetcher.load()); - // return; - // } break; default: @@ -819,7 +819,7 @@ export class Recorder { this.pendingRequests = new Map(); this.skipIds = new Set(); this.skipRangeUrls = new Map(); - this.skipping = false; + this.pageFinished = false; this.pageInfo = { pageid, urls: {}, @@ -889,6 +889,7 @@ export class Recorder { let pending = []; while ( numPending && + !this.pageFinished && !this.crawler.interrupted && !this.crawler.postCrawling ) { @@ -938,6 +939,8 @@ export class Recorder { async onClosePage() { // Any page-specific handling before page is closed. this.frameIdToExecId = null; + + this.pageFinished = true; } async onDone(timeout: number) { @@ -1164,10 +1167,6 @@ export class Recorder { logNetwork("Skipping ignored id", { requestId }); return null; } - if (this.skipping) { - //logger.debug("Skipping request, page already finished", this.logDetails, "recorder"); - return null; - } const reqresp = new RequestResponseInfo(requestId); this.pendingRequests.set(requestId, reqresp); return reqresp; From b6b45574dd62ebf92f888e35989636dc09238e1d Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Thu, 31 Oct 2024 12:07:46 -0700 Subject: [PATCH 6/8] Update src/util/recorder.ts Co-authored-by: Tessa Walsh --- src/util/recorder.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/recorder.ts b/src/util/recorder.ts index 72eb7432..a4faed03 100644 --- a/src/util/recorder.ts +++ b/src/util/recorder.ts @@ -1101,7 +1101,7 @@ export class Recorder { if ( contentLength < 0 && !this.isEssentialResource(resourceType, mimeType) && - responseStatusCode < 300 + reponseStatusCode >= 200 && responseStatusCode < 300 ) { return true; } From 856448d0b9767b438b784136c8ade3fe36b9618c Mon Sep 17 00:00:00 2001 From: Tessa Walsh Date: Thu, 31 Oct 2024 15:12:53 -0400 Subject: [PATCH 7/8] Fix typo --- src/util/recorder.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/recorder.ts b/src/util/recorder.ts index a4faed03..e21435f3 100644 --- a/src/util/recorder.ts +++ b/src/util/recorder.ts @@ -1101,7 +1101,7 @@ export class Recorder { if ( contentLength < 0 && !this.isEssentialResource(resourceType, mimeType) && - reponseStatusCode >= 200 && responseStatusCode < 300 + responseStatusCode >= 200 && responseStatusCode < 300 ) { return true; } From ce4da11dd1e06dd23a4a0f7d079429091a10512b Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Thu, 31 Oct 2024 13:06:46 -0700 Subject: [PATCH 8/8] format fix --- src/util/recorder.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/recorder.ts b/src/util/recorder.ts index e21435f3..be36cc3b 100644 --- a/src/util/recorder.ts +++ b/src/util/recorder.ts @@ -1101,7 +1101,8 @@ export class Recorder { if ( contentLength < 0 && !this.isEssentialResource(resourceType, mimeType) && - responseStatusCode >= 200 && responseStatusCode < 300 + responseStatusCode >= 200 && + responseStatusCode < 300 ) { return true; }