This repository was archived by the owner on Jan 31, 2025. It is now read-only.
File tree 1 file changed +31
-32
lines changed
1 file changed +31
-32
lines changed Original file line number Diff line number Diff line change @@ -46,22 +46,24 @@ export function isWindow(item) {
46
46
return false ;
47
47
}
48
48
49
- try {
49
+ if ( isSameDomain ( item ) ) {
50
+ try {
50
51
51
- for ( let key of [ 'setTimeout' , 'setInterval' , 'postMessage' , 'alert' ] ) {
52
- if ( typeof item [ key ] !== 'function' ) {
53
- return false ;
52
+ for ( let key of [ 'setTimeout' , 'setInterval' , 'postMessage' , 'alert' ] ) {
53
+ if ( typeof item [ key ] !== 'function' ) {
54
+ return false ;
55
+ }
54
56
}
55
- }
56
57
57
- if ( ! item . document || ! item . location ) {
58
- return false ;
59
- }
58
+ if ( ! item . document || ! item . location ) {
59
+ return false ;
60
+ }
60
61
61
- return true ;
62
+ return true ;
62
63
63
- } catch ( err ) {
64
- // pass
64
+ } catch ( err ) {
65
+ // pass
66
+ }
65
67
}
66
68
67
69
try {
@@ -85,7 +87,11 @@ export function isWindowClosed(win) {
85
87
86
88
try {
87
89
88
- if ( ! win || win . closed || ( isSameDomain ( win ) && util . safeGet ( win , 'mockclosed' ) ) ) {
90
+ if ( ! win || win . closed ) {
91
+ return true ;
92
+ }
93
+
94
+ if ( isSameDomain ( win ) && util . safeGet ( win , 'mockclosed' ) ) {
89
95
return true ;
90
96
}
91
97
@@ -201,31 +207,24 @@ export function getFrames(win) {
201
207
202
208
result . push ( frame ) ;
203
209
}
204
- } else {
205
210
206
- let i = 0 ;
207
-
208
- while ( true ) {
209
- let frame ;
210
-
211
- try {
212
- frame = frames [ i ] ;
213
- } catch ( err ) {
214
- return result ;
215
- }
216
-
217
- if ( ! frame ) {
218
- return result ;
219
- }
211
+ return result ;
212
+ }
220
213
221
- result . push ( frame ) ;
214
+ for ( let i = 0 ; i < 100 ; i ++ ) {
215
+ let frame ;
222
216
223
- i += 1 ;
217
+ try {
218
+ frame = frames [ i ] ;
219
+ } catch ( err ) {
220
+ return result ;
221
+ }
224
222
225
- if ( i > 20 ) {
226
- return result ;
227
- }
223
+ if ( ! frame ) {
224
+ return result ;
228
225
}
226
+
227
+ result . push ( frame ) ;
229
228
}
230
229
231
230
return result ;
You can’t perform that action at this time.
0 commit comments