Quellcode durchsuchen

renamed properties of document data

Gildas vor 6 Jahren
Ursprung
Commit
862d72073d

+ 1 - 1
cli/back-ends/jsdom.js

@@ -96,7 +96,7 @@ exports.getPageData = async options => {
 		win.Element.prototype.getBoundingClientRect = undefined;
 		executeFrameScripts(doc, scripts);
 		if (!options.saveRawPage && !options.removeFrames) {
-			options.framesData = await win.singlefile.lib.frameTree.content.frames.getAsync(options);
+			options.frames = await win.singlefile.lib.frameTree.content.frames.getAsync(options);
 		}
 		options.win = win;
 		options.doc = doc;

+ 1 - 1
cli/back-ends/puppeteer.js

@@ -113,7 +113,7 @@ exports.getPageData = async options => {
 					preInitializationPromises.push(singlefile.lib.lazy.content.loader.process(options));
 				}
 			}
-			[options.framesData] = await Promise.all(preInitializationPromises);
+			[options.frames] = await Promise.all(preInitializationPromises);
 			options.doc = document;
 			options.win = window;
 			const SingleFile = singlefile.lib.SingleFile.getClass();

+ 1 - 1
cli/back-ends/webdriver-chromium.js

@@ -175,7 +175,7 @@ function getPageDataScript() {
 				preInitializationPromises.push(singlefile.lib.lazy.content.loader.process(options));
 			}
 		}
-		[options.framesData] = await Promise.all(preInitializationPromises);
+		[options.frames] = await Promise.all(preInitializationPromises);
 		options.doc = document;
 		options.win = window;
 		const SingleFile = singlefile.lib.SingleFile.getClass();

+ 1 - 1
cli/back-ends/webdriver-gecko.js

@@ -182,7 +182,7 @@ function getPageDataScript() {
 				preInitializationPromises.push(singlefile.lib.lazy.content.loader.process(options));
 			}
 		}
-		[options.framesData] = await Promise.all(preInitializationPromises);
+		[options.frames] = await Promise.all(preInitializationPromises);
 		options.doc = document;
 		options.win = window;
 		const SingleFile = singlefile.lib.SingleFile.getClass();

+ 7 - 7
extension/core/bg/autosave.js

