File tree 1 file changed +12
-2
lines changed 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1062,15 +1062,25 @@ var Gmail_ = function(localJQuery) {
1062
1062
if ( ! api . tracker . xhr_init ) {
1063
1063
api . tracker . xhr_init = true ;
1064
1064
var js_frame = null ;
1065
+
1065
1066
if ( top . document . getElementById ( "js_frame" ) ) {
1066
1067
js_frame = top . document . getElementById ( "js_frame" ) ;
1067
1068
} else if ( window . opener ) {
1068
1069
js_frame = window . opener . top . document . getElementById ( "js_frame" ) ;
1069
1070
}
1070
1071
if ( ! js_frame ) {
1071
- throw "Cannot register the xhr watcher as mail.google.com is not fully loaded yet. Please wrap your code in `gmail.observe.on(\"load\")`" ;
1072
+ if ( window . opener ) {
1073
+ js_frame = window . opener . top ;
1074
+ } else {
1075
+ js_frame = top ;
1076
+ }
1077
+ }
1078
+ var win ;
1079
+ if ( js_frame . contentDocument ) {
1080
+ win = js_frame . contentDocument . defaultView ;
1081
+ } else {
1082
+ win = js_frame ;
1072
1083
}
1073
- var win = js_frame . contentDocument . defaultView ;
1074
1084
1075
1085
if ( ! win . gjs_XMLHttpRequest_open ) {
1076
1086
win . gjs_XMLHttpRequest_open = win . XMLHttpRequest . prototype . open ;
You can’t perform that action at this time.
0 commit comments