Procházet zdrojové kódy

catch errors when trying to read contentDocument

Gildas před 7 roky
rodič
revize
bd8877104e
1 změnil soubory, kde provedl 7 přidání a 1 odebrání
  1. 7 1
      lib/single-file/frame-tree.js

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

@@ -129,7 +129,13 @@ this.frameTree = this.frameTree || (() => {
 			const windowId = parentWindowId + WINDOW_ID_SEPARATOR + frameIndex;
 			frameElement.setAttribute(docHelper.windowIdAttributeName(options.sessionId), windowId);
 			framesData.push({ windowId });
-			if (!frameElement.contentDocument) {
+			let contentDocument;
+			try {
+				contentDocument = frameElement.contentDocument;
+			} catch (error) {
+				// ignored
+			}
+			if (!contentDocument) {
 				try {
 					sendMessage(frameElement.contentWindow, { method: INIT_REQUEST_MESSAGE, windowId, sessionId, options });
 				} catch (error) {