Skip to content

Commit bda967a

Browse files
committed
ensure about:blank pages are never recorded!
- don't cache pageinfo if nothing added - exclude about:blank / no-timestamp pageinfo from being added fixes #314
1 parent 26fdca5 commit bda967a

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@webrecorder/archivewebpage",
33
"productName": "ArchiveWeb.page",
4-
"version": "0.15.8",
4+
"version": "0.15.9",
55
"main": "index.js",
66
"description": "Create Web Archives directly in your browser",
77
"repository": {

src/recorder.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ class Recorder {
368368
}
369369

370370
// @ts-expect-error - TS2339 - Property '_cachePageInfo' does not exist on type 'Recorder'.
371-
if (this._cachePageInfo) {
371+
if (this._cachePageInfo?.ts && this.cachePageInfo.url !== "about:blank") {
372372
// @ts-expect-error - TS2339 - Property '_doAddPage' does not exist on type 'Recorder'. | TS2339 - Property '_cachePageInfo' does not exist on type 'Recorder'.
373373
await this._doAddPage(this._cachePageInfo);
374374
// @ts-expect-error - TS2339 - Property '_cachePageInfo' does not exist on type 'Recorder'.
@@ -1147,12 +1147,14 @@ class Recorder {
11471147
// @ts-expect-error - TS2339 - Property 'sizeNew' does not exist on type 'Recorder'.
11481148
this.sizeNew += writtenSize;
11491149

1150-
// @ts-expect-error - TS2339 - Property '_cachePageInfo' does not exist on type 'Recorder'.
1151-
this._cachePageInfo = pageInfo;
1152-
// @ts-expect-error - TS2339 - Property '_cacheSessionTotal' does not exist on type 'Recorder'.
1153-
this._cacheSessionTotal += payloadSize;
1154-
// @ts-expect-error - TS2339 - Property '_cacheSessionNew' does not exist on type 'Recorder'.
1155-
this._cacheSessionNew += writtenSize;
1150+
if (writtenSize) {
1151+
// @ts-expect-error - TS2339 - Property '_cachePageInfo' does not exist on type 'Recorder'.
1152+
this._cachePageInfo = pageInfo;
1153+
// @ts-expect-error - TS2339 - Property '_cacheSessionTotal' does not exist on type 'Recorder'.
1154+
this._cacheSessionTotal += payloadSize;
1155+
// @ts-expect-error - TS2339 - Property '_cacheSessionNew' does not exist on type 'Recorder'.
1156+
this._cacheSessionNew += writtenSize;
1157+
}
11561158
}
11571159

11581160
// @ts-expect-error - TS7006 - Parameter 'params' implicitly has an 'any' type. | TS7006 - Parameter 'sessions' implicitly has an 'any' type.

0 commit comments

Comments
 (0)