Skip to content

Commit 10d5be9

Browse files
committed
v3.4.12
1 parent d9dff9a commit 10d5be9

File tree

6 files changed

+25
-40
lines changed

6 files changed

+25
-40
lines changed

build/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bugbattle",
3-
"version": "3.4.11",
3+
"version": "3.4.12",
44
"main": "build/index.js",
55
"types": "index.d.ts",
66
"scripts": {

published/latest/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ReplayRecorder.js

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ export default class ReplayRecorder {
242242
stop(fetchResources = false) {
243243
this.stopped = true;
244244
if (!this.rootFrame) {
245-
this.clearFakeFocus();
246245
this.rootFrame = null;
247246
return;
248247
}
@@ -260,12 +259,12 @@ export default class ReplayRecorder {
260259
};
261260

262261
this.rootFrame.stop();
263-
this.clearFakeFocus();
264262
this.rootFrame = null;
265263

266264
this.finalizingResult = true;
267265
if (fetchResources) {
268266
return this.fetchImageResources().then(() => {
267+
this.cleanupResources();
269268
this.result = ret;
270269
this.finalizingResult = false;
271270
});
@@ -275,19 +274,11 @@ export default class ReplayRecorder {
275274
}
276275
}
277276

278-
clearFakeFocus() {
279-
if (!this.focusedElement) {
280-
return;
281-
}
282-
this.focusedElement.removeAttribute("fakeFocus");
283-
let ancestor = this.focusedElement;
284-
while (ancestor) {
285-
ancestor.removeAttribute("fakeFocusWithin");
286-
const nextAncestor = ancestor.parentElement;
287-
if (!nextAncestor) {
288-
ancestor = ancestor.ownerDocument.ReplayRecInner.iframeElement;
289-
} else {
290-
ancestor = nextAncestor;
277+
cleanupResources() {
278+
let resourceKeys = Object.keys(this.resourcesToResolve);
279+
for (var i = 0; i < resourceKeys.length; i++) {
280+
if (this.resourcesToResolve[resourceKeys[i]] === "--") {
281+
delete this.resourcesToResolve[resourceKeys[i]];
291282
}
292283
}
293284
}
@@ -311,11 +302,8 @@ export default class ReplayRecorder {
311302
if (e === this.focusedElement) {
312303
return;
313304
}
314-
this.clearFakeFocus();
315-
e.setAttribute("fakeFocus", "");
316305
let ancestor = e;
317306
while (ancestor) {
318-
ancestor.setAttribute("fakeFocusWithin", "");
319307
const nextAncestor = ancestor.parentElement;
320308
if (!nextAncestor) {
321309
ancestor.ownerDocument.ReplayRecInner.flushObserver();
@@ -508,7 +496,6 @@ export default class ReplayRecorder {
508496
// eslint-disable-next-line @typescript-eslint/no-unused-vars
509497
observer
510498
) {
511-
// Observer callbacks can nest when we flush while detaching from an IFRAME
512499
if (this.nestedObserverCallbacks === 0) {
513500
const now = Date.now();
514501
if (now > this.lastActionTime) {
@@ -520,10 +507,6 @@ export default class ReplayRecorder {
520507
++this.nestedObserverCallbacks;
521508

522509
try {
523-
// A node has a ReplayRecID if and only if it was in the non-excluded DOM at the start of the records
524-
// batch.
525-
// If a node has a ReplayRecID and is not our root, then its parent must also
526-
// have a ReplayRecID.
527510
for (const r of records) {
528511
if (r.target.ReplayRecID && r.type === "childList") {
529512
for (const child of r.removedNodes) {
@@ -538,16 +521,12 @@ export default class ReplayRecorder {
538521
}
539522
}
540523
}
541-
// A node has a ReplayRecID if and only if it was in the non-excluded DOM at the start of the records
542-
// batch, and was not ever removed during this records batch.
543-
// If a node has a ReplayRecID and is not our root, then its parent must also
544-
// have a ReplayRecID.
524+
545525
const nodesWithAddedChildren = [];
546526
for (const r of records) {
547527
const target = r.target;
548528
const id = target.ReplayRecID;
549529
if (!id) {
550-
// Node not in non-excluded DOM at the start of the records batch.
551530
continue;
552531
}
553532
// eslint-disable-next-line default-case
@@ -616,10 +595,6 @@ export default class ReplayRecorder {
616595
}
617596
--this.nestedObserverCallbacks;
618597
if (this.nestedObserverCallbacks === 0) {
619-
// Ignore time spent doing ReplayRec recording.
620-
// Note that during this processing, the browser might be downloading stuff or
621-
// doing other off-main-thread work, so this could give an optimistic picture
622-
// of actual performance. Doesn't really matter.
623598
this.lastActionTime = Date.now();
624599
}
625600
}

src/ResourceExclusionList.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
const blacklist = [
2-
"https://fonts.googleapis.com",
3-
"https://cdn.jsdelivr.net",
4-
"https://cdnjs.cloudflare.com",
5-
"https://ajax.googleapis.com",
6-
"https://use.typekit.net",
2+
"//fonts.googleapis.com",
3+
"//cdn.jsdelivr.net",
4+
"//cdnjs.cloudflare.com",
5+
"//ajax.googleapis.com",
6+
"//use.typekit.net",
7+
".amazonaws.com",
78
];
89

910
export const isBlacklisted = function (url) {

src/ScreenCapture.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { isMobile, resizeImage } from "./ImageHelper";
2+
import { isBlacklisted } from "./ResourceExclusionList";
23

34
export const startScreenCapture = (snapshotPosition) => {
45
return checkOnlineStatus(window.location.origin)
@@ -118,6 +119,10 @@ const fetchLinkItemResource = (elem, proxy = false) => {
118119
elem.href.includes(".css") ||
119120
(elem.rel && elem.rel.includes("stylesheet"));
120121
if (elem && elem.href && isCSS) {
122+
if (isBlacklisted(elem.href)) {
123+
return resolve();
124+
}
125+
121126
var basePath = elem.href.substring(0, elem.href.lastIndexOf("/"));
122127
var xhr = new XMLHttpRequest();
123128
xhr.onload = function () {
@@ -227,6 +232,10 @@ const progressResource = (data, elem, resolve, reject) => {
227232
const fetchItemResource = (elem, proxy = false) => {
228233
return new Promise((resolve, reject) => {
229234
if (elem && elem.src) {
235+
if (isBlacklisted(elem.src)) {
236+
return resolve();
237+
}
238+
230239
var xhr = new XMLHttpRequest();
231240
xhr.onload = function () {
232241
if (proxy) {

0 commit comments

Comments
 (0)