Переглянути джерело

don't retrieve frame contents when there are none

Former-commit-id: d2a5c714f470455e073664eebdfab5924777933f
Gildas 6 роки тому
батько
коміт
c31f895599

+ 2 - 2
extension/core/content/content-bootstrap.js

@@ -70,7 +70,7 @@ this.singlefile.extension.core.content.bootstrap = this.singlefile.extension.cor
 				const docData = helper.preProcessDoc(document, window, options);
 				let frames = [];
 				autoSaveTimeout = null;
-				if (!options.removeFrames && singlefile.lib.frameTree.content.frames) {
+				if (!options.removeFrames && singlefile.lib.frameTree.content.frames && window.frames && window.frames.length) {
 					frames = await singlefile.lib.frameTree.content.frames.getAsync(options);
 				}
 				browser.runtime.sendMessage({
@@ -114,7 +114,7 @@ this.singlefile.extension.core.content.bootstrap = this.singlefile.extension.cor
 		if (!pageAutoSaved || options.autoSaveUnload) {
 			const docData = helper.preProcessDoc(document, window, options);
 			let frames = [];
-			if (!options.removeFrames && singlefile.lib.frameTree.content.frames) {
+			if (!options.removeFrames && singlefile.lib.frameTree.content.frames && window.frames && window.frames.length) {
 				frames = singlefile.lib.frameTree.content.frames.getSync(options);
 			}
 			browser.runtime.sendMessage({

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

@@ -86,7 +86,7 @@ this.singlefile.extension.core.content.main = this.singlefile.extension.core.con
 		const preInitializationPromises = [];
 		options.insertSingleFileComment = true;
 		if (!options.saveRawPage) {
-			if (!options.removeFrames && frames) {
+			if (!options.removeFrames && frames && window.frames && window.frames.length) {
 				let frameTreePromise;
 				if (options.loadDeferredImages) {
 					frameTreePromise = new Promise(resolve => setTimeout(() => resolve(frames.getAsync(options)), options.loadDeferredImagesMaxIdleTime - frames.TIMEOUT_INIT_REQUEST_MESSAGE));