@@ -92,14 +92,14 @@ singlefile.extension.core.bg.autosave = (() => {
 		const tabId = tab.id;
 		options.content = message.content;
 		options.url = message.url;
-		options.framesData = message.framesData;
-		options.canvasData = message.canvasData;
-		options.fontsData = message.fontsData;
-		options.stylesheetsData = message.stylesheetsData;
-		options.imagesData = message.imagesData;
-		options.postersData = message.postersData;
+		options.frames = message.frames;
+		options.canvases = message.canvases;
+		options.fonts = message.fonts;
+		options.stylesheets = message.stylesheets;
+		options.images = message.images;
+		options.posters = message.posters;
 		options.usedFonts = message.usedFonts;
-		options.shadowRootsData = message.shadowRootsData;
+		options.shadowRoots = message.shadowRoots;
 		options.referrer = message.referrer;
 		options.insertSingleFileComment = true;
 		options.insertFaviconLink = true;

+ 19 - 20
extension/core/content/content-bootstrap.js

@@ -60,7 +60,6 @@ this.singlefile.extension.core.content.bootstrap = this.singlefile.extension.cor
 
 	async function autoSavePage() {
 		const helper = singlefile.lib.helper;
-		const frames = singlefile.lib.frameTree.content.frames;
 		if ((!autoSavingPage || autoSaveTimeout) && !pageAutoSaved) {
 			autoSavingPage = true;
 			if (options.autoSaveDelay && !autoSaveTimeout) {
@@ -69,23 +68,23 @@ this.singlefile.extension.core.content.bootstrap = this.singlefile.extension.cor
 				}, options.autoSaveDelay * 1000);
 			} else {
 				const docData = helper.preProcessDoc(document, window, options);
-				let framesData = [];
+				let frames = [];
 				autoSaveTimeout = null;
-				if (!options.removeFrames && frames) {
-					framesData = await frames.getAsync(options);
+				if (!options.removeFrames && singlefile.lib.frameTree.content.frames) {
+					frames = await singlefile.lib.frameTree.content.frames.getAsync(options);
 				}
 				browser.runtime.sendMessage({
 					method: "autosave.save",
 					content: helper.serialize(document, false),
-					canvasData: docData.canvasData,
-					fontsData: docData.fontsData,
-					stylesheetsData: docData.stylesheetsData,
-					imagesData: docData.imagesData,
-					postersData: docData.postersData,
+					canvases: docData.canvases,
+					fonts: docData.fonts,
+					stylesheets: docData.stylesheets,
+					images: docData.images,
+					posters: docData.posters,
 					usedFonts: docData.usedFonts,
-					shadowRootsData: docData.shadowRootsData,
+					shadowRoots: docData.shadowRoots,
 					referrer: docData.referrer,
-					framesData,
+					frames: frames,
 					url: location.href
 				});
 				helper.postProcessDoc(document, options);
@@ -113,22 +112,22 @@ this.singlefile.extension.core.content.bootstrap = this.singlefile.extension.cor
 		const helper = singlefile.lib.helper;
 		if (!pageAutoSaved || options.autoSaveUnload) {
 			const docData = helper.preProcessDoc(document, window, options);
-			let framesData = [];
+			let frames = [];
 			if (!options.removeFrames && singlefile.lib.frameTree.content.frames) {
-				framesData = singlefile.lib.frameTree.content.frames.getSync(options);
+				frames = singlefile.lib.frameTree.content.frames.getSync(options);
 			}
 			browser.runtime.sendMessage({
 				method: "autosave.save",
 				content: helper.serialize(document),
-				canvasData: docData.canvasData,
-				fontsData: docData.fontsData,
-				stylesheetsData: docData.stylesheetsData,
-				imagesData: docData.imagesData,
-				postersData: docData.postersData,
+				canvases: docData.canvases,
+				fonts: docData.fonts,
+				stylesheets: docData.stylesheets,
+				images: docData.images,
+				posters: docData.posters,
 				usedFonts: docData.usedFonts,
-				shadowRootsData: docData.shadowRootsData,
+				shadowRoots: docData.shadowRoots,
 				referrer: docData.referrer,
-				framesData,
+				frames: frames,
 				url: location.href
 			});
 		}

+ 8 - 8
extension/core/content/content-main.js

@@ -132,19 +132,19 @@ this.singlefile.extension.core.content.main = this.singlefile.extension.core.con
 				}
 			}
 		};
-		[options.framesData] = await Promise.all(preInitializationPromises);
-		const selectedFrame = options.framesData && options.framesData.find(frameData => frameData.requestedFrame);
+		[options.frames] = await Promise.all(preInitializationPromises);
+		const selectedFrame = options.frames && options.frames.find(frameData => frameData.requestedFrame);
 		options.win = window;
 		if (selectedFrame) {
 			options.content = selectedFrame.content;
 			options.url = selectedFrame.baseURI;
-			options.canvasData = selectedFrame.canvasData;
-			options.fontsData = selectedFrame.fontsData;
-			options.stylesheetsData = selectedFrame.stylesheetsData;
-			options.imagesData = selectedFrame.imagesData;
-			options.postersData = selectedFrame.postersData;
+			options.canvases = selectedFrame.canvases;
+			options.fonts = selectedFrame.fonts;
+			options.stylesheets = selectedFrame.stylesheets;
+			options.images = selectedFrame.images;
+			options.posters = selectedFrame.posters;
 			options.usedFonts = selectedFrame.usedFonts;
-			options.shadowRootsData = selectedFrame.shadowRootsData;
+			options.shadowRoots = selectedFrame.shadowRoots;
 		} else {
 			options.doc = document;
 		}

+ 22 - 22
lib/frame-tree/content/content-frame-tree.js

@@ -103,7 +103,7 @@ this.singlefile.lib.frameTree.content.frames = this.singlefile.lib.frameTree.con
 		}
 		processFrames(document, message.options, windowId, sessionId);
 		if (!TOP_WINDOW) {
-			sendInitResponse({ framesData: [getFrameData(document, window, windowId, message.options)], sessionId, requestedFrameId: document.documentElement.dataset.requestedFrameId && windowId });
+			sendInitResponse({ frames: [getFrameData(document, window, windowId, message.options)], sessionId, requestedFrameId: document.documentElement.dataset.requestedFrameId && windowId });
 			delete document.documentElement.dataset.requestedFrameId;
 		}
 	}
