1
0
Эх сурвалжийг харах

don't cancel if URL changes while saving the page

Former-commit-id: dda37345bc9f9ace248bb0f3ab75dab8c644ab0d
Gildas 5 жил өмнө
parent
commit
618f70fca8

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

@@ -82,7 +82,7 @@ this.singlefile.extension.core.content.bootstrap = this.singlefile.extension.cor
 	}
 
 	function init() {
-		if (previousLocationHref != location.href) {
+		if (previousLocationHref != location.href && !singlefile.extension.core.processing) {
 			pageAutoSaved = false;
 			previousLocationHref = location.href;
 			browser.runtime.sendMessage({ method: "tabs.init" });

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

@@ -28,7 +28,7 @@ this.singlefile.extension.core.content.main = this.singlefile.extension.core.con
 	const singlefile = this.singlefile;
 	const MOZ_EXTENSION_PROTOCOL = "moz-extension:";
 
-	let ui, processing = false, processor;
+	let ui, processor;
 
 	singlefile.lib.main.init({
 		fetch: singlefile.extension.lib.fetch.content.resources.fetch,
@@ -68,7 +68,7 @@ this.singlefile.extension.core.content.main = this.singlefile.extension.core.con
 
 	async function savePage(message) {
 		const options = message.options;
-		if (!processing) {
+		if (!singlefile.extension.core.processing) {
 			options.updatedResources = singlefile.extension.core.content.updatedResources || {};
 			Object.keys(options.updatedResources).forEach(url => options.updatedResources[url].retrieved = false);
 			let selectionFound;
@@ -79,7 +79,7 @@ this.singlefile.extension.core.content.main = this.singlefile.extension.core.con
 				options.selected = true;
 			}
 			if (!options.selected || selectionFound) {
-				processing = true;
+				singlefile.extension.core.processing = true;
 				try {
 					const pageData = await processPage(options);
 					if (pageData) {
@@ -97,7 +97,7 @@ this.singlefile.extension.core.content.main = this.singlefile.extension.core.con
 			} else {
 				browser.runtime.sendMessage({ method: "ui.processCancelled" });
 			}
-			processing = false;
+			singlefile.extension.core.processing = false;
 		}
 	}