File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ const FILE_OR_FTP = /^(?:file|ftp):$/.test(location.protocol);
103103 let policy = null ;
104104 for ( let attempts = 10 ; ! ( policy || this . policy ) && attempts -- > 0 ; ) {
105105 try {
106- debug ( `Retrieving policy asynchronously (${ attempts } attempts left).` ) ;
106+ debug ( `Retrieving policy asynchronously for ${ document . readyState } ${ url } (${ attempts } attempts left).` ) ;
107107 policy = await Messages . send ( msg . id , msg ) || this . domPolicy ;
108108 debug ( "Asynchronous policy" , policy ) ;
109109 } catch ( e ) {
@@ -112,14 +112,15 @@ const FILE_OR_FTP = /^(?:file|ftp):$/.test(location.protocol);
112112 }
113113 setup ( policy ) ;
114114 } ) ;
115+ const { readyState} = document ;
115116
116- if ( ! this . syncFetchPolicy && this . embeddingDocument ) {
117+ if ( readyState == "complete" || ! this . syncFetchPolicy && this . embeddingDocument ) {
117118 asyncFetch ( ) ;
118119 return ;
119120 }
120- debug ( `Synchronously fetching policy for ${ url } .` ) ;
121+ debug ( `Synchronously fetching policy for ${ readyState } ${ url } .` ) ;
121122 let policy = null ;
122- let attempts = document . readyState == "loading" ? 100 : 1 ;
123+ let attempts = readyState == "loading" ? 100 : 1 ;
123124 let refetch = ( ) => {
124125 try {
125126 policy = browser . runtime . sendSyncMessage ( msg ) || this . domPolicy ;
You can’t perform that action at this time.
0 commit comments