@@ -119,7 +119,7 @@ this.singlefile.lib.frameTree.content.frames = this.singlefile.lib.frameTree.con
 			if (message.requestedFrameId) {
 				windowData.requestedFrameId = message.requestedFrameId;
 			}
-			message.framesData.forEach(messageFrameData => {
+			message.frames.forEach(messageFrameData => {
 				let frameData = windowData.frames.find(frameData => messageFrameData.windowId == frameData.windowId);
 				if (!frameData) {
 					frameData = { windowId: messageFrameData.windowId };
@@ -129,13 +129,13 @@ this.singlefile.lib.frameTree.content.frames = this.singlefile.lib.frameTree.con
 					frameData.content = messageFrameData.content;
 					frameData.baseURI = messageFrameData.baseURI;
 					frameData.title = messageFrameData.title;
-					frameData.stylesheetsData = messageFrameData.stylesheetsData;
-					frameData.imagesData = messageFrameData.imagesData;
-					frameData.postersData = messageFrameData.postersData;
-					frameData.canvasData = messageFrameData.canvasData;
-					frameData.fontsData = messageFrameData.fontsData;
+					frameData.canvases = messageFrameData.canvases;
+					frameData.fonts = messageFrameData.fonts;
+					frameData.stylesheets = messageFrameData.stylesheets;
+					frameData.images = messageFrameData.images;
+					frameData.posters = messageFrameData.posters;
 					frameData.usedFonts = messageFrameData.usedFonts;
-					frameData.shadowRootsData = messageFrameData.shadowRootsData;
+					frameData.shadowRoots = messageFrameData.shadowRoots;
 					frameData.processed = messageFrameData.processed;
 				}
 			});
@@ -164,24 +164,24 @@ this.singlefile.lib.frameTree.content.frames = this.singlefile.lib.frameTree.con
 	}
 
 	function processFramesAsync(doc, frameElements, options, parentWindowId, sessionId) {
-		const framesData = [];
+		const frames = [];
 		frameElements.forEach((frameElement, frameIndex) => {
 			const windowId = parentWindowId + WINDOW_ID_SEPARATOR + frameIndex;
 			frameElement.setAttribute(singlefile.lib.helper.WIN_ID_ATTRIBUTE_NAME, windowId);
-			framesData.push({ windowId });
+			frames.push({ windowId });
 			try {
 				sendMessage(frameElement.contentWindow, { method: INIT_REQUEST_MESSAGE, windowId, sessionId, options });
 			} catch (error) {
 				/* ignored */
 			}
-			setTimeout(() => sendInitResponse({ framesData: [{ windowId, processed: true }], sessionId }), TIMEOUT_INIT_REQUEST_MESSAGE);
+			setTimeout(() => sendInitResponse({ frames: [{ windowId, processed: true }], sessionId }), TIMEOUT_INIT_REQUEST_MESSAGE);
 		});
-		sendInitResponse({ framesData, sessionId, requestedFrameId: doc.documentElement.dataset.requestedFrameId && parentWindowId });
+		sendInitResponse({ frames, sessionId, requestedFrameId: doc.documentElement.dataset.requestedFrameId && parentWindowId });
 		delete doc.documentElement.dataset.requestedFrameId;
 	}
 
 	function processFramesSync(doc, frameElements, options, parentWindowId, sessionId) {
-		const framesData = [];
+		const frames = [];
 		frameElements.forEach((frameElement, frameIndex) => {
 			const windowId = parentWindowId + WINDOW_ID_SEPARATOR + frameIndex;
 			let frameDoc;
@@ -195,13 +195,13 @@ this.singlefile.lib.frameTree.content.frames = this.singlefile.lib.frameTree.con
 					const frameWindow = frameElement.contentWindow;
 					frameWindow.stop();
 					processFrames(frameDoc, options, windowId, sessionId);
-					framesData.push(getFrameData(frameDoc, frameWindow, windowId, options));
+					frames.push(getFrameData(frameDoc, frameWindow, windowId, options));
 				} catch (error) {
-					framesData.push({ windowId, processed: true });
+					frames.push({ windowId, processed: true });
 				}
 			}
 		});
