|
|
@@ -132,12 +132,12 @@ this.frameTree = this.frameTree || (() => {
|
|
|
/* ignored */
|
|
|
}
|
|
|
timeout.set(async () => {
|
|
|
- let content;
|
|
|
+ let frameDoc;
|
|
|
if (frameElement.src && frameElement.src.match(PREFIX_VALID_FRAME_URL)) {
|
|
|
- content = await getFrameContent(frameElement.src, parentWindowId, options);
|
|
|
+ frameDoc = await getFrameDoc(frameElement.src, parentWindowId, options);
|
|
|
}
|
|
|
- if (content) {
|
|
|
- sendInitResponse({ framesData: [{ windowId, processed: true, content }], sessionId });
|
|
|
+ if (frameDoc) {
|
|
|
+ sendInitResponse({ framesData: [getFrameData(frameDoc, null, windowId, options)] });
|
|
|
} else {
|
|
|
sendInitResponse({ framesData: [{ windowId, processed: true, timeout: true }], sessionId });
|
|
|
}
|
|
|
@@ -183,7 +183,7 @@ this.frameTree = this.frameTree || (() => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async function getFrameContent(frameUrl, parentWindowId, options) {
|
|
|
+ async function getFrameDoc(frameUrl, parentWindowId, options) {
|
|
|
let frameContent;
|
|
|
try {
|
|
|
frameContent = await ((typeof superFetch !== "undefined" && superFetch.fetch) || fetch)(frameUrl);
|
|
|
@@ -214,9 +214,9 @@ this.frameTree = this.frameTree || (() => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- const buffer = await frameContent.arrayBuffer();
|
|
|
let doc;
|
|
|
try {
|
|
|
+ const buffer = await frameContent.arrayBuffer();
|
|
|
const content = (new TextDecoder(charSet)).decode(buffer);
|
|
|
const domParser = new DOMParser();
|
|
|
doc = domParser.parseFromString(content, mimeType);
|
|
|
@@ -229,7 +229,7 @@ this.frameTree = this.frameTree || (() => {
|
|
|
const windowId = parentWindowId + WINDOW_ID_SEPARATOR + frameIndex;
|
|
|
frameElement.setAttribute(docHelper.windowIdAttributeName(options.sessionId), windowId);
|
|
|
});
|
|
|
- return docHelper.serialize(doc);
|
|
|
+ return doc;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -247,7 +247,7 @@ this.frameTree = this.frameTree || (() => {
|
|
|
function getFrameData(document, window, windowId, options) {
|
|
|
const docData = docHelper.preProcessDoc(document, window, options);
|
|
|
const content = docHelper.serialize(document);
|
|
|
- docHelper.postProcessDoc(document, window, options);
|
|
|
+ docHelper.postProcessDoc(document, options);
|
|
|
const baseURI = document.baseURI.split("#")[0];
|
|
|
return {
|
|
|
windowId,
|