We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 69dc06f commit fafd03bCopy full SHA for fafd03b
support.js
@@ -66,8 +66,13 @@ const registerHooks = () => {
66
windowCoverageObjects = []
67
68
const saveCoverageObject = (win) => {
69
- // if application code has been instrumented, the app iframe "window" has an object
70
- const applicationSourceCoverage = win.__coverage__
+ // if the application code has been instrumented, then the app iframe "win.__coverage__" will be available,
+ // 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 {}
76
if (!applicationSourceCoverage) {
77
return
78
}
0 commit comments