-		sendInitResponse({ framesData, sessionId, requestedFrameId: doc.documentElement.dataset.requestedFrameId && parentWindowId });
+		sendInitResponse({ frames, sessionId, requestedFrameId: doc.documentElement.dataset.requestedFrameId && parentWindowId });
 		delete doc.documentElement.dataset.requestedFrameId;
 	}
 
@@ -267,13 +267,13 @@ this.singlefile.lib.frameTree.content.frames = this.singlefile.lib.frameTree.con
 			content,
 			baseURI,
 			title: document.title,
-			stylesheetsData: docData.stylesheetsData,
-			imagesData: docData.imagesData,
-			postersData: docData.postersData,
-			canvasData: docData.canvasData,
-			fontsData: docData.fontsData,
+			canvases: docData.canvases,
+			fonts: docData.fonts,
+			stylesheets: docData.stylesheets,
+			images: docData.images,
+			posters: docData.posters,
 			usedFonts: docData.usedFonts,
-			shadowRootsData: docData.shadowRootsData,
+			shadowRoots: docData.shadowRoots,
 			processed: true
 		};
 	}

+ 50 - 50
lib/single-file/single-file-core.js

@@ -149,13 +149,13 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 			this.processor = new Processor(options, this.batchRequest);
 			if (this.options.doc) {
 				const docData = util.preProcessDoc(this.options.doc, this.options.win, this.options);
-				this.options.canvasData = docData.canvasData;
-				this.options.fontsData = docData.fontsData;
-				this.options.stylesheetsData = docData.stylesheetsData;
-				this.options.imagesData = docData.imagesData;
-				this.options.postersData = docData.postersData;
+				this.options.canvases = docData.canvases;
+				this.options.fonts = docData.fonts;
+				this.options.stylesheets = docData.stylesheets;
+				this.options.images = docData.images;
+				this.options.posters = docData.posters;
 				this.options.usedFonts = docData.usedFonts;
-				this.options.shadowRootsData = docData.shadowRootsData;
+				this.options.shadowRoots = docData.shadowRoots;
 				this.options.referrer = docData.referrer;
 			}
 			if (this.options.saveRawPage) {
@@ -346,8 +346,8 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 				this.maffMetaDataPromise = this.batchRequest.addURL(util.resolveURL("index.rdf", this.options.baseURI || this.options.url), false);
 			}
 			this.maxResources = this.batchRequest.getMaxResources();
-			if (!this.options.saveRawPage && !this.options.removeFrames && this.options.framesData) {
-				this.options.framesData.forEach(frameData => this.maxResources += frameData.maxResources || 0);
+			if (!this.options.saveRawPage && !this.options.removeFrames && this.options.frames) {
+				this.options.frames.forEach(frameData => this.maxResources += frameData.maxResources || 0);
 			}
 			this.stats.set("processed", "resources", this.maxResources);
 		}
@@ -474,21 +474,21 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 			if (this.options.win) {
 				this.doc.body.querySelectorAll(":not(svg) title, meta, link[href][rel*=\"icon\"]").forEach(element => element instanceof this.options.win.HTMLElement && this.doc.head.appendChild(element));
 			}
