Skip to content

Commit fafd03b

Browse files
Update support.js
1 parent 69dc06f commit fafd03b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

support.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,13 @@ const registerHooks = () => {
6666
windowCoverageObjects = []
6767

6868
const saveCoverageObject = (win) => {
69-
// if application code has been instrumented, the app iframe "window" has an object
70-
const applicationSourceCoverage = win.__coverage__
69+
// if the application code has been instrumented, then the app iframe "win.__coverage__" will be available,
70+
// in addition, accessing win.__coverage__ can throw when testing cross-origin code,
71+
// because we don't control the cross-origin code, we can safely return
72+
let applicationSourceCoverage
73+
try {
74+
applicationSourceCoverage = win?.__coverage__
75+
} catch {}
7176
if (!applicationSourceCoverage) {
7277
return
7378
}

0 commit comments

Comments
 (0)