wait for next paint in about:blank frames, fixes #1165
This commit is contained in:
		
							parent
							
								
									784a1018f8
								
							
						
					
					
						commit
						50959354ec
					
				|  | @ -65,11 +65,15 @@ | ||||||
|     } else { |     } else { | ||||||
|       const SYM_ID = 'styles'; |       const SYM_ID = 'styles'; | ||||||
|       const SYM = Symbol.for(SYM_ID); |       const SYM = Symbol.for(SYM_ID); | ||||||
|  |       const parentStyles = isFrameAboutBlank && | ||||||
|  |         tryCatch(() => parent[parent.Symbol.for(SYM_ID)]); | ||||||
|       const styles = |       const styles = | ||||||
|         window[SYM] || |         window[SYM] || | ||||||
|         (isFrameAboutBlank |         /* about:blank iframes are often used by sites for file upload or background tasks | ||||||
|           ? tryCatch(() => parent[parent.Symbol.for(SYM_ID)]) |          * and they may break if unexpected DOM stuff is present at `load` event | ||||||
|           : chrome.app && !chrome.tabs && tryCatch(getStylesViaXhr)) || |          * so we'll add the styles in the next tick */ | ||||||
|  |         parentStyles && await new Promise(requestAnimationFrame) && parentStyles || | ||||||
|  |         chrome.app && !chrome.tabs && tryCatch(getStylesViaXhr) || | ||||||
|         await API.styles.getSectionsByUrl(matchUrl, null, true); |         await API.styles.getSectionsByUrl(matchUrl, null, true); | ||||||
|       hasStyles = !styles.disableAll; |       hasStyles = !styles.disableAll; | ||||||
|       if (hasStyles) { |       if (hasStyles) { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user