|
|
@@ -133,31 +133,23 @@ this.frameTree = this.frameTree || (() => {
|
|
|
const windowId = parentWindowId + WINDOW_ID_SEPARATOR + frameIndex;
|
|
|
frameElement.setAttribute(docHelper.windowIdAttributeName(options.sessionId), windowId);
|
|
|
framesData.push({ windowId });
|
|
|
- let contentDocument;
|
|
|
try {
|
|
|
- contentDocument = frameElement.contentDocument;
|
|
|
+ sendMessage(frameElement.contentWindow, { method: INIT_REQUEST_MESSAGE, windowId, sessionId, options });
|
|
|
} catch (error) {
|
|
|
- // ignored
|
|
|
+ /* ignored */
|
|
|
}
|
|
|
- if (!contentDocument) {
|
|
|
- try {
|
|
|
- sendMessage(frameElement.contentWindow, { method: INIT_REQUEST_MESSAGE, windowId, sessionId, options });
|
|
|
- } catch (error) {
|
|
|
- /* ignored */
|
|
|
+ timeout.set(async () => {
|
|
|
+ let frameDoc;
|
|
|
+ if (frameElement.src && frameElement.src.match(PREFIX_VALID_FRAME_URL)) {
|
|
|
+ frameDoc = await getFrameDoc(frameElement.src, parentWindowId, options);
|
|
|
}
|
|
|
- timeout.set(async () => {
|
|
|
- let frameDoc;
|
|
|
- if (frameElement.src && frameElement.src.match(PREFIX_VALID_FRAME_URL)) {
|
|
|
- frameDoc = await getFrameDoc(frameElement.src, parentWindowId, options);
|
|
|
- }
|
|
|
- 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 });
|
|
|
- }
|
|
|
- }, TIMEOUT_INIT_REQUEST_MESSAGE);
|
|
|
- }
|
|
|
+ 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 });
|
|
|
+ }
|
|
|
+ }, TIMEOUT_INIT_REQUEST_MESSAGE);
|
|
|
});
|
|
|
sendInitResponse({ framesData, sessionId });
|
|
|
}
|