|
|
@@ -36,6 +36,7 @@ this.singlefile.lib.processors.frameTree.content.frames = this.singlefile.lib.pr
|
|
|
const INIT_RESPONSE_MESSAGE = "singlefile.frameTree.initResponse";
|
|
|
const TARGET_ORIGIN = "*";
|
|
|
const TIMEOUT_INIT_REQUEST_MESSAGE = 750;
|
|
|
+ const TIMEOUT_INIT_RESPONSE_MESSAGE = 10000;
|
|
|
const TOP_WINDOW_ID = "0";
|
|
|
const WINDOW_ID_SEPARATOR = ".";
|
|
|
const TOP_WINDOW = window == window.top;
|
|
|
@@ -60,6 +61,7 @@ this.singlefile.lib.processors.frameTree.content.frames = this.singlefile.lib.pr
|
|
|
return Promise.resolve({});
|
|
|
} else if (message.method == ACK_INIT_REQUEST_MESSAGE) {
|
|
|
clearFrameTimeout(message.sessionId, message.windowId);
|
|
|
+ createFrameResponseTimeout(message.sessionId, message.windowId);
|
|
|
return Promise.resolve({});
|
|
|
}
|
|
|
});
|
|
|
@@ -81,6 +83,7 @@ this.singlefile.lib.processors.frameTree.content.frames = this.singlefile.lib.pr
|
|
|
}
|
|
|
} else if (message.method == ACK_INIT_REQUEST_MESSAGE) {
|
|
|
clearFrameTimeout(message.sessionId, message.windowId);
|
|
|
+ createFrameResponseTimeout(message.sessionId, message.windowId);
|
|
|
} else if (message.method == CLEANUP_REQUEST_MESSAGE) {
|
|
|
cleanupRequest(message);
|
|
|
} else if ((!browser || !browser.runtime) && message.method == INIT_RESPONSE_MESSAGE) {
|
|
|
@@ -157,6 +160,7 @@ this.singlefile.lib.processors.frameTree.content.frames = this.singlefile.lib.pr
|
|
|
}
|
|
|
|
|
|
function initResponse(message) {
|
|
|
+ message.frames.forEach(frameData => clearFrameTimeout(message.sessionId, frameData.windowId));
|
|
|
const windowData = sessions.get(message.sessionId);
|
|
|
if (windowData) {
|
|
|
if (message.requestedFrameId) {
|
|
|
@@ -271,6 +275,13 @@ this.singlefile.lib.processors.frameTree.content.frames = this.singlefile.lib.pr
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ function createFrameResponseTimeout(sessionId, windowId) {
|
|
|
+ const session = sessions.get(sessionId);
|
|
|
+ if (session && session.timeouts) {
|
|
|
+ session.timeouts[windowId] = setTimeout.call(window, () => sendInitResponse({ frames: [{ windowId: windowId, processed: true }], sessionId: sessionId }), TIMEOUT_INIT_RESPONSE_MESSAGE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
function cleanupFrames(frameElements, parentWindowId, sessionId) {
|
|
|
frameElements.forEach((frameElement, frameIndex) => {
|
|
|
const windowId = parentWindowId + WINDOW_ID_SEPARATOR + frameIndex;
|