فهرست منبع

always remove frames content before processing them

Gildas 7 سال پیش
والد
کامیت
66ba55d1de
1فایلهای تغییر یافته به همراه2 افزوده شده و 4 حذف شده
  1. 2 4
      lib/single-file/single-file-core.js

+ 2 - 4
lib/single-file/single-file-core.js

@@ -448,6 +448,8 @@ this.SingleFileCore = (() => {
 			await Promise.all(frameElements.map(async (frameElement, frameIndex) => {
 				const frameWindowId = (this.options.windowId || "0") + "." + frameIndex;
 				const frameData = this.options.framesData.find(frame => frame.windowId == frameWindowId);
+				DomProcessorHelper.setFrameEmptySrc(frameElement);
+				frameElement.setAttribute("sandbox", "");
 				if (frameData) {
 					if (initialization) {
 						const options = Object.create(this.options);
@@ -463,15 +465,11 @@ this.SingleFileCore = (() => {
 							return frameData.processor.initialize();
 						}
 					} else {
-						DomProcessorHelper.setFrameEmptySrc(frameElement);
 						if (frameData.processor) {
 							const pageData = await frameData.processor.getPageData();
 							DomProcessorHelper.setFrameContent(frameElement, pageData.content);
-							frameElement.setAttribute("sandbox", "");
 						}
 					}
-				} else {
-					DomProcessorHelper.setFrameEmptySrc(frameElement);
 				}
 			}));
 		}