-			if (this.options.imagesData && !this.options.saveRawPage) {
+			if (this.options.images && !this.options.saveRawPage) {
 				const dataAttributeName = util.IMAGE_ATTRIBUTE_NAME;
 				this.doc.querySelectorAll("img").forEach(imgElement => {
-					const imgData = this.options.imagesData[Number(imgElement.getAttribute(dataAttributeName))];
-					if (this.options.removeHiddenElements && imgData.size && !imgData.size.pxWidth && !imgData.size.pxHeight) {
+					const imageData = this.options.images[Number(imgElement.getAttribute(dataAttributeName))];
+					if (this.options.removeHiddenElements && imageData.size && !imageData.size.pxWidth && !imageData.size.pxHeight) {
 						imgElement.setAttribute("src", EMPTY_IMAGE);
-					} else if (imgData.currentSrc) {
-						imgElement.setAttribute("src", imgData.currentSrc);
+					} else if (imageData.currentSrc) {
+						imgElement.setAttribute("src", imageData.currentSrc);
 					}
 				});
 				if (this.options.loadDeferredImages) {
 					this.doc.querySelectorAll("img[data-src]").forEach(imgElement => {
-						const imgData = this.options.imagesData[Number(imgElement.getAttribute(dataAttributeName))];
+						const imageData = this.options.images[Number(imgElement.getAttribute(dataAttributeName))];
 						if ((!imgElement.getAttribute("src") || imgElement.getAttribute("src") == EMPTY_IMAGE) && imgElement.getAttribute("data-src")) {
-							imgData.src = imgElement.dataset.src;
+							imageData.src = imgElement.dataset.src;
 							imgElement.setAttribute("src", imgElement.dataset.src);
 							imgElement.removeAttribute("data-src");
 						}
@@ -504,10 +504,10 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 		}
 
 		replaceStyleContents() {
-			if (this.options.stylesheetsData) {
+			if (this.options.stylesheets) {
 				this.doc.querySelectorAll("style").forEach((styleElement, styleIndex) => {
-					if (this.options.stylesheetsData[styleIndex]) {
-						styleElement.textContent = this.options.stylesheetsData[styleIndex];
+					if (this.options.stylesheets[styleIndex]) {
+						styleElement.textContent = this.options.stylesheets[styleIndex];
 					}
 				});
 			}
@@ -553,7 +553,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 		}
 
 		insertVideoPosters() {
-			if (this.options.postersData) {
+			if (this.options.posters) {
 				this.doc.querySelectorAll("video[src], video > source[src]").forEach(element => {
 					let videoElement;
 					if (element.tagName == "VIDEO") {
@@ -562,8 +562,8 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 						videoElement = element.parentElement;
 					}
 					const videoIndex = Number(element.getAttribute(util.POSTER_ATTRIBUTE_NAME));
-					if (!videoElement.poster && this.options.postersData[videoIndex]) {
-						videoElement.setAttribute("poster", this.options.postersData[videoIndex]);
+					if (!videoElement.poster && this.options.posters[videoIndex]) {
+						videoElement.setAttribute("poster", this.options.posters[videoIndex]);
 					}
 				});
 			}
@@ -711,10 +711,10 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 		}
 
 		replaceCanvasElements() {
-			if (this.options.canvasData) {
+			if (this.options.canvases) {
 				this.doc.querySelectorAll("canvas").forEach(canvasElement => {
 					const canvasIndex = Number(canvasElement.getAttribute(util.CANVAS_ATTRIBUTE_NAME));
-					const canvasData = this.options.canvasData[canvasIndex];
+					const canvasData = this.options.canvases[canvasIndex];
 					if (canvasData) {
 						ProcessorHelper.setBackgroundImage(canvasElement, "url(" + canvasData.dataURI + ")");
 						this.stats.add("processed", "canvas", 1);
@@ -724,17 +724,17 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 		}
 
 		insertFonts() {
-			if (this.options.fontsData && this.options.fontsData.length) {
+			if (this.options.fonts && this.options.fonts.length) {
 				let stylesheetContent = "";
-				this.options.fontsData.forEach(fontStyles => {
-					if (fontStyles["font-family"] && fontStyles.src) {
+				this.options.fonts.forEach(fontData => {
+					if (fontData["font-family"] && fontData.src) {
 						stylesheetContent += "@font-face{";
 						let stylesContent = "";
-						Object.keys(fontStyles).forEach(fontStyle => {
+						Object.keys(fontData).forEach(fontStyle => {
 							if (stylesContent) {
 								stylesContent += ";";
 							}
-							stylesContent += fontStyle + ":" + fontStyles[fontStyle];
+							stylesContent += fontStyle + ":" + fontData[fontStyle];
 						});
 						stylesheetContent += stylesContent + "}";
 					}
@@ -835,7 +835,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 		}
 
 		async resolveFrameURLs() {
-			if (!this.options.saveRawPage && this.options.framesData) {
+			if (!this.options.saveRawPage && this.options.frames) {
 				const frameElements = Array.from(this.doc.querySelectorAll("iframe, frame, object[type=\"text/html\"][data]"));
 				await Promise.all(frameElements.map(async frameElement => {
 					if (frameElement.tagName == "OBJECT") {
@@ -846,7 +846,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 					}
 					const frameWindowId = frameElement.getAttribute(util.WIN_ID_ATTRIBUTE_NAME);
 					if (frameWindowId) {
-						const frameData = this.options.framesData.find(frame => frame.windowId == frameWindowId);
+						const frameData = this.options.frames.find(frame => frame.windowId == frameWindowId);
 						if (frameData) {
 							await initializeProcessor(frameData, frameElement, frameWindowId, this.batchRequest, Object.create(this.options));
 						}
@@ -863,13 +863,13 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 				options.windowId = frameWindowId;
 				if (frameData.content) {
 					options.content = frameData.content;
-					options.postersData = frameData.postersData;
-					options.canvasData = frameData.canvasData;
-					options.stylesheetsData = frameData.stylesheetsData;
-					options.fontsData = frameData.fontsData;
-					options.imagesData = frameData.imagesData;
+					options.canvases = frameData.canvases;
+					options.fonts = frameData.fonts;
+					options.stylesheets = frameData.stylesheets;
+					options.images = frameData.images;
+					options.posters = frameData.posters;
 					options.usedFonts = frameData.usedFonts;
-					options.shadowRootsData = frameData.shadowRootsData;
+					options.shadowRoots = frameData.shadowRoots;
 					frameData.processor = new Runner(options);
 					frameData.frameElement = frameElement;
 					await frameData.processor.loadPage();
@@ -882,7 +882,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 		insertShadowRootContents() {
 			const doc = this.doc;
 			const options = this.options;
-			if (this.options.shadowRootsData && this.options.shadowRootsData.length) {
+			if (this.options.shadowRoots && this.options.shadowRoots.length) {
 				processElement(this.doc);
 				const scriptElement = doc.createElement("script");
 				scriptElement.textContent = `(()=>{document.currentScript.remove();processNode(document);function processNode(node){debugger;node.querySelectorAll("template[${WC_ATTRIBUTE_NAME}]").forEach(element=>{const shadowRoot=element.parentElement.attachShadow({mode:"open"});shadowRoot.innerHTML=element.innerHTML;element.remove();processNode(shadowRoot)})}})()`;
@@ -893,7 +893,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 				const shadowRootElements = Array.from((element.querySelectorAll("[" + util.SHADOW_ROOT_ATTRIBUTE_NAME + "]")));
 				shadowRootElements.forEach(element => {
 					const id = element.getAttribute(util.SHADOW_ROOT_ATTRIBUTE_NAME);
-					const shadowRootData = options.shadowRootsData[Number(id)];
+					const shadowRootData = options.shadowRoots[Number(id)];
 					if (shadowRootData) {
 						const templateElement = doc.createElement("template");
 						templateElement.setAttribute(WC_ATTRIBUTE_NAME, "");
@@ -1028,14 +1028,14 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 		}
 
 		async processFrames() {
-			if (this.options.framesData) {
+			if (this.options.frames) {
 				const frameElements = Array.from(this.doc.querySelectorAll("iframe, frame, object[type=\"text/html\"][data]"));
 				await Promise.all(frameElements.map(async frameElement => {
 					const frameWindowId = frameElement.getAttribute(util.WIN_ID_ATTRIBUTE_NAME);
 					if (frameWindowId) {
-						const frameData = this.options.framesData.find(frame => frame.windowId == frameWindowId);
+						const frameData = this.options.frames.find(frame => frame.windowId == frameWindowId);
 						if (frameData) {
-							this.options.framesData = this.options.framesData.filter(frame => frame.windowId != frameWindowId);
+							this.options.frames = this.options.frames.filter(frame => frame.windowId != frameWindowId);
 							if (frameData.processor) {
 								this.stats.add("processed", "frames", 1);
 								await frameData.processor.run();
@@ -1570,19 +1570,19 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 		static replaceImageSource(imgElement, variableName, options) {
 			const dataAttributeName = util.IMAGE_ATTRIBUTE_NAME;
 			if (imgElement.getAttribute(dataAttributeName) != null) {
-				const imgData = options.imagesData[Number(imgElement.getAttribute(dataAttributeName))];
-				if (imgData.replaceable) {
-					imgElement.setAttribute("src", `${PREFIX_DATA_URI_IMAGE_SVG},<svg xmlns="http://www.w3.org/2000/svg" width="${imgData.size.pxWidth}" height="${imgData.size.pxHeight}"><rect fill-opacity="0"/></svg>`);
+				const imageData = options.images[Number(imgElement.getAttribute(dataAttributeName))];
+				if (imageData.replaceable) {
+					imgElement.setAttribute("src", `${PREFIX_DATA_URI_IMAGE_SVG},<svg xmlns="http://www.w3.org/2000/svg" width="${imageData.size.pxWidth}" height="${imageData.size.pxHeight}"><rect fill-opacity="0"/></svg>`);
 					const backgroundStyle = {};
-					const backgroundSize = (imgData.objectFit == "content" || imgData.objectFit == "cover") && imgData.objectFit;
+					const backgroundSize = (imageData.objectFit == "content" || imageData.objectFit == "cover") && imageData.objectFit;
 					if (backgroundSize) {
-						backgroundStyle["background-size"] = imgData.objectFit;
+						backgroundStyle["background-size"] = imageData.objectFit;
 					}
-					if (imgData.objectPosition) {
-						backgroundStyle["background-position"] = imgData.objectPosition;
+					if (imageData.objectPosition) {
+						backgroundStyle["background-position"] = imageData.objectPosition;
 					}
-					if (imgData.backgroundColor) {
-						backgroundStyle["background-color"] = imgData.backgroundColor;
+					if (imageData.backgroundColor) {
+						backgroundStyle["background-color"] = imageData.backgroundColor;
 					}
 					ProcessorHelper.setBackgroundImage(imgElement, "var(" + variableName + ")", backgroundStyle);
 					imgElement.removeAttribute(dataAttributeName);

+ 19 - 19
lib/single-file/single-file-helper.js

@@ -82,27 +82,27 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
 			elementsInfo = getElementsInfo(win, doc, doc.body, options);
 		} else {
 			elementsInfo = {
-				canvasData: [],
-				imagesData: [],
-				postersData: [],
+				canvases: [],
+				images: [],
+				posters: [],
 				usedFonts: [],
-				shadowRootsData: []
+				shadowRoots: []
 			};
 		}
 		saveInputValues(doc);
 		return {
-			canvasData: elementsInfo.canvasData,
-			fontsData: getFontsData(doc),
-			stylesheetsData: getStylesheetsData(doc),
-			imagesData: elementsInfo.imagesData,
-			postersData: elementsInfo.postersData,
+			canvases: elementsInfo.canvases,
+			fonts: getFontsData(doc),
+			stylesheets: getStylesheetsData(doc),
+			images: elementsInfo.images,
+			posters: elementsInfo.posters,
 			usedFonts: Array.from(elementsInfo.usedFonts),
-			shadowRootsData: elementsInfo.shadowRootsData,
+			shadowRoots: elementsInfo.shadowRoots,
 			referrer: doc.referrer
 		};
 	}
 
-	function getElementsInfo(win, doc, element, options, data = { usedFonts: new Set(), canvasData: [], imagesData: [], postersData: [], shadowRootsData: [] }, ascendantHidden) {
+	function getElementsInfo(win, doc, element, options, data = { usedFonts: new Set(), canvases: [], images: [], posters: [], shadowRoots: [] }, ascendantHidden) {
 		const elements = Array.from(element.childNodes).filter(node => node instanceof win.HTMLElement);
 		elements.forEach(element => {
 			let elementHidden, computedStyle;
@@ -136,8 +136,8 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
 			getResourcesInfo(win, doc, element, options, data, elementHidden, computedStyle);
 			if (element.shadowRoot) {
 				const shadowRootInfo = {};
-				element.setAttribute(SHADOW_ROOT_ATTRIBUTE_NAME, data.shadowRootsData.length);
-				data.shadowRootsData.push(shadowRootInfo);
+				element.setAttribute(SHADOW_ROOT_ATTRIBUTE_NAME, data.shadowRoots.length);
+				data.shadowRoots.push(shadowRootInfo);
 				getElementsInfo(win, doc, element.shadowRoot, options, data, elementHidden);
 				shadowRootInfo.content = element.shadowRoot.innerHTML;
 			}
@@ -150,14 +150,14 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
 		if (element.tagName == "CANVAS") {
 			try {
 				const size = getSize(win, element, computedStyle);
-				data.canvasData.push({ dataURI: element.toDataURL("image/png", ""), width: size.width, height: size.height });
-				element.setAttribute(CANVAS_ATTRIBUTE_NAME, data.canvasData.length - 1);
+				data.canvases.push({ dataURI: element.toDataURL("image/png", ""), width: size.width, height: size.height });
+				element.setAttribute(CANVAS_ATTRIBUTE_NAME, data.canvases.length - 1);
 			} catch (error) {
 				// ignored
 			}
 		}
 		if (element.tagName == "IMG") {
-			element.setAttribute(IMAGE_ATTRIBUTE_NAME, data.imagesData.length);
+			element.setAttribute(IMAGE_ATTRIBUTE_NAME, data.images.length);
 			const imageData = {
 				currentSrc: elementHidden ?
 					"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" :
@@ -179,7 +179,7 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
 					imageData.objectPosition = computedStyle.getPropertyValue("object-position");
 				}
 			}
-			data.imagesData.push(imageData);
+			data.images.push(imageData);
 		}
 		if (element.tagName == "VIDEO") {
 			if (!element.poster) {
@@ -189,8 +189,8 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
 				canvasElement.height = element.clientHeight;
 				try {
 					context.drawImage(element, 0, 0, canvasElement.width, canvasElement.height);
-					data.postersData.push(canvasElement.toDataURL("image/png", ""));
-					element.setAttribute(POSTER_ATTRIBUTE_NAME, data.postersData.length - 1);
+					data.posters.push(canvasElement.toDataURL("image/png", ""));
+					element.setAttribute(POSTER_ATTRIBUTE_NAME, data.posters.length - 1);
 				} catch (error) {
 					// ignored
 				}

+ 1 - 1
maff2html/back-ends/webdriver-gecko.js

@@ -162,7 +162,7 @@ function getPageDataScript() {
 				preInitializationPromises.push(singlefile.lib.lazy.content.loader.process(options));
 			}
 		}
-		[options.framesData] = await Promise.all(preInitializationPromises);
+		[options.frames] = await Promise.all(preInitializationPromises);
 		options.doc = document;
 		options.win = window;
 		const SingleFile = singlefile.lib.SingleFile.getClass();