Sfoglia il codice sorgente

added timeout for frame contents retrieved in the fallback

Gildas 7 anni fa
parent
commit
4dc8d7c624
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      lib/single-file/frame-tree.js

+ 2 - 1
lib/single-file/frame-tree.js

@@ -140,6 +140,7 @@ this.frameTree = this.frameTree || (() => {
 					}
 					if (frameDoc) {
 						sendInitResponse({ framesData: [getFrameData(frameDoc, null, windowId, options)] });
+						timeout.set(() => sendInitResponse({ framesData: [{ windowId, processed: true, timeout: true }], sessionId }));
 					} else {
 						sendInitResponse({ framesData: [{ windowId, processed: true, timeout: true }], sessionId });
 					}
@@ -192,7 +193,7 @@ this.frameTree = this.frameTree || (() => {
 		} catch (error) {
 			/* ignored */
 		}
-		if (frameContent.status >= 400 && superFetch.hostFetch) {
+		if (frameContent && frameContent.status >= 400 && superFetch.hostFetch) {
 			try {
 				frameContent = await superFetch.hostFetch(frameUrl);
 			} catch (error) {